您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ BoxToRect函数代码示例

51自学网 2021-06-01 19:55:39
  C++
这篇教程C++ BoxToRect函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中BoxToRect函数的典型用法代码示例。如果您正苦于以下问题:C++ BoxToRect函数的具体用法?C++ BoxToRect怎么用?C++ BoxToRect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了BoxToRect函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: EntryElementDraw

static void EntryElementDraw(    void *clientData, void *elementRecord, Tk_Window tkwin,    Drawable d, Ttk_Box b, Ttk_State state){    EntryElement *e = elementRecord;    Tk_3DBorder backgroundPtr = Tk_Get3DBorderFromObj(tkwin,e->backgroundObj);    Ttk_Box inner = Ttk_PadBox(b, Ttk_UniformPadding(3));    CGRect bounds = BoxToRect(d, inner);    const HIThemeFrameDrawInfo info = {        .version = 0,        .kind = kHIThemeFrameTextFieldSquare,        .state = Ttk_StateTableLookup(ThemeStateTable, state),        .isFocused = state & TTK_STATE_FOCUS,    };    /*     * Erase w/background color:     */    XFillRectangle(Tk_Display(tkwin), d,                   Tk_3DBorderGC(tkwin, backgroundPtr, TK_3D_FLAT_GC),                   inner.x,inner.y, inner.width, inner.height);    BEGIN_DRAWING(d)    ChkErr(HIThemeDrawFrame, &bounds, &info, dc.context, HIOrientation);    /*if (state & TTK_STATE_FOCUS) {    ChkErr(DrawThemeFocusRect, &bounds, 1);    }*/    END_DRAWING}static Ttk_ElementSpec EntryElementSpec = {    TK_STYLE_VERSION_2,    sizeof(EntryElement),    EntryElementOptions,    EntryElementSize,    EntryElementDraw};/*---------------------------------------------------------------------- * +++ Combobox: * * NOTES: *	kThemeMetricComboBoxLargeDisclosureWidth -> 17 *	Padding and margins guesstimated by trial-and-error. */static Ttk_Padding ComboboxPadding = { 2, 3, 17, 1 };static Ttk_Padding ComboboxMargins = { 3, 3, 4, 4 };static void ComboboxElementSize(    void *clientData, void *elementRecord, Tk_Window tkwin,    int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr){    *widthPtr = 0;    *heightPtr = 0;    *paddingPtr = Ttk_AddPadding(ComboboxMargins, ComboboxPadding);}
开发者ID:swkarlekar,项目名称:STIDER_work,代码行数:57,


示例2: ClientElementDraw

static void ClientElementDraw(    void *clientData, void *elementRecord, Tk_Window tkwin,    Drawable d, Ttk_Box b, unsigned int state){    RECT rc = BoxToRect(b);    TkWinDCState dcState;    HDC hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState);    DrawEdge(hdc, &rc, EDGE_RAISED, BF_RECT | BF_SOFT);    TkWinReleaseDrawableDC(d, hdc, &dcState);}
开发者ID:aosm,项目名称:tcl,代码行数:10,


示例3: ButtonElementDraw

static void ButtonElementDraw(    void *clientData, void *elementRecord, Tk_Window tkwin,    Drawable d, Ttk_Box b, Ttk_State state){    ThemeButtonParams *params = clientData;    CGRect bounds = BoxToRect(d, Ttk_PadBox(b, ButtonMargins));    const HIThemeButtonDrawInfo info = computeButtonDrawInfo(params, state);    BEGIN_DRAWING(d)    ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation, NULL);    END_DRAWING}
开发者ID:swkarlekar,项目名称:STIDER_work,代码行数:12,


示例4: FocusElementDraw

static void FocusElementDraw(    void *clientData, void *elementRecord, Tk_Window tkwin,    Drawable d, Ttk_Box b, unsigned int state){    if (state & TTK_STATE_FOCUS) {	RECT rc = BoxToRect(b);	TkWinDCState dcState;	HDC hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState);    	DrawFocusRect(hdc, &rc);	TkWinReleaseDrawableDC(d, hdc, &dcState);    }}
开发者ID:aosm,项目名称:tcl,代码行数:12,


