diff options
author | treectrl <treectrl> | 2002-12-29 02:37:37 (GMT) |
---|---|---|
committer | treectrl <treectrl> | 2002-12-29 02:37:37 (GMT) |
commit | 32492bfa784837e0da5d0a0b4bc4d08774277413 (patch) | |
tree | 271d851c7d46b9393da93da49cab63ebf97f0b3f /generic | |
parent | 3e4a96d8c4a2f9aa5b002625f343148aecbeacc9 (diff) | |
download | tktreectrl-32492bfa784837e0da5d0a0b4bc4d08774277413.zip tktreectrl-32492bfa784837e0da5d0a0b4bc4d08774277413.tar.gz tktreectrl-32492bfa784837e0da5d0a0b4bc4d08774277413.tar.bz2 |
Define TreeStyle_ValidateElements.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkTreeStyle.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/generic/tkTreeStyle.c b/generic/tkTreeStyle.c index 4e3566f..b169846 100644 --- a/generic/tkTreeStyle.c +++ b/generic/tkTreeStyle.c @@ -1208,8 +1208,12 @@ static void Style_DoLayout(StyleDrawArgs *drawArgs, struct Layout layouts[20], c int state = drawArgs->state; int i; - if (style->neededWidth == -1) panic("Style_DoLayout(file %s line %d): style.neededWidth == -1", file, line); - if (style->minWidth > drawArgs->width) panic("Style_DoLayout: style.minWidth %d > drawArgs.width %d", style->minWidth, drawArgs->width); + if (style->neededWidth == -1) + panic("Style_DoLayout(file %s line %d): style.neededWidth == -1", + file, line); + if (style->minWidth > drawArgs->width) + panic("Style_DoLayout: style.minWidth %d > drawArgs.width %d", + style->minWidth, drawArgs->width); Style_DoLayoutH(drawArgs, layouts); @@ -3526,6 +3530,31 @@ int TreeStyle_GetSortData(TreeCtrl *tree, TreeStyle style_, int type, long *lv, return TCL_ERROR; } +int TreeStyle_ValidateElements(StyleDrawArgs *drawArgs, int objc, Tcl_Obj *CONST objv[]) +{ + Style *style = (Style *) drawArgs->style; + Style *master = style->master ? style->master : style; + Element *elem; + ElementLink *eLink; + int i; + + for (i = 0; i < objc; i++) + { + if (Element_FromObj(drawArgs->tree, objv[i], &elem) != TCL_OK) + return TCL_ERROR; + + eLink = Style_FindElem(drawArgs->tree, master, elem, NULL); + if (eLink == NULL) + { + FormatResult(drawArgs->tree->interp, + "style %s does not use element %s", + style->name, elem->name); + return TCL_ERROR; + } + } + return TCL_OK; +} + int TreeStyle_GetElemRects(StyleDrawArgs *drawArgs, int objc, Tcl_Obj *CONST objv[], XRectangle rects[20]) { |