static void ClientElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { int borderWidth = 2; *paddingPtr = Ttk_UniformPadding((short)borderWidth); }
static void ScrollbarTroughElementGeometry( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { if (qApp == NULL) NULL_Q_APP; *paddingPtr = Ttk_UniformPadding(0); }
static void TreeViewFieldElementGeometry( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { if (!TileGtk_GtkInitialised()) NO_GTK_STYLE_ENGINE; *paddingPtr = Ttk_UniformPadding(0); }
static void RadioIndicatorElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned state) { IndicatorElement *indicator = elementRecord; GC gcb=Ttk_GCForColor(tkwin,indicator->backgroundObj,d); GC gcf=Ttk_GCForColor(tkwin,indicator->foregroundObj,d); GC gcu=Ttk_GCForColor(tkwin,indicator->upperColorObj,d); GC gcl=Ttk_GCForColor(tkwin,indicator->lowerColorObj,d); Ttk_Padding padding; Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &padding); b = Ttk_PadBox(b, padding); XFillArc(Tk_Display(tkwin),d,gcb, b.x,b.y,b.width,b.height, 0,360*64); XDrawArc(Tk_Display(tkwin),d,gcl, b.x,b.y,b.width,b.height, 225*64,180*64); XDrawArc(Tk_Display(tkwin),d,gcu, b.x,b.y,b.width,b.height, 45*64,180*64); if (state & TTK_STATE_SELECTED) { b = Ttk_PadBox(b,Ttk_UniformPadding(3)); XFillArc(Tk_Display(tkwin),d,gcf, b.x,b.y,b.width,b.height, 0,360*64); XDrawArc(Tk_Display(tkwin),d,gcf, b.x,b.y,b.width,b.height, 0,360*64); #if WIN32_XDRAWLINE_HACK XDrawArc(Tk_Display(tkwin),d,gcf, b.x,b.y,b.width,b.height, 300*64,360*64); #endif } }
static void TreeitemIndicatorDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { TreeitemIndicator *indicator = elementRecord; XColor *color = Tk_GetColorFromObj(tkwin, indicator->colorObj); GC gc = Tk_GCForColor(color, d); Ttk_Padding padding = Ttk_UniformPadding(0); int w = WIN32_XDRAWLINE_HACK; int cx, cy; if (state & TTK_STATE_LEAF) { /* don't draw anything ... */ return; } Ttk_GetPaddingFromObj(NULL,tkwin,indicator->marginObj,&padding); b = Ttk_PadBox(b, padding); XDrawRectangle(Tk_Display(tkwin), d, gc, b.x, b.y, b.width - 1, b.height - 1); cx = b.x + (b.width - 1) / 2; cy = b.y + (b.height - 1) / 2; XDrawLine(Tk_Display(tkwin), d, gc, b.x+2, cy, b.x+b.width-3+w, cy); if (!(state & TTK_STATE_OPEN)) { /* turn '-' into a '+' */ XDrawLine(Tk_Display(tkwin), d, gc, cx, b.y+2, cx, b.y+b.height-3+w); } }
static void BorderElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { BorderElement *bd = elementRecord; Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, bd->borderObj); XColor *borderColor = Tk_GetColorFromObj(tkwin, bd->borderColorObj); int borderWidth = 2; int relief = TK_RELIEF_FLAT; int defaultState = TTK_BUTTON_DEFAULT_DISABLED; /* * Get option values. */ Tcl_GetIntFromObj(NULL, bd->borderWidthObj, &borderWidth); Tk_GetReliefFromObj(NULL, bd->reliefObj, &relief); Ttk_GetButtonDefaultStateFromObj(NULL, bd->defaultStateObj, &defaultState); if (defaultState == TTK_BUTTON_DEFAULT_ACTIVE) { GC gc = Tk_GCForColor(borderColor, d); XDrawRectangle(Tk_Display(tkwin), d, gc, b.x, b.y, b.width-1, b.height-1); } if (defaultState != TTK_BUTTON_DEFAULT_DISABLED) { /* Space for default ring: */ b = Ttk_PadBox(b, Ttk_UniformPadding(1)); } DrawBorder(tkwin, d, border, borderColor, b, borderWidth, relief); }
static void BorderElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { BorderElement *bd = elementRecord; int borderWidth = 0; Tcl_GetIntFromObj(NULL, bd->borderWidthObj, &borderWidth); *paddingPtr = Ttk_UniformPadding((short)borderWidth); }
static void FieldElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { FieldElement *field = elementRecord; int borderWidth = 2; Tk_GetPixelsFromObj(NULL, tkwin, field->borderWidthObj, &borderWidth); *paddingPtr = Ttk_UniformPadding((short)borderWidth); }
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); }
static void ClientElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { ClientElement *ce = elementRecord; int borderWidth = 1; Tk_GetPixelsFromObj(0, tkwin, ce->borderWidthObj, &borderWidth); *paddingPtr = Ttk_UniformPadding((short)borderWidth); }
static void BorderElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { BorderElement *border = (BorderElement*)elementRecord; int borderWidth = 2; Tk_GetPixelsFromObj(NULL, tkwin, border->borderWidthObj, &borderWidth); if (borderWidth == 1) ++borderWidth; *paddingPtr = Ttk_UniformPadding((short)borderWidth); }
static void FocusElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { FocusElement *focus = elementRecord; int focusThickness = 0; Tcl_GetIntFromObj(NULL, focus->focusThicknessObj, &focusThickness); *paddingPtr = Ttk_UniformPadding((short)focusThickness); }
/*------------------------------------------------------------------------ * +++ Progress bar element */ static void PbarElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { SliderElementSize(clientData, elementRecord, tkwin, widthPtr, heightPtr, paddingPtr); *paddingPtr = Ttk_UniformPadding(2); *widthPtr += 4; *heightPtr += 4; }
static void HighlightElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { HighlightElement *hl = elementRecord; int highlightThickness = 0; Tcl_GetIntFromObj(NULL,hl->highlightThicknessObj,&highlightThickness); *paddingPtr = Ttk_UniformPadding((short)highlightThickness); }
static void ScrollbarDownArrowElementGeometry( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { if (qApp == NULL) NULL_Q_APP; NULL_PROXY_ORIENTED_WIDGET(TileQt_QScrollBar_Widget); Tcl_MutexLock(&tileqtMutex); if (orient == TTK_ORIENT_HORIZONTAL) { wc->TileQt_QScrollBar_Widget->setOrientation(Qt::Horizontal); } else { wc->TileQt_QScrollBar_Widget->setOrientation(Qt::Vertical); } #ifdef TILEQT_QT_VERSION_4 QStyleOptionSlider option; option.initFrom(wc->TileQt_QScrollBar_Widget); QRect rc = wc->TileQt_Style->subControlRect(QStyle::CC_ScrollBar, &option, QStyle::SC_ScrollBarAddLine, wc->TileQt_QScrollBar_Widget); #endif /* TILEQT_QT_VERSION_4 */ if (rc.isValid()) { *widthPtr = rc.width(); *heightPtr = rc.height(); /* Qt Style Fixes: */ // printf("%s\n", wc->TileQt_Style->name()); if (TileQt_ThemeIs(wc, "keramik") || TileQt_ThemeIs(wc, "thinkeramik") || TileQt_ThemeIs(wc, "shinekeramik")) { // Keramic & ThinKeramic are buggy: Their subcontrol metrics are for 2 // buttons, not one. Find the smallest dimension, and return a // rectangle. if (orient == TTK_ORIENT_HORIZONTAL) { *heightPtr = 17; *widthPtr = 34; } else { *heightPtr = 34; *widthPtr = 17; } } else if (TileQt_ThemeIs(wc, "sgi") || TileQt_ThemeIs(wc, "compact") || TileQt_ThemeIs(wc, "platinum") || TileQt_ThemeIs(wc, "motifplus") || TileQt_ThemeIs(wc, "cde") || TileQt_ThemeIs(wc, "motif") || TileQt_ThemeIs(wc, "windows")) { // These styles are buggy?: Some times one dimension is returned as 10, // others as 21. if (*widthPtr < *heightPtr) *widthPtr = *heightPtr; if (*heightPtr < *widthPtr) *heightPtr = *widthPtr; } } Tcl_MutexUnlock(&tileqtMutex); *paddingPtr = Ttk_UniformPadding(0); #ifdef TILEQT_SCROLLBAR_SIZE_DEBUG printf("ScrollbarDownArrowElementGeometry: width=%d, height=%d, orient=%d\n", *widthPtr, *heightPtr, orient); fflush(0); #endif /* TILEQT_SCROLLBAR_SIZE_DEBUG */ }
static void BorderElementGeometry( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { if (qApp == NULL) NULL_Q_APP; //Tcl_MutexLock(&tileqtMutex); BorderElement *border = (BorderElement*) elementRecord; int borderWidth = 0; Tcl_GetIntFromObj(NULL, border->borderWidthObj, &borderWidth); *paddingPtr = Ttk_UniformPadding((short)borderWidth+2); //Tcl_MutexUnlock(&tileqtMutex); }
static void SquareElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { SquareElement *square = elementRecord; int borderWidth = 0; Tcl_GetIntFromObj(NULL, square->borderWidthObj, &borderWidth); *paddingPtr = Ttk_UniformPadding((short)borderWidth); Tk_GetPixelsFromObj(NULL, tkwin, square->widthObj, widthPtr); Tk_GetPixelsFromObj(NULL, tkwin, square->heightObj, heightPtr); }
static void SizeGripElementGeometry( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { if (qApp == NULL) NULL_Q_APP; NULL_PROXY_WIDGET(TileQt_QWidget_Widget); QSizeGrip widget(wc->TileQt_QWidget_Widget); QSize size = widget.sizeHint(); *widthPtr = size.width(); *heightPtr = size.height(); *paddingPtr = Ttk_UniformPadding(0); }
static void NotebookStyleOptions(Notebook *nb, NotebookStyle *nbstyle) { Tcl_Obj *objPtr; nbstyle->tabPosition = TTK_PACK_TOP | TTK_STICK_W; if ((objPtr = Ttk_QueryOption(nb->core.layout, "-tabposition", 0)) != 0) { TtkGetLabelAnchorFromObj(NULL, objPtr, &nbstyle->tabPosition); } /* compute tabPlacement and tabOrient as function of tabPosition: */ if (nbstyle->tabPosition & TTK_PACK_LEFT) { nbstyle->tabPlacement = TTK_PACK_TOP | TTK_STICK_E; nbstyle->tabOrient = TTK_ORIENT_VERTICAL; } else if (nbstyle->tabPosition & TTK_PACK_RIGHT) { nbstyle->tabPlacement = TTK_PACK_TOP | TTK_STICK_W; nbstyle->tabOrient = TTK_ORIENT_VERTICAL; } else if (nbstyle->tabPosition & TTK_PACK_BOTTOM) { nbstyle->tabPlacement = TTK_PACK_LEFT | TTK_STICK_N; nbstyle->tabOrient = TTK_ORIENT_HORIZONTAL; } else { /* Assume TTK_PACK_TOP */ nbstyle->tabPlacement = TTK_PACK_LEFT | TTK_STICK_S; nbstyle->tabOrient = TTK_ORIENT_HORIZONTAL; } nbstyle->tabMargins = Ttk_UniformPadding(0); if ((objPtr = Ttk_QueryOption(nb->core.layout, "-tabmargins", 0)) != 0) { Ttk_GetBorderFromObj(NULL, objPtr, &nbstyle->tabMargins); } nbstyle->padding = Ttk_UniformPadding(0); if ((objPtr = Ttk_QueryOption(nb->core.layout, "-padding", 0)) != 0) { Ttk_GetPaddingFromObj(NULL,nb->core.tkwin,objPtr,&nbstyle->padding); } nbstyle->minTabWidth = DEFAULT_MIN_TAB_WIDTH; if ((objPtr = Ttk_QueryOption(nb->core.layout, "-mintabwidth", 0)) != 0) { Tcl_GetIntFromObj(NULL, objPtr, &nbstyle->minTabWidth); } }
/* * FrameMargins -- * Compute internal margins for a frame widget. * This includes the -borderWidth, plus any additional -padding. */ static Ttk_Padding FrameMargins(Frame *framePtr) { Ttk_Padding margins = Ttk_UniformPadding(0); /* Check -padding: */ if (framePtr->frame.paddingObj) { Ttk_GetPaddingFromObj(NULL, framePtr->core.tkwin, framePtr->frame.paddingObj, &margins); } /* Add padding for border: */ if (framePtr->frame.borderWidthObj) { int border = 0; Tk_GetPixelsFromObj(NULL, framePtr->core.tkwin, framePtr->frame.borderWidthObj, &border); margins = Ttk_AddPadding(margins, Ttk_UniformPadding((short)border)); } return margins; }
static void PanedSashGripElementGeometry( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { if (qApp == NULL) NULL_Q_APP; NULL_PROXY_ORIENTED_WIDGET(TileQt_QWidget_Widget); if (orient == TTK_ORIENT_HORIZONTAL) { *widthPtr = PMW(PM_SplitterWidth, 0); } else { *heightPtr = PMW(PM_SplitterWidth, 0); } *paddingPtr = Ttk_UniformPadding(PanedUniformPadding); }
static void FieldElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned state) { FieldElement *field = elementRecord; Tk_3DBorder bg = Tk_Get3DBorderFromObj(tkwin, field->backgroundObj); Ttk_Box f = Ttk_PadBox(b, Ttk_UniformPadding(2)); Tcl_Obj *outer = field->borderColorObj, *inner = field->lightColorObj; DrawSmoothBorder(tkwin, d, b, outer, inner, inner); Tk_Fill3DRectangle( tkwin, d, bg, f.x, f.y, f.width, f.height, 0, TK_RELIEF_SUNKEN); }
static void TroughElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { TroughElement *troughPtr = elementRecord; int borderWidth = 2, grooveWidth = 0; Tk_GetPixelsFromObj(NULL, tkwin, troughPtr->borderWidthObj, &borderWidth); Tk_GetPixelsFromObj(NULL, tkwin, troughPtr->grooveWidthObj, &grooveWidth); if (grooveWidth <= 0) { *paddingPtr = Ttk_UniformPadding((short)borderWidth); } }
static void PbarElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned state) { ScrollbarElement *sb = elementRecord; b = Ttk_PadBox(b, Ttk_UniformPadding(2)); if (b.width > 4 && b.height > 4) { DrawSmoothBorder(tkwin, d, b, sb->borderColorObj, sb->lightColorObj, sb->darkColorObj); XFillRectangle(Tk_Display(tkwin), d, BackgroundGC(tkwin, sb->backgroundObj), b.x+2, b.y+2, b.width-4, b.height-4); } }
static void ButtonBorderElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { ButtonBorderElement *bd = elementRecord; int defaultState = TTK_BUTTON_DEFAULT_DISABLED; int borderWidth = 0; Tcl_GetIntFromObj(NULL, bd->borderWidthObj, &borderWidth); Ttk_GetButtonDefaultStateFromObj(NULL, bd->defaultStateObj, &defaultState); if (defaultState != TTK_BUTTON_DEFAULT_DISABLED) { borderWidth += 5; } *paddingPtr = Ttk_UniformPadding((short)borderWidth); }
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); }
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); }
static void ScrollbarThumbElementGeometry( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { TILEGTK_WIDGET_CACHE_DEFINITION; gint slider_width = 0, slider_min = ScrollbarThumbMinimumLen; GtkWidget *widget = TileGtk_GetScrollBar(wc); TILEGTK_ENSURE_GTK_STYLE_ENGINE_ACTIVE; TILEGTK_ENSURE_WIDGET_OK; TileGtk_gtk_widget_style_get(widget, "slider-width", &slider_width, "min-slider-length", &slider_min, NULL); *heightPtr = *widthPtr = slider_min; if (wc->orientation == TTK_ORIENT_HORIZONTAL) { *heightPtr = slider_width; *widthPtr = slider_min; } else { *widthPtr = slider_width; *heightPtr = slider_min; } *paddingPtr = Ttk_UniformPadding(0); }
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); }
static void ScrollbarThumbElementGeometry( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { if (qApp == NULL) NULL_Q_APP; NULL_PROXY_ORIENTED_WIDGET(TileQt_QScrollBar_Widget); Tcl_MutexLock(&tileqtMutex); if (orient == TTK_ORIENT_HORIZONTAL) { *heightPtr = wc->TileQt_Style->pixelMetric(QStyle::PM_ScrollBarExtent, #ifdef TILEQT_QT_VERSION_4 0, #endif /* TILEQT_QT_VERSION_4 */ wc->TileQt_QScrollBar_Widget); *widthPtr = wc->TileQt_Style->pixelMetric(QStyle::PM_ScrollBarSliderMin, #ifdef TILEQT_QT_VERSION_4 0, #endif /* TILEQT_QT_VERSION_4 */ wc->TileQt_QScrollBar_Widget); if (*heightPtr > 30) *heightPtr = 30; if (*widthPtr > 100) *widthPtr = 100; } else { *widthPtr = wc->TileQt_Style->pixelMetric(QStyle::PM_ScrollBarExtent, #ifdef TILEQT_QT_VERSION_4 0, #endif /* TILEQT_QT_VERSION_4 */ wc->TileQt_QScrollBar_Widget); *heightPtr = wc->TileQt_Style->pixelMetric(QStyle::PM_ScrollBarSliderMin, #ifdef TILEQT_QT_VERSION_4 0, #endif /* TILEQT_QT_VERSION_4 */ wc->TileQt_QScrollBar_Widget); if (*heightPtr > 100) *heightPtr = 100; if (*widthPtr > 30) *widthPtr = 30; } Tcl_MutexUnlock(&tileqtMutex); *paddingPtr = Ttk_UniformPadding(0); #ifdef TILEQT_SCROLLBAR_SIZE_DEBUG printf("ScrollbarThumbElementGeometry: width=%d, height=%d, orient=%d\n", *widthPtr, *heightPtr, orient); fflush(0); #endif /* TILEQT_SCROLLBAR_SIZE_DEBUG */ }