Posted to tcl by patthoyts at Tue Sep 30 20:17:45 GMT 2008view raw
- Index: demos/demo.tcl
- ===================================================================
- RCS file: /cvsroot/tktable/tile/demos/demo.tcl,v
- retrieving revision 1.116
- diff -u -r1.116 demo.tcl
- --- demos/demo.tcl 24 Feb 2008 15:11:20 -0000 1.116
- +++ demos/demo.tcl 24 Feb 2008 23:13:18 -0000
- @@ -329,7 +329,7 @@
- ttk::menubutton $l.mb -text "Menubutton" -underline 2
- $l.mb configure -menu [menubuttonMenu $l.mb.menu]
- -
- +ttk::spinbox $l.spn -width 6 -textvariable ::V(SPINBOX)
- set ::entryText "Entry widget"
- ttk::entry $l.e -textvariable ::entryText
- $l.e selection range 6 end
- @@ -342,6 +342,7 @@
- grid $l.rb3 -sticky ew
- grid $l.button -sticky ew -padx 2 -pady 2
- grid $l.mb -sticky ew -padx 2 -pady 2
- +grid $l.spn -sticky w -padx 2 -pady 2
- grid $l.e -sticky ew -padx 2 -pady 2
- grid $ltext -sticky news
- @@ -356,6 +357,7 @@
- radiobutton $r.rb3 -text "Three" -variable ::V(CHOICE) -value 3
- button $r.button -text "Button"
- menubutton $r.mb -text "Menubutton" -underline 3 -takefocus 1
- +spinbox $r.spn -width 6 -textvariable ::V(SPINBOX)
- $r.mb configure -menu [menubuttonMenu $r.mb.menu]
- # Add -indicatoron control:
- set ::V(rmbIndicatoron) [$r.mb cget -indicatoron]
- @@ -374,6 +376,7 @@
- grid $r.rb3 -sticky ew
- grid $r.button -sticky ew -padx 2 -pady 2
- grid $r.mb -sticky ew -padx 2 -pady 2
- +grid $r.spn -sticky w -padx 2 -pady 2
- grid $r.e -sticky ew -padx 2 -pady 2
- grid $rtext -sticky news
- Index: generic/entry.c
- ===================================================================
- RCS file: /cvsroot/tktable/tile/generic/entry.c,v
- retrieving revision 1.46
- diff -u -r1.46 entry.c
- --- generic/entry.c 18 May 2007 21:50:49 -0000 1.46
- +++ generic/entry.c 19 May 2007 21:19:52 -0000
- @@ -1839,6 +1839,56 @@
- };
- /*------------------------------------------------------------------------
- + * +++ Spinbox widget record.
- + */
- +
- +typedef struct {
- + int junk;
- +} SpinboxPart;
- +
- +typedef struct {
- + WidgetCore core;
- + EntryPart entry;
- + SpinboxPart spinbox;
- +} Spinbox;
- +
- +static Tk_OptionSpec SpinboxOptionSpecs[] =
- +{
- + WIDGET_INHERIT_OPTIONS(EntryOptionSpecs)
- +};
- +
- +/* SpinboxInitialize --
- + * Initialization hook for spinbox widgets.
- + */
- +static int
- +SpinboxInitialize(Tcl_Interp *interp, void *recordPtr)
- +{
- + Spinbox *sb = recordPtr;
- + TtkTrackElementState(&sb->core);
- + return EntryInitialize(interp, recordPtr);
- +}
- +
- +/*------------------------------------------------------------------------
- + * +++ Spinbox widget definition.
- + */
- +
- +static WidgetSpec SpinboxWidgetSpec =
- +{
- + "TSpinbox", /* className */
- + sizeof(Spinbox), /* recordSize */
- + SpinboxOptionSpecs, /* optionSpecs */
- + EntryCommands, /* subcommands */
- + SpinboxInitialize, /* initializeProc */
- + EntryCleanup, /* cleanupProc */
- + EntryConfigure, /* configureProc */
- + EntryPostConfigure, /* postConfigureProc */
- + TtkWidgetGetLayout, /* getLayoutProc */
- + TtkWidgetSize, /* sizeProc */
- + EntryDoLayout, /* layoutProc */
- + EntryDisplay /* displayProc */
- +};
- +
- +/*------------------------------------------------------------------------
- * +++ Textarea element.
- *
- * Text display area for Entry widgets.
- @@ -1902,6 +1952,14 @@
- TTK_NODE("Combobox.textarea", TTK_FILL_BOTH)))
- TTK_END_LAYOUT
- +TTK_BEGIN_LAYOUT(SpinboxLayout)
- + TTK_GROUP("Spinbox.field", TTK_FILL_BOTH,
- + TTK_GROUP("Spinbox.padding", TTK_FILL_BOTH,
- + TTK_NODE("Spinbox.textarea", TTK_PACK_LEFT|TTK_EXPAND))
- + TTK_NODE("Spinbox.uparrow", TTK_PACK_TOP|TTK_STICK_E)
- + TTK_NODE("Spinbox.downarrow", TTK_PACK_BOTTOM|TTK_STICK_E))
- +TTK_END_LAYOUT
- +
- /*------------------------------------------------------------------------
- * +++ Initialization.
- */
- @@ -1914,9 +1972,11 @@
- Ttk_RegisterLayout(themePtr, "TEntry", EntryLayout);
- Ttk_RegisterLayout(themePtr, "TCombobox", ComboboxLayout);
- + Ttk_RegisterLayout(themePtr, "TSpinbox", SpinboxLayout);
- RegisterWidget(interp, "ttk::entry", &EntryWidgetSpec);
- RegisterWidget(interp, "ttk::combobox", &ComboboxWidgetSpec);
- + RegisterWidget(interp, "ttk::spinbox", &SpinboxWidgetSpec);
- }
- /*EOF*/
- Index: library/altTheme.tcl
- ===================================================================
- RCS file: /cvsroot/tktable/tile/library/altTheme.tcl,v
- retrieving revision 1.40
- diff -u -r1.40 altTheme.tcl
- --- library/altTheme.tcl 8 Dec 2007 03:52:01 -0000 1.40
- +++ library/altTheme.tcl 17 Dec 2007 10:12:14 -0000
- @@ -59,6 +59,10 @@
- ttk::style configure TCombobox -padding 1
- ttk::style map TCombobox -fieldbackground \
- [list readonly $colors(-frame) disabled $colors(-frame)]
- + style configure TSpinbox -arrowsize 10 -padding {2 0 10 0}
- + style map TSpinbox -fieldbackground \
- + [list readonly $colors(-frame) disabled $colors(-frame)] \
- + -arrowcolor [list disabled $colors(-disabledfg)]
- ttk::style configure Toolbutton -relief flat -padding 2
- ttk::style map Toolbutton -relief \
- Index: library/clamTheme.tcl
- ===================================================================
- RCS file: /cvsroot/tktable/tile/library/clamTheme.tcl,v
- retrieving revision 1.31
- diff -u -r1.31 clamTheme.tcl
- --- library/clamTheme.tcl 18 Nov 2007 18:09:26 -0000 1.31
- +++ library/clamTheme.tcl 23 Nov 2007 18:26:44 -0000
- @@ -106,6 +106,14 @@
- -foreground [list {readonly focus} $colors(-selectfg)] \
- ;
- + ttk::style configure TSpinbox -arrowsize 10 -padding {2 0 10 0}
- + ttk::style map TSpinbox \
- + -background [list readonly $colors(-frame)] \
- + -bordercolor [list focus $colors(-selectbg)] \
- + -lightcolor [list focus "#6f9dc6"] \
- + -darkcolor [list focus "#6f9dc6"] \
- + -arrowcolor [list disabled $colors(-disabledfg)]
- +
- ttk::style configure TNotebook.Tab -padding {6 2 6 2}
- ttk::style map TNotebook.Tab \
- -padding [list selected {6 4 6 2}] \
- Index: library/classicTheme.tcl
- ===================================================================
- RCS file: /cvsroot/tktable/tile/library/classicTheme.tcl,v
- retrieving revision 1.19
- diff -u -r1.19 classicTheme.tcl
- --- library/classicTheme.tcl 8 Dec 2007 03:52:01 -0000 1.19
- +++ library/classicTheme.tcl 17 Dec 2007 10:12:14 -0000
- @@ -70,6 +70,9 @@
- ttk::style configure TCombobox -padding 1
- ttk::style map TCombobox -fieldbackground \
- [list readonly $colors(-frame) disabled $colors(-frame)]
- + style configure TSpinbox -arrowsize 10 -padding {2 0 10 0}
- + style map TSpinbox -fieldbackground \
- + [list readonly $colors(-frame) disabled $colors(-frame)]
- ttk::style configure TLabelframe -borderwidth 2 -relief groove
- Index: library/defaults.tcl
- ===================================================================
- RCS file: /cvsroot/tktable/tile/library/defaults.tcl,v
- retrieving revision 1.38
- diff -u -r1.38 defaults.tcl
- --- library/defaults.tcl 18 Nov 2007 18:09:26 -0000 1.38
- +++ library/defaults.tcl 23 Nov 2007 18:26:44 -0000
- @@ -64,6 +64,11 @@
- ttk::style map TCombobox -fieldbackground \
- [list readonly $colors(-frame) disabled $colors(-frame)]
- + ttk::style configure TSpinbox -arrowsize 10 -padding {2 0 10 0}
- + ttk::style map TSpinbox -fieldbackground \
- + [list readonly $colors(-frame) disabled $colors(-frame)] \
- + -arrowcolor [list disabled $colors(-disabledfg)]
- +
- ttk::style configure TLabelframe \
- -relief groove -borderwidth 2
- Index: library/entry.tcl
- ===================================================================
- RCS file: /cvsroot/tktable/tile/library/entry.tcl,v
- retrieving revision 1.15
- diff -u -r1.15 entry.tcl
- --- library/entry.tcl 30 Sep 2007 16:56:11 -0000 1.15
- +++ library/entry.tcl 14 Oct 2007 21:59:26 -0000
- @@ -224,7 +224,7 @@
- # position following the next end-of-word position.
- #
- set ::ttk::entry::State(startNext) \
- - [string equal $tcl_platform(platform) "windows"]
- + [string equal $::tcl_platform(platform) "windows"]
- proc ttk::entry::NextWord {w start} {
- variable State
- Index: library/tile.tcl
- ===================================================================
- RCS file: /cvsroot/tktable/tile/library/tile.tcl,v
- retrieving revision 1.104
- diff -u -r1.104 tile.tcl
- --- library/tile.tcl 13 Dec 2006 17:05:25 -0000 1.104
- +++ library/tile.tcl 22 Mar 2007 08:43:46 -0000
- @@ -143,6 +143,7 @@
- source [file join $tile::library paned.tcl]
- source [file join $tile::library entry.tcl]
- source [file join $tile::library combobox.tcl] ;# dependency: entry.tcl
- +source [file join $tile::library spinbox.tcl] ;# dependency: entry.tcl
- source [file join $tile::library treeview.tcl]
- source [file join $tile::library sizegrip.tcl]
- source [file join $tile::library dialog.tcl]
- Index: library/xpTheme.tcl
- ===================================================================
- RCS file: /cvsroot/tktable/tile/library/xpTheme.tcl,v
- retrieving revision 1.39
- diff -u -r1.39 xpTheme.tcl
- --- library/xpTheme.tcl 18 Nov 2007 18:09:26 -0000 1.39
- +++ library/xpTheme.tcl 23 Nov 2007 18:26:45 -0000
- @@ -57,6 +57,11 @@
- -foreground [list {readonly focus} SystemHighlightText] \
- -focusfill [list {readonly focus} SystemHighlight] \
- ;
- + style configure TSpinbox -padding {2 0 14 0}
- + style map TSpinbox \
- + -selectbackground [list !focus SystemWindow] \
- + -selectforeground [list !focus SystemWindowText] \
- + ;
- ttk::style configure Toolbutton -padding {4 4}
- }
- Index: win/xpTheme.c
- ===================================================================
- RCS file: /cvsroot/tktable/tile/win/xpTheme.c,v
- retrieving revision 1.96
- diff -u -r1.96 xpTheme.c
- --- win/xpTheme.c 7 Mar 2008 13:51:48 -0000 1.96
- +++ win/xpTheme.c 7 Mar 2008 13:57:14 -0000
- @@ -244,6 +244,14 @@
- /* NOT USED: ETS_ASSIST, ETS_SELECTED */
- };
- +static Ttk_StateTable spinbutton_statemap[] =
- +{
- + { DNS_DISABLED, TTK_STATE_DISABLED, 0 },
- + { DNS_PRESSED, TTK_STATE_PRESSED, 0 },
- + { DNS_HOT, TTK_STATE_ACTIVE, 0 },
- + { DNS_NORMAL, 0, 0 },
- +};
- +
- /*
- * Combobox text field statemap:
- * Same as edittext_statemap, but doesn't use ETS_READONLY
- @@ -592,6 +600,36 @@
- };
- /*----------------------------------------------------------------------
- + * +++ Spinbox arrow element.
- + * These are half-height scrollbar buttons.
- + */
- +
- +static void
- +SpinboxArrowElementSize(
- + void *clientData, void *elementRecord, Tk_Window tkwin,
- + int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
- +{
- + ElementData *elementData = clientData;
- +
- + if (!InitElementData(elementData, tkwin, 0))
- + return;
- +
- + GenericSizedElementSize(clientData, elementRecord, tkwin,
- + widthPtr, heightPtr, paddingPtr);
- +
- + /* force the arrow button height to half size */
- + *heightPtr /= 2;
- +}
- +
- +static Ttk_ElementSpec SpinboxArrowElementSpec = {
- + TK_STYLE_VERSION_2,
- + sizeof(NullElement),
- + TtkNullElementOptions,
- + SpinboxArrowElementSize,
- + GenericElementDraw
- +};
- +
- +/*----------------------------------------------------------------------
- * +++ Scrollbar thumb element.
- * Same as a GenericElement, but don't draw in the disabled state.
- */
- @@ -970,6 +1008,14 @@
- HP_HEADERITEM, header_statemap, PAD(4,0,4,0),0 },
- { "sizegrip", &GenericElementSpec, L"STATUS",
- SP_GRIPPER, null_statemap, NOPAD,0 },
- + { "Spinbox.field", &GenericElementSpec, L"EDIT",
- + EP_EDITTEXT, edittext_statemap, PAD(1, 1, 1, 1), 0 },
- + { "Spinbox.uparrow", &SpinboxArrowElementSpec, L"SPIN",
- + SPNP_UP, spinbutton_statemap, NOPAD,
- + PAD_MARGINS | ((SM_CXVSCROLL << 8) | SM_CYVSCROLL) },
- + { "Spinbox.downarrow", &SpinboxArrowElementSpec, L"SPIN",
- + SPNP_DOWN, spinbutton_statemap, NOPAD,
- + PAD_MARGINS | ((SM_CXVSCROLL << 8) | SM_CYVSCROLL) },
- #if BROKEN_TEXT_ELEMENT
- { "Labelframe.text", &TextElementSpec, L"BUTTON",