示例5: ButtonBorderElementDraw

static void ButtonBorderElementDraw(    void *clientData, void *elementRecord, Tk_Window tkwin,    Drawable d, Ttk_Box b, unsigned int state){    ButtonBorderElement *bd = elementRecord;    int relief = TK_RELIEF_FLAT;    int defaultState = TTK_BUTTON_DEFAULT_DISABLED;    TkWinDCState dcState;    HDC hdc;    RECT rc;    Tk_GetReliefFromObj(NULL, bd->reliefObj, &relief);    Ttk_GetButtonDefaultStateFromObj(NULL, bd->defaultStateObj, &defaultState);    if (defaultState == TTK_BUTTON_DEFAULT_ACTIVE) {	XColor *highlightColor =	    Tk_GetColorFromObj(tkwin, bd->highlightColorObj);	GC gc = Tk_GCForColor(highlightColor, d);	XDrawRectangle(Tk_Display(tkwin), d, gc, b.x,b.y,b.width-1,b.height-1);    }    if (defaultState != TTK_BUTTON_DEFAULT_DISABLED) {	++b.x; ++b.y; b.width -= 2; b.height -= 2;    }    hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState);    rc = BoxToRect(b);    DrawFrameControl(hdc, &rc,	DFC_BUTTON,	/* classId */	DFCS_BUTTONPUSH | Ttk_StateTableLookup(pushbutton_statemap, state));    /* Draw focus ring:     */    if (state & TTK_STATE_FOCUS) {	short int borderWidth = 3;	/* @@@ Use GetSystemMetrics?*/	rc = BoxToRect(Ttk_PadBox(b, Ttk_UniformPadding(borderWidth)));    	DrawFocusRect(hdc, &rc);    }    TkWinReleaseDrawableDC(d, hdc, &dcState);}
开发者ID:aosm,项目名称:tcl,代码行数:40,


示例6: ToolbarBackgroundElementDraw

/*---------------------------------------------------------------------- * +++ ToolbarBackground element -- toolbar style for frames. * *	This is very similar to the normal background element, but uses a *	different ThemeBrush in order to get the lighter pinstripe effect *	used in toolbars. We use SetThemeBackground() rather than *	ApplyThemeBackground() in order to get the right style. * * <URL: http://developer.apple.com/documentation/Carbon/Reference/ *	Appearance_Manager/appearance_manager/constant_7.html#/ *	/apple_ref/doc/uid/TP30000243/C005321> * */static void ToolbarBackgroundElementDraw(    void *clientData, void *elementRecord, Tk_Window tkwin,    Drawable d, Ttk_Box b, Ttk_State state){    ThemeBrush brush = kThemeBrushToolbarBackground;    CGRect bounds = BoxToRect(d, Ttk_WinBox(tkwin));    BEGIN_DRAWING(d)    ChkErr(HIThemeSetFill, brush, NULL, dc.context, HIOrientation);    //QDSetPatternOrigin(PatternOrigin(tkwin, d));    CGContextFillRect(dc.context, bounds);    END_DRAWING}
开发者ID:swkarlekar,项目名称:STIDER_work,代码行数:26,


示例7: FrameControlElementDraw

static void FrameControlElementDraw(    void *clientData, void *elementRecord, Tk_Window tkwin,    Drawable d, Ttk_Box b, unsigned int state){    FrameControlElementData *elementData = clientData;    RECT rc = BoxToRect(Ttk_PadBox(b, elementData->margins));    TkWinDCState dcState;    HDC hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState);    DrawFrameControl(hdc, &rc,	elementData->classId,	elementData->partId|Ttk_StateTableLookup(elementData->stateMap, state));    TkWinReleaseDrawableDC(d, hdc, &dcState);}
开发者ID:aosm,项目名称:tcl,代码行数:14,


