summaryrefslogtreecommitdiffstats
path: root/generic/ttk/ttkLayout.c
diff options
context:
space:
mode:
authorjenglish <jenglish@flightlab.com>2007-12-02 04:32:22 (GMT)
committerjenglish <jenglish@flightlab.com>2007-12-02 04:32:22 (GMT)
commitb9257b2ca5a2c1098db948daf8a8b050caa0e96c (patch)
treedcc1e3b870946ba7a2888ef66bd97ad71aa71aa3 /generic/ttk/ttkLayout.c
parent547f91bd5d798f6eb0d2993c410a0e4c6d31b8dd (diff)
downloadtk-b9257b2ca5a2c1098db948daf8a8b050caa0e96c.zip
tk-b9257b2ca5a2c1098db948daf8a8b050caa0e96c.tar.gz
tk-b9257b2ca5a2c1098db948daf8a8b050caa0e96c.tar.bz2
Improved macrology for statically-initialized layout template tables.
Diffstat (limited to 'generic/ttk/ttkLayout.c')
-rw-r--r--generic/ttk/ttkLayout.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/generic/ttk/ttkLayout.c b/generic/ttk/ttkLayout.c
index 76754e7..3606c59 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.9 2007/11/18 17:28:02 jenglish Exp $
+ * $Id: ttkLayout.c,v 1.10 2007/12/02 04:32:23 jenglish 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);