diff options
33 files changed, 157 insertions, 114 deletions
diff --git a/doc/ttk_Geometry.3 b/doc/ttk_Geometry.3 index 09d59e0..0f8a171 100644 --- a/doc/ttk_Geometry.3 +++ b/doc/ttk_Geometry.3 @@ -66,8 +66,9 @@ Extra padding (in pixels) to add uniformly to each side of a region. .AP short bottom in Extra padding (in pixels) to add to the bottom of a region. .AP Ttk_Box box in -.AP "Ttk_Box *" box_rtn out Specifies a rectangular region. +.AP "Ttk_Box *" box_rtn out +A rectangular region. .AP int height in The height in pixels of a region. .AP "Tcl_Interp *" interp in @@ -79,13 +80,14 @@ String value contains a symbolic name to be converted to an enumerated value or bitmask. Internal rep may be be modified to cache corresponding value. .AP Ttk_Padding padding in -.AP "Ttk_Padding *" padding_rtn out Extra padding to add on the inside of a region. +.AP "Ttk_Padding *" padding_rtn out +Padding present in the inside of a region. .AP Ttk_Box parcel in A rectangular region, allocated from a cavity. .AP int relief in One of the standard Tk relief options -(TK_RELIEF_RAISED, TK_RELIEF_SUNKEN, etc.). +(\fBTK_RELIEF_RAISED\fR, \fBTK_RELIEF_SUNKEN\fR, etc.). See \fBTk_GetReliefFromObj\fR. .AP short right in Extra padding (in pixels) to add to the right side of a region. @@ -95,13 +97,13 @@ One of \fBTTK_SIDE_LEFT\fR, \fBTTK_SIDE_TOP\fR, .AP unsigned sticky in A bitmask containing one or more of the bits \fBTTK_STICK_W\fR (west, or left), -\fBTTK_STICK_E\fR (east, or right, +\fBTTK_STICK_E\fR (east, or right), \fBTTK_STICK_N\fR (north, or top), and \fBTTK_STICK_S\fR (south, or bottom). -\fBTTK_FILL_X\fR is defined as a synonym for (TTK_STICK_W|TTK_STICK_E), -\fBTTK_FILL_Y\fR is a synonym for (TTK_STICK_N|TTK_STICK_S), -and \fBTTK_FILL_BOTH\fR and \fBTTK_STICK_ALL\fR -are synonyms for (TTK_FILL_X|TTK_FILL_Y). +\fBTTK_FILL_X\fR is defined as a synonym for (\fBTTK_STICK_W\fR|\fBTTK_STICK_E\fR), +\fBTTK_FILL_Y\fR is a synonym for (\fBTTK_STICK_N\fR|\fBTTK_STICK_S\fR), +and \fBTTK_FILL_BOTH\fR +is a synonym for (\fBTTK_FILL_X\fR|\fBTTK_FILL_Y\fR). See also: \fIgrid(n)\fR. .AP Tk_Window tkwin in Window whose screen geometry determines diff --git a/doc/ttk_intro.n b/doc/ttk_intro.n index 3b399ee..c146dd1 100644 --- a/doc/ttk_intro.n +++ b/doc/ttk_intro.n @@ -86,7 +86,7 @@ ttk::\fBstyle layout\fR Horizontal.TScrollbar { Scrollbar.trough \-children { Scrollbar.leftarrow \-side left \-sticky w Scrollbar.rightarrow \-side right \-sticky e - Scrollbar.thumb \-side left \-expand true \-sticky ew + Scrollbar.thumb \-sticky ew } } .CE diff --git a/doc/ttk_style.n b/doc/ttk_style.n index db80d95..3c0f9ce 100644 --- a/doc/ttk_style.n +++ b/doc/ttk_style.n @@ -98,19 +98,40 @@ by one or more options specifying how to arrange the element. The layout mechanism uses a simplified version of the \fBpack\fR geometry manager: given an initial cavity, each element is allocated a parcel. +Then the parcel actually used by the element is adjusted within +the allocated parcel. Valid options are: +.\" -border should remain undocumented for now (dubious usefulness) +.\" .TP +.\" \fB\-border\fR \fIboolean\fR +.\" Specifies whether the element is drawn after its children. Defaults to 0. +.TP +\fB\-children { \fIsublayout...\fB }\fR +Specifies a list of elements to place inside the element. +.TP +\fB\-expand\fR \fIboolean\fR +Specifies whether the allocated parcel is the entire cavity. If so, +simultaneous specification of \fB\-side\fR is ignored. +Defaults to 0. .TP \fB\-side \fIside\fR Specifies which side of the cavity to place the element; one of \fBleft\fR, \fBright\fR, \fBtop\fR, or \fBbottom\fR. -If omitted, the element occupies the entire cavity. +For instance, \fB\-side top\fR allocates the parcel along the top of +the cavity having width and height respectively the width of the cavity +and the height of the element. +If omitted, the allocated parcel is the entire cavity (same effect +as \fB\-expand\fR 1). .TP \fB\-sticky\fR \fB[\fInswe\fB]\fR -Specifies where the element is placed inside its allocated parcel. -.TP -\fB\-children { \fIsublayout... \fB}\fR -Specifies a list of elements to place inside the element. -.\" Also: -border, -unit, -expand: may go away. +Specifies the actual parcel position and size inside the allocated parcel. +If specified as an empty string then the actual parcel is centered in +the allocated parcel. Default is \fBnswe\fR. +.\" -unit should remain undocumented for now (dubious usefulness) +.\" .TP +.\" \fB\-unit\fR \fIboolean\fR +.\" Specifies whether the element propagates its state to its children. +.\" Defaults to 0. .PP For example: .CS diff --git a/generic/tkConfig.c b/generic/tkConfig.c index 01cc83a..69a3586 100644 --- a/generic/tkConfig.c +++ b/generic/tkConfig.c @@ -1906,7 +1906,7 @@ GetObjectForOption( break; case TK_OPTION_INDEX: if (*((int *) internalPtr) == INT_MIN) { - objPtr = Tcl_NewWideIntObj(-1); + objPtr = Tcl_NewObj(); } else if (*((int *) internalPtr) == INT_MAX) { objPtr = Tcl_NewStringObj("end+1", -1); } else if (*((int *) internalPtr) == -1) { diff --git a/generic/tkInt.h b/generic/tkInt.h index c91b6d8..74f2501 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -1372,7 +1372,11 @@ MODULE_SCOPE void TkRotatePoint(double originX, double originY, double *yPtr); MODULE_SCOPE int TkGetIntForIndex(Tcl_Obj *, TkSizeT, int lastOK, TkSizeT*); -#define TkNewIndexObj(value) Tcl_NewWideIntObj((Tcl_WideInt)(value + 1) - 1) +#if !defined(TK_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9) +# define TkNewIndexObj(value) Tcl_NewWideIntObj((Tcl_WideInt)(value + 1) - 1) +#else +# define TkNewIndexObj(value) (((value) == TCL_INDEX_NONE) ? Tcl_NewObj() : Tcl_NewWideIntObj(value)) +#endif #ifdef _WIN32 #define TkParseColor XParseColor diff --git a/generic/tkListbox.c b/generic/tkListbox.c index fcd3244..c6a148d 100644 --- a/generic/tkListbox.c +++ b/generic/tkListbox.c @@ -842,7 +842,7 @@ ListboxWidgetObjCmd( if (result != TCL_OK) { break; } - Tcl_SetObjResult(interp, Tcl_NewWideIntObj(index)); + Tcl_SetObjResult(interp, TkNewIndexObj(index)); result = TCL_OK; break; diff --git a/generic/tkMenu.c b/generic/tkMenu.c index 69995f0..3e43e01 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -843,6 +843,11 @@ MenuWidgetObjCmd( if (GetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) { goto error; } +#if !defined(TK_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9) + if (index == TCL_INDEX_NONE) { + Tcl_SetObjResult(interp, Tcl_NewStringObj("none", -1)); + } else +#endif Tcl_SetObjResult(interp, TkNewIndexObj(index)); break; } diff --git a/generic/tkObj.c b/generic/tkObj.c index b8ddb2b..a5ac233 100644 --- a/generic/tkObj.c +++ b/generic/tkObj.c @@ -233,6 +233,9 @@ TkGetIntForIndex( } return TCL_ERROR; } + if (Tcl_GetString(indexObj)[0] == '-') { + return TCL_ERROR; + } if ((end + 1 >= 0) && (*indexPtr + 1) > (end + 1)) { *indexPtr = end + 1; } diff --git a/generic/ttk/ttkButton.c b/generic/ttk/ttkButton.c index 38e8721..8c39c93 100644 --- a/generic/ttk/ttkButton.c +++ b/generic/ttk/ttkButton.c @@ -66,7 +66,7 @@ static const Tk_OptionSpec BaseOptionSpecs[] = offsetof(Base,base.textVariableObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_INDEX, "-underline", "underline", "Underline", - "-1", offsetof(Base,base.underlineObj), TCL_INDEX_NONE, + NULL, offsetof(Base,base.underlineObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,0 }, /* SB: OPTION_INT, see <<NOTE-NULLOPTIONS>> */ {TK_OPTION_STRING, "-width", "width", "Width", @@ -858,7 +858,7 @@ TTK_BEGIN_LAYOUT(MenubuttonLayout) TTK_GROUP("Menubutton.border", TTK_FILL_BOTH, TTK_GROUP("Menubutton.focus", TTK_FILL_BOTH, TTK_NODE("Menubutton.indicator", TTK_PACK_RIGHT) - TTK_GROUP("Menubutton.padding", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_X, + TTK_GROUP("Menubutton.padding", TTK_FILL_X, TTK_NODE("Menubutton.label", TTK_PACK_LEFT)))) TTK_END_LAYOUT diff --git a/generic/ttk/ttkClamTheme.c b/generic/ttk/ttkClamTheme.c index dae54e4..035cabc 100644 --- a/generic/ttk/ttkClamTheme.c +++ b/generic/ttk/ttkClamTheme.c @@ -955,7 +955,7 @@ TTK_BEGIN_LAYOUT_TABLE(LayoutTable) TTK_LAYOUT("TCombobox", TTK_NODE("Combobox.downarrow", TTK_PACK_RIGHT|TTK_FILL_Y) - TTK_GROUP("Combobox.field", TTK_PACK_LEFT|TTK_FILL_BOTH|TTK_EXPAND, + TTK_GROUP("Combobox.field", TTK_FILL_BOTH, TTK_GROUP("Combobox.padding", TTK_FILL_BOTH, TTK_NODE("Combobox.textarea", TTK_FILL_BOTH)))) diff --git a/generic/ttk/ttkClassicTheme.c b/generic/ttk/ttkClassicTheme.c index ec35480..be7d74b 100644 --- a/generic/ttk/ttkClassicTheme.c +++ b/generic/ttk/ttkClassicTheme.c @@ -453,7 +453,7 @@ TTK_LAYOUT("TMenubutton", TTK_GROUP("Menubutton.highlight", TTK_FILL_BOTH, TTK_GROUP("Menubutton.border", TTK_FILL_BOTH, TTK_NODE("Menubutton.indicator", TTK_PACK_RIGHT) - TTK_GROUP("Menubutton.padding", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_X, + TTK_GROUP("Menubutton.padding", TTK_FILL_X, TTK_NODE("Menubutton.label", 0))))) /* "classic" entry, includes highlight border */ diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c index f8c18e7..f82c701 100644 --- a/generic/ttk/ttkEntry.c +++ b/generic/ttk/ttkEntry.c @@ -600,9 +600,9 @@ EntryValidateChange( VMODE vmode = entryPtr->entry.validate; int code, change_ok; - if ( (entryPtr->entry.validateCmd == NULL) + if ((entryPtr->entry.validateCmd == NULL) || (entryPtr->core.flags & VALIDATING) - || !EntryNeedsValidation(vmode, reason) ) + || !EntryNeedsValidation(vmode, reason)) { return TCL_OK; } @@ -1650,7 +1650,7 @@ static int EntrySelectionRangeCommand( Tcl_WrongNumArgs(interp, 3, objv, "start end"); return TCL_ERROR; } - if ( EntryIndex(interp, entryPtr, objv[3], &start) != TCL_OK + if (EntryIndex(interp, entryPtr, objv[3], &start) != TCL_OK || EntryIndex(interp, entryPtr, objv[4], &end) != TCL_OK) { return TCL_ERROR; } @@ -1849,7 +1849,7 @@ static int ComboboxCurrentCommand( if (objc == 2) { /* Check if currentIndex still valid: */ - if ( currentIndex == TCL_INDEX_NONE + if (currentIndex == TCL_INDEX_NONE || currentIndex >= (TkSizeT)nValues || strcmp(currentValue,Tcl_GetString(values[currentIndex])) ) @@ -2109,7 +2109,7 @@ TTK_END_LAYOUT TTK_BEGIN_LAYOUT(ComboboxLayout) 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_PACK_LEFT|TTK_EXPAND, + TTK_GROUP("Combobox.padding", TTK_FILL_BOTH, TTK_NODE("Combobox.textarea", TTK_FILL_BOTH))) TTK_END_LAYOUT diff --git a/generic/ttk/ttkFrame.c b/generic/ttk/ttkFrame.c index e1ab211..8a22bd6 100644 --- a/generic/ttk/ttkFrame.c +++ b/generic/ttk/ttkFrame.c @@ -258,7 +258,7 @@ static const Tk_OptionSpec LabelframeOptionSpecs[] = { offsetof(Labelframe,label.textObj), TCL_INDEX_NONE, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_INDEX, "-underline", "underline", "Underline", - "-1", offsetof(Labelframe,label.underlineObj), TCL_INDEX_NONE, + NULL , offsetof(Labelframe,label.underlineObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_WINDOW, "-labelwidget", "labelWidget", "LabelWidget", NULL, TCL_INDEX_NONE, offsetof(Labelframe,label.labelWidget), diff --git a/generic/ttk/ttkLabel.c b/generic/ttk/ttkLabel.c index 91f52a8..3dc5c58 100644 --- a/generic/ttk/ttkLabel.c +++ b/generic/ttk/ttkLabel.c @@ -469,7 +469,7 @@ static const Ttk_ElementOptionSpec LabelElementOptions[] = { { "-foreground", TK_OPTION_COLOR, offsetof(LabelElement,text.foregroundObj), "black" }, { "-underline", TK_OPTION_INDEX, - offsetof(LabelElement,text.underlineObj), "-1"}, + offsetof(LabelElement,text.underlineObj), NULL}, { "-width", TK_OPTION_INT, offsetof(LabelElement,text.widthObj), ""}, { "-anchor", TK_OPTION_ANCHOR, diff --git a/generic/ttk/ttkLayout.c b/generic/ttk/ttkLayout.c index a39ae2b..a971d23 100644 --- a/generic/ttk/ttkLayout.c +++ b/generic/ttk/ttkLayout.c @@ -809,7 +809,7 @@ Tcl_Obj *Ttk_UnparseLayoutTemplate(Ttk_TemplateNode *node) APPENDSTR("-sticky"); APPENDOBJ(Ttk_NewStickyObj(flags & _TTK_MASK_STICK)); - /* @@@ Check again: are these necessary? */ + /* @@@ Check again: are these necessary? Can't see any effect! */ if (flags & TTK_BORDER) { APPENDSTR("-border"); APPENDSTR("1"); } if (flags & TTK_UNIT) { APPENDSTR("-unit"); APPENDSTR("1"); } diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c index 6c8aba2..4ff7611 100644 --- a/generic/ttk/ttkNotebook.c +++ b/generic/ttk/ttkNotebook.c @@ -67,7 +67,7 @@ static const Tk_OptionSpec TabOptionSpecs[] = {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", NULL, offsetof(Tab,compoundObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,(void *)ttkCompoundStrings,GEOMETRY_CHANGED }, - {TK_OPTION_INDEX, "-underline", "underline", "Underline", "-1", + {TK_OPTION_INDEX, "-underline", "underline", "Underline", NULL, offsetof(Tab,underlineObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0 } }; @@ -1079,7 +1079,7 @@ static int NotebookIdentifyCommand( return TCL_ERROR; } - if ( Tcl_GetIntFromObj(interp, objv[objc-2], &x) != TCL_OK + if (Tcl_GetIntFromObj(interp, objv[objc-2], &x) != TCL_OK || Tcl_GetIntFromObj(interp, objv[objc-1], &y) != TCL_OK || (objc == 5 && Tcl_GetIndexFromObjStruct(interp, objv[2], whatTable, sizeof(char *), "option", 0, &what) != TCL_OK) @@ -1135,7 +1135,7 @@ static int NotebookIndexCommand( } status = FindTabIndex(interp, nb, objv[2], &index); - if (status == TCL_OK) { + if (status == TCL_OK) { #if !defined(TK_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9) if (index != TCL_INDEX_NONE) #endif diff --git a/generic/ttk/ttkScrollbar.c b/generic/ttk/ttkScrollbar.c index 1b915cc..40dbc80 100644 --- a/generic/ttk/ttkScrollbar.c +++ b/generic/ttk/ttkScrollbar.c @@ -316,16 +316,14 @@ TTK_BEGIN_LAYOUT(VerticalScrollbarLayout) TTK_GROUP("Vertical.Scrollbar.trough", TTK_FILL_Y, TTK_NODE("Vertical.Scrollbar.uparrow", TTK_PACK_TOP) TTK_NODE("Vertical.Scrollbar.downarrow", TTK_PACK_BOTTOM) - TTK_NODE( - "Vertical.Scrollbar.thumb", TTK_PACK_TOP|TTK_EXPAND|TTK_FILL_BOTH)) + TTK_NODE("Vertical.Scrollbar.thumb", TTK_FILL_BOTH)) TTK_END_LAYOUT TTK_BEGIN_LAYOUT(HorizontalScrollbarLayout) TTK_GROUP("Horizontal.Scrollbar.trough", TTK_FILL_X, TTK_NODE("Horizontal.Scrollbar.leftarrow", TTK_PACK_LEFT) TTK_NODE("Horizontal.Scrollbar.rightarrow", TTK_PACK_RIGHT) - TTK_NODE( - "Horizontal.Scrollbar.thumb", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_BOTH)) + TTK_NODE("Horizontal.Scrollbar.thumb", TTK_FILL_BOTH)) TTK_END_LAYOUT /*------------------------------------------------------------------------ diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c index ccc65ee..33c3466 100644 --- a/generic/ttk/ttkTreeview.c +++ b/generic/ttk/ttkTreeview.c @@ -792,9 +792,8 @@ static int PickupSlack(Treeview *tv, int extra) { int newSlack = tv->tree.slack + extra; - if ( (newSlack < 0 && 0 <= tv->tree.slack) - || (newSlack > 0 && 0 >= tv->tree.slack)) - { + if ((newSlack < 0 && 0 <= tv->tree.slack) + || (newSlack > 0 && 0 >= tv->tree.slack)) { tv->tree.slack = 0; return newSlack; } else { @@ -1101,10 +1100,9 @@ TreeviewConfigure(Tcl_Interp *interp, void *recordPtr, int mask) TtkScrollbarUpdateRequired(tv->tree.xscrollHandle); TtkScrollbarUpdateRequired(tv->tree.yscrollHandle); } - if ( (mask & SHOW_CHANGED) - && GetEnumSetFromObj( - interp,tv->tree.showObj,showStrings,&showFlags) != TCL_OK) - { + if ((mask & SHOW_CHANGED) + && GetEnumSetFromObj( + interp,tv->tree.showObj,showStrings,&showFlags) != TCL_OK) { return TCL_ERROR; } @@ -1780,7 +1778,7 @@ static void DrawItem( x+indent, y, colwidth-indent, rowHeight); if (item->textObj) { displayItem.textObj = item->textObj; } if (item->imageObj) { displayItem.imageObj = item->imageObj; } - /* ??? displayItem.anchorObj = 0; <<NOTE-ANCHOR>> */ + displayItem.anchorObj = tv->tree.column0.anchorObj; DisplayLayout(tv->tree.itemLayout, &displayItem, state, parcel, d); x += colwidth; } @@ -2201,9 +2199,8 @@ static int TreeviewHorribleIdentify( /* ASSERT: objc == 4 */ - if ( Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK - || Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK - ) { + if (Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK + || Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK) { return TCL_ERROR; } @@ -2750,9 +2747,8 @@ static int TreeviewMoveCommand( Tcl_WrongNumArgs(interp, 2, objv, "item parent index"); return TCL_ERROR; } - if ( (item = FindItem(interp, tv, objv[2])) == 0 - || (parent = FindItem(interp, tv, objv[3])) == 0) - { + if ((item = FindItem(interp, tv, objv[2])) == 0 + || (parent = FindItem(interp, tv, objv[3])) == 0) { return TCL_ERROR; } @@ -2879,9 +2875,8 @@ static int TreeviewDragCommand( return TCL_ERROR; } - if ( (column = FindColumn(interp, tv, objv[2])) == 0 - || Tcl_GetIntFromObj(interp, objv[3], &newx) != TCL_OK) - { + if ((column = FindColumn(interp, tv, objv[2])) == 0 + || Tcl_GetIntFromObj(interp, objv[3], &newx) != TCL_OK) { return TCL_ERROR; } @@ -3351,8 +3346,7 @@ TTK_LAYOUT("Item", TTK_GROUP("Treeitem.padding", TTK_FILL_BOTH, TTK_NODE("Treeitem.indicator", TTK_PACK_LEFT) TTK_NODE("Treeitem.image", TTK_PACK_LEFT) - TTK_GROUP("Treeitem.focus", TTK_PACK_LEFT, - TTK_NODE("Treeitem.text", TTK_PACK_LEFT)))) + TTK_NODE("Treeitem.text", TTK_FILL_BOTH))) TTK_LAYOUT("Cell", TTK_GROUP("Treedata.padding", TTK_FILL_BOTH, diff --git a/library/ttk/vistaTheme.tcl b/library/ttk/vistaTheme.tcl index 165b496..d841962 100644 --- a/library/ttk/vistaTheme.tcl +++ b/library/ttk/vistaTheme.tcl @@ -69,9 +69,9 @@ namespace eval ttk::theme::vista { ttk::style layout TCombobox { Combobox.border -sticky nswe -border 0 -children { Combobox.rightdownarrow -side right -sticky ns - Combobox.padding -expand 1 -sticky nswe -children { + Combobox.padding -sticky nswe -children { Combobox.background -sticky nswe -children { - Combobox.focus -expand 1 -sticky nswe -children { + Combobox.focus -sticky nswe -children { Combobox.textarea -sticky nswe } } @@ -138,7 +138,7 @@ namespace eval ttk::theme::vista { Spinbox.background -sticky news -children { Spinbox.padding -sticky news -children { Spinbox.innerbg -sticky news -children { - Spinbox.textarea -expand 1 + Spinbox.textarea } } Spinbox.uparrow -side top -sticky ens @@ -203,8 +203,8 @@ namespace eval ttk::theme::vista { TRACKBAR 3 {disabled 5 focus 4 pressed 3 active 2 {} 1} \ -width 6 -height 12 ttk::style layout Horizontal.TScale { - Scale.focus -expand 1 -sticky nswe -children { - Horizontal.Scale.trough -expand 1 -sticky nswe -children { + Scale.focus -sticky nswe -children { + Horizontal.Scale.trough -sticky nswe -children { Horizontal.Scale.track -sticky we Horizontal.Scale.slider -side left -sticky {} } @@ -214,8 +214,8 @@ namespace eval ttk::theme::vista { TRACKBAR 6 {disabled 5 focus 4 pressed 3 active 2 {} 1} \ -width 12 -height 6 ttk::style layout Vertical.TScale { - Scale.focus -expand 1 -sticky nswe -children { - Vertical.Scale.trough -expand 1 -sticky nswe -children { + Scale.focus -sticky nswe -children { + Vertical.Scale.trough -sticky nswe -children { Vertical.Scale.track -sticky ns Vertical.Scale.slider -side top -sticky {} } diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c index 537290e..ee333cf 100644 --- a/macosx/tkMacOSXColor.c +++ b/macosx/tkMacOSXColor.c @@ -23,6 +23,7 @@ static Tcl_HashTable systemColors; static int numSystemColors; static int rgbColorIndex; static int controlAccentIndex; +static int selectedTabTextIndex; static Bool useFakeAccentColor = NO; static SystemColorDatum **systemColorIndex; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 @@ -66,7 +67,7 @@ void initColorTable() if (![NSColor respondsToSelector:colorSelector]) { if ([colorName isEqualToString:@"controlAccentColor"]) { useFakeAccentColor = YES; - } else { + } else if (![colorName isEqualToString:@"selectedTabTextColor"]) { /* Uncomment to print all unsupported colors: */ /* printf("Unsupported color %s\n", colorName.UTF8String); */ continue; @@ -143,6 +144,9 @@ void initColorTable() hPtr = Tcl_FindHashEntry(&systemColors, "ControlAccentColor"); entry = (SystemColorDatum *) Tcl_GetHashValue(hPtr); controlAccentIndex = entry->index; + hPtr = Tcl_FindHashEntry(&systemColors, "SelectedTabTextColor"); + entry = (SystemColorDatum *) Tcl_GetHashValue(hPtr); + selectedTabTextIndex = entry->index; [pool drain]; } @@ -314,10 +318,19 @@ GetRGBA( #if MAC_OS_X_VERSION_MAX_ALLOWED < 101500 color = [[NSColor colorForControlTint: [NSColor currentControlTint]] colorUsingColorSpace:sRGB]; + [color getComponents: rgba]; #endif - } else { - color = [[NSColor valueForKey:entry->selector] colorUsingColorSpace:sRGB]; + break; + } + if (entry->index == selectedTabTextIndex) { + int OSVersion = [NSApp macOSVersion]; + if (OSVersion > 100600 && OSVersion < 110000) { + color = [NSColor whiteColor]; + [color getComponents: rgba]; + break; + } } + color = [[NSColor valueForKey:entry->selector] colorUsingColorSpace:sRGB]; [color getComponents: rgba]; break; case clearColor: diff --git a/macosx/tkMacOSXColor.h b/macosx/tkMacOSXColor.h index 58f8060..7449095 100644 --- a/macosx/tkMacOSXColor.h +++ b/macosx/tkMacOSXColor.h @@ -175,12 +175,8 @@ static SystemColorDatum systemColorData[] = { {"WindowBackgroundColor7", ttkBackground, 7, NULL, 0, NULL }, /* Apple's SecondaryLabelColor is the same as their LabelColor so we roll our own. */ {"SecondaryLabelColor", ttkBackground, 14, NULL, 0, NULL }, -/* Color to use for notebook tab labels. */ -#if MAC_OS_X_VERSION_MAX_ALLOWED > 1060 -{"SelectedTabTextColor", semantic, 0, "whiteColor", 0, NULL }, -#else -{"SelectedTabTextColor", semantic, 0, "blackColor", 0, NULL }, -#endif +/* Color to use for notebook tab labels -- depends on OS version. */ +{"SelectedTabTextColor", semantic, 0, "textColor", 0, NULL }, /* Semantic colors that we simulate on older systems which don't supoort them. */ {"SelectedMenuItemTextColor", semantic, 0, "selectedMenuItemTextColor", 0, NULL }, {"ControlAccentColor", semantic, 0, "controlAccentColor", 0, NULL }, diff --git a/macosx/tkMacOSXDefault.h b/macosx/tkMacOSXDefault.h index 9d35c23..a71fbf2 100644 --- a/macosx/tkMacOSXDefault.h +++ b/macosx/tkMacOSXDefault.h @@ -114,6 +114,7 @@ #define DEF_BUTTON_TAKE_FOCUS NULL #define DEF_BUTTON_TEXT "" #define DEF_BUTTON_TEXT_VARIABLE "" +#define DEF_BUTTON_UNDERLINE "-1" #define DEF_BUTTON_VALUE "" #define DEF_BUTTON_WIDTH "0" #define DEF_BUTTON_WRAP_LENGTH "0" @@ -304,6 +305,7 @@ #define DEF_MENU_ENTRY_CHECK_VARIABLE NULL #define DEF_MENU_ENTRY_RADIO_VARIABLE "selectedButton" #define DEF_MENU_ENTRY_SELECT NULL +#define DEF_MENU_ENTRY_UNDERLINE "-1" /* * Defaults for menus overall: @@ -368,6 +370,7 @@ #define DEF_MENUBUTTON_TAKE_FOCUS "0" #define DEF_MENUBUTTON_TEXT "" #define DEF_MENUBUTTON_TEXT_VARIABLE "" +#define DEF_MENUBUTTON_UNDERLINE "-1" #define DEF_MENUBUTTON_WIDTH "0" #define DEF_MENUBUTTON_WRAP_LENGTH "0" diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index 2510575..a083e9f 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -3050,20 +3050,20 @@ TTK_LAYOUT("TCombobox", /* Notebook tabs -- no focus ring */ TTK_LAYOUT("Tab", TTK_GROUP("Notebook.tab", TTK_FILL_BOTH, - TTK_GROUP("Notebook.padding", TTK_EXPAND | TTK_FILL_BOTH, - TTK_NODE("Notebook.label", TTK_EXPAND | TTK_FILL_BOTH)))) + TTK_GROUP("Notebook.padding", TTK_FILL_BOTH, + TTK_NODE("Notebook.label", TTK_FILL_BOTH)))) /* Spinbox -- buttons 2px to the right of the field. */ TTK_LAYOUT("TSpinbox", TTK_GROUP("Spinbox.buttons", 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.field", TTK_EXPAND | TTK_FILL_X, - TTK_NODE("Spinbox.textarea", TTK_EXPAND | TTK_FILL_X))) + TTK_GROUP("Spinbox.field", TTK_FILL_X, + TTK_NODE("Spinbox.textarea", TTK_FILL_X))) /* Progress bars -- track only */ TTK_LAYOUT("TProgressbar", - TTK_NODE("Progressbar.track", TTK_EXPAND | TTK_FILL_BOTH)) + TTK_NODE("Progressbar.track", TTK_FILL_BOTH)) /* Treeview -- no border. */ TTK_LAYOUT("Treeview", @@ -3088,15 +3088,13 @@ TTK_LAYOUT("Item", TTK_LAYOUT("Vertical.TScrollbar", TTK_GROUP("Vertical.Scrollbar.trough", TTK_FILL_Y, - TTK_NODE("Vertical.Scrollbar.thumb", - TTK_PACK_TOP | TTK_EXPAND | TTK_FILL_BOTH) + TTK_NODE("Vertical.Scrollbar.thumb", TTK_FILL_BOTH) TTK_NODE("Vertical.Scrollbar.downarrow", TTK_PACK_BOTTOM) TTK_NODE("Vertical.Scrollbar.uparrow", TTK_PACK_BOTTOM))) TTK_LAYOUT("Horizontal.TScrollbar", TTK_GROUP("Horizontal.Scrollbar.trough", TTK_FILL_X, - TTK_NODE("Horizontal.Scrollbar.thumb", - TTK_PACK_LEFT | TTK_EXPAND | TTK_FILL_BOTH) + TTK_NODE("Horizontal.Scrollbar.thumb", TTK_FILL_BOTH) TTK_NODE("Horizontal.Scrollbar.rightarrow", TTK_PACK_RIGHT) TTK_NODE("Horizontal.Scrollbar.leftarrow", TTK_PACK_RIGHT))) diff --git a/tests/canvText.test b/tests/canvText.test index a097e8f..60d7857 100644 --- a/tests/canvText.test +++ b/tests/canvText.test @@ -753,7 +753,7 @@ test canvText-14.1 {GetTextIndex procedure} -setup { list [.c index test end] [.c index test insert] \ [.c index test sel.first] [.c index test sel.last] \ [.c index test @0,0] \ - [.c index test -1] [.c index test 10] [.c index test 100] + [.c index test {}] [.c index test 10] [.c index test 100] } -cleanup { .c delete test } -result {15 12 5 8 0 0 10 15} diff --git a/tests/entry.test b/tests/entry.test index 262447f..7ee50dd 100644 --- a/tests/entry.test +++ b/tests/entry.test @@ -1534,7 +1534,7 @@ test entry-3.79 {EntryWidgetCmd procedure, "xview" widget command} -setup { .e insert end "runs off the end of the window quite a bit." .e xview 0 update - .e xview -1 + .e xview {} .e index @0 } -cleanup { destroy .e @@ -2104,7 +2104,7 @@ test entry-8.2 {DeleteChars procedure} -setup { .e configure -textvariable contents -xscrollcommand scroll set timeout [after 500 {set scrollInfo {-1000000 -1000000}}] .e insert 0 abcde - .e delete -1 2 + .e delete {} 2 vwait scrollInfo list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo] } -cleanup { @@ -2835,7 +2835,7 @@ test entry-13.23 {GetEntryIndex procedure} -body { .e insert 0 012345678901234567890 .e xview 4 update - .e index -1 + .e index {} } -cleanup { destroy .e } -result 0 diff --git a/tests/listbox.test b/tests/listbox.test index efd5f46..e8e126b 100644 --- a/tests/listbox.test +++ b/tests/listbox.test @@ -374,7 +374,7 @@ test listbox-3.5 {ListboxWidgetCmd procedure, "activate" option} -body { .l index active } -result 3 test listbox-3.6 {ListboxWidgetCmd procedure, "activate" option} -body { - .l activate -1 + .l activate {} .l index active } -result 0 test listbox-3.7 {ListboxWidgetCmd procedure, "activate" option} -body { @@ -587,7 +587,7 @@ test listbox-3.36 {ListboxWidgetCmd procedure, "delete" option} -setup { } -body { listbox .l2 .l2 insert 0 el0 el1 el2 el3 el4 el5 el6 el7 - .l2 delete -1 2 + .l2 delete {} 2 .l2 get 0 end } -cleanup { destroy .l2 @@ -597,7 +597,7 @@ test listbox-3.37 {ListboxWidgetCmd procedure, "delete" option} -setup { } -body { listbox .l2 .l2 insert 0 el0 el1 el2 el3 el4 el5 el6 el7 - .l2 delete -1 -1 + .l2 delete {} {} .l2 get 0 end } -cleanup { destroy .l2 @@ -681,13 +681,13 @@ test listbox-3.48 {ListboxWidgetCmd procedure, "get" option} -setup { destroy .l2 } -result {{two words} el4 el5 el6 el7} test listbox-3.49 {ListboxWidgetCmd procedure, "get" option} -body { - .l get -1 + .l get {} } -result {} test listbox-3.50 {ListboxWidgetCmd procedure, "get" option} -body { - .l get -1 -1 + .l get {} {} } -result {} test listbox-3.51 {ListboxWidgetCmd procedure, "get" option} -body { - .l get -1 3 + .l get {} 3 } -result {el0 el1 el2 el3} test listbox-3.52 {ListboxWidgetCmd procedure, "get" option} -body { .l get 12 end @@ -717,8 +717,8 @@ test listbox-3.60 {ListboxWidgetCmd procedure, "index" option} -body { .l index 2 } -result 2 test listbox-3.61 {ListboxWidgetCmd procedure, "index" option} -body { - .l index -1 -} -result {-1} + .l index {} +} -result -1 test listbox-3.62 {ListboxWidgetCmd procedure, "index" option} -body { .l index end } -result 18 @@ -858,7 +858,7 @@ test listbox-3.88 {ListboxWidgetCmd procedure, "see" option} -body { } -result 11 test listbox-3.89 {ListboxWidgetCmd procedure, "see" option} -body { .l yview 7 - .l see -1 + .l see {} .l index @0,0 } -result 0 test listbox-3.90 {ListboxWidgetCmd procedure, "see" option} -body { @@ -896,7 +896,7 @@ test listbox-3.98 {ListboxWidgetCmd procedure, "selection" option} -body { [.l selection anchor 0; .l index anchor] } -result {5 0} test listbox-3.99 {ListboxWidgetCmd procedure, "selection" option} -body { - .l selection anchor -1 + .l selection anchor {} .l index anchor } -result 0 test listbox-3.100 {ListboxWidgetCmd procedure, "selection" option} -body { @@ -925,7 +925,7 @@ test listbox-3.104 {ListboxWidgetCmd procedure, "selection" option} -body { } -result {1 0 1} test listbox-3.105 {ListboxWidgetCmd procedure, "selection" option} -body { .l selection set 0 end - .l selection includes -1 + .l selection includes {} } -result 0 test listbox-3.106 {ListboxWidgetCmd procedure, "selection" option} -body { .l selection clear 0 end @@ -2129,10 +2129,10 @@ test listbox-10.19 {GetListboxIndex procedure} -setup { pack [listbox .l] .l insert 0 el0 el1 el2 el3 el4 el5 el6 el7 el8 el9 el10 el11 update - .l index -1 + .l index {} } -cleanup { destroy .l -} -result -1 +} -result -1 test listbox-10.20 {GetListboxIndex procedure} -setup { destroy .l } -body { @@ -2155,7 +2155,7 @@ test listbox-11.1 {ChangeListboxView procedure, boundary conditions for index} - .l yview 3 update set x [.l index @0,0] - .l yview -1 + .l yview {} update lappend x [.l index @0,0] } -cleanup { @@ -2378,14 +2378,14 @@ test listbox-15.4 {ListboxSelect procedure, boundary conditions for indices} -bo .l delete 0 end .l insert 0 a b c d e f .l select clear 0 end - .l select set -1 -1 + .l select set {} {} .l curselection } -result {} test listbox-15.5 {ListboxSelect procedure, boundary conditions for indices} -body { .l delete 0 end .l insert 0 a b c d e f .l select clear 0 end - .l select set -1 3 + .l select set {} 3 .l curselection } -result {0 1 2 3} test listbox-15.6 {ListboxSelect procedure, boundary conditions for indices} -body { diff --git a/tests/menuDraw.test b/tests/menuDraw.test index 776c985..bf15f25 100644 --- a/tests/menuDraw.test +++ b/tests/menuDraw.test @@ -561,7 +561,7 @@ test menuDraw-15.2 {TkPostTearoffMenu - Deactivation} -setup { $tearoff index active } -cleanup { deleteWindows -} -result -1 +} -result none test menuDraw-15.3 {TkPostTearoffMenu - post command} -setup { deleteWindows } -body { diff --git a/tests/spinbox.test b/tests/spinbox.test index e3c7009..88cdc3c 100644 --- a/tests/spinbox.test +++ b/tests/spinbox.test @@ -1872,7 +1872,7 @@ test spinbox-3.79 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { .e insert end "runs off the end of the window quite a bit." .e xview 0 update - .e xview -1 + .e xview {} .e index @0 } -cleanup { destroy .e @@ -2393,7 +2393,7 @@ test spinbox-8.2 {DeleteChars procedure} -setup { .e insert 0 abcde update idletasks set timeout [after 500 {set scrollInfo {-1000000 -1000000}}] - .e delete -1 2 + .e delete {} 2 vwait scrollInfo list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo] } -cleanup { @@ -3122,7 +3122,7 @@ test spinbox-13.23 {GetSpinboxIndex procedure} -body { .e insert 0 012345678901234567890 .e xview 4 update - .e index -1 + .e index {} } -cleanup { destroy .e } -result 0 diff --git a/tests/ttk/notebook.test b/tests/ttk/notebook.test index ac63088..253e1cc 100644 --- a/tests/ttk/notebook.test +++ b/tests/ttk/notebook.test @@ -69,7 +69,7 @@ test notebook-2.5 "tab - get all options" -body { .nb tab .nb.foo } -result [list \ -padding 0 -sticky nsew \ - -state normal -text "Changed Foo" -image "" -compound {} -underline -1] + -state normal -text "Changed Foo" -image "" -compound {} -underline {}] test notebook-4.1 "Test .nb index end" -body { .nb index end diff --git a/unix/tkUnixDefault.h b/unix/tkUnixDefault.h index 87af737..fa1f120 100644 --- a/unix/tkUnixDefault.h +++ b/unix/tkUnixDefault.h @@ -86,6 +86,7 @@ #define DEF_BUTTON_TAKE_FOCUS NULL #define DEF_BUTTON_TEXT "" #define DEF_BUTTON_TEXT_VARIABLE "" +#define DEF_BUTTON_UNDERLINE "-1" #define DEF_BUTTON_VALUE "" #define DEF_BUTTON_WIDTH "0" #define DEF_BUTTON_WRAP_LENGTH "0" @@ -265,6 +266,7 @@ #define DEF_MENU_ENTRY_CHECK_VARIABLE NULL #define DEF_MENU_ENTRY_RADIO_VARIABLE "selectedButton" #define DEF_MENU_ENTRY_SELECT NULL +#define DEF_MENU_ENTRY_UNDERLINE "-1" /* * Defaults for menus overall: @@ -329,6 +331,7 @@ #define DEF_MENUBUTTON_TAKE_FOCUS "0" #define DEF_MENUBUTTON_TEXT "" #define DEF_MENUBUTTON_TEXT_VARIABLE "" +#define DEF_MENUBUTTON_UNDERLINE "-1" #define DEF_MENUBUTTON_WIDTH "0" #define DEF_MENUBUTTON_WRAP_LENGTH "0" diff --git a/win/tkWinDefault.h b/win/tkWinDefault.h index 1aac782..33756f8 100644 --- a/win/tkWinDefault.h +++ b/win/tkWinDefault.h @@ -91,6 +91,7 @@ #define DEF_BUTTON_TEXT "" #define DEF_BUTTON_TEXT_VARIABLE "" #define DEF_BUTTON_TRISTATE_VALUE "" +#define DEF_BUTTON_UNDERLINE "-1" #define DEF_BUTTON_VALUE "" #define DEF_BUTTON_WIDTH "0" #define DEF_BUTTON_WRAP_LENGTH "0" @@ -269,6 +270,7 @@ #define DEF_MENU_ENTRY_CHECK_VARIABLE NULL #define DEF_MENU_ENTRY_RADIO_VARIABLE "selectedButton" #define DEF_MENU_ENTRY_SELECT NULL +#define DEF_MENU_ENTRY_UNDERLINE "-1" /* * Defaults for menus overall: @@ -333,6 +335,7 @@ #define DEF_MENUBUTTON_TAKE_FOCUS "0" #define DEF_MENUBUTTON_TEXT "" #define DEF_MENUBUTTON_TEXT_VARIABLE "" +#define DEF_MENUBUTTON_UNDERLINE "-1" #define DEF_MENUBUTTON_WIDTH "0" #define DEF_MENUBUTTON_WRAP_LENGTH "0" diff --git a/win/ttkWinTheme.c b/win/ttkWinTheme.c index d181f5d..aa4dc24 100644 --- a/win/ttkWinTheme.c +++ b/win/ttkWinTheme.c @@ -746,8 +746,8 @@ TTK_LAYOUT("TButton", TTK_LAYOUT("TCombobox", TTK_GROUP("Combobox.field", TTK_FILL_BOTH, TTK_NODE("Combobox.downarrow", TTK_PACK_RIGHT|TTK_FILL_Y) - TTK_GROUP("Combobox.padding", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_BOTH, - TTK_GROUP("Combobox.focus", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_BOTH, + TTK_GROUP("Combobox.padding", TTK_FILL_BOTH, + TTK_GROUP("Combobox.focus", TTK_FILL_BOTH, TTK_NODE("Combobox.textarea", TTK_FILL_BOTH))))) TTK_END_LAYOUT_TABLE diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c index 26807f7..5ab1967 100644 --- a/win/ttkWinXPTheme.c +++ b/win/ttkWinXPTheme.c @@ -919,8 +919,8 @@ TTK_LAYOUT("TButton", TTK_LAYOUT("TMenubutton", TTK_NODE("Menubutton.dropdown", TTK_PACK_RIGHT|TTK_FILL_Y) - TTK_GROUP("Menubutton.button", TTK_PACK_RIGHT|TTK_EXPAND|TTK_FILL_BOTH, - TTK_GROUP("Menubutton.padding", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_X, + TTK_GROUP("Menubutton.button", TTK_FILL_BOTH, + TTK_GROUP("Menubutton.padding", TTK_FILL_X, TTK_NODE("Menubutton.label", 0)))) TTK_LAYOUT("Horizontal.TScrollbar", @@ -938,14 +938,14 @@ TTK_LAYOUT("Vertical.TScrollbar", TTK_NODE("Vertical.Scrollbar.grip", 0)))) TTK_LAYOUT("Horizontal.TScale", - TTK_GROUP("Scale.focus", TTK_EXPAND|TTK_FILL_BOTH, - TTK_GROUP("Horizontal.Scale.trough", TTK_EXPAND|TTK_FILL_BOTH, + TTK_GROUP("Scale.focus", TTK_FILL_BOTH, + TTK_GROUP("Horizontal.Scale.trough", TTK_FILL_BOTH, TTK_NODE("Horizontal.Scale.track", TTK_FILL_X) TTK_NODE("Horizontal.Scale.slider", TTK_PACK_LEFT) ))) TTK_LAYOUT("Vertical.TScale", - TTK_GROUP("Scale.focus", TTK_EXPAND|TTK_FILL_BOTH, - TTK_GROUP("Vertical.Scale.trough", TTK_EXPAND|TTK_FILL_BOTH, + TTK_GROUP("Scale.focus", TTK_FILL_BOTH, + TTK_GROUP("Vertical.Scale.trough", TTK_FILL_BOTH, TTK_NODE("Vertical.Scale.track", TTK_FILL_Y) TTK_NODE("Vertical.Scale.slider", TTK_PACK_TOP) ))) |