示例8: TreeHeaderElementDraw

static void TreeHeaderElementDraw(    void *clientData, void *elementRecord, Tk_Window tkwin,    Drawable d, Ttk_Box b, Ttk_State state){    ThemeButtonParams *params = clientData;    CGRect bounds = BoxToRect(d, b);    const HIThemeButtonDrawInfo info = {        .version = 0,        .state = Ttk_StateTableLookup(ThemeStateTable, state),        .kind = params->kind,        .value = Ttk_StateTableLookup(TreeHeaderValueTable, state),        .adornment = Ttk_StateTableLookup(TreeHeaderAdornmentTable, state),    };    BEGIN_DRAWING(d)    ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation, NULL);    END_DRAWING}static Ttk_ElementSpec TreeHeaderElementSpec = {    TK_STYLE_VERSION_2,    sizeof(NullElement),    TtkNullElementOptions,    ButtonElementSizeNoPadding,    TreeHeaderElementDraw};/* * Disclosure triangle: */#define TTK_TREEVIEW_STATE_OPEN 	TTK_STATE_USER1#define TTK_TREEVIEW_STATE_LEAF 	TTK_STATE_USER2static Ttk_StateTable DisclosureValueTable[] = {    { kThemeDisclosureDown, TTK_TREEVIEW_STATE_OPEN, 0 },    { kThemeDisclosureRight, 0, 0 },};static void DisclosureElementSize(    void *clientData, void *elementRecord, Tk_Window tkwin,    int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr){    SInt32 s;    ChkErr(GetThemeMetric, kThemeMetricDisclosureTriangleWidth, &s);    *widthPtr = s;    ChkErr(GetThemeMetric, kThemeMetricDisclosureTriangleHeight, &s);    *heightPtr = s;}
开发者ID:swkarlekar,项目名称:STIDER_work,代码行数:48,


示例9: ThumbElementDraw

static void ThumbElementDraw(    void *clientData, void *elementRecord, Tk_Window tkwin,    Drawable d, Ttk_Box b, unsigned int state){    RECT rc = BoxToRect(b);    TkWinDCState dcState;    HDC hdc;    /* Windows doesn't show a thumb when the scrollbar is disabled */    if (state & TTK_STATE_DISABLED)	return;    hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState);    DrawEdge(hdc, &rc, EDGE_RAISED, BF_RECT | BF_MIDDLE);    TkWinReleaseDrawableDC(d, hdc, &dcState);}
开发者ID:aosm,项目名称:tcl,代码行数:16,


示例10: GroupElementDraw

static void GroupElementDraw(    void *clientData, void *elementRecord, Tk_Window tkwin,    Drawable d, Ttk_Box b, Ttk_State state){    CGRect bounds = BoxToRect(d, b);    const HIThemeGroupBoxDrawInfo info = {        .version = 0,        .state = Ttk_StateTableLookup(ThemeStateTable, state),        .kind = kHIThemeGroupBoxKindPrimaryOpaque,    };    BEGIN_DRAWING(d)    ChkErr(HIThemeDrawGroupBox, &bounds, &info, dc.context, HIOrientation);    END_DRAWING}static Ttk_ElementSpec GroupElementSpec = {    TK_STYLE_VERSION_2,    sizeof(NullElement),    TtkNullElementOptions,    GroupElementSize,    GroupElementDraw};/*---------------------------------------------------------------------- * +++ Entry element -- *	3 pixels padding for focus rectangle *	2 pixels padding for EditTextFrame */typedef struct {    Tcl_Obj	*backgroundObj;} EntryElement;static Ttk_ElementOptionSpec EntryElementOptions[] = {    {   "-background", TK_OPTION_BORDER,        Tk_Offset(EntryElement,backgroundObj), "white"    },    {0}};static void EntryElementSize(    void *clientData, void *elementRecord, Tk_Window tkwin,    int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr){    *paddingPtr = Ttk_UniformPadding(5);}
开发者ID:swkarlekar,项目名称:STIDER_work,代码行数:47,


