1
////////////////////////////////////////////////////////////////////////////////
3
// This file is part of Toolkit for Conceptual Modeling (TCM).
4
// (c) copyright 1996, Vrije Universiteit Amsterdam.
5
// Author: Frank Dehne (frank@cs.vu.nl).
7
// TCM is free software; you can redistribute it and/or modify
8
// it under the terms of the GNU General Public License as published by
9
// the Free Software Foundation; either version 2 of the License, or
10
// (at your option) any later version.
12
// TCM is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
// GNU General Public License for more details.
17
// You should have received a copy of the GNU General Public License
18
// along with TCM; if not, write to the Free Software
19
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21
////////////////////////////////////////////////////////////////////////////////
22
#include "dumpwidgettree.h"
25
#include <X11/IntrinsicP.h>
26
#include <X11/CoreP.h>
28
void DumpWidgetTree::Dump(Widget w) {
30
Cardinal num_children = 0;
32
static unsigned n = 0;
34
static const char *indent =
35
"----------------------------------------------------------------------------";
38
if ( n >= strlen(indent) +1) {
39
printf("ERROR: Widget tree is too deep ( < %d )!\n", n);
43
strncpy(tmp, indent, n);
45
printf("%s> widget tree of %s %s \n", tmp,
46
((CoreClassPart *)XtClass(w))->class_name, XtName(w));
47
if (!XtIsComposite(w)) {
48
printf("%s> %s has no children\n", tmp, XtName(w));
54
XmNnumChildren, &num_children, 0);
55
printf("%s> %s has %d %s:\n", tmp,
56
XtName(w), num_children,
57
num_children == 1 ? "child" : "children");
58
for (i=1; i<=num_children; i++) {
60
printf("%s> child %2d: %20s\n",
61
tmp, i, XtName(child));
64
for (i=1; i <= num_children; i++) {