summaryrefslogtreecommitdiffstats
path: root/generic/ttk
diff options
context:
space:
mode:
authorjenglish <jenglish@flightlab.com>2006-12-14 19:51:02 (GMT)
committerjenglish <jenglish@flightlab.com>2006-12-14 19:51:02 (GMT)
commitb822c063c5281f853e702026499f46c31b47e518 (patch)
treeeddfc995a90320e7557281183d21567f58985d44 /generic/ttk
parentd4a63ee0259256e40eba77a360b9902afc472bc4 (diff)
downloadtk-b822c063c5281f853e702026499f46c31b47e518.zip
tk-b822c063c5281f853e702026499f46c31b47e518.tar.gz
tk-b822c063c5281f853e702026499f46c31b47e518.tar.bz2
Global reduction: use per-file *_Init() routines to reduce
the number of globally-visible initialization records.
Diffstat (limited to 'generic/ttk')
-rw-r--r--generic/ttk/ttkButton.c40
-rw-r--r--generic/ttk/ttkElements.c21
-rw-r--r--generic/ttk/ttkEntry.c24
-rw-r--r--generic/ttk/ttkFrame.c28
-rw-r--r--generic/ttk/ttkImage.c9
-rw-r--r--generic/ttk/ttkInit.c85
-rw-r--r--generic/ttk/ttkLabel.c30
-rw-r--r--generic/ttk/ttkNotebook.c11
-rw-r--r--generic/ttk/ttkPanedwindow.c7
-rw-r--r--generic/ttk/ttkProgress.c10
-rw-r--r--generic/ttk/ttkScale.c16
-rw-r--r--generic/ttk/ttkScrollbar.c21
-rw-r--r--generic/ttk/ttkSeparator.c28
-rw-r--r--generic/ttk/ttkTheme.h37
-rw-r--r--generic/ttk/ttkTreeview.c12
-rw-r--r--generic/ttk/ttkWidget.h11
16 files changed, 211 insertions, 179 deletions
diff --git a/generic/ttk/ttkButton.c b/generic/ttk/ttkButton.c
index 033279f..b87a7dbf 100644
--- a/generic/ttk/ttkButton.c
+++ b/generic/ttk/ttkButton.c
@@ -1,4 +1,4 @@
-/* $Id: ttkButton.c,v 1.3 2006/12/09 20:53:35 jenglish Exp $
+/* $Id: ttkButton.c,v 1.4 2006/12/14 19:51:02 jenglish Exp $
* Copyright (c) 2003, Joe English
*
* label, button, checkbutton, radiobutton, and menubutton widgets.
@@ -259,8 +259,7 @@ static WidgetCommandSpec LabelCommands[] =
{ NULL, NULL }
};
-MODULE_SCOPE WidgetSpec ttkLabelWidgetSpec;
-WidgetSpec ttkLabelWidgetSpec =
+static WidgetSpec LabelWidgetSpec =
{
"TLabel", /* className */
sizeof(Label), /* recordSize */
@@ -270,7 +269,7 @@ WidgetSpec ttkLabelWidgetSpec =
BaseCleanup, /* cleanupProc */
BaseConfigure, /* configureProc */
BasePostConfigure, /* postConfigureProc */
- TtkWidgetGetLayout, /* getLayoutProc */
+ TtkWidgetGetLayout, /* getLayoutProc */
TtkWidgetSize, /* sizeProc */
TtkWidgetDoLayout, /* layoutProc */
TtkWidgetDisplay /* displayProc */
@@ -362,8 +361,7 @@ static WidgetCommandSpec ButtonCommands[] =
{ NULL, NULL }
};
-MODULE_SCOPE WidgetSpec ttkButtonWidgetSpec;
-WidgetSpec ttkButtonWidgetSpec =
+static WidgetSpec ButtonWidgetSpec =
{
"TButton", /* className */
sizeof(Button), /* recordSize */
@@ -373,7 +371,7 @@ WidgetSpec ttkButtonWidgetSpec =
BaseCleanup, /* cleanupProc */
ButtonConfigure, /* configureProc */
BasePostConfigure, /* postConfigureProc */
- TtkWidgetGetLayout, /* getLayoutProc */
+ TtkWidgetGetLayout, /* getLayoutProc */
TtkWidgetSize, /* sizeProc */
TtkWidgetDoLayout, /* layoutProc */
TtkWidgetDisplay /* displayProc */
@@ -555,8 +553,7 @@ static WidgetCommandSpec CheckbuttonCommands[] =
{ NULL, NULL }
};
-MODULE_SCOPE WidgetSpec ttkCheckbuttonWidgetSpec;
-WidgetSpec ttkCheckbuttonWidgetSpec =
+static WidgetSpec CheckbuttonWidgetSpec =
{
"TCheckbutton", /* className */
sizeof(Checkbutton), /* recordSize */
@@ -566,7 +563,7 @@ WidgetSpec ttkCheckbuttonWidgetSpec =
CheckbuttonCleanup, /* cleanupProc */
CheckbuttonConfigure, /* configureProc */
CheckbuttonPostConfigure, /* postConfigureProc */
- TtkWidgetGetLayout, /* getLayoutProc */
+ TtkWidgetGetLayout, /* getLayoutProc */
TtkWidgetSize, /* sizeProc */
TtkWidgetDoLayout, /* layoutProc */
TtkWidgetDisplay /* displayProc */
@@ -727,8 +724,7 @@ static WidgetCommandSpec RadiobuttonCommands[] =
{ NULL, NULL }
};
-MODULE_SCOPE WidgetSpec ttkRadiobuttonWidgetSpec;
-WidgetSpec ttkRadiobuttonWidgetSpec =
+static WidgetSpec RadiobuttonWidgetSpec =
{
"TRadiobutton", /* className */
sizeof(Radiobutton), /* recordSize */
@@ -738,7 +734,7 @@ WidgetSpec ttkRadiobuttonWidgetSpec =
RadiobuttonCleanup, /* cleanupProc */
RadiobuttonConfigure, /* configureProc */
RadiobuttonPostConfigure, /* postConfigureProc */
- TtkWidgetGetLayout, /* getLayoutProc */
+ TtkWidgetGetLayout, /* getLayoutProc */
TtkWidgetSize, /* sizeProc */
TtkWidgetDoLayout, /* layoutProc */
TtkWidgetDisplay /* displayProc */
@@ -790,8 +786,7 @@ static WidgetCommandSpec MenubuttonCommands[] =
{ NULL, NULL }
};
-MODULE_SCOPE WidgetSpec ttkMenubuttonWidgetSpec;
-WidgetSpec ttkMenubuttonWidgetSpec =
+static WidgetSpec MenubuttonWidgetSpec =
{
"TMenubutton", /* className */
sizeof(Menubutton), /* recordSize */
@@ -801,9 +796,22 @@ WidgetSpec ttkMenubuttonWidgetSpec =
BaseCleanup, /* cleanupProc */
BaseConfigure, /* configureProc */
BasePostConfigure, /* postConfigureProc */
- TtkWidgetGetLayout, /* getLayoutProc */
+ TtkWidgetGetLayout, /* getLayoutProc */
TtkWidgetSize, /* sizeProc */
TtkWidgetDoLayout, /* layoutProc */
TtkWidgetDisplay /* displayProc */
};
+/*
+ * Initialization:
+ */
+
+MODULE_SCOPE
+void TtkButton_Init(Tcl_Interp *interp)
+{
+ RegisterWidget(interp, "ttk::label", &LabelWidgetSpec);
+ RegisterWidget(interp, "ttk::button", &ButtonWidgetSpec);
+ RegisterWidget(interp, "ttk::checkbutton", &CheckbuttonWidgetSpec);
+ RegisterWidget(interp, "ttk::radiobutton", &RadiobuttonWidgetSpec);
+ RegisterWidget(interp, "ttk::menubutton", &MenubuttonWidgetSpec);
+}
diff --git a/generic/ttk/ttkElements.c b/generic/ttk/ttkElements.c
index e7af248..171058a 100644
--- a/generic/ttk/ttkElements.c
+++ b/generic/ttk/ttkElements.c
@@ -1,4 +1,4 @@
-/* $Id: ttkElements.c,v 1.3 2006/12/13 17:06:32 jenglish Exp $
+/* $Id: ttkElements.c,v 1.4 2006/12/14 19:51:03 jenglish Exp $
*
* Copyright (c) 2003, Joe English
*
@@ -1358,17 +1358,12 @@ TTK_BEGIN_LAYOUT(SizegripLayout)
TTK_END_LAYOUT
/*----------------------------------------------------------------------
- * TtkRegisterElements --
- *
- * Register all elements and layouts defined in this package.
+ * TtkElements_Init --
+ * Register elements and default layouts.
*/
-extern Ttk_ElementSpec ttkTextElementSpec;
-extern Ttk_ElementSpec ttkImageElementSpec;
-extern Ttk_ElementSpec ttkImageTextElementSpec;
-extern Ttk_ElementSpec ttkLabelElementSpec;
-
-void TtkRegisterElements(Tcl_Interp *interp)
+MODULE_SCOPE
+void TtkElements_Init(Tcl_Interp *interp)
{
Ttk_Theme theme = Ttk_GetDefaultTheme(interp);
@@ -1383,11 +1378,7 @@ void TtkRegisterElements(Tcl_Interp *interp)
Ttk_RegisterElement(interp, theme, "focus", &FocusElementSpec, NULL);
Ttk_RegisterElement(interp, theme, "padding", &PaddingElementSpec, NULL);
- Ttk_RegisterElement(interp, theme, "text", &ttkTextElementSpec, NULL);
- Ttk_RegisterElement(interp, theme,
- "Labelframe.text",&ttkImageTextElementSpec,NULL);
- Ttk_RegisterElement(interp, theme, "image", &ttkImageElementSpec, interp);
- Ttk_RegisterElement(interp, theme, "label", &ttkLabelElementSpec, interp);
+
Ttk_RegisterElement(interp, theme, "Checkbutton.indicator",
&CheckbuttonIndicatorElementSpec, NULL);
Ttk_RegisterElement(interp, theme, "Radiobutton.indicator",
diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c
index 897c6b6..c7a7a2f 100644
--- a/generic/ttk/ttkEntry.c
+++ b/generic/ttk/ttkEntry.c
@@ -1,5 +1,5 @@
/*
- * $Id: ttkEntry.c,v 1.2 2006/11/03 03:06:22 das Exp $
+ * $Id: ttkEntry.c,v 1.3 2006/12/14 19:51:04 jenglish Exp $
*
* DERIVED FROM: tk/generic/tkEntry.c r1.35.
*
@@ -1666,7 +1666,7 @@ static WidgetSpec EntryWidgetSpec =
EntryCleanup, /* cleanupProc */
EntryConfigure, /* configureProc */
EntryPostConfigure, /* postConfigureProc */
- TtkWidgetGetLayout, /* getLayoutProc */
+ TtkWidgetGetLayout, /* getLayoutProc */
TtkWidgetSize, /* sizeProc */
EntryDoLayout, /* layoutProc */
EntryDisplay /* displayProc */
@@ -1822,7 +1822,7 @@ static WidgetSpec ComboboxWidgetSpec =
EntryCleanup, /* cleanupProc */
ComboboxConfigure, /* configureProc */
EntryPostConfigure, /* postConfigureProc */
- TtkWidgetGetLayout, /* getLayoutProc */
+ TtkWidgetGetLayout, /* getLayoutProc */
TtkWidgetSize, /* sizeProc */
EntryDoLayout, /* layoutProc */
EntryDisplay /* displayProc */
@@ -1848,7 +1848,7 @@ static Ttk_ElementOptionSpec TextareaElementOptions[] = {
{0,0,0}
};
-static void TextareaElementGeometry(
+static void TextareaElementSize(
void *clientData, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
@@ -1871,10 +1871,14 @@ static Ttk_ElementSpec TextareaElementSpec = {
TK_STYLE_VERSION_2,
sizeof(TextareaElement),
TextareaElementOptions,
- TextareaElementGeometry,
+ TextareaElementSize,
TtkNullElementDraw
};
+/*------------------------------------------------------------------------
+ * +++ Widget layouts.
+ */
+
TTK_BEGIN_LAYOUT(EntryLayout)
TTK_GROUP("Entry.field", TTK_FILL_BOTH|TTK_BORDER,
TTK_GROUP("Entry.padding", TTK_FILL_BOTH,
@@ -1888,10 +1892,12 @@ TTK_BEGIN_LAYOUT(ComboboxLayout)
TTK_NODE("Combobox.textarea", TTK_FILL_BOTH)))
TTK_END_LAYOUT
-/* TtkEntryWidget_Init --
- * Register entry-based widgets and related resources.
+/*------------------------------------------------------------------------
+ * +++ Initialization.
*/
-MODULE_SCOPE int TtkEntryWidget_Init(Tcl_Interp *interp)
+
+MODULE_SCOPE
+void TtkEntry_Init(Tcl_Interp *interp)
{
Ttk_Theme themePtr = Ttk_GetDefaultTheme(interp);
@@ -1902,8 +1908,6 @@ MODULE_SCOPE int TtkEntryWidget_Init(Tcl_Interp *interp)
RegisterWidget(interp, "ttk::entry", &EntryWidgetSpec);
RegisterWidget(interp, "ttk::combobox", &ComboboxWidgetSpec);
-
- return TCL_OK;
}
/*EOF*/
diff --git a/generic/ttk/ttkFrame.c b/generic/ttk/ttkFrame.c
index 958cb3e..5ed6272 100644
--- a/generic/ttk/ttkFrame.c
+++ b/generic/ttk/ttkFrame.c
@@ -1,7 +1,7 @@
-/* $Id: ttkFrame.c,v 1.2 2006/11/03 03:06:22 das Exp $
+/* $Id: ttkFrame.c,v 1.3 2006/12/14 19:51:04 jenglish Exp $
* Copyright (c) 2004, Joe English
*
- * Ttk widget set: frame and labelframe widgets
+ * ttk::frame and ttk::labelframe widgets.
*/
#include <tk.h>
@@ -149,9 +149,7 @@ static int FrameConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
return TtkCoreConfigure(interp, recordPtr, mask);
}
-/* public */
-MODULE_SCOPE WidgetSpec ttkFrameWidgetSpec;
-WidgetSpec ttkFrameWidgetSpec =
+static WidgetSpec FrameWidgetSpec =
{
"TFrame", /* className */
sizeof(Frame), /* recordSize */
@@ -160,8 +158,8 @@ WidgetSpec ttkFrameWidgetSpec =
TtkNullInitialize, /* initializeProc */
TtkNullCleanup, /* cleanupProc */
FrameConfigure, /* configureProc */
- TtkNullPostConfigure, /* postConfigureProc */
- TtkWidgetGetLayout, /* getLayoutProc */
+ TtkNullPostConfigure, /* postConfigureProc */
+ TtkWidgetGetLayout, /* getLayoutProc */
FrameSize, /* sizeProc */
TtkWidgetDoLayout, /* layoutProc */
TtkWidgetDisplay /* displayProc */
@@ -602,9 +600,7 @@ static int LabelframeConfigure(Tcl_Interp *interp,void *recordPtr,int mask)
return TCL_OK;
}
-/* public */
-MODULE_SCOPE WidgetSpec ttkLabelframeWidgetSpec;
-WidgetSpec ttkLabelframeWidgetSpec =
+static WidgetSpec LabelframeWidgetSpec =
{
"TLabelframe", /* className */
sizeof(Labelframe), /* recordSize */
@@ -614,9 +610,19 @@ WidgetSpec ttkLabelframeWidgetSpec =
LabelframeCleanup, /* cleanupProc */
LabelframeConfigure, /* configureProc */
TtkNullPostConfigure, /* postConfigureProc */
- TtkWidgetGetLayout, /* getLayoutProc */
+ TtkWidgetGetLayout, /* getLayoutProc */
LabelframeSize, /* sizeProc */
LabelframeDoLayout, /* layoutProc */
TtkWidgetDisplay /* displayProc */
};
+/* ======================================================================
+ * +++ Initialization:
+ */
+
+MODULE_SCOPE
+void TtkFrame_Init(Tcl_Interp *interp)
+{
+ RegisterWidget(interp, "ttk::frame", &FrameWidgetSpec);
+ RegisterWidget(interp, "ttk::labelframe", &LabelframeWidgetSpec);
+}
diff --git a/generic/ttk/ttkImage.c b/generic/ttk/ttkImage.c
index 7f0a2af..acc4e8f 100644
--- a/generic/ttk/ttkImage.c
+++ b/generic/ttk/ttkImage.c
@@ -1,4 +1,4 @@
-/* $Id: ttkImage.c,v 1.4 2006/12/09 20:53:35 jenglish Exp $
+/* $Id: ttkImage.c,v 1.5 2006/12/14 19:51:04 jenglish Exp $
* Image specifications and image element factory.
*
* Copyright (C) 2004 Pat Thoyts <patthoyts@users.sf.net>
@@ -408,11 +408,10 @@ error:
return TCL_ERROR;
}
-MODULE_SCOPE int Ttk_ImageInit(Tcl_Interp *);
-int Ttk_ImageInit(Tcl_Interp *interp)
+MODULE_SCOPE
+void TtkImage_Init(Tcl_Interp *interp)
{
- return Ttk_RegisterElementFactory(interp, "image",
- Ttk_CreateImageElement, NULL);
+ Ttk_RegisterElementFactory(interp, "image", Ttk_CreateImageElement, NULL);
}
/*EOF*/
diff --git a/generic/ttk/ttkInit.c b/generic/ttk/ttkInit.c
index c4e4e6a..38197b2 100644
--- a/generic/ttk/ttkInit.c
+++ b/generic/ttk/ttkInit.c
@@ -1,4 +1,4 @@
-/* $Id: ttkInit.c,v 1.3 2006/12/13 20:40:32 hobbs Exp $
+/* $Id: ttkInit.c,v 1.4 2006/12/14 19:51:04 jenglish Exp $
* Copyright (c) 2003, Joe English
*
* Ttk package: initialization routine and miscellaneous utilities.
@@ -11,7 +11,7 @@
/*
* Legal values for the button -default option.
- * See also: enum Ttk_ButtonDefaultState in ttkTheme.h.
+ * See also: enum Ttk_ButtonDefaultState.
*/
CONST char *ttkDefaultStrings[] = {
"normal", "active", "disabled", NULL
@@ -27,7 +27,7 @@ int Ttk_GetButtonDefaultStateFromObj(
/*
* Legal values for the -compound option.
- * See also: enum Ttk_Compound in ttkTheme.h
+ * See also: enum Ttk_Compound.
*/
const char *ttkCompoundStrings[] = {
"none", "text", "image", "center",
@@ -44,7 +44,7 @@ int Ttk_GetCompoundFromObj(
/*
* Legal values for the -orient option.
- * See also: enum TTK_ORIENT in ttkTheme.h
+ * See also: enum Ttk_Orient.
*/
CONST char *ttkOrientStrings[] = {
"horizontal", "vertical", NULL
@@ -62,7 +62,7 @@ int Ttk_GetOrientFromObj(
* Recognized values for the -state compatibility option.
* Other options are accepted and interpreted as synonyms for "normal".
*/
-static const char *TTKStateStrings[] = {
+static const char *ttkStateStrings[] = {
"normal", "readonly", "disabled", "active", NULL
};
enum {
@@ -86,7 +86,7 @@ void TtkCheckStateOption(WidgetCore *corePtr, Tcl_Obj *objPtr)
unsigned all = TTK_STATE_DISABLED|TTK_STATE_READONLY|TTK_STATE_ACTIVE;
# define SETFLAGS(f) TtkWidgetChangeState(corePtr, f, all^f)
- (void)Tcl_GetIndexFromObj(NULL,objPtr,TTKStateStrings,"",0,&stateOption);
+ (void)Tcl_GetIndexFromObj(NULL,objPtr,ttkStateStrings,"",0,&stateOption);
switch (stateOption) {
case TTK_COMPAT_STATE_NORMAL:
default:
@@ -189,47 +189,50 @@ Tk_OptionSpec ttkCoreOptionSpecs[] =
};
/*------------------------------------------------------------------------
- * +++ Widget definitions.
+ * +++ Initialization: elements and element factories.
*/
-extern WidgetSpec ttkFrameWidgetSpec;
-extern WidgetSpec ttkLabelframeWidgetSpec;
-extern WidgetSpec ttkLabelWidgetSpec;
-extern WidgetSpec ttkButtonWidgetSpec;
-extern WidgetSpec ttkCheckbuttonWidgetSpec;
-extern WidgetSpec ttkRadiobuttonWidgetSpec;
-extern WidgetSpec ttkMenubuttonWidgetSpec;
-extern WidgetSpec ttkScrollbarWidgetSpec;
-extern WidgetSpec ttkScaleWidgetSpec;
-extern WidgetSpec ttkSeparatorWidgetSpec;
-extern WidgetSpec ttkSizegripWidgetSpec;
-
-extern int TtkProgressbar_Init(Tcl_Interp *);
-extern int TtkNotebook_Init(Tcl_Interp *);
-extern int TtkEntryWidget_Init(Tcl_Interp *);
-extern int TtkTreeview_Init(Tcl_Interp *);
-extern int TtkPanedwindow_Init(Tcl_Interp *);
+extern void TtkElements_Init(Tcl_Interp *);
+extern void TtkLabel_Init(Tcl_Interp *);
+extern void TtkImage_Init(Tcl_Interp *);
+
+static void RegisterElements(Tcl_Interp *interp)
+{
+ TtkElements_Init(interp);
+ TtkLabel_Init(interp);
+ TtkImage_Init(interp);
+}
+
+/*------------------------------------------------------------------------
+ * +++ Initialization: Widget definitions.
+ */
+
+extern void TtkButton_Init(Tcl_Interp *);
+extern void TtkEntry_Init(Tcl_Interp *);
+extern void TtkFrame_Init(Tcl_Interp *);
+extern void TtkNotebook_Init(Tcl_Interp *);
+extern void TtkPanedwindow_Init(Tcl_Interp *);
+extern void TtkProgressbar_Init(Tcl_Interp *);
+extern void TtkScale_Init(Tcl_Interp *);
+extern void TtkScrollbar_Init(Tcl_Interp *);
+extern void TtkSeparator_Init(Tcl_Interp *);
+extern void TtkTreeview_Init(Tcl_Interp *);
+
#ifdef TTK_SQUARE_WIDGET
extern int TtkSquareWidget_Init(Tcl_Interp *);
#endif
static void RegisterWidgets(Tcl_Interp *interp)
{
- RegisterWidget(interp, "::ttk::frame", &ttkFrameWidgetSpec);
- RegisterWidget(interp, "::ttk::labelframe", &ttkLabelframeWidgetSpec);
- RegisterWidget(interp, "::ttk::label", &ttkLabelWidgetSpec);
- RegisterWidget(interp, "::ttk::button", &ttkButtonWidgetSpec);
- RegisterWidget(interp, "::ttk::checkbutton", &ttkCheckbuttonWidgetSpec);
- RegisterWidget(interp, "::ttk::radiobutton", &ttkRadiobuttonWidgetSpec);
- RegisterWidget(interp, "::ttk::menubutton", &ttkMenubuttonWidgetSpec);
- RegisterWidget(interp, "::ttk::scrollbar", &ttkScrollbarWidgetSpec);
- RegisterWidget(interp, "::ttk::scale", &ttkScaleWidgetSpec);
- RegisterWidget(interp, "::ttk::separator", &ttkSeparatorWidgetSpec);
- RegisterWidget(interp, "::ttk::sizegrip", &ttkSizegripWidgetSpec);
+ TtkButton_Init(interp);
+ TtkEntry_Init(interp);
+ TtkFrame_Init(interp);
TtkNotebook_Init(interp);
- TtkEntryWidget_Init(interp);
- TtkProgressbar_Init(interp);
TtkPanedwindow_Init(interp);
+ TtkProgressbar_Init(interp);
+ TtkScale_Init(interp);
+ TtkScrollbar_Init(interp);
+ TtkSeparator_Init(interp);
TtkTreeview_Init(interp);
#ifdef TTK_SQUARE_WIDGET
TtkSquareWidget_Init(interp);
@@ -237,18 +240,16 @@ static void RegisterWidgets(Tcl_Interp *interp)
}
/*------------------------------------------------------------------------
- * +++ Built-in themes.
+ * +++ Initialization: Built-in themes.
*/
extern int TtkAltTheme_Init(Tcl_Interp *);
extern int TtkClassicTheme_Init(Tcl_Interp *);
extern int TtkClamTheme_Init(Tcl_Interp *);
-extern int Ttk_ImageInit(Tcl_Interp *);
-
static void RegisterThemes(Tcl_Interp *interp)
{
- Ttk_ImageInit(interp); /* not really a theme... */
+
TtkAltTheme_Init(interp);
TtkClassicTheme_Init(interp);
TtkClamTheme_Init(interp);
@@ -269,7 +270,7 @@ Ttk_Init(Tcl_Interp *interp)
*/
Ttk_StylePkgInit(interp);
- TtkRegisterElements(interp);
+ RegisterElements(interp);
RegisterWidgets(interp);
RegisterThemes(interp);
diff --git a/generic/ttk/ttkLabel.c b/generic/ttk/ttkLabel.c
index e03fea4..11e6a73 100644
--- a/generic/ttk/ttkLabel.c
+++ b/generic/ttk/ttkLabel.c
@@ -1,4 +1,4 @@
-/* $Id: ttkLabel.c,v 1.3 2006/12/09 20:53:35 jenglish Exp $
+/* $Id: ttkLabel.c,v 1.4 2006/12/14 19:51:04 jenglish Exp $
*
* text, image, and label elements.
*
@@ -209,8 +209,7 @@ static void TextElementDraw(
}
}
-MODULE_SCOPE Ttk_ElementSpec ttkTextElementSpec;
-/*public*/ Ttk_ElementSpec ttkTextElementSpec =
+static Ttk_ElementSpec TextElementSpec =
{
TK_STYLE_VERSION_2,
sizeof(TextElement),
@@ -240,8 +239,7 @@ static void ImageTextElementDraw(
TextCleanup(text);
}
-MODULE_SCOPE Ttk_ElementSpec ttkImageTextElementSpec;
-/*public*/ Ttk_ElementSpec ttkImageTextElementSpec =
+static Ttk_ElementSpec ImageTextElementSpec =
{
TK_STYLE_VERSION_2,
sizeof(TextElement),
@@ -401,8 +399,7 @@ static void ImageElementDraw(
}
}
-MODULE_SCOPE Ttk_ElementSpec ttkImageElementSpec;
-/*public*/ Ttk_ElementSpec ttkImageElementSpec =
+static Ttk_ElementSpec ImageElementSpec =
{
TK_STYLE_VERSION_2,
sizeof(ImageElement),
@@ -699,8 +696,7 @@ static void LabelElementDraw(
LabelCleanup(l);
}
-MODULE_SCOPE Ttk_ElementSpec ttkLabelElementSpec;
-/*public*/ Ttk_ElementSpec ttkLabelElementSpec =
+static Ttk_ElementSpec LabelElementSpec =
{
TK_STYLE_VERSION_2,
sizeof(LabelElement),
@@ -709,3 +705,19 @@ MODULE_SCOPE Ttk_ElementSpec ttkLabelElementSpec;
LabelElementDraw
};
+/*------------------------------------------------------------------------
+ * +++ Initialization.
+ */
+
+MODULE_SCOPE
+void TtkLabel_Init(Tcl_Interp *interp)
+{
+ Ttk_Theme theme = Ttk_GetDefaultTheme(interp);
+
+ Ttk_RegisterElement(interp, theme, "text", &TextElementSpec, NULL);
+ Ttk_RegisterElement(interp, theme, "image", &ImageElementSpec, interp);
+ Ttk_RegisterElement(interp, theme, "label", &LabelElementSpec, interp);
+ Ttk_RegisterElement(interp, theme, "Labelframe.text", /* @@@ */
+ &ImageTextElementSpec,NULL);
+}
+
diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c
index 4e8caf9..70450af 100644
--- a/generic/ttk/ttkNotebook.c
+++ b/generic/ttk/ttkNotebook.c
@@ -1,4 +1,4 @@
-/* $Id: ttkNotebook.c,v 1.3 2006/12/09 20:53:35 jenglish Exp $
+/* $Id: ttkNotebook.c,v 1.4 2006/12/14 19:51:04 jenglish Exp $
* Copyright (c) 2004, Joe English
*
* NOTE-ACTIVE: activeTabIndex is not always correct (it's
@@ -1249,7 +1249,12 @@ TTK_BEGIN_LAYOUT(TabLayout)
TTK_NODE("Notebook.label", TTK_PACK_TOP))))
TTK_END_LAYOUT
-MODULE_SCOPE int TtkNotebook_Init(Tcl_Interp *interp)
+/*------------------------------------------------------------------------
+ * +++ Initialization.
+ */
+
+MODULE_SCOPE
+void TtkNotebook_Init(Tcl_Interp *interp)
{
Ttk_Theme themePtr = Ttk_GetDefaultTheme(interp);
@@ -1257,8 +1262,6 @@ MODULE_SCOPE int TtkNotebook_Init(Tcl_Interp *interp)
Ttk_RegisterLayout(themePtr, "TNotebook", NotebookLayout);
RegisterWidget(interp, "ttk::notebook", &NotebookWidgetSpec);
-
- return TCL_OK;
}
/*EOF*/
diff --git a/generic/ttk/ttkPanedwindow.c b/generic/ttk/ttkPanedwindow.c
index d53cb71..cb0502a 100644
--- a/generic/ttk/ttkPanedwindow.c
+++ b/generic/ttk/ttkPanedwindow.c
@@ -1,4 +1,4 @@
-/* $Id: ttkPanedwindow.c,v 1.6 2006/12/13 20:40:32 hobbs Exp $
+/* $Id: ttkPanedwindow.c,v 1.7 2006/12/14 19:51:04 jenglish Exp $
*
* Copyright (c) 2005, Joe English. Freely redistributable.
*
@@ -799,7 +799,8 @@ TTK_END_LAYOUT
/*------------------------------------------------------------------------
* +++ Registration routine.
*/
-MODULE_SCOPE int TtkPanedwindow_Init(Tcl_Interp *interp)
+MODULE_SCOPE
+void TtkPanedwindow_Init(Tcl_Interp *interp)
{
Ttk_Theme themePtr = Ttk_GetDefaultTheme(interp);
RegisterWidget(interp, "ttk::panedwindow", &PanedWidgetSpec);
@@ -810,7 +811,5 @@ MODULE_SCOPE int TtkPanedwindow_Init(Tcl_Interp *interp)
Ttk_RegisterLayout(themePtr, "TPanedwindow", PanedLayout);
Ttk_RegisterLayout(themePtr, "Horizontal.Sash", HorizontalSashLayout);
Ttk_RegisterLayout(themePtr, "Vertical.Sash", VerticalSashLayout);
-
- return TCL_OK;
}
diff --git a/generic/ttk/ttkProgress.c b/generic/ttk/ttkProgress.c
index 45b4415..4b442d3 100644
--- a/generic/ttk/ttkProgress.c
+++ b/generic/ttk/ttkProgress.c
@@ -1,8 +1,8 @@
-/* $Id: ttkProgress.c,v 1.2 2006/11/03 03:06:22 das Exp $
+/* $Id: ttkProgress.c,v 1.3 2006/12/14 19:51:04 jenglish Exp $
*
* Copyright (c) Joe English, Pat Thoyts, Michael Kirkham
*
- * Ttk widget set: progress bar widget.
+ * ttk::progressbar widget.
*/
#include <math.h>
@@ -534,7 +534,9 @@ TTK_END_LAYOUT
/*
* Initialization:
*/
-MODULE_SCOPE int TtkProgressbar_Init(Tcl_Interp *interp)
+
+MODULE_SCOPE
+void TtkProgressbar_Init(Tcl_Interp *interp)
{
Ttk_Theme themePtr = Ttk_GetDefaultTheme(interp);
@@ -544,8 +546,6 @@ MODULE_SCOPE int TtkProgressbar_Init(Tcl_Interp *interp)
"Horizontal.TProgressbar", HorizontalProgressbarLayout);
RegisterWidget(interp, "ttk::progressbar", &ProgressbarWidgetSpec);
-
- return TCL_OK;
}
/*EOF*/
diff --git a/generic/ttk/ttkScale.c b/generic/ttk/ttkScale.c
index 56169d0..6cf3cbb 100644
--- a/generic/ttk/ttkScale.c
+++ b/generic/ttk/ttkScale.c
@@ -1,7 +1,7 @@
-/* $Id: ttkScale.c,v 1.2 2006/11/03 03:06:22 das Exp $
+/* $Id: ttkScale.c,v 1.3 2006/12/14 19:51:04 jenglish Exp $
* Copyright (C) 2004 Pat Thoyts <patthoyts@users.sourceforge.net>
*
- * Ttk widget set: scale widget.
+ * ttk::scale widget.
*/
#include <tk.h>
@@ -485,8 +485,7 @@ static WidgetCommandSpec ScaleCommands[] =
{ 0, 0 }
};
-MODULE_SCOPE WidgetSpec ttkScaleWidgetSpec;
-WidgetSpec ttkScaleWidgetSpec =
+static WidgetSpec ScaleWidgetSpec =
{
"TScale", /* Class name */
sizeof(Scale), /* record size */
@@ -502,3 +501,12 @@ WidgetSpec ttkScaleWidgetSpec =
TtkWidgetDisplay /* displayProc */
};
+/*
+ * Initialization.
+ */
+MODULE_SCOPE
+void TtkScale_Init(Tcl_Interp *interp)
+{
+ RegisterWidget(interp, "ttk::scale", &ScaleWidgetSpec);
+}
+
diff --git a/generic/ttk/ttkScrollbar.c b/generic/ttk/ttkScrollbar.c
index 4558a4c..ab32208 100644
--- a/generic/ttk/ttkScrollbar.c
+++ b/generic/ttk/ttkScrollbar.c
@@ -1,9 +1,9 @@
-/* $Id: ttkScrollbar.c,v 1.2 2006/11/03 03:06:22 das Exp $
+/* $Id: ttkScrollbar.c,v 1.3 2006/12/14 19:51:04 jenglish Exp $
* Copyright (c) 2003, Joe English
- * Ttk widget set: scrollbar widget implementation.
+ *
+ * ttk::scrollbar widget.
*/
-#include <string.h>
#include <tk.h>
#include "ttkTheme.h"
@@ -297,8 +297,7 @@ static WidgetCommandSpec ScrollbarCommands[] =
/*------------------------------------------------------------------------
* +++ Widget specification.
*/
-MODULE_SCOPE WidgetSpec ttkScrollbarWidgetSpec;
-WidgetSpec ttkScrollbarWidgetSpec =
+static WidgetSpec ScrollbarWidgetSpec =
{
"TScrollbar", /* className */
sizeof(Scrollbar), /* recordSize */
@@ -307,11 +306,21 @@ WidgetSpec ttkScrollbarWidgetSpec =
ScrollbarInitialize, /* initializeProc */
TtkNullCleanup, /* cleanupProc */
TtkCoreConfigure, /* configureProc */
- TtkNullPostConfigure, /* postConfigureProc */
+ TtkNullPostConfigure, /* postConfigureProc */
ScrollbarGetLayout, /* getLayoutProc */
TtkWidgetSize, /* sizeProc */
ScrollbarDoLayout, /* layoutProc */
TtkWidgetDisplay /* displayProc */
};
+/*------------------------------------------------------------------------
+ * +++ Initialization.
+ */
+
+MODULE_SCOPE
+void TtkScrollbar_Init(Tcl_Interp *interp)
+{
+ RegisterWidget(interp, "ttk::scrollbar", &ScrollbarWidgetSpec);
+}
+
/*EOF*/
diff --git a/generic/ttk/ttkSeparator.c b/generic/ttk/ttkSeparator.c
index feb8763..9781e98 100644
--- a/generic/ttk/ttkSeparator.c
+++ b/generic/ttk/ttkSeparator.c
@@ -1,8 +1,8 @@
-/* $Id: ttkSeparator.c,v 1.2 2006/11/03 03:06:22 das Exp $
+/* $Id: ttkSeparator.c,v 1.3 2006/12/14 19:51:04 jenglish Exp $
*
* Copyright (c) 2004, Joe English
*
- * Ttk widget set: separator and sizegrip widgets.
+ * ttk::separator and ttk::sizegrip widgets.
*/
#include <tk.h>
@@ -62,8 +62,7 @@ static WidgetCommandSpec SeparatorCommands[] =
/*
* Widget specification:
*/
-MODULE_SCOPE WidgetSpec ttkSeparatorWidgetSpec;
-WidgetSpec ttkSeparatorWidgetSpec =
+static WidgetSpec SeparatorWidgetSpec =
{
"TSeparator", /* className */
sizeof(Separator), /* recordSize */
@@ -72,7 +71,7 @@ WidgetSpec ttkSeparatorWidgetSpec =
TtkNullInitialize, /* initializeProc */
TtkNullCleanup, /* cleanupProc */
TtkCoreConfigure, /* configureProc */
- TtkNullPostConfigure, /* postConfigureProc */
+ TtkNullPostConfigure, /* postConfigureProc */
SeparatorGetLayout, /* getLayoutProc */
TtkWidgetSize, /* sizeProc */
TtkWidgetDoLayout, /* layoutProc */
@@ -93,21 +92,30 @@ static WidgetCommandSpec SizegripCommands[] =
{ NULL, NULL }
};
-MODULE_SCOPE WidgetSpec ttkSizegripWidgetSpec;
-WidgetSpec ttkSizegripWidgetSpec =
+static WidgetSpec SizegripWidgetSpec =
{
"TSizegrip", /* className */
sizeof(WidgetCore), /* recordSize */
- ttkCoreOptionSpecs, /* optionSpecs */
+ ttkCoreOptionSpecs, /* optionSpecs */
SizegripCommands, /* subcommands */
TtkNullInitialize, /* initializeProc */
TtkNullCleanup, /* cleanupProc */
TtkCoreConfigure, /* configureProc */
- TtkNullPostConfigure, /* postConfigureProc */
- TtkWidgetGetLayout, /* getLayoutProc */
+ TtkNullPostConfigure, /* postConfigureProc */
+ TtkWidgetGetLayout, /* getLayoutProc */
TtkWidgetSize, /* sizeProc */
TtkWidgetDoLayout, /* layoutProc */
TtkWidgetDisplay /* displayProc */
};
+/* +++ Initialization:
+ */
+
+MODULE_SCOPE
+void TtkSeparator_Init(Tcl_Interp *interp)
+{
+ RegisterWidget(interp, "ttk::separator", &SeparatorWidgetSpec);
+ RegisterWidget(interp, "ttk::sizegrip", &SizegripWidgetSpec);
+}
+
/*EOF*/
diff --git a/generic/ttk/ttkTheme.h b/generic/ttk/ttkTheme.h
index ff18da8..12a471e 100644
--- a/generic/ttk/ttkTheme.h
+++ b/generic/ttk/ttkTheme.h
@@ -1,10 +1,7 @@
-/*
- * ttkTheme.h --
- * Declarations for Tk style engine.
- *
+/* $Id: ttkTheme.h,v 1.8 2006/12/14 19:51:04 jenglish Exp $
* Copyright (c) 2003 Joe English. Freely redistributable.
*
- * $Id: ttkTheme.h,v 1.7 2006/12/13 05:36:38 jenglish Exp $
+ * Declarations for Tk theme engine.
*/
#ifndef _TTKTHEME
@@ -14,13 +11,6 @@
extern "C" {
#endif
-#if defined(BUILD_ttk)
-# define TTKAPI DLLEXPORT
-# undef USE_TTK_STUBS
-#else
-# define TTKAPI DLLIMPORT
-#endif
-
#ifndef MODULE_SCOPE
# ifdef __cplusplus
# define MODULE_SCOPE extern "C"
@@ -29,6 +19,8 @@ extern "C" {
# endif
#endif
+#define TTKAPI MODULE_SCOPE
+
/* Ttk syncs to the Tk version & patchlevel */
#define TTK_VERSION TK_VERSION
#define TTK_PATCH_LEVEL TK_PATCH_LEVEL
@@ -170,7 +162,7 @@ typedef unsigned int Ttk_Sticky;
#define TTK_FILL_BOTH (0xF) /* -sticky nswe */
TTKAPI int Ttk_GetStickyFromObj(Tcl_Interp *, Tcl_Obj *, Ttk_Sticky *);
-MODULE_SCOPE Tcl_Obj *Ttk_NewStickyObj(Ttk_Sticky);
+TTKAPI Tcl_Obj *Ttk_NewStickyObj(Ttk_Sticky);
/*
* Extra bits for position specifications (combine -side and -sticky)
@@ -195,14 +187,13 @@ typedef unsigned int Ttk_PositionSpec; /* See below */
#define _TTK_MASK_STICK (0x0F) /* See Ttk_UnparseLayout() */
#define _TTK_MASK_PACK (0xF0) /* See Ttk_UnparseLayout(), packStrings */
-
TTKAPI Ttk_Box Ttk_PackBox(Ttk_Box *cavity, int w, int h, Ttk_Side side);
TTKAPI Ttk_Box Ttk_StickBox(Ttk_Box parcel, int w, int h, Ttk_Sticky sticky);
TTKAPI Ttk_Box Ttk_AnchorBox(Ttk_Box parcel, int w, int h, Tk_Anchor anchor);
TTKAPI Ttk_Box Ttk_PadBox(Ttk_Box b, Ttk_Padding p);
TTKAPI Ttk_Box Ttk_ExpandBox(Ttk_Box b, Ttk_Padding p);
TTKAPI Ttk_Box Ttk_PlaceBox(Ttk_Box *cavity, int w,int h, Ttk_Side,Ttk_Sticky);
-MODULE_SCOPE Ttk_Box Ttk_PositionBox(Ttk_Box *cavity, int w, int h, Ttk_PositionSpec);
+TTKAPI Ttk_Box Ttk_PositionBox(Ttk_Box *cavity, int w, int h, Ttk_PositionSpec);
/*------------------------------------------------------------------------
* +++ Themes.
@@ -241,7 +232,7 @@ typedef void (Ttk_ElementSizeProc)(void *clientData, void *elementRecord,
typedef void (Ttk_ElementDrawProc)(void *clientData, void *elementRecord,
Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state);
-typedef struct Ttk_ElementOptionSpec
+typedef struct Ttk_ElementOptionSpec
{
char *optionName; /* Command-line name of the widget option */
Tk_OptionType type; /* Accepted option types */
@@ -253,7 +244,7 @@ typedef struct Ttk_ElementOptionSpec
typedef struct Ttk_ElementSpec {
enum TTKStyleVersion2 version; /* Version of the style support. */
- size_t elementSize; /* Size of element record */
+ size_t elementSize; /* Size of element record */
Ttk_ElementOptionSpec *options; /* List of options, NULL-terminated */
Ttk_ElementSizeProc *size; /* Compute min size and padding */
Ttk_ElementDrawProc *draw; /* Draw the element */
@@ -360,9 +351,9 @@ MODULE_SCOPE void Ttk_RegisterNamedColor(Ttk_ResourceCache, const char *, XColor
*/
typedef struct TtkImageSpec Ttk_ImageSpec;
-extern Ttk_ImageSpec *TtkGetImageSpec(Tcl_Interp *, Tk_Window, Tcl_Obj *);
-extern void TtkFreeImageSpec(Ttk_ImageSpec *);
-extern Tk_Image TtkSelectImage(Ttk_ImageSpec *, Ttk_State);
+TTKAPI Ttk_ImageSpec *TtkGetImageSpec(Tcl_Interp *, Tk_Window, Tcl_Obj *);
+TTKAPI void TtkFreeImageSpec(Ttk_ImageSpec *);
+TTKAPI Tk_Image TtkSelectImage(Ttk_ImageSpec *, Ttk_State);
/*------------------------------------------------------------------------
* +++ Miscellaneous enumerations.
@@ -375,7 +366,7 @@ typedef enum /* -default option values */
TTK_BUTTON_DEFAULT_DISABLED /* not defaultable */
} Ttk_ButtonDefaultState;
-MODULE_SCOPE int Ttk_GetButtonDefaultStateFromObj(Tcl_Interp *, Tcl_Obj *, int *);
+TTKAPI int Ttk_GetButtonDefaultStateFromObj(Tcl_Interp *, Tcl_Obj *, int *);
typedef enum /* -compound option values */
{
@@ -389,11 +380,11 @@ typedef enum /* -compound option values */
TTK_COMPOUND_RIGHT /* image to right of text */
} Ttk_Compound;
-MODULE_SCOPE int Ttk_GetCompoundFromObj(Tcl_Interp *, Tcl_Obj *, int *);
+TTKAPI int Ttk_GetCompoundFromObj(Tcl_Interp *, Tcl_Obj *, int *);
typedef enum { /* -orient option values */
TTK_ORIENT_HORIZONTAL,
- TTK_ORIENT_VERTICAL
+ TTK_ORIENT_VERTICAL
} Ttk_Orient;
/*------------------------------------------------------------------------
diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c
index cf75ee9..53f1b33 100644
--- a/generic/ttk/ttkTreeview.c
+++ b/generic/ttk/ttkTreeview.c
@@ -1,5 +1,5 @@
/*
- * $Id: ttkTreeview.c,v 1.7 2006/12/13 20:40:32 hobbs Exp $
+ * $Id: ttkTreeview.c,v 1.8 2006/12/14 19:51:04 jenglish Exp $
* Copyright (c) 2004, Joe English
*
* ttk::treeview widget implementation.
@@ -2949,14 +2949,16 @@ static Ttk_ElementSpec RowElementSpec =
/*------------------------------------------------------------------------
* +++ Initialisation.
*/
-MODULE_SCOPE int TtkTreeview_Init(Tcl_Interp *interp)
+
+MODULE_SCOPE
+void TtkTreeview_Init(Tcl_Interp *interp)
{
Ttk_Theme theme = Ttk_GetDefaultTheme(interp);
RegisterWidget(interp, "ttk::treeview", &TreeviewWidgetSpec);
- Ttk_RegisterElement(interp, theme,
- "Treeitem.indicator", &TreeitemIndicatorElementSpec, 0);
+ Ttk_RegisterElement(interp, theme, "Treeitem.indicator",
+ &TreeitemIndicatorElementSpec, 0);
Ttk_RegisterElement(interp, theme, "Treeitem.row", &RowElementSpec, 0);
Ttk_RegisterElement(interp, theme, "Treeheading.cell", &RowElementSpec, 0);
@@ -2965,8 +2967,6 @@ MODULE_SCOPE int TtkTreeview_Init(Tcl_Interp *interp)
Ttk_RegisterLayout(theme, "Cell", CellLayout);
Ttk_RegisterLayout(theme, "Heading", HeadingLayout);
Ttk_RegisterLayout(theme, "Row", RowLayout);
-
- return TCL_OK;
}
/*EOF*/
diff --git a/generic/ttk/ttkWidget.h b/generic/ttk/ttkWidget.h
index 9312040..035e464 100644
--- a/generic/ttk/ttkWidget.h
+++ b/generic/ttk/ttkWidget.h
@@ -1,17 +1,12 @@
-/* $Id: ttkWidget.h,v 1.3 2006/12/09 20:53:35 jenglish Exp $
+/* $Id: ttkWidget.h,v 1.4 2006/12/14 19:51:04 jenglish Exp $
* Copyright (c) 2003, Joe English
- *
* Helper routines for widget implementations.
- *
- * Require: ttkTheme.h.
*/
#ifndef _TTKWIDGET
#define _TTKWIDGET
/* State flags for 'flags' field.
- * @@@ todo: distinguish:
- * need reconfigure, need redisplay, redisplay pending
*/
#define WIDGET_DESTROYED 0x0001
#define REDISPLAY_PENDING 0x0002 /* scheduled call to RedisplayWidget */
@@ -225,7 +220,6 @@ MODULE_SCOPE int Ttk_GetTagListFromObj(
MODULE_SCOPE void Ttk_FreeTagList(void **taglist);
-
/*
* Useful widget base classes:
*/
@@ -245,9 +239,8 @@ MODULE_SCOPE const char *ttkDefaultStrings[];
MODULE_SCOPE int TtkGetLabelAnchorFromObj(Tcl_Interp*,Tcl_Obj*,Ttk_PositionSpec *);
/*
- * Package initialiation routines:
+ * Platform-specific initialization.
*/
-MODULE_SCOPE void TtkRegisterElements(Tcl_Interp *);
#if defined(__WIN32__)
#define Ttk_PlatformInit Ttk_WinPlatformInit