Posted to tcl by patthoyts at Tue Sep 30 20:17:45 GMT 2008view raw

  1. Index: demos/demo.tcl
  2. ===================================================================
  3. RCS file: /cvsroot/tktable/tile/demos/demo.tcl,v
  4. retrieving revision 1.116
  5. diff -u -r1.116 demo.tcl
  6. --- demos/demo.tcl 24 Feb 2008 15:11:20 -0000 1.116
  7. +++ demos/demo.tcl 24 Feb 2008 23:13:18 -0000
  8. @@ -329,7 +329,7 @@
  9.  
  10. ttk::menubutton $l.mb -text "Menubutton" -underline 2
  11. $l.mb configure -menu [menubuttonMenu $l.mb.menu]
  12. -
  13. +ttk::spinbox $l.spn -width 6 -textvariable ::V(SPINBOX)
  14. set ::entryText "Entry widget"
  15. ttk::entry $l.e -textvariable ::entryText
  16. $l.e selection range 6 end
  17. @@ -342,6 +342,7 @@
  18. grid $l.rb3 -sticky ew
  19. grid $l.button -sticky ew -padx 2 -pady 2
  20. grid $l.mb -sticky ew -padx 2 -pady 2
  21. +grid $l.spn -sticky w -padx 2 -pady 2
  22. grid $l.e -sticky ew -padx 2 -pady 2
  23. grid $ltext -sticky news
  24.  
  25. @@ -356,6 +357,7 @@
  26. radiobutton $r.rb3 -text "Three" -variable ::V(CHOICE) -value 3
  27. button $r.button -text "Button"
  28. menubutton $r.mb -text "Menubutton" -underline 3 -takefocus 1
  29. +spinbox $r.spn -width 6 -textvariable ::V(SPINBOX)
  30. $r.mb configure -menu [menubuttonMenu $r.mb.menu]
  31. # Add -indicatoron control:
  32. set ::V(rmbIndicatoron) [$r.mb cget -indicatoron]
  33. @@ -374,6 +376,7 @@
  34. grid $r.rb3 -sticky ew
  35. grid $r.button -sticky ew -padx 2 -pady 2
  36. grid $r.mb -sticky ew -padx 2 -pady 2
  37. +grid $r.spn -sticky w -padx 2 -pady 2
  38. grid $r.e -sticky ew -padx 2 -pady 2
  39. grid $rtext -sticky news
  40.  
  41. Index: generic/entry.c
  42. ===================================================================
  43. RCS file: /cvsroot/tktable/tile/generic/entry.c,v
  44. retrieving revision 1.46
  45. diff -u -r1.46 entry.c
  46. --- generic/entry.c 18 May 2007 21:50:49 -0000 1.46
  47. +++ generic/entry.c 19 May 2007 21:19:52 -0000
  48. @@ -1839,6 +1839,56 @@
  49. };
  50.  
  51. /*------------------------------------------------------------------------
  52. + * +++ Spinbox widget record.
  53. + */
  54. +
  55. +typedef struct {
  56. + int junk;
  57. +} SpinboxPart;
  58. +
  59. +typedef struct {
  60. + WidgetCore core;
  61. + EntryPart entry;
  62. + SpinboxPart spinbox;
  63. +} Spinbox;
  64. +
  65. +static Tk_OptionSpec SpinboxOptionSpecs[] =
  66. +{
  67. + WIDGET_INHERIT_OPTIONS(EntryOptionSpecs)
  68. +};
  69. +
  70. +/* SpinboxInitialize --
  71. + * Initialization hook for spinbox widgets.
  72. + */
  73. +static int
  74. +SpinboxInitialize(Tcl_Interp *interp, void *recordPtr)
  75. +{
  76. + Spinbox *sb = recordPtr;
  77. + TtkTrackElementState(&sb->core);
  78. + return EntryInitialize(interp, recordPtr);
  79. +}
  80. +
  81. +/*------------------------------------------------------------------------
  82. + * +++ Spinbox widget definition.
  83. + */
  84. +
  85. +static WidgetSpec SpinboxWidgetSpec =
  86. +{
  87. + "TSpinbox", /* className */
  88. + sizeof(Spinbox), /* recordSize */
  89. + SpinboxOptionSpecs, /* optionSpecs */
  90. + EntryCommands, /* subcommands */
  91. + SpinboxInitialize, /* initializeProc */
  92. + EntryCleanup, /* cleanupProc */
  93. + EntryConfigure, /* configureProc */
  94. + EntryPostConfigure, /* postConfigureProc */
  95. + TtkWidgetGetLayout, /* getLayoutProc */
  96. + TtkWidgetSize, /* sizeProc */
  97. + EntryDoLayout, /* layoutProc */
  98. + EntryDisplay /* displayProc */
  99. +};
  100. +
  101. +/*------------------------------------------------------------------------
  102. * +++ Textarea element.
  103. *
  104. * Text display area for Entry widgets.
  105. @@ -1902,6 +1952,14 @@
  106. TTK_NODE("Combobox.textarea", TTK_FILL_BOTH)))
  107. TTK_END_LAYOUT
  108.  
  109. +TTK_BEGIN_LAYOUT(SpinboxLayout)
  110. + TTK_GROUP("Spinbox.field", TTK_FILL_BOTH,
  111. + TTK_GROUP("Spinbox.padding", TTK_FILL_BOTH,
  112. + TTK_NODE("Spinbox.textarea", TTK_PACK_LEFT|TTK_EXPAND))
  113. + TTK_NODE("Spinbox.uparrow", TTK_PACK_TOP|TTK_STICK_E)
  114. + TTK_NODE("Spinbox.downarrow", TTK_PACK_BOTTOM|TTK_STICK_E))
  115. +TTK_END_LAYOUT
  116. +
  117. /*------------------------------------------------------------------------
  118. * +++ Initialization.
  119. */
  120. @@ -1914,9 +1972,11 @@
  121.  
  122. Ttk_RegisterLayout(themePtr, "TEntry", EntryLayout);
  123. Ttk_RegisterLayout(themePtr, "TCombobox", ComboboxLayout);
  124. + Ttk_RegisterLayout(themePtr, "TSpinbox", SpinboxLayout);
  125.  
  126. RegisterWidget(interp, "ttk::entry", &EntryWidgetSpec);
  127. RegisterWidget(interp, "ttk::combobox", &ComboboxWidgetSpec);
  128. + RegisterWidget(interp, "ttk::spinbox", &SpinboxWidgetSpec);
  129. }
  130.  
  131. /*EOF*/
  132. Index: library/altTheme.tcl
  133. ===================================================================
  134. RCS file: /cvsroot/tktable/tile/library/altTheme.tcl,v
  135. retrieving revision 1.40
  136. diff -u -r1.40 altTheme.tcl
  137. --- library/altTheme.tcl 8 Dec 2007 03:52:01 -0000 1.40
  138. +++ library/altTheme.tcl 17 Dec 2007 10:12:14 -0000
  139. @@ -59,6 +59,10 @@
  140. ttk::style configure TCombobox -padding 1
  141. ttk::style map TCombobox -fieldbackground \
  142. [list readonly $colors(-frame) disabled $colors(-frame)]
  143. + style configure TSpinbox -arrowsize 10 -padding {2 0 10 0}
  144. + style map TSpinbox -fieldbackground \
  145. + [list readonly $colors(-frame) disabled $colors(-frame)] \
  146. + -arrowcolor [list disabled $colors(-disabledfg)]
  147.  
  148. ttk::style configure Toolbutton -relief flat -padding 2
  149. ttk::style map Toolbutton -relief \
  150. Index: library/clamTheme.tcl
  151. ===================================================================
  152. RCS file: /cvsroot/tktable/tile/library/clamTheme.tcl,v
  153. retrieving revision 1.31
  154. diff -u -r1.31 clamTheme.tcl
  155. --- library/clamTheme.tcl 18 Nov 2007 18:09:26 -0000 1.31
  156. +++ library/clamTheme.tcl 23 Nov 2007 18:26:44 -0000
  157. @@ -106,6 +106,14 @@
  158. -foreground [list {readonly focus} $colors(-selectfg)] \
  159. ;
  160.  
  161. + ttk::style configure TSpinbox -arrowsize 10 -padding {2 0 10 0}
  162. + ttk::style map TSpinbox \
  163. + -background [list readonly $colors(-frame)] \
  164. + -bordercolor [list focus $colors(-selectbg)] \
  165. + -lightcolor [list focus "#6f9dc6"] \
  166. + -darkcolor [list focus "#6f9dc6"] \
  167. + -arrowcolor [list disabled $colors(-disabledfg)]
  168. +
  169. ttk::style configure TNotebook.Tab -padding {6 2 6 2}
  170. ttk::style map TNotebook.Tab \
  171. -padding [list selected {6 4 6 2}] \
  172. Index: library/classicTheme.tcl
  173. ===================================================================
  174. RCS file: /cvsroot/tktable/tile/library/classicTheme.tcl,v
  175. retrieving revision 1.19
  176. diff -u -r1.19 classicTheme.tcl
  177. --- library/classicTheme.tcl 8 Dec 2007 03:52:01 -0000 1.19
  178. +++ library/classicTheme.tcl 17 Dec 2007 10:12:14 -0000
  179. @@ -70,6 +70,9 @@
  180. ttk::style configure TCombobox -padding 1
  181. ttk::style map TCombobox -fieldbackground \
  182. [list readonly $colors(-frame) disabled $colors(-frame)]
  183. + style configure TSpinbox -arrowsize 10 -padding {2 0 10 0}
  184. + style map TSpinbox -fieldbackground \
  185. + [list readonly $colors(-frame) disabled $colors(-frame)]
  186.  
  187. ttk::style configure TLabelframe -borderwidth 2 -relief groove
  188.  
  189. Index: library/defaults.tcl
  190. ===================================================================
  191. RCS file: /cvsroot/tktable/tile/library/defaults.tcl,v
  192. retrieving revision 1.38
  193. diff -u -r1.38 defaults.tcl
  194. --- library/defaults.tcl 18 Nov 2007 18:09:26 -0000 1.38
  195. +++ library/defaults.tcl 23 Nov 2007 18:26:44 -0000
  196. @@ -64,6 +64,11 @@
  197. ttk::style map TCombobox -fieldbackground \
  198. [list readonly $colors(-frame) disabled $colors(-frame)]
  199.  
  200. + ttk::style configure TSpinbox -arrowsize 10 -padding {2 0 10 0}
  201. + ttk::style map TSpinbox -fieldbackground \
  202. + [list readonly $colors(-frame) disabled $colors(-frame)] \
  203. + -arrowcolor [list disabled $colors(-disabledfg)]
  204. +
  205. ttk::style configure TLabelframe \
  206. -relief groove -borderwidth 2
  207.  
  208. Index: library/entry.tcl
  209. ===================================================================
  210. RCS file: /cvsroot/tktable/tile/library/entry.tcl,v
  211. retrieving revision 1.15
  212. diff -u -r1.15 entry.tcl
  213. --- library/entry.tcl 30 Sep 2007 16:56:11 -0000 1.15
  214. +++ library/entry.tcl 14 Oct 2007 21:59:26 -0000
  215. @@ -224,7 +224,7 @@
  216. # position following the next end-of-word position.
  217. #
  218. set ::ttk::entry::State(startNext) \
  219. - [string equal $tcl_platform(platform) "windows"]
  220. + [string equal $::tcl_platform(platform) "windows"]
  221.  
  222. proc ttk::entry::NextWord {w start} {
  223. variable State
  224. Index: library/tile.tcl
  225. ===================================================================
  226. RCS file: /cvsroot/tktable/tile/library/tile.tcl,v
  227. retrieving revision 1.104
  228. diff -u -r1.104 tile.tcl
  229. --- library/tile.tcl 13 Dec 2006 17:05:25 -0000 1.104
  230. +++ library/tile.tcl 22 Mar 2007 08:43:46 -0000
  231. @@ -143,6 +143,7 @@
  232. source [file join $tile::library paned.tcl]
  233. source [file join $tile::library entry.tcl]
  234. source [file join $tile::library combobox.tcl] ;# dependency: entry.tcl
  235. +source [file join $tile::library spinbox.tcl] ;# dependency: entry.tcl
  236. source [file join $tile::library treeview.tcl]
  237. source [file join $tile::library sizegrip.tcl]
  238. source [file join $tile::library dialog.tcl]
  239. Index: library/xpTheme.tcl
  240. ===================================================================
  241. RCS file: /cvsroot/tktable/tile/library/xpTheme.tcl,v
  242. retrieving revision 1.39
  243. diff -u -r1.39 xpTheme.tcl
  244. --- library/xpTheme.tcl 18 Nov 2007 18:09:26 -0000 1.39
  245. +++ library/xpTheme.tcl 23 Nov 2007 18:26:45 -0000
  246. @@ -57,6 +57,11 @@
  247. -foreground [list {readonly focus} SystemHighlightText] \
  248. -focusfill [list {readonly focus} SystemHighlight] \
  249. ;
  250. + style configure TSpinbox -padding {2 0 14 0}
  251. + style map TSpinbox \
  252. + -selectbackground [list !focus SystemWindow] \
  253. + -selectforeground [list !focus SystemWindowText] \
  254. + ;
  255.  
  256. ttk::style configure Toolbutton -padding {4 4}
  257. }
  258. Index: win/xpTheme.c
  259. ===================================================================
  260. RCS file: /cvsroot/tktable/tile/win/xpTheme.c,v
  261. retrieving revision 1.96
  262. diff -u -r1.96 xpTheme.c
  263. --- win/xpTheme.c 7 Mar 2008 13:51:48 -0000 1.96
  264. +++ win/xpTheme.c 7 Mar 2008 13:57:14 -0000
  265. @@ -244,6 +244,14 @@
  266. /* NOT USED: ETS_ASSIST, ETS_SELECTED */
  267. };
  268.  
  269. +static Ttk_StateTable spinbutton_statemap[] =
  270. +{
  271. + { DNS_DISABLED, TTK_STATE_DISABLED, 0 },
  272. + { DNS_PRESSED, TTK_STATE_PRESSED, 0 },
  273. + { DNS_HOT, TTK_STATE_ACTIVE, 0 },
  274. + { DNS_NORMAL, 0, 0 },
  275. +};
  276. +
  277. /*
  278. * Combobox text field statemap:
  279. * Same as edittext_statemap, but doesn't use ETS_READONLY
  280. @@ -592,6 +600,36 @@
  281. };
  282.  
  283. /*----------------------------------------------------------------------
  284. + * +++ Spinbox arrow element.
  285. + * These are half-height scrollbar buttons.
  286. + */
  287. +
  288. +static void
  289. +SpinboxArrowElementSize(
  290. + void *clientData, void *elementRecord, Tk_Window tkwin,
  291. + int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
  292. +{
  293. + ElementData *elementData = clientData;
  294. +
  295. + if (!InitElementData(elementData, tkwin, 0))
  296. + return;
  297. +
  298. + GenericSizedElementSize(clientData, elementRecord, tkwin,
  299. + widthPtr, heightPtr, paddingPtr);
  300. +
  301. + /* force the arrow button height to half size */
  302. + *heightPtr /= 2;
  303. +}
  304. +
  305. +static Ttk_ElementSpec SpinboxArrowElementSpec = {
  306. + TK_STYLE_VERSION_2,
  307. + sizeof(NullElement),
  308. + TtkNullElementOptions,
  309. + SpinboxArrowElementSize,
  310. + GenericElementDraw
  311. +};
  312. +
  313. +/*----------------------------------------------------------------------
  314. * +++ Scrollbar thumb element.
  315. * Same as a GenericElement, but don't draw in the disabled state.
  316. */
  317. @@ -970,6 +1008,14 @@
  318. HP_HEADERITEM, header_statemap, PAD(4,0,4,0),0 },
  319. { "sizegrip", &GenericElementSpec, L"STATUS",
  320. SP_GRIPPER, null_statemap, NOPAD,0 },
  321. + { "Spinbox.field", &GenericElementSpec, L"EDIT",
  322. + EP_EDITTEXT, edittext_statemap, PAD(1, 1, 1, 1), 0 },
  323. + { "Spinbox.uparrow", &SpinboxArrowElementSpec, L"SPIN",
  324. + SPNP_UP, spinbutton_statemap, NOPAD,
  325. + PAD_MARGINS | ((SM_CXVSCROLL << 8) | SM_CYVSCROLL) },
  326. + { "Spinbox.downarrow", &SpinboxArrowElementSpec, L"SPIN",
  327. + SPNP_DOWN, spinbutton_statemap, NOPAD,
  328. + PAD_MARGINS | ((SM_CXVSCROLL << 8) | SM_CYVSCROLL) },
  329.  
  330. #if BROKEN_TEXT_ELEMENT
  331. { "Labelframe.text", &TextElementSpec, L"BUTTON",