示例11: pixman_region32_rectangles

nsRegion& nsRegion::Transform (const gfx3DMatrix &aTransform){  int n;  pixman_box32_t *boxes = pixman_region32_rectangles(&mImpl, &n);  for (int i=0; i<n; i++) {    nsRect rect = BoxToRect(boxes[i]);    boxes[i] = RectToBox(nsIntRegion::ToRect(TransformRect(nsIntRegion::FromRect(rect), aTransform)));  }  pixman_region32_t region;  // This will union all of the rectangles and runs in about O(n lg(n))  pixman_region32_init_rects(&region, boxes, n);  pixman_region32_fini(&mImpl);  mImpl = region;  return *this;}
开发者ID:bebef1987,项目名称:gecko-dev,代码行数:17,


示例12: FieldElementDraw

static void FieldElementDraw(    void *clientData, void *elementRecord, Tk_Window tkwin,    Drawable d, Ttk_Box b, unsigned int state){    FieldElement *field = elementRecord;    Tk_3DBorder bg = Tk_Get3DBorderFromObj(tkwin, field->backgroundObj);    RECT rc = BoxToRect(b);    TkWinDCState dcState;    HDC hdc;    Tk_Fill3DRectangle(	tkwin, d, bg, b.x, b.y, b.width, b.height, 0, TK_RELIEF_FLAT);    hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState);    DrawEdge(hdc, &rc, EDGE_SUNKEN, BF_RECT);    TkWinReleaseDrawableDC(d, hdc, &dcState);}
开发者ID:aosm,项目名称:tcl,代码行数:17,


示例13: ComboboxElementDraw

static void ComboboxElementDraw(    void *clientData, void *elementRecord, Tk_Window tkwin,    Drawable d, Ttk_Box b, Ttk_State state){    CGRect bounds = BoxToRect(d, Ttk_PadBox(b, ComboboxMargins));    const HIThemeButtonDrawInfo info = {        .version = 0,        .state = Ttk_StateTableLookup(ThemeStateTable, state),        .kind = kThemeComboBox,        .value = Ttk_StateTableLookup(ButtonValueTable, state),        .adornment = Ttk_StateTableLookup(ButtonAdornmentTable, state),    };    BEGIN_DRAWING(d)    ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation, NULL);    END_DRAWING}static Ttk_ElementSpec ComboboxElementSpec = {    TK_STYLE_VERSION_2,    sizeof(NullElement),    TtkNullElementOptions,    ComboboxElementSize,    ComboboxElementDraw};/*---------------------------------------------------------------------- * +++ Spinbuttons. * * From Apple HIG, part III, section "Controls", "The Stepper Control": * there should be 2 pixels of space between the stepper control * (AKA IncDecButton, AKA "little arrows") and the text field it modifies. */static Ttk_Padding SpinbuttonMargins = {2,0,2,0};static void SpinButtonElementSize(    void *clientData, void *elementRecord, Tk_Window tkwin,    int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr){    SInt32 s;    ChkErr(GetThemeMetric, kThemeMetricLittleArrowsWidth, &s);    *widthPtr = s + Ttk_PaddingWidth(SpinbuttonMargins);    ChkErr(GetThemeMetric, kThemeMetricLittleArrowsHeight, &s);    *heightPtr = s + Ttk_PaddingHeight(SpinbuttonMargins);}
开发者ID:swkarlekar,项目名称:STIDER_work,代码行数:46,


示例14: PaneElementDraw

