diff options
author | jenglish@flightlab.com <jenglish> | 2007-12-02 04:32:22 (GMT) |
---|---|---|
committer | jenglish@flightlab.com <jenglish> | 2007-12-02 04:32:22 (GMT) |
commit | c4e52cdf0e261e935a7ad034b5bf8164acd0b715 (patch) | |
tree | dcc1e3b870946ba7a2888ef66bd97ad71aa71aa3 /generic/ttk/ttkLayout.c | |
parent | b25374985e9630820e30eebab696142d770db8d4 (diff) | |
download | tk-c4e52cdf0e261e935a7ad034b5bf8164acd0b715.zip tk-c4e52cdf0e261e935a7ad034b5bf8164acd0b715.tar.gz tk-c4e52cdf0e261e935a7ad034b5bf8164acd0b715.tar.bz2 |
Improved macrology for statically-initialized layout template tables.
Diffstat (limited to 'generic/ttk/ttkLayout.c')
-rw-r--r-- | generic/ttk/ttkLayout.c | 22 |
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); |