summaryrefslogtreecommitdiffstats
path: root/generic/ttk/ttkButton.c
diff options
context:
space:
mode:
authorjenglish <jenglish@flightlab.com>2007-10-25 07:08:25 (GMT)
committerjenglish <jenglish@flightlab.com>2007-10-25 07:08:25 (GMT)
commit504f22c2002890ce5b39d30561d76cae861d0d40 (patch)
treecc3ec59b3743ffde75e375f9a9f2c21fcfbf95a2 /generic/ttk/ttkButton.c
parenta9b41e61dd1f2274961a88385d433a9bac66d44a (diff)
downloadtk-504f22c2002890ce5b39d30561d76cae861d0d40.zip
tk-504f22c2002890ce5b39d30561d76cae861d0d40.tar.gz
tk-504f22c2002890ce5b39d30561d76cae861d0d40.tar.bz2
Move widget layout registration from TtkElements_Init()
to widget *_Init() routines. Renaming/consistency: s/...ElementGeometry()/...ElementSize()/
Diffstat (limited to 'generic/ttk/ttkButton.c')
-rw-r--r--generic/ttk/ttkButton.c52
1 files changed, 47 insertions, 5 deletions
diff --git a/generic/ttk/ttkButton.c b/generic/ttk/ttkButton.c
index 48dcea0..3c1651d 100644
--- a/generic/ttk/ttkButton.c
+++ b/generic/ttk/ttkButton.c
@@ -1,4 +1,4 @@
-/* $Id: ttkButton.c,v 1.6 2007/01/11 14:49:46 jenglish Exp $
+/* $Id: ttkButton.c,v 1.7 2007/10/25 07:08:26 jenglish Exp $
* Copyright (c) 2003, Joe English
*
* label, button, checkbutton, radiobutton, and menubutton widgets.
@@ -194,9 +194,8 @@ BasePostConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
return status;
}
-
/*------------------------------------------------------------------------
- * +++ Label widget:
+ * +++ Label widget.
* Just a base widget that adds a few appearance-related options
*/
@@ -275,6 +274,12 @@ static WidgetSpec LabelWidgetSpec =
TtkWidgetDisplay /* displayProc */
};
+TTK_BEGIN_LAYOUT(LabelLayout)
+ TTK_GROUP("Label.border", TTK_FILL_BOTH|TTK_BORDER,
+ TTK_GROUP("Label.padding", TTK_FILL_BOTH|TTK_BORDER,
+ TTK_NODE("Label.label", TTK_FILL_BOTH)))
+TTK_END_LAYOUT
+
/*------------------------------------------------------------------------
* +++ Button widget.
* Adds a new subcommand "invoke", and options "-command" and "-default"
@@ -377,6 +382,13 @@ static WidgetSpec ButtonWidgetSpec =
TtkWidgetDisplay /* displayProc */
};
+TTK_BEGIN_LAYOUT(ButtonLayout)
+ TTK_GROUP("Button.border", TTK_FILL_BOTH|TTK_BORDER,
+ TTK_GROUP("Button.focus", TTK_FILL_BOTH,
+ TTK_GROUP("Button.padding", TTK_FILL_BOTH,
+ TTK_NODE("Button.label", TTK_FILL_BOTH))))
+TTK_END_LAYOUT
+
/*------------------------------------------------------------------------
* +++ Checkbutton widget.
*/
@@ -569,6 +581,13 @@ static WidgetSpec CheckbuttonWidgetSpec =
TtkWidgetDisplay /* displayProc */
};
+TTK_BEGIN_LAYOUT(CheckbuttonLayout)
+ TTK_GROUP("Checkbutton.padding", TTK_FILL_BOTH,
+ TTK_NODE("Checkbutton.indicator", TTK_PACK_LEFT)
+ TTK_GROUP("Checkbutton.focus", TTK_PACK_LEFT | TTK_STICK_W,
+ TTK_NODE("Checkbutton.label", TTK_FILL_BOTH)))
+TTK_END_LAYOUT
+
/*------------------------------------------------------------------------
* +++ Radiobutton widget.
*/
@@ -740,6 +759,13 @@ static WidgetSpec RadiobuttonWidgetSpec =
TtkWidgetDisplay /* displayProc */
};
+TTK_BEGIN_LAYOUT(RadiobuttonLayout)
+ TTK_GROUP("Radiobutton.padding", TTK_FILL_BOTH,
+ TTK_NODE("Radiobutton.indicator", TTK_PACK_LEFT)
+ TTK_GROUP("Radiobutton.focus", TTK_PACK_LEFT,
+ TTK_NODE("Radiobutton.label", TTK_FILL_BOTH)))
+TTK_END_LAYOUT
+
/*------------------------------------------------------------------------
* +++ Menubutton widget.
*/
@@ -802,13 +828,29 @@ static WidgetSpec MenubuttonWidgetSpec =
TtkWidgetDisplay /* displayProc */
};
-/*
- * Initialization:
+TTK_BEGIN_LAYOUT(MenubuttonLayout)
+ TTK_GROUP("Menubutton.border", TTK_FILL_BOTH,
+ TTK_GROUP("Menubutton.focus", TTK_FILL_BOTH,
+ TTK_NODE("Menubutton.indicator", TTK_PACK_RIGHT)
+ TTK_GROUP("Menubutton.padding", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_X,
+ TTK_NODE("Menubutton.label", TTK_PACK_LEFT))))
+TTK_END_LAYOUT
+
+/*------------------------------------------------------------------------
+ * +++ Initialization.
*/
MODULE_SCOPE
void TtkButton_Init(Tcl_Interp *interp)
{
+ Ttk_Theme theme = Ttk_GetDefaultTheme(interp);
+
+ Ttk_RegisterLayout(theme, "TLabel", LabelLayout);
+ Ttk_RegisterLayout(theme, "TButton", ButtonLayout);
+ Ttk_RegisterLayout(theme, "TCheckbutton", CheckbuttonLayout);
+ Ttk_RegisterLayout(theme, "TRadiobutton", RadiobuttonLayout);
+ Ttk_RegisterLayout(theme, "TMenubutton", MenubuttonLayout);
+
RegisterWidget(interp, "ttk::label", &LabelWidgetSpec);
RegisterWidget(interp, "ttk::button", &ButtonWidgetSpec);
RegisterWidget(interp, "ttk::checkbutton", &CheckbuttonWidgetSpec);