static void PaneElementDraw(    void *clientData, void *elementRecord, Tk_Window tkwin,    Drawable d, Ttk_Box b, Ttk_State state){    CGRect bounds = BoxToRect(d, b);    HIThemeTabPaneDrawInfo info = {        .version = 1,        .state = Ttk_StateTableLookup(ThemeStateTable, state),        .direction = kThemeTabNorth,        .size = kHIThemeTabSizeNormal,        .kind = kHIThemeTabKindNormal,        .adornment = kHIThemeTabPaneAdornmentNormal,    };    bounds.origin.y -= kThemeMetricTabFrameOverlap;    bounds.size.height += kThemeMetricTabFrameOverlap;    BEGIN_DRAWING(d)    ChkErr(HIThemeDrawTabPane, &bounds, &info, dc.context, HIOrientation);    END_DRAWING}static Ttk_ElementSpec PaneElementSpec = {    TK_STYLE_VERSION_2,    sizeof(NullElement),    TtkNullElementOptions,    PaneElementSize,    PaneElementDraw};/* * Labelframe borders: * Use "primary group box ..." * Quoth DrawThemePrimaryGroup reference: * "The primary group box frame is drawn inside the specified * rectangle and is a maximum of 2 pixels thick." * * "Maximum of 2 pixels thick" is apparently a lie; * looks more like 4 to me with shading. */static void GroupElementSize(    void *clientData, void *elementRecord, Tk_Window tkwin,    int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr){    *paddingPtr = Ttk_UniformPadding(4);}
开发者ID:swkarlekar,项目名称:STIDER_work,代码行数:45,


示例15: FillFocusElementDraw

	/* @@@ FIX THIS */static void FillFocusElementDraw(    void *clientData, void *elementRecord, Tk_Window tkwin,    Drawable d, Ttk_Box b, unsigned int state){    FillFocusElement *focus = elementRecord;    if (state & TTK_STATE_FOCUS) {	RECT rc = BoxToRect(b);	TkWinDCState dcState;	XColor *fillColor = Tk_GetColorFromObj(tkwin, focus->fillColorObj);	GC gc = Tk_GCForColor(fillColor, d);	HDC hdc;	XFillRectangle(Tk_Display(tkwin),d,gc, b.x,b.y,b.width,b.height);	hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState);    	DrawFocusRect(hdc, &rc);	TkWinReleaseDrawableDC(d, hdc, &dcState);    }}
开发者ID:aosm,项目名称:tcl,代码行数:19,


示例16: BorderElementDraw

static void BorderElementDraw(    void *clientData, void *elementRecord, Tk_Window tkwin,    Drawable d, Ttk_Box b, unsigned int state){    BorderElement *border = elementRecord;    RECT rc = BoxToRect(b);    int relief = TK_RELIEF_FLAT;    TkWinDCState dcState;    HDC hdc;    Tk_GetReliefFromObj(NULL, border->reliefObj, &relief);    if (relief != TK_RELIEF_FLAT) {	UINT xFlags = (relief == TK_RELIEF_SOLID) ? BF_FLAT : 0;	hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState);	DrawEdge(hdc, &rc, ReliefToEdge(relief), BF_RECT | xFlags);	TkWinReleaseDrawableDC(d, hdc, &dcState);    }}
开发者ID:aosm,项目名称:tcl,代码行数:19,


示例17: DisclosureElementDraw

static void DisclosureElementDraw(    void *clientData, void *elementRecord, Tk_Window tkwin,    Drawable d, Ttk_Box b, Ttk_State state){    if (!(state & TTK_TREEVIEW_STATE_LEAF)) {        CGRect bounds = BoxToRect(d, b);        const HIThemeButtonDrawInfo info = {            .version = 0,            .state = Ttk_StateTableLookup(ThemeStateTable, state),            .kind = kThemeDisclosureTriangle,            .value = Ttk_StateTableLookup(DisclosureValueTable, state),            .adornment = kThemeAdornmentDrawIndicatorOnly,        };        BEGIN_DRAWING(d)        ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation, NULL);        END_DRAWING    }}
开发者ID:swkarlekar,项目名称:STIDER_work,代码行数:19,



注:本文中的BoxToRect函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ Bprint函数代码示例
C++ Box2d函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。