diff options
author | dgp <dgp@users.sourceforge.net> | 2007-12-04 17:05:20 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2007-12-04 17:05:20 (GMT) |
commit | 68ae9855a65a2bee4130a02c1a3f464aca9d7e3b (patch) | |
tree | 37c6f768853ec6d9ec839445a8e844384142a737 | |
parent | 0a97d8c36b7cd622ada94fa095a9ee4fe2c5498b (diff) | |
download | tk-68ae9855a65a2bee4130a02c1a3f464aca9d7e3b.zip tk-68ae9855a65a2bee4130a02c1a3f464aca9d7e3b.tar.gz tk-68ae9855a65a2bee4130a02c1a3f464aca9d7e3b.tar.bz2 |
merge updates from HEAD
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | generic/ttk/ttkClamTheme.c | 25 | ||||
-rw-r--r-- | generic/ttk/ttkClassicTheme.c | 43 | ||||
-rw-r--r-- | generic/ttk/ttkLayout.c | 22 | ||||
-rw-r--r-- | generic/ttk/ttkManager.h | 5 | ||||
-rw-r--r-- | generic/ttk/ttkTheme.c | 5 | ||||
-rw-r--r-- | generic/ttk/ttkTheme.h | 26 | ||||
-rw-r--r-- | generic/ttk/ttkThemeInt.h | 7 | ||||
-rw-r--r-- | generic/ttk/ttkTreeview.c | 37 | ||||
-rw-r--r-- | generic/ttk/ttkWidget.h | 38 | ||||
-rw-r--r-- | macosx/ttkMacOSXTheme.c | 68 | ||||
-rwxr-xr-x | win/configure | 15 | ||||
-rw-r--r-- | win/tcl.m4 | 11 | ||||
-rw-r--r-- | win/ttkWinTheme.c | 43 | ||||
-rw-r--r-- | win/ttkWinXPTheme.c | 51 |
15 files changed, 210 insertions, 200 deletions
@@ -1,3 +1,17 @@ +2007-12-03 Jeff Hobbs <jeffh@ActiveState.com> + + * win/configure, win/tcl.m4 (LIBS_GUI): remove ole32.lib oleaut32.lib + (LIBS): add ws2_32.lib for static builds with Tcl. + +2007-12-01 Joe English <jenglish@users.sourceforge.net> + + * generic/ttk/ttkTheme.h, generic/ttk/ttkThemeInt.h, + generic/ttk/ttkTheme.c, generic/ttk/ttkLayout.c, + generic/ttk/ttkClamTheme.c, generic/ttk/ttkClassicTheme.c, + generic/ttk/ttkTreeview.c, macosx/ttkMacOSXTheme.c, + win/ttkWinTheme.c, win/ttkWinXPTheme.c: Improved macrology for + statically-initialized layout template tables. + 2007-11-28 Don Porter <dgp@users.sourceforge.net> * unix/tkUnixPort.h: When unix/configure determines whether the diff --git a/generic/ttk/ttkClamTheme.c b/generic/ttk/ttkClamTheme.c index b1dea77..0c4571e 100644 --- a/generic/ttk/ttkClamTheme.c +++ b/generic/ttk/ttkClamTheme.c @@ -1,5 +1,5 @@ /* - * $Id: ttkClamTheme.c,v 1.5.2.2 2007/11/12 19:22:37 dgp Exp $ + * $Id: ttkClamTheme.c,v 1.5.2.3 2007/12/04 17:05:20 dgp Exp $ * * Copyright (C) 2004 Joe English * @@ -896,22 +896,23 @@ static Ttk_ElementSpec ClientElementSpec = * +++ Modified widget layouts. */ -TTK_BEGIN_LAYOUT(ComboboxLayout) +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.padding", TTK_FILL_BOTH, - TTK_NODE("Combobox.textarea", TTK_FILL_BOTH))) -TTK_END_LAYOUT + TTK_NODE("Combobox.textarea", TTK_FILL_BOTH)))) -TTK_BEGIN_LAYOUT(HorizontalSashLayout) +TTK_LAYOUT("Horizontal.Sash", TTK_GROUP("Sash.hsash", TTK_FILL_BOTH, - TTK_NODE("Sash.hgrip", TTK_FILL_BOTH)) -TTK_END_LAYOUT + TTK_NODE("Sash.hgrip", TTK_FILL_BOTH))) -TTK_BEGIN_LAYOUT(VerticalSashLayout) +TTK_LAYOUT("Vertical.Sash", TTK_GROUP("Sash.vsash", TTK_FILL_BOTH, - TTK_NODE("Sash.vgrip", TTK_FILL_BOTH)) -TTK_END_LAYOUT + TTK_NODE("Sash.vgrip", TTK_FILL_BOTH))) + +TTK_END_LAYOUT_TABLE /*------------------------------------------------------------------------ * +++ Initialization. @@ -964,9 +965,7 @@ TtkClamTheme_Init(Tcl_Interp *interp) Ttk_RegisterElement(interp, theme, "vgrip", &GripElementSpec, &GripClientData[1]); - Ttk_RegisterLayout(theme, "TCombobox", ComboboxLayout); - Ttk_RegisterLayout(theme, "Horizontal.Sash", HorizontalSashLayout); - Ttk_RegisterLayout(theme, "Vertical.Sash", VerticalSashLayout); + Ttk_RegisterLayouts(theme, LayoutTable); Tcl_PkgProvide(interp, "ttk::theme::clam", TTK_VERSION); diff --git a/generic/ttk/ttkClassicTheme.c b/generic/ttk/ttkClassicTheme.c index a5f4302..f1532e5 100644 --- a/generic/ttk/ttkClassicTheme.c +++ b/generic/ttk/ttkClassicTheme.c @@ -1,5 +1,5 @@ /* - * $Id: ttkClassicTheme.c,v 1.3.2.1 2007/10/27 04:23:15 dgp Exp $ + * $Id: ttkClassicTheme.c,v 1.3.2.2 2007/12/04 17:05:20 dgp Exp $ * * Copyright (c) 2004, Joe English * @@ -419,51 +419,49 @@ static Ttk_ElementSpec SashElementSpec = { * +++ Widget layouts. */ -TTK_BEGIN_LAYOUT(ButtonLayout) +TTK_BEGIN_LAYOUT_TABLE(LayoutTable) + +TTK_LAYOUT("TButton", TTK_GROUP("Button.highlight", TTK_FILL_BOTH, TTK_GROUP("Button.border", TTK_FILL_BOTH|TTK_BORDER, TTK_GROUP("Button.padding", TTK_FILL_BOTH, - TTK_NODE("Button.label", TTK_FILL_BOTH)))) -TTK_END_LAYOUT + TTK_NODE("Button.label", TTK_FILL_BOTH))))) -TTK_BEGIN_LAYOUT(CheckbuttonLayout) +TTK_LAYOUT("TCheckbutton", TTK_GROUP("Checkbutton.highlight", TTK_FILL_BOTH, TTK_GROUP("Checkbutton.border", TTK_FILL_BOTH, TTK_GROUP("Checkbutton.padding", TTK_FILL_BOTH, TTK_NODE("Checkbutton.indicator", TTK_PACK_LEFT) - TTK_NODE("Checkbutton.label", TTK_PACK_LEFT|TTK_FILL_BOTH)))) -TTK_END_LAYOUT + TTK_NODE("Checkbutton.label", TTK_PACK_LEFT|TTK_FILL_BOTH))))) -TTK_BEGIN_LAYOUT(RadiobuttonLayout) +TTK_LAYOUT("TRadiobutton", TTK_GROUP("Radiobutton.highlight", TTK_FILL_BOTH, TTK_GROUP("Radiobutton.border", TTK_FILL_BOTH, TTK_GROUP("Radiobutton.padding", TTK_FILL_BOTH, TTK_NODE("Radiobutton.indicator", TTK_PACK_LEFT) - TTK_NODE("Radiobutton.label", TTK_PACK_LEFT|TTK_FILL_BOTH)))) -TTK_END_LAYOUT + TTK_NODE("Radiobutton.label", TTK_PACK_LEFT|TTK_FILL_BOTH))))) -TTK_BEGIN_LAYOUT(MenubuttonLayout) +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_NODE("Menubutton.label", 0)))) -TTK_END_LAYOUT + TTK_NODE("Menubutton.label", 0))))) /* "classic" entry, includes highlight border */ -TTK_BEGIN_LAYOUT(EntryLayout) +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)))) -TTK_END_LAYOUT + TTK_NODE("Entry.textarea", TTK_FILL_BOTH))))) /* Notebook tabs -- omit focus ring */ -TTK_BEGIN_LAYOUT(TabLayout) +TTK_LAYOUT("Tab", TTK_GROUP("Notebook.tab", TTK_FILL_BOTH, TTK_GROUP("Notebook.padding", TTK_FILL_BOTH, - TTK_NODE("Notebook.label", TTK_FILL_BOTH))) -TTK_END_LAYOUT + TTK_NODE("Notebook.label", TTK_FILL_BOTH)))) + +TTK_END_LAYOUT_TABLE /* POSSIBLY: include Scale layouts w/focus border */ @@ -509,12 +507,7 @@ MODULE_SCOPE int TtkClassicTheme_Init(Tcl_Interp *interp) /* * Register layouts: */ - Ttk_RegisterLayout(theme, "TButton", ButtonLayout); - Ttk_RegisterLayout(theme, "TCheckbutton", CheckbuttonLayout); - Ttk_RegisterLayout(theme, "TRadiobutton", RadiobuttonLayout); - Ttk_RegisterLayout(theme, "TMenubutton", MenubuttonLayout); - Ttk_RegisterLayout(theme, "TEntry", EntryLayout); - Ttk_RegisterLayout(theme, "TNotebook.Tab", TabLayout); + Ttk_RegisterLayouts(theme, LayoutTable); Tcl_PkgProvide(interp, "ttk::theme::classic", TTK_VERSION); diff --git a/generic/ttk/ttkLayout.c b/generic/ttk/ttkLayout.c index d604cfe..cd74ee5 100644 --- a/generic/ttk/ttkLayout.c +++ b/generic/ttk/ttkLayout.c @@ -5,7 +5,7 @@ * * Copyright (c) 2003 Joe English. Freely redistributable. * - * $Id: ttkLayout.c,v 1.8.2.1 2007/11/21 16:46:27 dgp Exp $ + * $Id: ttkLayout.c,v 1.8.2.2 2007/12/04 17:05:20 dgp Exp $ */ #include <string.h> @@ -722,7 +722,7 @@ Ttk_LayoutTemplate Ttk_BuildLayoutTemplate(Ttk_LayoutSpec spec) { Ttk_TemplateNode *first = 0, *last = 0; - for ( ; !(spec->opcode & TTK_LAYOUT_END) ; ++spec) { + for ( ; !(spec->opcode & _TTK_LAYOUT_END) ; ++spec) { if (spec->elementName) { Ttk_TemplateNode *node = Ttk_NewTemplateNode(spec->elementName, spec->opcode); @@ -735,7 +735,7 @@ Ttk_LayoutTemplate Ttk_BuildLayoutTemplate(Ttk_LayoutSpec spec) last = node; } - if (spec->opcode & TTK_CHILDREN) { + if (spec->opcode & _TTK_CHILDREN) { int depth = 1; last->child = Ttk_BuildLayoutTemplate(spec+1); @@ -743,19 +743,31 @@ Ttk_LayoutTemplate Ttk_BuildLayoutTemplate(Ttk_LayoutSpec spec) */ while (depth) { ++spec; - if (spec->opcode & TTK_CHILDREN) { + if (spec->opcode & _TTK_CHILDREN) { ++depth; } - if (spec->opcode & TTK_LAYOUT_END) { + if (spec->opcode & _TTK_LAYOUT_END) { --depth; } } } + } /* for */ return first; } +void Ttk_RegisterLayouts(Ttk_Theme theme, Ttk_LayoutSpec spec) +{ + while (!(spec->opcode & _TTK_LAYOUT_END)) { + Ttk_LayoutTemplate layoutTemplate = Ttk_BuildLayoutTemplate(spec+1); + Ttk_RegisterLayoutTemplate(theme, spec->elementName, layoutTemplate); + do { + ++spec; + } while (!(spec->opcode & _TTK_LAYOUT)); + } +} + Tcl_Obj *Ttk_UnparseLayoutTemplate(Ttk_TemplateNode *node) { Tcl_Obj *result = Tcl_NewListObj(0,0); diff --git a/generic/ttk/ttkManager.h b/generic/ttk/ttkManager.h index 58df8f0..2b6d0c1 100644 --- a/generic/ttk/ttkManager.h +++ b/generic/ttk/ttkManager.h @@ -1,4 +1,4 @@ -/* $Id: ttkManager.h,v 1.5.2.2 2007/11/25 19:19:21 dgp Exp $ +/* $Id: ttkManager.h,v 1.5.2.3 2007/12/04 17:05:20 dgp Exp $ * * Copyright (c) 2005, Joe English. Freely redistributable. * @@ -81,9 +81,6 @@ MODULE_SCOPE int Ttk_GetSlaveIndexFromObj( MODULE_SCOPE int Ttk_NumberSlaves(Ttk_Manager *); /* Returns: number of managed slaves */ -MODULE_SCOPE void *Ttk_ManagerData(Ttk_Manager *); - /* Returns: client data associated with master */ - MODULE_SCOPE void *Ttk_SlaveData(Ttk_Manager *, int slaveIndex); /* Returns: client data associated with slave */ diff --git a/generic/ttk/ttkTheme.c b/generic/ttk/ttkTheme.c index 813330f..987d376 100644 --- a/generic/ttk/ttkTheme.c +++ b/generic/ttk/ttkTheme.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * $Id: ttkTheme.c,v 1.6.2.2 2007/11/21 16:46:27 dgp Exp $ + * $Id: ttkTheme.c,v 1.6.2.3 2007/12/04 17:05:20 dgp Exp $ */ #include <stdlib.h> @@ -671,7 +671,8 @@ Ttk_GetResourceCache(Tcl_Interp *interp) * Register a new layout specification with a style. * @@@ TODO: Make sure layoutName is not ".", root style must not have a layout */ -static void Ttk_RegisterLayoutTemplate( +MODULE_SCOPE +void Ttk_RegisterLayoutTemplate( Ttk_Theme theme, /* Target theme */ const char *layoutName, /* Name of new layout */ Ttk_LayoutTemplate layoutTemplate) /* Template */ diff --git a/generic/ttk/ttkTheme.h b/generic/ttk/ttkTheme.h index 206784c..7eb8865 100644 --- a/generic/ttk/ttkTheme.h +++ b/generic/ttk/ttkTheme.h @@ -1,4 +1,4 @@ -/* $Id: ttkTheme.h,v 1.8.2.1 2007/10/27 04:23:16 dgp Exp $ +/* $Id: ttkTheme.h,v 1.8.2.2 2007/12/04 17:05:20 dgp Exp $ * Copyright (c) 2003 Joe English. Freely redistributable. * * Declarations for Tk theme engine. @@ -181,8 +181,9 @@ typedef unsigned int Ttk_PositionSpec; /* See below */ /* * Extra bits for layout specifications */ -#define TTK_CHILDREN (0x1000)/* for LayoutSpecs -- children follow */ -#define TTK_LAYOUT_END (0x2000)/* for LayoutSpecs -- end of child list */ +#define _TTK_CHILDREN (0x1000)/* for LayoutSpecs -- children follow */ +#define _TTK_LAYOUT_END (0x2000)/* for LayoutSpecs -- end of child list */ +#define _TTK_LAYOUT (0x4000)/* for LayoutSpec tables -- define layout */ #define _TTK_MASK_STICK (0x0F) /* See Ttk_UnparseLayout() */ #define _TTK_MASK_PACK (0xF0) /* See Ttk_UnparseLayout(), packStrings */ @@ -285,17 +286,28 @@ typedef struct { unsigned opcode; } TTKLayoutInstruction, *Ttk_LayoutSpec; -#define TTK_BEGIN_LAYOUT(name) static TTKLayoutInstruction name[] = { +#define TTK_BEGIN_LAYOUT_TABLE(name) \ + static TTKLayoutInstruction name[] = { +#define TTK_LAYOUT(name, content) \ + { name, _TTK_CHILDREN|_TTK_LAYOUT }, \ + content \ + { 0, _TTK_LAYOUT_END }, #define TTK_GROUP(name, flags, children) \ - { name, flags | TTK_CHILDREN }, \ + { name, flags | _TTK_CHILDREN }, \ children \ - { 0, TTK_LAYOUT_END }, + { 0, _TTK_LAYOUT_END }, #define TTK_NODE(name, flags) { name, flags }, -#define TTK_END_LAYOUT { 0, TTK_LAYOUT_END } }; +#define TTK_END_LAYOUT_TABLE { 0, _TTK_LAYOUT | _TTK_LAYOUT_END } }; + +#define TTK_BEGIN_LAYOUT(name) static TTKLayoutInstruction name[] = { +#define TTK_END_LAYOUT { 0, _TTK_LAYOUT_END } }; TTKAPI void Ttk_RegisterLayout( Ttk_Theme theme, const char *className, Ttk_LayoutSpec layoutSpec); +TTKAPI void Ttk_RegisterLayouts( + Ttk_Theme theme, Ttk_LayoutSpec layoutTable); + /*------------------------------------------------------------------------ * +++ Layout instances. */ diff --git a/generic/ttk/ttkThemeInt.h b/generic/ttk/ttkThemeInt.h index 9a904de..be1125b 100644 --- a/generic/ttk/ttkThemeInt.h +++ b/generic/ttk/ttkThemeInt.h @@ -1,5 +1,5 @@ /* - * $Id: ttkThemeInt.h,v 1.3 2006/12/10 19:19:44 jenglish Exp $ + * $Id: ttkThemeInt.h,v 1.3.2.1 2007/12/04 17:05:21 dgp Exp $ * * Theme engine: private definitions. * @@ -28,10 +28,13 @@ MODULE_SCOPE void Ttk_DrawElement( MODULE_SCOPE Tcl_Obj *Ttk_QueryStyle( Ttk_Style, void *, Tk_OptionTable, const char *, Ttk_State state); -MODULE_SCOPE Ttk_LayoutTemplate Ttk_ParseLayoutTemplate(Tcl_Interp *, Tcl_Obj *); +MODULE_SCOPE Ttk_LayoutTemplate Ttk_ParseLayoutTemplate( + Tcl_Interp *, Tcl_Obj *); MODULE_SCOPE Tcl_Obj *Ttk_UnparseLayoutTemplate(Ttk_LayoutTemplate); MODULE_SCOPE Ttk_LayoutTemplate Ttk_BuildLayoutTemplate(Ttk_LayoutSpec); MODULE_SCOPE void Ttk_FreeLayoutTemplate(Ttk_LayoutTemplate); +MODULE_SCOPE void Ttk_RegisterLayoutTemplate( + Ttk_Theme theme, const char *layoutName, Ttk_LayoutTemplate); MODULE_SCOPE Ttk_Style Ttk_GetStyle(Ttk_Theme themePtr, const char *styleName); MODULE_SCOPE Ttk_LayoutTemplate Ttk_FindLayoutTemplate( diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c index 39af902..b96d886 100644 --- a/generic/ttk/ttkTreeview.c +++ b/generic/ttk/ttkTreeview.c @@ -1,4 +1,4 @@ -/* $Id: ttkTreeview.c,v 1.16.2.4 2007/11/12 19:22:38 dgp Exp $ +/* $Id: ttkTreeview.c,v 1.16.2.5 2007/12/04 17:05:21 dgp Exp $ * Copyright (c) 2004, Joe English * * ttk::treeview widget implementation. @@ -3041,36 +3041,35 @@ static WidgetSpec TreeviewWidgetSpec = * +++ Layout specifications. */ -TTK_BEGIN_LAYOUT(TreeviewLayout) +TTK_BEGIN_LAYOUT_TABLE(LayoutTable) + +TTK_LAYOUT("Treeview", 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 + TTK_NODE("Treeview.treearea", TTK_FILL_BOTH)))) -TTK_BEGIN_LAYOUT(ItemLayout) +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_END_LAYOUT + TTK_NODE("Treeitem.text", TTK_PACK_LEFT)))) -TTK_BEGIN_LAYOUT(CellLayout) +TTK_LAYOUT("Cell", TTK_GROUP("Treedata.padding", TTK_FILL_BOTH, - TTK_NODE("Treeitem.text", TTK_FILL_BOTH)) -TTK_END_LAYOUT + TTK_NODE("Treeitem.text", TTK_FILL_BOTH))) -TTK_BEGIN_LAYOUT(HeadingLayout) +TTK_LAYOUT("Heading", TTK_NODE("Treeheading.cell", TTK_FILL_BOTH) TTK_GROUP("Treeheading.border", TTK_FILL_BOTH, TTK_GROUP("Treeheading.padding", TTK_FILL_BOTH, TTK_NODE("Treeheading.image", TTK_PACK_RIGHT) - TTK_NODE("Treeheading.text", TTK_FILL_X))) -TTK_END_LAYOUT + TTK_NODE("Treeheading.text", TTK_FILL_X)))) + +TTK_LAYOUT("Row", + TTK_NODE("Treeitem.row", TTK_FILL_BOTH)) -TTK_BEGIN_LAYOUT(RowLayout) - TTK_NODE("Treeitem.row", TTK_FILL_BOTH) -TTK_END_LAYOUT +TTK_END_LAYOUT_TABLE /*------------------------------------------------------------------------ * +++ Tree indicator element. @@ -3201,11 +3200,7 @@ void TtkTreeview_Init(Tcl_Interp *interp) Ttk_RegisterElement(interp, theme, "Treeheading.cell", &RowElementSpec, 0); Ttk_RegisterElement(interp, theme, "treearea", &ttkNullElementSpec, 0); - Ttk_RegisterLayout(theme, TreeviewWidgetSpec.className, TreeviewLayout); - Ttk_RegisterLayout(theme, "Item", ItemLayout); - Ttk_RegisterLayout(theme, "Cell", CellLayout); - Ttk_RegisterLayout(theme, "Heading", HeadingLayout); - Ttk_RegisterLayout(theme, "Row", RowLayout); + Ttk_RegisterLayouts(theme, LayoutTable); } /*EOF*/ diff --git a/generic/ttk/ttkWidget.h b/generic/ttk/ttkWidget.h index 2049323..7f67b68 100644 --- a/generic/ttk/ttkWidget.h +++ b/generic/ttk/ttkWidget.h @@ -1,4 +1,4 @@ -/* $Id: ttkWidget.h,v 1.6 2007/01/11 14:49:47 jenglish Exp $ +/* $Id: ttkWidget.h,v 1.6.2.1 2007/12/04 17:05:21 dgp Exp $ * Copyright (c) 2003, Joe English * Helper routines for widget implementations. */ @@ -6,7 +6,8 @@ #ifndef _TTKWIDGET #define _TTKWIDGET -/* State flags for 'flags' field. +/* + * State flags for 'flags' field. */ #define WIDGET_DESTROYED 0x0001 #define REDISPLAY_PENDING 0x0002 /* scheduled call to RedisplayWidget */ @@ -91,27 +92,33 @@ struct WidgetSpec_ MODULE_SCOPE int TtkNullInitialize(Tcl_Interp *, void *); MODULE_SCOPE int TtkNullPostConfigure(Tcl_Interp *, void *, int); MODULE_SCOPE void TtkNullCleanup(void *recordPtr); -MODULE_SCOPE Ttk_Layout TtkWidgetGetLayout(Tcl_Interp *, Ttk_Theme, void *recordPtr); +MODULE_SCOPE Ttk_Layout TtkWidgetGetLayout( + Tcl_Interp *, Ttk_Theme, void *recordPtr); MODULE_SCOPE Ttk_Layout TtkWidgetGetOrientedLayout( - Tcl_Interp *, Ttk_Theme, void *recordPtr, Tcl_Obj *orientObj); + Tcl_Interp *, Ttk_Theme, void *recordPtr, Tcl_Obj *orientObj); MODULE_SCOPE int TtkWidgetSize(void *recordPtr, int *w, int *h); MODULE_SCOPE void TtkWidgetDoLayout(void *recordPtr); MODULE_SCOPE void TtkWidgetDisplay(void *recordPtr, Drawable); MODULE_SCOPE int TtkCoreConfigure(Tcl_Interp*, void *, int mask); -/* Commands present in all widgets: - */ -MODULE_SCOPE int TtkWidgetConfigureCommand(Tcl_Interp *, int, Tcl_Obj*const[], void *); -MODULE_SCOPE int TtkWidgetCgetCommand(Tcl_Interp *, int, Tcl_Obj*const[], void *); -MODULE_SCOPE int TtkWidgetInstateCommand(Tcl_Interp *, int, Tcl_Obj*const[], void *); -MODULE_SCOPE int TtkWidgetStateCommand(Tcl_Interp *, int, Tcl_Obj*const[], void *); - /* Common widget commands: */ -MODULE_SCOPE int TtkWidgetIdentifyCommand(Tcl_Interp *, int, Tcl_Obj*const[], void *); - -MODULE_SCOPE int TtkWidgetConstructorObjCmd(ClientData,Tcl_Interp*,int,Tcl_Obj*CONST[]); +MODULE_SCOPE int TtkWidgetConfigureCommand( + Tcl_Interp *, int, Tcl_Obj*const[], void *); +MODULE_SCOPE int TtkWidgetCgetCommand( + Tcl_Interp *, int, Tcl_Obj*const[], void *); +MODULE_SCOPE int TtkWidgetInstateCommand( + Tcl_Interp *, int, Tcl_Obj*const[], void *); +MODULE_SCOPE int TtkWidgetStateCommand( + Tcl_Interp *, int, Tcl_Obj*const[], void *); +MODULE_SCOPE int TtkWidgetIdentifyCommand( + Tcl_Interp *, int, Tcl_Obj*const[], void *); + +/* Widget constructor: + */ +MODULE_SCOPE int TtkWidgetConstructorObjCmd( + ClientData, Tcl_Interp*, int, Tcl_Obj*const[]); #define RegisterWidget(interp, name, specPtr) \ Tcl_CreateObjCommand(interp, name, \ @@ -236,7 +243,8 @@ MODULE_SCOPE const char *ttkDefaultStrings[]; /* * ... other option types... */ -MODULE_SCOPE int TtkGetLabelAnchorFromObj(Tcl_Interp*,Tcl_Obj*,Ttk_PositionSpec *); +MODULE_SCOPE int TtkGetLabelAnchorFromObj( + Tcl_Interp*, Tcl_Obj*, Ttk_PositionSpec *); /* * Platform-specific initialization. diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index 95d8723..e1b82f4 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -27,7 +27,7 @@ * top-level window, not to the Tk_Window. BoxToRect() * accounts for this. * - * RCS: @(#) $Id: ttkMacOSXTheme.c,v 1.7.2.7 2007/11/21 16:46:28 dgp Exp $ + * RCS: @(#) $Id: ttkMacOSXTheme.c,v 1.7.2.8 2007/12/04 17:05:21 dgp Exp $ */ #include "tkMacOSXPrivate.h" @@ -936,66 +936,61 @@ static Ttk_ElementSpec DisclosureElementSpec = { /*---------------------------------------------------------------------- * +++ Widget layouts. */ -TTK_BEGIN_LAYOUT(ToolbarLayout) - TTK_NODE("Toolbar.background", TTK_FILL_BOTH) -TTK_END_LAYOUT -TTK_BEGIN_LAYOUT(ButtonLayout) +TTK_BEGIN_LAYOUT_TABLE(LayoutTable) + +TTK_LAYOUT("Toolbar", + TTK_NODE("Toolbar.background", TTK_FILL_BOTH)) + +TTK_LAYOUT("TButton", TTK_GROUP("Button.button", TTK_FILL_BOTH, TTK_GROUP("Button.padding", TTK_FILL_BOTH, - TTK_NODE("Button.label", TTK_FILL_BOTH))) -TTK_END_LAYOUT + TTK_NODE("Button.label", TTK_FILL_BOTH)))) -TTK_BEGIN_LAYOUT(RadiobuttonLayout) +TTK_LAYOUT("TRadiobutton", TTK_GROUP("Radiobutton.button", TTK_FILL_BOTH, TTK_GROUP("Radiobutton.padding", TTK_FILL_BOTH, - TTK_NODE("Radiobutton.label", TTK_PACK_LEFT))) -TTK_END_LAYOUT + TTK_NODE("Radiobutton.label", TTK_PACK_LEFT)))) -TTK_BEGIN_LAYOUT(CheckbuttonLayout) +TTK_LAYOUT("TCheckbutton", TTK_GROUP("Checkbutton.button", TTK_FILL_BOTH, TTK_GROUP("Checkbutton.padding", TTK_FILL_BOTH, - TTK_NODE("Checkbutton.label", TTK_PACK_LEFT))) -TTK_END_LAYOUT + TTK_NODE("Checkbutton.label", TTK_PACK_LEFT)))) -TTK_BEGIN_LAYOUT(MenubuttonLayout) +TTK_LAYOUT("TMenubutton", TTK_GROUP("Menubutton.button", TTK_FILL_BOTH, TTK_GROUP("Menubutton.padding", TTK_FILL_BOTH, - TTK_NODE("Menubutton.label", TTK_PACK_LEFT))) -TTK_END_LAYOUT + TTK_NODE("Menubutton.label", TTK_PACK_LEFT)))) -TTK_BEGIN_LAYOUT(ComboboxLayout) +TTK_LAYOUT("TCombobox", TTK_GROUP("Combobox.button", TTK_PACK_TOP|TTK_FILL_X, TTK_GROUP("Combobox.padding", TTK_FILL_BOTH, - TTK_NODE("Combobox.textarea", TTK_PACK_LEFT|TTK_FILL_X))) -TTK_END_LAYOUT + TTK_NODE("Combobox.textarea", TTK_PACK_LEFT|TTK_FILL_X)))) /* Notebook tabs -- no focus ring */ -TTK_BEGIN_LAYOUT(TabLayout) +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_END_LAYOUT + TTK_NODE("Notebook.label", TTK_EXPAND|TTK_FILL_BOTH)))) /* Progress bars -- track only */ -TTK_BEGIN_LAYOUT(ProgressbarLayout) - TTK_NODE("Progressbar.track", TTK_EXPAND|TTK_FILL_BOTH) -TTK_END_LAYOUT +TTK_LAYOUT("TProgressbar", + TTK_NODE("Progressbar.track", TTK_EXPAND|TTK_FILL_BOTH)) /* Tree heading -- no border, fixed height */ -TTK_BEGIN_LAYOUT(TreeheadingLayout) +TTK_LAYOUT("Heading", TTK_NODE("Treeheading.cell", TTK_FILL_X) TTK_NODE("Treeheading.image", TTK_PACK_RIGHT) - TTK_NODE("Treeheading.text", 0) -TTK_END_LAYOUT + TTK_NODE("Treeheading.text", 0)) /* Tree items -- omit focus ring */ -TTK_BEGIN_LAYOUT(TreeitemLayout) +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_NODE("Treeitem.text", TTK_PACK_LEFT)) -TTK_END_LAYOUT + TTK_NODE("Treeitem.text", TTK_PACK_LEFT))) + +TTK_END_LAYOUT_TABLE /*---------------------------------------------------------------------- * +++ Initialization. @@ -1060,16 +1055,7 @@ static int AquaTheme_Init(Tcl_Interp *interp) /* * Layouts: */ - Ttk_RegisterLayout(themePtr, "Toolbar", ToolbarLayout); - Ttk_RegisterLayout(themePtr, "TButton", ButtonLayout); - Ttk_RegisterLayout(themePtr, "TCheckbutton", CheckbuttonLayout); - Ttk_RegisterLayout(themePtr, "TRadiobutton", RadiobuttonLayout); - Ttk_RegisterLayout(themePtr, "TMenubutton", MenubuttonLayout); - Ttk_RegisterLayout(themePtr, "TCombobox", ComboboxLayout); - Ttk_RegisterLayout(themePtr, "TProgressbar", ProgressbarLayout); - Ttk_RegisterLayout(themePtr, "TNotebook.Tab", TabLayout); - Ttk_RegisterLayout(themePtr, "Heading", TreeheadingLayout); - Ttk_RegisterLayout(themePtr, "Item", TreeitemLayout); + Ttk_RegisterLayouts(themePtr, LayoutTable); Tcl_PkgProvide(interp, "ttk::theme::aqua", TTK_VERSION); return TCL_OK; diff --git a/win/configure b/win/configure index 0075426..5f56e1d 100755 --- a/win/configure +++ b/win/configure @@ -309,7 +309,7 @@ ac_includes_default="\ # include <unistd.h> #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT AR RANLIB RC SET_MAKE TCL_THREADS CYGPATH CELIB_DIR DL_LIBS CFLAGS_DEBUG CFLAGS_OPTIMIZE CFLAGS_WARNING CPP EGREP MAN2TCLFLAGS CFLAGS_DEFAULT LDFLAGS_DEFAULT TCL_VERSION TCL_PATCH_LEVEL TCL_BIN_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_DEFS BUILD_TCLSH TCLSH_PROG TK_WIN_VERSION MACHINE TK_VERSION TK_MAJOR_VERSION TK_MINOR_VERSION TK_PATCH_LEVEL TK_DBGX TK_LIB_FILE TK_DLL_FILE TK_STUB_LIB_FILE TK_STUB_LIB_FLAG TK_BUILD_STUB_LIB_SPEC TK_SRC_DIR TK_BIN_DIR TCL_MAJOR_VERSION TCL_MINOR_VERSION TCL_DBGX CFG_TK_SHARED_LIB_SUFFIX CFG_TK_UNSHARED_LIB_SUFFIX CFG_TK_EXPORT_FILE_SUFFIX TK_SHARED_BUILD DEPARG EXTRA_CFLAGS STLIB_LD SHLIB_LD SHLIB_LD_LIBS SHLIB_CFLAGS SHLIB_SUFFIX CC_OBJNAME CC_EXENAME LDFLAGS_DEBUG LDFLAGS_OPTIMIZE LDFLAGS_CONSOLE LDFLAGS_WINDOW RC_OUT RC_TYPE RC_INCLUDE RC_DEFINE RC_DEFINES TK_RES RES LIBS_GUI DLLSUFFIX LIBPREFIX LIBSUFFIX EXESUFFIX LIBRARIES MAKE_LIB POST_MAKE_LIB MAKE_DLL MAKE_EXE TK_LIB_FLAG TK_LIB_SPEC TK_BUILD_LIB_SPEC TK_STUB_LIB_SPEC TK_STUB_LIB_PATH TK_BUILD_STUB_LIB_PATH TK_CC_SEARCH_FLAGS TK_LD_SEARCH_FLAGS LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT AR RANLIB RC SET_MAKE TCL_THREADS CYGPATH CELIB_DIR DL_LIBS CFLAGS_DEBUG CFLAGS_OPTIMIZE CFLAGS_WARNING CPP EGREP MAN2TCLFLAGS CFLAGS_DEFAULT LDFLAGS_DEFAULT TCL_VERSION TCL_BIN_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_DEFS BUILD_TCLSH TCLSH_PROG TK_WIN_VERSION MACHINE TK_VERSION TK_MAJOR_VERSION TK_MINOR_VERSION TK_PATCH_LEVEL TK_DBGX TK_LIB_FILE TK_DLL_FILE TK_STUB_LIB_FILE TK_STUB_LIB_FLAG TK_BUILD_STUB_LIB_SPEC TK_SRC_DIR TK_BIN_DIR TCL_MAJOR_VERSION TCL_MINOR_VERSION TCL_PATCH_LEVEL TCL_DBGX CFG_TK_SHARED_LIB_SUFFIX CFG_TK_UNSHARED_LIB_SUFFIX CFG_TK_EXPORT_FILE_SUFFIX TK_SHARED_BUILD DEPARG EXTRA_CFLAGS STLIB_LD SHLIB_LD SHLIB_LD_LIBS SHLIB_CFLAGS SHLIB_SUFFIX CC_OBJNAME CC_EXENAME LDFLAGS_DEBUG LDFLAGS_OPTIMIZE LDFLAGS_CONSOLE LDFLAGS_WINDOW RC_OUT RC_TYPE RC_INCLUDE RC_DEFINE RC_DEFINES TK_RES RES LIBS_GUI DLLSUFFIX LIBPREFIX LIBSUFFIX EXESUFFIX LIBRARIES MAKE_LIB POST_MAKE_LIB MAKE_DLL MAKE_EXE TK_LIB_FLAG TK_LIB_SPEC TK_BUILD_LIB_SPEC TK_STUB_LIB_SPEC TK_STUB_LIB_PATH TK_BUILD_STUB_LIB_PATH TK_CC_SEARCH_FLAGS TK_LD_SEARCH_FLAGS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -2731,8 +2731,8 @@ echo "$as_me: WARNING: 64bit mode not supported with GCC on Windows" >&2;} fi SHLIB_LD="" SHLIB_LD_LIBS="" - LIBS="" - LIBS_GUI="-lgdi32 -lcomdlg32 -limm32 -lcomctl32 -lshell32 -lole32 -loleaut32 -luuid" + LIBS="-lws2_32" + LIBS_GUI="-lgdi32 -lcomdlg32 -limm32 -lcomctl32 -lshell32 -luuid" STLIB_LD='${AR} cr' RC_OUT=-o RC_TYPE= @@ -2908,6 +2908,7 @@ echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6 fi fi + LIBS="user32.lib advapi32.lib ws2_32.lib" if test "$do64bit" != "no" ; then # The space-based-path will work for the Makefile, but will # not work if AC_TRY_COMPILE is called. TEA has the @@ -2922,7 +2923,7 @@ echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6 LINKBIN="\"${PATH64}/link.exe\"" # Avoid 'unresolved external symbol __security_cookie' errors. # c.f. http://support.microsoft.com/?id=894573 - LIBS="user32.lib advapi32.lib bufferoverflowU.lib" + LIBS="$LIBS bufferoverflowU.lib" else RC="rc" # -Od - no optimization @@ -2932,7 +2933,6 @@ echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6 CFLAGS_OPTIMIZE="-nologo -O2 ${runtime}" lflags="-nologo" LINKBIN="link" - LIBS="user32.lib advapi32.lib" fi if test "$doWince" != "no" ; then @@ -3038,7 +3038,7 @@ _ACEOF LIBS="$LIBS \"\${CELIB_DIR}/wince-${ARCH}-pocket-wce300-release/celib.lib\"" LIBS_GUI="commctrl.lib commdlg.lib" else - LIBS_GUI="gdi32.lib comdlg32.lib imm32.lib comctl32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib" + LIBS_GUI="gdi32.lib comdlg32.lib imm32.lib comctl32.lib shell32.lib uuid.lib" fi SHLIB_LD="${LINKBIN} -dll -incremental:no ${lflags}" @@ -3958,7 +3958,6 @@ echo "${ECHO_T}file not found" >&6 - echo "$as_me:$LINENO: checking for tclsh in Tcl build directory" >&5 echo $ECHO_N "checking for tclsh in Tcl build directory... $ECHO_C" >&6 BUILD_TCLSH=${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT} @@ -4815,7 +4814,6 @@ s,@MAN2TCLFLAGS@,$MAN2TCLFLAGS,;t t s,@CFLAGS_DEFAULT@,$CFLAGS_DEFAULT,;t t s,@LDFLAGS_DEFAULT@,$LDFLAGS_DEFAULT,;t t s,@TCL_VERSION@,$TCL_VERSION,;t t -s,@TCL_PATCH_LEVEL@,$TCL_PATCH_LEVEL,;t t s,@TCL_BIN_DIR@,$TCL_BIN_DIR,;t t s,@TCL_SRC_DIR@,$TCL_SRC_DIR,;t t s,@TCL_LIB_FILE@,$TCL_LIB_FILE,;t t @@ -4843,6 +4841,7 @@ s,@TK_SRC_DIR@,$TK_SRC_DIR,;t t s,@TK_BIN_DIR@,$TK_BIN_DIR,;t t s,@TCL_MAJOR_VERSION@,$TCL_MAJOR_VERSION,;t t s,@TCL_MINOR_VERSION@,$TCL_MINOR_VERSION,;t t +s,@TCL_PATCH_LEVEL@,$TCL_PATCH_LEVEL,;t t s,@TCL_DBGX@,$TCL_DBGX,;t t s,@CFG_TK_SHARED_LIB_SUFFIX@,$CFG_TK_SHARED_LIB_SUFFIX,;t t s,@CFG_TK_UNSHARED_LIB_SUFFIX@,$CFG_TK_UNSHARED_LIB_SUFFIX,;t t @@ -137,7 +137,6 @@ AC_DEFUN([SC_LOAD_TCLCONFIG], [ eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\"" AC_SUBST(TCL_VERSION) - AC_SUBST(TCL_PATCH_LEVEL) AC_SUBST(TCL_BIN_DIR) AC_SUBST(TCL_SRC_DIR) @@ -447,8 +446,8 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ fi SHLIB_LD="" SHLIB_LD_LIBS="" - LIBS="" - LIBS_GUI="-lgdi32 -lcomdlg32 -limm32 -lcomctl32 -lshell32 -lole32 -loleaut32 -luuid" + LIBS="-lws2_32" + LIBS_GUI="-lgdi32 -lcomdlg32 -limm32 -lcomctl32 -lshell32 -luuid" STLIB_LD='${AR} cr' RC_OUT=-o RC_TYPE= @@ -614,6 +613,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ fi fi + LIBS="user32.lib advapi32.lib ws2_32.lib" if test "$do64bit" != "no" ; then # The space-based-path will work for the Makefile, but will # not work if AC_TRY_COMPILE is called. TEA has the @@ -628,7 +628,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ LINKBIN="\"${PATH64}/link.exe\"" # Avoid 'unresolved external symbol __security_cookie' errors. # c.f. http://support.microsoft.com/?id=894573 - LIBS="user32.lib advapi32.lib bufferoverflowU.lib" + LIBS="$LIBS bufferoverflowU.lib" else RC="rc" # -Od - no optimization @@ -638,7 +638,6 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ CFLAGS_OPTIMIZE="-nologo -O2 ${runtime}" lflags="-nologo" LINKBIN="link" - LIBS="user32.lib advapi32.lib" fi if test "$doWince" != "no" ; then @@ -731,7 +730,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ LIBS="$LIBS \"\${CELIB_DIR}/wince-${ARCH}-pocket-wce300-release/celib.lib\"" LIBS_GUI="commctrl.lib commdlg.lib" else - LIBS_GUI="gdi32.lib comdlg32.lib imm32.lib comctl32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib" + LIBS_GUI="gdi32.lib comdlg32.lib imm32.lib comctl32.lib shell32.lib uuid.lib" fi SHLIB_LD="${LINKBIN} -dll -incremental:no ${lflags}" diff --git a/win/ttkWinTheme.c b/win/ttkWinTheme.c index 346b696..3557fdc 100644 --- a/win/ttkWinTheme.c +++ b/win/ttkWinTheme.c @@ -1,6 +1,6 @@ /* winTheme.c - Copyright (C) 2004 Pat Thoyts <patthoyts@users.sf.net> * - * $Id: ttkWinTheme.c,v 1.5.2.4 2007/11/12 19:22:39 dgp Exp $ + * $Id: ttkWinTheme.c,v 1.5.2.5 2007/12/04 17:05:21 dgp Exp $ */ #ifdef _MSC_VER @@ -38,7 +38,7 @@ static RECT BoxToRect(Ttk_Box b) * which must be handled specially. * * Passing the BF_FLAT flag to DrawEdge() yields something similar - * to TK_RELIEF_SOLID. TK_RELIEF_FLAT can be implemented by not + * to TK_RELIEF_SOLID. TK_RELIEF_FLAT can be implemented by not * drawing anything. */ static unsigned int ReliefToEdge(int relief) @@ -53,7 +53,7 @@ static unsigned int ReliefToEdge(int relief) case TK_RELIEF_FLAT: return BDR_RAISEDOUTER; } } - + /* ---------------------------------------------------------------------- */ static Ttk_StateTable checkbutton_statemap[] = @@ -74,7 +74,7 @@ static Ttk_StateTable pushbutton_statemap[] = { 0, 0, 0 } }; -static Ttk_StateTable arrow_statemap[] = +static Ttk_StateTable arrow_statemap[] = { { DFCS_INACTIVE, TTK_STATE_DISABLED, 0 }, { DFCS_PUSHED | DFCS_FLAT, TTK_STATE_PRESSED, 0 }, @@ -98,7 +98,7 @@ typedef struct static FrameControlElementData FrameControlElements[] = { - { "Checkbutton.indicator", + { "Checkbutton.indicator", DFC_BUTTON, DFCS_BUTTONCHECK, SM_CYMENUCHECK, SM_CYMENUCHECK, checkbutton_statemap, {0,0,4,0} }, { "Radiobutton.indicator", @@ -149,7 +149,7 @@ static void FrameControlElementDraw( TkWinReleaseDrawableDC(d, hdc, &dcState); } -static Ttk_ElementSpec FrameControlElementSpec = +static Ttk_ElementSpec FrameControlElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), @@ -220,7 +220,7 @@ typedef struct static Ttk_ElementOptionSpec FieldElementOptions[] = { - { "-fieldbackground", TK_OPTION_BORDER, + { "-fieldbackground", TK_OPTION_BORDER, Tk_Offset(FieldElement,backgroundObj), "white" }, {NULL} }; @@ -392,7 +392,7 @@ static Ttk_ElementSpec FocusElementSpec = FocusElementSize, FocusElementDraw }; - + /* FillFocusElement -- * Draws a focus ring filled with the selection color */ @@ -426,7 +426,7 @@ static void FillFocusElementDraw( TkWinReleaseDrawableDC(d, hdc, &dcState); } } - + /* * ComboboxFocusElement -- * Read-only comboboxes have a filled focus ring, editable ones do not. @@ -578,7 +578,7 @@ static Ttk_ElementSpec ThumbElementSpec = ThumbElementDraw }; -/* ---------------------------------------------------------------------- +/* ---------------------------------------------------------------------- * The slider element is the shaped thumb used in the slider widget. * Windows likes to call this a trackbar. */ @@ -670,24 +670,26 @@ static Ttk_ElementSpec ClientElementSpec = * +++ Layouts. */ -TTK_BEGIN_LAYOUT(ButtonLayout) +TTK_BEGIN_LAYOUT_TABLE(LayoutTable) + +TTK_LAYOUT("TButton", TTK_GROUP("Button.border", TTK_FILL_BOTH, TTK_GROUP("Button.padding", TTK_FILL_BOTH, - TTK_NODE("Button.label", TTK_FILL_BOTH))) -TTK_END_LAYOUT + TTK_NODE("Button.label", TTK_FILL_BOTH)))) -TTK_BEGIN_LAYOUT(ComboboxLayout) +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_NODE("Combobox.textarea", TTK_FILL_BOTH)))) -TTK_END_LAYOUT + TTK_NODE("Combobox.textarea", TTK_FILL_BOTH))))) +TTK_END_LAYOUT_TABLE /* ---------------------------------------------------------------------- */ -MODULE_SCOPE int TtkWinTheme_Init(Tcl_Interp *interp, HWND hwnd) +MODULE_SCOPE +int TtkWinTheme_Init(Tcl_Interp *interp, HWND hwnd) { Ttk_Theme themePtr, parentPtr; FrameControlElementData *fce = FrameControlElements; @@ -699,11 +701,11 @@ MODULE_SCOPE int TtkWinTheme_Init(Tcl_Interp *interp, HWND hwnd) } Ttk_RegisterElementSpec(themePtr, "border", &BorderElementSpec, NULL); - Ttk_RegisterElementSpec(themePtr, "Button.border", + Ttk_RegisterElementSpec(themePtr, "Button.border", &ButtonBorderElementSpec, NULL); Ttk_RegisterElementSpec(themePtr, "field", &FieldElementSpec, NULL); Ttk_RegisterElementSpec(themePtr, "focus", &FocusElementSpec, NULL); - Ttk_RegisterElementSpec(themePtr, "Combobox.focus", + Ttk_RegisterElementSpec(themePtr, "Combobox.focus", &ComboboxFocusElementSpec, NULL); Ttk_RegisterElementSpec(themePtr, "thumb", &ThumbElementSpec, NULL); Ttk_RegisterElementSpec(themePtr, "slider", &SliderElementSpec, NULL); @@ -717,8 +719,7 @@ MODULE_SCOPE int TtkWinTheme_Init(Tcl_Interp *interp, HWND hwnd) &FrameControlElementSpec, fce); } - Ttk_RegisterLayout(themePtr, "TButton", ButtonLayout); - Ttk_RegisterLayout(themePtr, "TCombobox", ComboboxLayout); + Ttk_RegisterLayouts(themePtr, LayoutTable); Tcl_PkgProvide(interp, "ttk::theme::winnative", TTK_VERSION); return TCL_OK; diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c index fde13bd..3d91fde 100644 --- a/win/ttkWinXPTheme.c +++ b/win/ttkWinXPTheme.c @@ -1,5 +1,5 @@ /* - * $Id: ttkWinXPTheme.c,v 1.12.2.3 2007/11/21 16:46:31 dgp Exp $ + * $Id: ttkWinXPTheme.c,v 1.12.2.4 2007/12/04 17:05:21 dgp Exp $ * * Tk theme engine which uses the Windows XP "Visual Styles" API * Adapted from Georgios Petasis' XP theme patch. @@ -825,49 +825,47 @@ static Ttk_ElementSpec TextElementSpec = * +++ Widget layouts: */ -TTK_BEGIN_LAYOUT(ButtonLayout) +TTK_BEGIN_LAYOUT_TABLE(LayoutTable) + +TTK_LAYOUT("TButton", TTK_GROUP("Button.button", TTK_FILL_BOTH, TTK_GROUP("Button.focus", TTK_FILL_BOTH, TTK_GROUP("Button.padding", TTK_FILL_BOTH, - TTK_NODE("Button.label", TTK_FILL_BOTH)))) -TTK_END_LAYOUT + TTK_NODE("Button.label", TTK_FILL_BOTH))))) -TTK_BEGIN_LAYOUT(MenubuttonLayout) +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_NODE("Menubutton.label", 0))) -TTK_END_LAYOUT + TTK_NODE("Menubutton.label", 0)))) -TTK_BEGIN_LAYOUT(HorizontalScrollbarLayout) +TTK_LAYOUT("Horizontal.TScrollbar", 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_GROUP("Horizontal.Scrollbar.thumb", TTK_FILL_BOTH|TTK_UNIT, - TTK_NODE("Horizontal.Scrollbar.grip", 0))) -TTK_END_LAYOUT + TTK_NODE("Horizontal.Scrollbar.grip", 0)))) -TTK_BEGIN_LAYOUT(VerticalScrollbarLayout) +TTK_LAYOUT("Vertical.TScrollbar", 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_GROUP("Vertical.Scrollbar.thumb", TTK_FILL_BOTH|TTK_UNIT, - TTK_NODE("Vertical.Scrollbar.grip", 0))) -TTK_END_LAYOUT + 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_NODE("Horizontal.Scale.track", TTK_FILL_X) + TTK_NODE("Horizontal.Scale.slider", TTK_PACK_LEFT) ))) -TTK_BEGIN_LAYOUT(VerticalScaleLayout) +TTK_LAYOUT("Vertical.TScale", TTK_GROUP("Scale.focus", TTK_EXPAND|TTK_FILL_BOTH, TTK_GROUP("Vertical.Scale.trough", TTK_EXPAND|TTK_FILL_BOTH, TTK_NODE("Vertical.Scale.track", TTK_FILL_Y) - TTK_NODE("Vertical.Scale.slider", TTK_PACK_TOP) )) -TTK_END_LAYOUT + TTK_NODE("Vertical.Scale.slider", TTK_PACK_TOP) ))) -TTK_BEGIN_LAYOUT(HorizontalScaleLayout) - TTK_GROUP("Scale.focus", TTK_EXPAND|TTK_FILL_BOTH, - TTK_GROUP("Horizontal.Scale.trough", TTK_EXPAND|TTK_FILL_BOTH, - TTK_NODE("Horizontal.Scale.track", TTK_FILL_X) - TTK_NODE("Horizontal.Scale.slider", TTK_PACK_LEFT) )) -TTK_END_LAYOUT +TTK_END_LAYOUT_TABLE /*---------------------------------------------------------------------- * +++ XP element info table: @@ -1016,14 +1014,7 @@ MODULE_SCOPE int TtkXPTheme_Init(Tcl_Interp *interp, HWND hwnd) /* * Layouts: */ - Ttk_RegisterLayout(themePtr, "TButton", ButtonLayout); - Ttk_RegisterLayout(themePtr, "TMenubutton", MenubuttonLayout); - Ttk_RegisterLayout(themePtr, "Vertical.TScrollbar", - VerticalScrollbarLayout); - Ttk_RegisterLayout(themePtr, "Horizontal.TScrollbar", - HorizontalScrollbarLayout); - Ttk_RegisterLayout(themePtr, "Vertical.TScale", VerticalScaleLayout); - Ttk_RegisterLayout(themePtr, "Horizontal.TScale", HorizontalScaleLayout); + Ttk_RegisterLayouts(themePtr, LayoutTable); Tcl_PkgProvide(interp, "ttk::theme::xpnative", TTK_VERSION); |