diff options
author | csaba <csaba> | 2023-08-23 18:05:06 (GMT) |
---|---|---|
committer | csaba <csaba> | 2023-08-23 18:05:06 (GMT) |
commit | 467482773719c9bf5a6b08833fd694f6c1e504ce (patch) | |
tree | 7ec67a3a5b9fedbd8ee7f04b90b24d4b3c958a39 /generic/ttk/ttkElements.c | |
parent | e79708b4b12f47f5976ed3ddb83bc8d3f7aed5fc (diff) | |
download | tk-467482773719c9bf5a6b08833fd694f6c1e504ce.zip tk-467482773719c9bf5a6b08833fd694f6c1e504ce.tar.gz tk-467482773719c9bf5a6b08833fd694f6c1e504ce.tar.bz2 |
Improved the look of the ttk::scrollbar widget in the themes "default" and "alt".
Diffstat (limited to 'generic/ttk/ttkElements.c')
-rw-r--r-- | generic/ttk/ttkElements.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/generic/ttk/ttkElements.c b/generic/ttk/ttkElements.c index c899195..47131b1 100644 --- a/generic/ttk/ttkElements.c +++ b/generic/ttk/ttkElements.c @@ -830,13 +830,14 @@ static const Ttk_ElementSpec IndicatorElementSpec = { }; /*---------------------------------------------------------------------- - * +++ Arrow elements. + * +++ Arrow element(s). * * Draws a solid triangle inside a box. * clientData is an enum ArrowDirection pointer. */ typedef struct { + Tcl_Obj *smallObj; Tcl_Obj *sizeObj; Tcl_Obj *colorObj; Tcl_Obj *borderObj; @@ -845,6 +846,8 @@ typedef struct { } ArrowElement; static const Ttk_ElementOptionSpec ArrowElementOptions[] = { + { "-smallarrow", TK_OPTION_BOOLEAN, + offsetof(ArrowElement,smallObj), "0" }, { "-arrowsize", TK_OPTION_PIXELS, offsetof(ArrowElement,sizeObj), "14" }, { "-arrowcolor", TK_OPTION_COLOR, @@ -866,22 +869,30 @@ static void ArrowElementSize( { ArrowElement *arrow = (ArrowElement *)elementRecord; ArrowDirection direction = (ArrowDirection)PTR2INT(clientData); - int size = 14; - Ttk_Padding padding; double scalingLevel = TkScalingLevel(tkwin); + Ttk_Padding padding; + int size = 14, small = 0; (void)paddingPtr; - Tk_GetPixelsFromObj(NULL, tkwin, arrow->sizeObj, &size); - padding.left = round(ArrowMargins.left * scalingLevel); padding.top = round(ArrowMargins.top * scalingLevel); padding.right = round(ArrowMargins.right * scalingLevel); padding.bottom = round(ArrowMargins.bottom * scalingLevel); + Tk_GetPixelsFromObj(NULL, tkwin, arrow->sizeObj, &size); size -= Ttk_PaddingWidth(padding); TtkArrowSize(size/2, direction, widthPtr, heightPtr); *widthPtr += Ttk_PaddingWidth(padding); *heightPtr += Ttk_PaddingHeight(padding); + + Tcl_GetBooleanFromObj(NULL, arrow->smallObj, &small); + if (!small) { + if (*widthPtr < *heightPtr) { + *widthPtr = *heightPtr; + } else { + *heightPtr = *widthPtr; + } + } } static void ArrowElementDraw( @@ -1287,7 +1298,6 @@ static void SliderElementDraw( XFillRectangle(disp, d, gc, troughInnerBox.x, troughInnerBox.y, b.x + dim/2 - 1, troughInnerBox.height); break; - case TTK_ORIENT_VERTICAL: XFillRectangle(disp, d, gc, troughInnerBox.x, troughInnerBox.y, troughInnerBox.width, b.y + dim/2 - 1); |