From 645e704d85418ea761b72d4fb0e275219ba2183f Mon Sep 17 00:00:00 2001 From: csaba Date: Mon, 13 May 2024 12:55:52 +0000 Subject: Better way to set the borderwidth of two style elements of the "classic" theme to 2. --- generic/ttk/ttkElements.c | 28 ++++++++++++++-------------- library/ttk/classicTheme.tcl | 5 +++-- library/ttk/defaults.tcl | 4 ++-- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/generic/ttk/ttkElements.c b/generic/ttk/ttkElements.c index f136a21..da96c90 100644 --- a/generic/ttk/ttkElements.c +++ b/generic/ttk/ttkElements.c @@ -730,10 +730,10 @@ static Ttk_ElementOptionSpec MenuIndicatorElementOptions[] = { Tk_Offset(MenuIndicatorElement,widthObj), "4.0m" }, { "-indicatorheight", TK_OPTION_PIXELS, Tk_Offset(MenuIndicatorElement,heightObj), "1.7m" }, - { "-borderwidth", TK_OPTION_PIXELS, + { "-indicatorborderwidth", TK_OPTION_PIXELS, Tk_Offset(MenuIndicatorElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { "-indicatorrelief", TK_OPTION_RELIEF, - Tk_Offset(MenuIndicatorElement,reliefObj),"raised" }, + Tk_Offset(MenuIndicatorElement,reliefObj), "raised" }, { "-indicatormargin", TK_OPTION_STRING, Tk_Offset(MenuIndicatorElement,marginObj), "5 0" }, { NULL, 0, 0, NULL } @@ -1085,18 +1085,18 @@ typedef struct { } SliderElement; static Ttk_ElementOptionSpec SliderElementOptions[] = { - { "-sliderlength", TK_OPTION_PIXELS, Tk_Offset(SliderElement,lengthObj), - "30" }, - { "-sliderthickness",TK_OPTION_PIXELS,Tk_Offset(SliderElement,thicknessObj), - "15" }, - { "-sliderrelief", TK_OPTION_RELIEF, Tk_Offset(SliderElement,reliefObj), - "raised" }, - { "-borderwidth", TK_OPTION_PIXELS, Tk_Offset(SliderElement,borderWidthObj), - DEFAULT_BORDERWIDTH }, - { "-background", TK_OPTION_BORDER, Tk_Offset(SliderElement,borderObj), - DEFAULT_BACKGROUND }, - { "-orient", TK_OPTION_ANY, Tk_Offset(SliderElement,orientObj), - "horizontal" }, + { "-sliderlength", TK_OPTION_PIXELS, + Tk_Offset(SliderElement,lengthObj), "30" }, + { "-sliderthickness", TK_OPTION_PIXELS, + Tk_Offset(SliderElement,thicknessObj), "15" }, + { "-sliderrelief", TK_OPTION_RELIEF, + Tk_Offset(SliderElement,reliefObj), "raised" }, + { "-sliderborderwidth", TK_OPTION_PIXELS, + Tk_Offset(SliderElement,borderWidthObj), DEFAULT_BORDERWIDTH }, + { "-background", TK_OPTION_BORDER, + Tk_Offset(SliderElement,borderObj), DEFAULT_BACKGROUND }, + { "-orient", TK_OPTION_ANY, + Tk_Offset(SliderElement,orientObj), "horizontal" }, { NULL, 0, 0, NULL } }; diff --git a/library/ttk/classicTheme.tcl b/library/ttk/classicTheme.tcl index 1d613fa..2a41fbf 100644 --- a/library/ttk/classicTheme.tcl +++ b/library/ttk/classicTheme.tcl @@ -65,7 +65,8 @@ namespace eval ttk::theme::classic { selected $colors(-indicator)] \ -indicatorrelief {alternate raised selected sunken pressed sunken} - ttk::style configure TMenubutton -relief raised -padding "3m 1m" + ttk::style configure TMenubutton -relief raised \ + -indicatorborderwidth 2 -padding "3m 1m" ttk::style configure TEntry -relief sunken -padding 1 -font TkTextFont ttk::style map TEntry -fieldbackground \ @@ -89,7 +90,7 @@ namespace eval ttk::theme::classic { ttk::style configure TScrollbar -relief raised -arrowsize 12 -width 12 ttk::style map TScrollbar -relief {{pressed !disabled} sunken} - ttk::style configure TScale -sliderrelief raised + ttk::style configure TScale -sliderrelief raised -sliderborderwidth 2 ttk::style map TScale -sliderrelief {{pressed !disabled} sunken} ttk::style configure TProgressbar -background SteelBlue diff --git a/library/ttk/defaults.tcl b/library/ttk/defaults.tcl index b68f501..2a7d2c3 100644 --- a/library/ttk/defaults.tcl +++ b/library/ttk/defaults.tcl @@ -68,7 +68,7 @@ namespace eval ttk::theme::default { [list alternate raised] ttk::style configure TMenubutton \ - -relief raised -padding "10 3" + -relief raised -indicatorborderwidth 1 -padding "10 3" ttk::style configure TEntry \ -fieldbackground white -padding 1 \ @@ -101,7 +101,7 @@ namespace eval ttk::theme::default { -arrowcolor [list disabled $colors(-disabledfg)] ttk::style configure TScale \ - -sliderrelief raised + -sliderrelief raised -sliderborderwidth 1 ttk::style configure TProgressbar \ -background $colors(-selectbg) -- cgit v0.12