Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Improvements related to the "classic" theme, submitted by Emiliano Gavilan (see ticket [aa2dd4c16d]). |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | core-8-branch |
Files: | files | file ages | folders |
SHA3-256: |
2f6d7d28077bdd680b3b7766d13b015b |
User & Date: | csaba 2024-05-09 18:38:24 |
References
2024-05-09
| ||
18:49 | • Closed ticket [aa2dd4c1]: Improvement of the "classic" ttk theme plus 7 other changes artifact: 5c36fbcf user: nemethi | |
Context
2024-05-09
| ||
21:40 | (c) -> © check-in: 2d448437 user: jan.nijtmans tags: core-8-branch | |
18:38 | Improvements related to the "classic" theme, submitted by Emiliano Gavilan (see ticket [aa2dd4c16d]). check-in: 2f6d7d28 user: csaba tags: core-8-branch | |
2024-05-06
| ||
07:33 | Fix [ff5417505b]: xlib/X11/X.h not compilable on x64 Windows, using gcc check-in: 5246e4ad user: jan.nijtmans tags: core-8-branch | |
Changes
Changes to generic/ttk/ttkClassicTheme.c.
︙ | ︙ | |||
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | * +++ Highlight element implementation. * Draw a solid highlight border to indicate focus. */ typedef struct { Tcl_Obj *highlightColorObj; Tcl_Obj *highlightThicknessObj; } HighlightElement; static const Ttk_ElementOptionSpec HighlightElementOptions[] = { { "-highlightcolor",TK_OPTION_COLOR, offsetof(HighlightElement,highlightColorObj), DEFAULT_BACKGROUND }, { "-highlightthickness",TK_OPTION_PIXELS, offsetof(HighlightElement,highlightThicknessObj), "0" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void HighlightElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, TCL_UNUSED(Tk_Window), | > > > | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | * +++ Highlight element implementation. * Draw a solid highlight border to indicate focus. */ typedef struct { Tcl_Obj *highlightColorObj; Tcl_Obj *highlightThicknessObj; Tcl_Obj *defaultStateObj; } HighlightElement; static const Ttk_ElementOptionSpec HighlightElementOptions[] = { { "-highlightcolor",TK_OPTION_COLOR, offsetof(HighlightElement,highlightColorObj), DEFAULT_BACKGROUND }, { "-highlightthickness",TK_OPTION_PIXELS, offsetof(HighlightElement,highlightThicknessObj), "0" }, { "-default", TK_OPTION_ANY, offsetof(HighlightElement,defaultStateObj), "disabled" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void HighlightElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, TCL_UNUSED(Tk_Window), |
︙ | ︙ | |||
50 51 52 53 54 55 56 57 58 59 60 61 | Tk_Window tkwin, Drawable d, TCL_UNUSED(Ttk_Box), TCL_UNUSED(Ttk_State)) { HighlightElement *hl = (HighlightElement *)elementRecord; int highlightThickness = 0; XColor *highlightColor = Tk_GetColorFromObj(tkwin, hl->highlightColorObj); Tcl_GetIntFromObj(NULL,hl->highlightThicknessObj,&highlightThickness); if (highlightColor && highlightThickness > 0) { GC gc = Tk_GCForColor(highlightColor, d); | > > > > > | > | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | Tk_Window tkwin, Drawable d, TCL_UNUSED(Ttk_Box), TCL_UNUSED(Ttk_State)) { HighlightElement *hl = (HighlightElement *)elementRecord; int highlightThickness = 0; Ttk_ButtonDefaultState defaultState = TTK_BUTTON_DEFAULT_DISABLED; XColor *highlightColor = Tk_GetColorFromObj(tkwin, hl->highlightColorObj); Tcl_GetIntFromObj(NULL,hl->highlightThicknessObj,&highlightThickness); if (highlightColor && highlightThickness > 0) { Ttk_GetButtonDefaultStateFromObj(NULL, hl->defaultStateObj, &defaultState); GC gc = Tk_GCForColor(highlightColor, d); if (defaultState == TTK_BUTTON_DEFAULT_NORMAL) { TkDrawInsetFocusHighlight(tkwin, gc, highlightThickness, d, 5); } else { Tk_DrawFocusHighlight(tkwin, gc, highlightThickness, d); } } } static const Ttk_ElementSpec HighlightElementSpec = { TK_STYLE_VERSION_2, sizeof(HighlightElement), |
︙ | ︙ | |||
611 612 613 614 615 616 617 | SliderElement *slider = (SliderElement *)elementRecord; Tk_3DBorder border = NULL; int relief = TK_RELIEF_RAISED, borderWidth = 2; Ttk_Orient orient; border = Tk_Get3DBorderFromObj(tkwin, slider->borderObj); TtkGetOrientFromObj(NULL, slider->orientObj, &orient); | < > > > | 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 | SliderElement *slider = (SliderElement *)elementRecord; Tk_3DBorder border = NULL; int relief = TK_RELIEF_RAISED, borderWidth = 2; Ttk_Orient orient; border = Tk_Get3DBorderFromObj(tkwin, slider->borderObj); TtkGetOrientFromObj(NULL, slider->orientObj, &orient); Tk_GetReliefFromObj(NULL, slider->reliefObj, &relief); #if 0 Tk_GetPixelsFromObj(NULL, tkwin, slider->borderWidthObj, &borderWidth); #endif Tk_Fill3DRectangle(tkwin, d, border, b.x, b.y, b.width, b.height, borderWidth, relief); if (relief != TK_RELIEF_FLAT) { if (orient == TTK_ORIENT_HORIZONTAL) { |
︙ | ︙ | |||
822 823 824 825 826 827 828 | /* "classic" entry, includes highlight border */ TTK_LAYOUT("TEntry", TTK_GROUP("Entry.highlight", TTK_FILL_BOTH, TTK_GROUP("Entry.field", TTK_FILL_BOTH|TTK_BORDER, TTK_GROUP("Entry.padding", TTK_FILL_BOTH, TTK_NODE("Entry.textarea", TTK_FILL_BOTH))))) | > > > > > > > | > | | > > > > | | > | > > > > > > > | > > > > > > | > | 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 | /* "classic" entry, includes highlight border */ TTK_LAYOUT("TEntry", TTK_GROUP("Entry.highlight", TTK_FILL_BOTH, TTK_GROUP("Entry.field", TTK_FILL_BOTH|TTK_BORDER, TTK_GROUP("Entry.padding", TTK_FILL_BOTH, TTK_NODE("Entry.textarea", TTK_FILL_BOTH))))) /* "classic" combobox, includes highlight border */ TTK_LAYOUT("TCombobox", TTK_GROUP("Combobox.highlight", TTK_FILL_BOTH, TTK_GROUP("Combobox.field", TTK_FILL_BOTH, TTK_NODE("Combobox.downarrow", TTK_PACK_RIGHT|TTK_FILL_Y) TTK_GROUP("Combobox.padding", TTK_FILL_BOTH, TTK_NODE("Combobox.textarea", TTK_FILL_BOTH))))) /* "classic" spinbox, includes highlight border */ TTK_LAYOUT("TSpinbox", TTK_GROUP("Spinbox.highlight", TTK_FILL_BOTH, TTK_GROUP("Spinbox.field", TTK_FILL_BOTH|TTK_FILL_X, TTK_GROUP("null", TTK_PACK_RIGHT, TTK_NODE("Spinbox.uparrow", TTK_PACK_TOP|TTK_STICK_E) TTK_NODE("Spinbox.downarrow", TTK_PACK_BOTTOM|TTK_STICK_E)) TTK_GROUP("Spinbox.padding", TTK_FILL_BOTH, TTK_NODE("Spinbox.textarea", TTK_FILL_BOTH))))) /* "classic" scale, includes highlight border */ TTK_LAYOUT("Vertical.TScale", TTK_GROUP("Vertical.Scale.highlight", TTK_FILL_BOTH, TTK_GROUP("Vertical.Scale.trough", TTK_FILL_BOTH, TTK_NODE("Vertical.Scale.slider", TTK_PACK_TOP)))) TTK_LAYOUT("Horizontal.TScale", TTK_GROUP("Horizontal.Scale.highlight", TTK_FILL_BOTH, TTK_GROUP("Horizontal.Scale.trough", TTK_FILL_BOTH, TTK_NODE("Horizontal.Scale.slider", TTK_PACK_LEFT)))) /* put highlight border around treeview */ TTK_LAYOUT("Treeview", TTK_GROUP("Treeview.highlight", TTK_FILL_BOTH, TTK_GROUP("Treeview.field", TTK_FILL_BOTH|TTK_BORDER, TTK_GROUP("Treeview.padding", TTK_FILL_BOTH, TTK_NODE("Treeview.treearea", TTK_FILL_BOTH))))) TTK_END_LAYOUT_TABLE /*------------------------------------------------------------------------ * TtkClassicTheme_Init -- * Install classic theme. */ MODULE_SCOPE int TtkClassicTheme_Init(Tcl_Interp *interp); |
︙ | ︙ |
Changes to generic/ttk/ttkElements.c.
︙ | ︙ | |||
355 356 357 358 359 360 361 362 363 364 365 366 367 368 | /*---------------------------------------------------------------------- * +++ Focus ring element. * Draws a dashed focus ring, if the widget has keyboard focus. */ typedef struct { Tcl_Obj *focusColorObj; Tcl_Obj *focusThicknessObj; } FocusElement; /* * DrawFocusRing -- * Draw a dotted rectangle to indicate focus. */ static void DrawFocusRing( | > | > > > | > > | | | | > > > | 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 | /*---------------------------------------------------------------------- * +++ Focus ring element. * Draws a dashed focus ring, if the widget has keyboard focus. */ typedef struct { Tcl_Obj *focusColorObj; Tcl_Obj *focusThicknessObj; Tcl_Obj *focusSolidObj; } FocusElement; /* * DrawFocusRing -- * Draw a dotted rectangle to indicate focus. */ static void DrawFocusRing( Tk_Window tkwin, Drawable d, Tcl_Obj *colorObj, int thickness, int solid, Ttk_Box b) { XColor *color = Tk_GetColorFromObj(tkwin, colorObj); unsigned long mask = 0UL; XGCValues gcvalues; GC gc; gcvalues.foreground = color->pixel; gcvalues.line_width = thickness < 1 ? 1 : thickness; if (solid) { gcvalues.line_style = LineSolid; mask = GCForeground | GCLineStyle | GCLineWidth; } else { gcvalues.line_style = LineOnOffDash; gcvalues.dashes = 1; gcvalues.dash_offset = 1; mask = GCForeground | GCLineStyle | GCDashList | GCDashOffset | GCLineWidth; } gc = Tk_GetGC(tkwin, mask, &gcvalues); XDrawRectangle(Tk_Display(tkwin), d, gc, b.x, b.y, b.width-1, b.height-1); Tk_FreeGC(Tk_Display(tkwin), gc); } static const Ttk_ElementOptionSpec FocusElementOptions[] = { { "-focuscolor",TK_OPTION_COLOR, offsetof(FocusElement,focusColorObj), "black" }, { "-focusthickness",TK_OPTION_PIXELS, offsetof(FocusElement,focusThicknessObj), "1" }, { "-focussolid",TK_OPTION_BOOLEAN, offsetof(FocusElement,focusSolidObj), "0" }, { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void FocusElementSize( TCL_UNUSED(void *), /* clientData */ void *elementRecord, TCL_UNUSED(Tk_Window), |
︙ | ︙ | |||
414 415 416 417 418 419 420 421 422 423 | Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { FocusElement *focus = (FocusElement *)elementRecord; int focusThickness = 0; if (state & TTK_STATE_FOCUS) { Tcl_GetIntFromObj(NULL,focus->focusThicknessObj,&focusThickness); | > > | > | 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 | Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { FocusElement *focus = (FocusElement *)elementRecord; int focusThickness = 0; int focusSolid = 0; if (state & TTK_STATE_FOCUS) { Tcl_GetIntFromObj(NULL,focus->focusThicknessObj,&focusThickness); Tcl_GetBooleanFromObj(NULL,focus->focusSolidObj,&focusSolid); DrawFocusRing(tkwin, d, focus->focusColorObj, focusThickness, focusSolid, b); } } static const Ttk_ElementSpec FocusElementSpec = { TK_STYLE_VERSION_2, sizeof(FocusElement), FocusElementOptions, |
︙ | ︙ |
Changes to library/ttk/classicTheme.tcl.
︙ | ︙ | |||
8 9 10 11 12 13 14 | variable colors array set colors { -frame "#d9d9d9" -window "#ffffff" -alternate "#f0f0f0" -activebg "#ececec" | | | > > | | > | > > | < | | | > | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | variable colors array set colors { -frame "#d9d9d9" -window "#ffffff" -alternate "#f0f0f0" -activebg "#ececec" -troughbg "#b3b3b3" -selectbg "#c3c3c3" -selectfg "#000000" -disabledfg "#a3a3a3" -indicator "#b03060" -altindicator "#b05e5e" } ttk::style theme settings classic { ttk::style configure "." \ -font TkDefaultFont \ -background $colors(-frame) \ -foreground black \ -selectbackground $colors(-selectbg) \ -selectforeground $colors(-selectfg) \ -troughcolor $colors(-troughbg) \ -indicatorcolor $colors(-frame) \ -highlightcolor $colors(-frame) \ -highlightthickness 1 \ -selectborderwidth 1 \ -insertwidth 2 \ -borderwidth 1 \ -focuswidth 0 # To match pre-Xft X11 appearance, use: # ttk::style configure . -font {Helvetica 12 bold} ttk::style map "." -background \ [list disabled $colors(-frame) active $colors(-activebg)] ttk::style map "." -foreground \ [list disabled $colors(-disabledfg)] ttk::style map "." -highlightcolor {focus black} ttk::style configure TButton \ -anchor center -padding "3m 1m" -relief raised -shiftrelief 1 ttk::style map TButton -relief {{!disabled pressed} sunken} ttk::style configure TCheckbutton -indicatorrelief raised \ -indicatormargin {0 1.5p 3p 1.5p} -borderwidth 1 ttk::style map TCheckbutton \ -indicatorcolor [list \ pressed $colors(-frame) \ alternate $colors(-altindicator) \ selected $colors(-indicator)] \ -indicatorrelief {alternate raised selected sunken pressed sunken} ttk::style configure TRadiobutton -indicatorrelief raised \ -indicatormargin {0 1.5p 3p 1.5p} -borderwidth 1 ttk::style map TRadiobutton \ -indicatorcolor [list \ pressed $colors(-frame) \ alternate $colors(-altindicator) \ selected $colors(-indicator)] \ -indicatorrelief {alternate raised selected sunken pressed sunken} ttk::style configure TMenubutton -relief raised \ -indicatormargin {3.75p 0} -padding {3m 1m} ttk::style configure TEntry -padding 1 -font TkTextFont ttk::style map TEntry -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] ttk::style element create Combobox.downarrow from default ttk::style configure TCombobox -padding 1 -arrowsize 9p ttk::style map TCombobox -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] ttk::style configure ComboboxPopdownFrame \ -relief solid -borderwidth 1 ttk::style element create Spinbox.uparrow from default ttk::style element create Spinbox.downarrow from default ttk::style configure TSpinbox -arrowsize 7.5p -padding {1.5p 0 7.5p 0} ttk::style map TSpinbox -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] ttk::style configure TLabelframe -borderwidth 2 -relief groove ttk::style configure TScrollbar -relief raised -arrowsize 9p -width 9p ttk::style map TScrollbar -relief {{pressed !disabled} sunken} ttk::style configure TScale -sliderrelief raised \ -sliderlength 22.5p -sliderthickness 11.25p ttk::style map TScale -sliderrelief {{pressed !disabled} sunken} ttk::style configure TProgressbar -background SteelBlue \ -barsize 22.5p -thickness 11.25p ttk::style configure TNotebook.Tab \ -padding {3m 1m} \ -background $colors(-troughbg) \ -focussolid 1 ttk::style map TNotebook.Tab -background [list selected $colors(-frame)] # Treeview: ttk::style configure Heading -font TkHeadingFont -relief raised ttk::style configure Item -indicatorsize 9p \ -indicatormargins {1.5p 1.5p 3p 1.5p} ttk::style configure Treeview -background $colors(-window) \ |
︙ | ︙ |