5 * This module implements an hierarchy widget for the BLT toolkit.
7 * Copyright 1998-1999 Lucent Technologies, Inc.
9 * Permission to use, copy, modify, and distribute this software and
10 * its documentation for any purpose and without fee is hereby
11 * granted, provided that the above copyright notice appear in all
12 * copies and that both that the copyright notice and warranty
13 * disclaimer appear in supporting documentation, and that the names
14 * of Lucent Technologies or any of their entities not be used in
15 * advertising or publicity pertaining to distribution of the software
16 * without specific, written prior permission.
18 * Lucent Technologies disclaims all warranties with regard to this
19 * software, including all implied warranties of merchantability and
20 * fitness. In no event shall Lucent Technologies be liable for any
21 * special, indirect or consequential damages or any damages
22 * whatsoever resulting from loss of use, data or profits, whether in
23 * an action of contract, negligence or other tortuous action, arising
24 * out of or in connection with the use or performance of this
27 * The "treeview" widget was created by George A. Howlett.
28 * Extensive cleanups and enhancements by Peter MacDonald.
35 * 1. "open" operation should change scroll offset so that as many
36 * new entries (up to half a screen) can be seen.
37 * 2. "open" needs to adjust the scrolloffset so that the same entry
38 * is seen at the same place.
41 #ifndef BLT_TREEVIEW_H
42 #define BLT_TREEVIEW_H
50 #include "bltObjConfig.h"
52 #define ITEM_ENTRY (ClientData)0
53 #define ITEM_ENTRY_BUTTON (ClientData)1
54 #define ITEM_COLUMN_TITLE (ClientData)2
55 #define ITEM_COLUMN_RULE (ClientData)3
56 #define ITEM_STYLE (ClientData)0x10004
60 #define Tcl_NumUtfChars(s,n) (((n) == -1) ? strlen((s)) : (n))
61 #define Tcl_UtfAtIndex(s,i) ((s) + (i))
64 #define ODD(x) ((x) | 0x01)
67 #define SEPARATOR_LIST ((char *)NULL)
68 #define SEPARATOR_NONE ((char *)-1)
75 * The macro below is used to modify a "char" value (e.g. by casting
76 * it to an unsigned character) so that it can be used safely with
77 * macros such as isspace.
79 #define UCHAR(c) ((unsigned char) (c))
81 #define TOGGLE(x, mask) (((x) & (mask)) ? ((x) & ~(mask)) : ((x) | (mask)))
84 #define SCREENX(h, wx) ((wx) - (h)->xOffset + (h)->insetX)
85 #define SCREENY(h, wy) ((wy) - (h)->yOffset + (h)->insetY + (h)->titleHeight)
87 #define WORLDX(h, sx) ((sx) - (h)->insetX + (h)->xOffset)
88 #define WORLDY(h, sy) ((sy) - ((h)->insetY + (h)->titleHeight) + (h)->yOffset)
90 #define VPORTWIDTH(h) (Tk_Width((h)->tkwin) - 2 * (h)->insetX)
91 #define VPORTHEIGHT(h) \
92 (Tk_Height((h)->tkwin) - (h)->titleHeight - 2 * (h)->insetY)
94 #define ICONWIDTH(d) (tvPtr->levelInfo[(d)].iconWidth)
95 #define LEVELX(d) (tvPtr->levelInfo[(d)].x)
98 (((h)->flatView) ? 0 : Blt_TreeNodeDepth((h)->tree, (n)))
100 #define SELECT_FG(t) \
101 (((((t)->flags & TV_FOCUS)) || ((t)->selOutFocusFgColor == NULL)) \
102 ? (t)->selInFocusFgColor : (t)->selOutFocusFgColor)
103 #define SELECT_BORDER(t) \
104 (((((t)->flags & TV_FOCUS)) || ((t)->selOutFocusBorder == NULL)) \
105 ? (t)->selInFocusBorder : (t)->selOutFocusBorder)
107 #define FLATIND(tvPtr, n) ((tvPtr->flatArr == NULL) || (n) >= tvPtr->nEntries ? NULL : tvPtr->flatArr[n])
109 #define SELECT_MODE_SINGLE (1<<0)
110 #define SELECT_MODE_MULTIPLE (1<<1)
111 #define SELECT_MODE_NONE (1<<2)
112 #define SELECT_MODE_CELL (1<<3)
113 #define SELECT_MODE_MCELL (1<<4)
114 #define SELECT_MODE_CELLMASK (SELECT_MODE_CELL|SELECT_MODE_MCELL)
117 * ----------------------------------------------------------------------------
119 * Internal treeview widget flags:
121 * TV_LAYOUT The layout of the hierarchy needs to be recomputed.
123 * TV_REDRAW A redraw request is pending for the widget.
125 * TV_XSCROLL X-scroll request is pending.
127 * TV_YSCROLL Y-scroll request is pending.
129 * TV_SCROLL Both X-scroll and Y-scroll requests are pending.
131 * TV_FOCUS The widget is receiving keyboard events.
132 * Draw the focus highlight border around the widget.
134 * TV_DIRTY The hierarchy has changed. It may invalidate
135 * the locations and pointers to entries. The widget
136 * will need to recompute its layout.
138 * TV_RESORT The tree has changed such that the view needs to
139 * be resorted. This can happen when an entry is
140 * open or closed, it's label changes, a column value
143 * TV_BORDERS The borders of the widget (highlight ring and
144 * 3-D border) need to be redrawn.
146 * TV_VIEWPORT Indicates that the viewport has changed in some
147 * way: the size of the viewport, the location of
148 * the viewport, or the contents of the viewport.
152 #define TV_LAYOUT (1<<0)
153 #define TV_REDRAW (1<<1)
154 #define TV_XSCROLL (1<<2)
155 #define TV_YSCROLL (1<<3)
156 #define TV_SCROLL (TV_XSCROLL | TV_YSCROLL)
157 #define TV_FOCUS (1<<4)
158 #define TV_DIRTY (1<<5)
159 #define TV_UPDATE (1<<6)
160 #define TV_RESORT (1<<7)
161 #define TV_SORTED (1<<8)
162 #define TV_SORT_PENDING (1<<9)
163 #define TV_BORDERS (1<<10)
164 #define TV_VIEWPORT (1<<11)
165 #define TV_DIRTYALL (1<<12)
166 #define TV_PICKING (1<<13)
167 #define TV_ATTACH (1<<14)
170 * Rule related flags: Rules are XOR-ed lines. We need to track whether
171 * they have been drawn or not.
173 * TV_RULE_ACTIVE Indicates that a rule is currently being drawn
177 * TV_RULE_NEEDED Indicates that a rule is needed (but not yet
178 * drawn) for a column.
181 #define TV_RULE_ACTIVE (1<<15)
182 #define TV_RULE_NEEDED (1<<16)
185 * Selection related flags:
187 * TV_SELECT_EXPORT Export the selection to X11.
189 * TV_SELECT_PENDING A "selection" command idle task is pending.
191 * TV_SELECT_CLEAR Clear selection flag of entry.
193 * TV_SELECT_SET Set selection flag of entry.
195 * TV_SELECT_TOGGLE Toggle selection flag of entry.
197 * TV_SELECT_MASK Mask of selection set/clear/toggle flags.
199 * TV_SELECT_SORTED Indicates if the entries in the selection
200 * should be sorted or displayed in the order
201 * they were selected.
204 #define TV_SELECT_CLEAR (1<<16)
205 #define TV_SELECT_EXPORT (1<<17)
206 #define TV_SELECT_PENDING (1<<18)
207 #define TV_SELECT_SET (1<<19)
208 #define TV_SELECT_TOGGLE (TV_SELECT_SET | TV_SELECT_CLEAR)
209 #define TV_SELECT_MASK (TV_SELECT_SET | TV_SELECT_CLEAR)
210 #define TV_SELECT_SORTED (1<<20)
213 * Miscellaneous flags:
215 * TV_ALLOW_DUPLICATES When inserting new entries, create
218 * TV_FILL_ANCESTORS Automatically create ancestor entries
219 * as needed when inserting a new entry.
221 * TV_HIDE_ROOT Don't display the root entry.
223 * TV_HIDE_LEAVES Don't display entries that are leaves.
225 * TV_SHOW_COLUMN_TITLES Indicates whether to draw titles over each
229 #define TV_ALLOW_DUPLICATES (1<<21)
230 #define TV_FILL_ANCESTORS (1<<22)
231 #define TV_HIDE_ROOT (1<<23)
232 #define TV_HIDE_LEAVES (1<<24)
233 #define TV_SHOW_COLUMN_TITLES (1<<25)
234 #define TV_SORT_AUTO (1<<26)
235 #define TV_NEW_TAGS (1<<27)
236 #define TV_NOAUTO_CLOSE_LEAF (1<<28)
237 /* #define TV_HIGHLIGHT_CELLS (1<<28) */
238 #define TV_HIDE_ICONS (1<<29)
239 #define TV_FILL_NULL (1<<30)
240 #define TV_DELETED (1<<31)
242 #define TV_ITEM_COLUMN 1
243 #define TV_ITEM_RULE 2
245 #define TV_WINDOW_CLEAR 1
246 #define TV_WINDOW_UNMAP 2
247 #define TV_WINDOW_DRAW 4
251 * -------------------------------------------------------------------------
253 * Internal entry flags:
255 * ENTRY_HAS_BUTTON Indicates that a button needs to be
256 * drawn for this entry.
258 * ENTRY_CLOSED Indicates that the entry is closed and
259 * its subentries are not displayed.
261 * ENTRY_HIDDEN Indicates that the entry is hidden (i.e.
262 * can not be viewed by opening or scrolling).
268 * -------------------------------------------------------------------------
270 #define ENTRY_CLOSED (1<<0)
271 #define ENTRY_HIDDEN (1<<1)
272 #define ENTRY_NOT_LEAF (1<<2)
273 #define ENTRY_MASK (ENTRY_CLOSED | ENTRY_HIDDEN)
275 #define ENTRY_HAS_BUTTON (1<<3)
276 #define ENTRY_ICON (1<<4)
277 #define ENTRY_REDRAW (1<<5)
278 #define ENTRY_LAYOUT_PENDING (1<<6)
279 #define ENTRY_DATA_CHANGED (1<<7)
280 #define ENTRY_DIRTY (ENTRY_DATA_CHANGED | ENTRY_LAYOUT_PENDING)
282 #define BUTTON_AUTO (1<<8)
283 #define BUTTON_SHOW (1<<9)
284 #define BUTTON_MASK (BUTTON_AUTO | BUTTON_SHOW)
285 #define ENTRY_ALTROW (1<<10)
286 #define ENTRY_IS_TREE (1<<11)
287 #define ENTRY_ONLYHIDDEN (1<<12)
288 #define ENTRY_DATA_WINDOW (1<<13)
289 #define ENTRY_WINDOW (1<<14)
290 #define ENTRY_DELETED (1<<15)
292 #define COLUMN_RULE_PICKED (1<<1)
293 #define COLUMN_DIRTY (1<<2)
294 #define COLUMN_DELETED (1<<3)
296 #define STYLE_TEXTBOX (0)
297 #define STYLE_COMBOBOX (1)
298 #define STYLE_CHECKBOX (2)
299 #define STYLE_WINDOWBOX (4)
300 #define STYLE_BARBOX (8)
301 #define STYLE_TYPE 0x15
303 #define STYLE_HIGHLIGHT (1<<10)
304 #define STYLE_USER (1<<11)
305 #define STYLE_LAYOUT (1<<12)
306 #define STYLE_DIRTY (1<<13)
308 #define STYLEFLAG_NOCLEAR (1<<0)
309 #define STYLEFLAG_ALTSTYLE (1<<1)
310 #define STYLEFLAG_EMPTYSTYLE (1<<2)
311 #define STYLEFLAG_SUBSTYLE (1<<3)
312 #define STYLEFLAG_TITLESTYLE (1<<4)
315 typedef struct TreeViewColumnStruct TreeViewColumn;
316 typedef struct TreeViewComboboxStruct TreeViewCombobox;
317 typedef struct TreeViewEntryStruct TreeViewEntry;
318 typedef struct TreeViewStruct TreeView;
319 typedef struct TreeViewStyleClassStruct TreeViewStyleClass;
320 typedef struct TreeViewStyleStruct TreeViewStyle;
322 typedef int (TreeViewCompareProc) _ANSI_ARGS_((Tcl_Interp *interp,
323 char *name, Tcl_Obj *pattern, int nocase));
325 typedef TreeViewEntry *(TreeViewIterProc) _ANSI_ARGS_((TreeViewEntry *entryPtr,
332 Blt_HashSearch cursor;
333 TreeViewEntry *entryPtr;
335 Tcl_Obj **objv, *objPtr;
339 Blt_TreeTagEntry* tPtr;
347 * Since instances of the same Tk image can be displayed in
348 * different windows with possibly different color palettes, Tk
349 * internally stores each instance in a linked list. But if
350 * the instances are used in the same widget and therefore use
351 * the same color palette, this adds a lot of overhead,
352 * especially when deleting instances from the linked list.
354 * For the treeview widget, we never need more than a single
355 * instance of an image, regardless of how many times it's used.
356 * Cache the image, maintaining a reference count for each
357 * image used in the widget. It's likely that the treeview
358 * widget will use many instances of the same image (for example
359 * the open/close icons).
362 typedef struct TreeViewIconStruct {
363 Tk_Image tkImage; /* The Tk image being cached. */
365 int refCount; /* Reference count for this image. */
367 short int width, height; /* Dimensions of the cached image. */
369 Blt_HashEntry *hashPtr; /* Hash table pointer to the image. */
371 int count; /* Count number of times displayed. */
375 #define TreeViewIconHeight(icon) ((icon)->height)
376 #define TreeViewIconWidth(icon) ((icon)->width)
377 #define TreeViewIconBits(icon) ((icon)->tkImage)
378 struct TreeViewValueStruct;
382 * A column describes how to display a field of data in the tree.
383 * It may display a title that you can bind to. It may display a
384 * rule for resizing the column. Columns may be hidden, and have
385 * attributes (foreground color, background color, font, etc)
386 * that override those designated globally for the treeview
389 struct TreeViewColumnStruct {
390 int type; /* Always TV_COLUMN */
391 Blt_TreeKey key; /* Data cell identifier for current tree. */
392 char *name; /* Global key lookup */
393 int position; /* Position of column in list. Used
394 * to indicate the first and last
396 UID tagsUid; /* List of binding tags for this
397 * entry. UID, not a string, because
398 * in the typical case most columns
399 * will have the same bindtags. */
404 /* Title-related information */
405 char *title; /* Text displayed in column heading as its
406 * title. By default, this is the same as
407 * the data cell name. */
408 Tk_Font titleFont; /* Font to draw title in. */
411 XColor *titleFgColor; /* Foreground color of text displayed in
413 Tk_3DBorder titleBorder; /* Background color of the column's heading. */
418 XColor *activeTitleFgColor; /* Foreground color of text heading when
419 * the column is activated.*/
420 XColor *fgColor; /* Foreground color. */
422 Tk_3DBorder activeTitleBorder;
424 int titleBorderWidth;
429 TextLayout *titleTextPtr;
430 short int titleWidth, titleHeight;
432 TreeViewIcon titleIcon; /* Icon displayed in column heading */
433 char *titleCmd; /* Tcl script to be executed by the
434 * column's "invoke" operation. */
436 char *sortCmd; /* Tcl script used to compare two
439 /* General information. */
440 int hidden; /* Indicates if the column is
442 int state; /* Indicates if column title can
444 int editable; /* Indicates if column can be
447 int max; /* Maximum space allowed for column. */
448 int reqMin, reqMax; /* Requested bounds on the width of
449 * column. Does not include any
450 * padding or the borderwidth of
451 * column. If non-zero, overrides the
452 * computed width of the column. */
454 int reqWidth; /* User-requested width of
455 * column. Does not include any
456 * padding or the borderwidth of
457 * column. If non-zero, overrides the
458 * computed column width. */
460 int maxWidth; /* Width of the widest entry in the
463 int worldX; /* Starting world x-coordinate of the
466 double weight; /* Growth factor for column. Zero
467 * indicates that the column can not
470 int width; /* Computed width of column. */
472 TreeViewStyle *stylePtr; /* Default style for column. */
474 Tk_3DBorder border; /* Background color of column. */
475 int borderWidth; /* Border width of the column. */
476 int relief; /* Relief of the column. */
477 Blt_Pad pad; /* Horizontal padding on either side
480 Tk_Justify justify; /* Indicates how the text or icon is
481 * justified within the column. */
483 Blt_ChainLink *linkPtr;
486 Blt_Dashes ruleDashes;
488 Blt_Tile tile; /* Tiled background */
489 int scrollTile; /* Adjust the tile along with viewport
490 * offsets as the widget is
492 int hasbg; /* A -bg was specified. */
493 int hasttlbg; /* A -titlebackground was specified. */
494 struct TreeViewValueStruct * defValue; /* Default empty value. */
495 char *validCmd; /* Command for post checking edits */
496 char *editOpts; /* Options used for builtin editing. */
497 Tk_Justify titleJustify; /* Indicates how the text or icon is
498 * justified within the title. */
499 short iX, iY, iW, iH; /* Needed by "nearest" to determine if over icon/label*/
500 short tX, tY, tW, tH;
504 TreeViewStyle *titleStylePtr; /* Default style for column title. */
506 int autoWidth; /* If contents exceed this then set as width, if width 0. */
507 int sortType; /* Type of sorting to be performed. */
508 /* The following colorPats/colorRegex change the fg color by pattern match. */
509 Tcl_Obj *colorPats; /* List of string match pattern/attribute pairs */
510 Tcl_Obj *colorRegex; /* List of regex pattern/attribute pairs */
512 Tcl_Obj *sortAltColumns;
516 #define TREEVIEW_STYLE_COMMON \
517 int refCount; /* Usage reference count. A reference \
518 * count of zero indicates that the \
519 * style may be freed. */ \
520 unsigned int flags; /* Bit field containing both the style \
521 * type and various flags. */ \
522 char *name; /* Instance name. */ \
523 TreeViewStyleClass *classPtr; \
524 /* Contains class-specific information such \
525 * as configuration specifications and \
526 * configure, draw, etc. routines. */ \
527 Blt_HashEntry *hashPtr; /* If non-NULL, points to the hash \
528 * table entry for the style. A style \
529 * that's been deleted, but still in \
530 * use (non-zero reference count) will \
531 * have no hash table entry. \
533 /* General style fields. */ \
534 Tk_Cursor cursor; /* X Cursor */ \
535 TreeViewIcon icon; /* If non-NULL, is a Tk_Image to be drawn \
537 int gap; /* # pixels gap between icon and text. */ \
539 XColor *fgColor; /* Normal foreground color of cell. */ \
540 Tk_3DBorder border; /* Normal background color of cell. */ \
541 XColor *highlightFgColor; /* Foreground color of cell when \
543 Tk_3DBorder highlightBorder;/* Background color of cell when \
545 XColor *activeFgColor; /* Foreground color of cell when active. */ \
546 Tk_3DBorder activeBorder; /* Background color of cell when active. */ \
547 int priority; /* Priority order for bg/fg/font. */ \
551 int hidden; /* Hidden value or subtext. */ \
559 struct TreeViewStyleStruct {
560 TREEVIEW_STYLE_COMMON
563 typedef struct TreeViewValueStruct {
564 TreeViewColumn *columnPtr; /* Column in which the value is located. */
565 TreeViewEntry *entryPtr; /* Entry for value. */
566 short int width, height; /* Dimensions of value. */
567 TreeViewStyle *stylePtr; /* Style information for cell
568 * displaying value. */
569 char *string; /* Raw text string. */
570 TextLayout *textPtr; /* Processes string to be displayed .*/
571 struct TreeViewValueStruct *nextPtr;
572 short iX, iY, iW, iH; /* Needed by "nearest" to determine if over icon/label*/
573 short tX, tY, tW, tH;
577 typedef void (StyleConfigProc) _ANSI_ARGS_((TreeView *tvPtr,
578 TreeViewStyle *stylePtr));
579 typedef void (StyleDrawProc) _ANSI_ARGS_((TreeView *tvPtr, Drawable drawable,
580 TreeViewEntry *entryPtr, TreeViewValue *valuePtr,
581 TreeViewStyle *stylePtr, TreeViewIcon icon, int x, int y));
582 typedef int (StyleEditProc) _ANSI_ARGS_((TreeView *tvPtr,
583 TreeViewEntry *entryPtr, TreeViewValue *valuePtr,
584 TreeViewStyle *stylePtr, int x, int y, int *retVal));
585 typedef void (StyleFreeProc) _ANSI_ARGS_((TreeView *tvPtr,
586 TreeViewStyle *stylePtr));
587 typedef void (StyleMeasureProc) _ANSI_ARGS_((TreeView *tvPtr,
588 TreeViewStyle *stylePtr, TreeViewValue *valuePtr));
589 typedef int (StylePickProc) _ANSI_ARGS_((TreeViewEntry *entryPtr,
590 TreeViewValue *valuePtr, TreeViewStyle *stylePtr, int worldX,
593 struct TreeViewStyleClassStruct {
594 char *className; /* Class name of the style */
595 Blt_ConfigSpec *specsPtr; /* Style configuration specifications */
596 StyleConfigProc *configProc;/* Sets the GCs for style. */
597 StyleMeasureProc *measProc; /* Measures the area needed for the value
598 * with this style. */
599 StyleDrawProc *drawProc; /* Draw the value in it's style. */
600 StylePickProc *pickProc; /* Routine to pick the style's button.
601 * Indicates if the mouse pointer is over
602 * the style's button (if it has one). */
603 StyleEditProc *editProc; /* Routine to edit the style's value. */
604 StyleFreeProc *freeProc; /* Routine to free the style's resources. */
610 * Contains data-specific information how to represent the data
611 * of a node of the hierarchy.
614 struct TreeViewEntryStruct {
615 Blt_TreeNode node; /* Node containing entry */
616 int worldX, worldY; /* X-Y position in world coordinates
617 * where the entry is positioned. */
619 short int width, height; /* Dimensions of the entry. This
620 * includes the size of its
623 int reqHeight; /* Requested height of the entry.
624 * Overrides computed height. */
626 int vertLineLength; /* Length of the vertical line
629 int lineHeight; /* Height of first line of text. */
630 unsigned int flags; /* Flags for this entry. For the
631 * definitions of the various bit
632 * fields see below. */
634 UID tagsUid; /* List of binding tags for this
635 * entry. UID, not a string, because
636 * in the typical case most entries
637 * will have the same bindtags. */
640 UID openCmd, closeCmd; /* Tcl commands to invoke when entries
641 * are opened or closed. They override
642 * those specified globally. */
644 * Button information:
646 short int buttonX, buttonY; /* X-Y coordinate offsets from to
647 * upper left corner of the entry to
648 * the upper-left corner of the
649 * button. Used to pick the
652 TreeViewIcon *icons; /* Tk images displayed for the entry.
653 * The first image is the icon
654 * displayed to the left of the
655 * entry's label. The second is icon
656 * displayed when entry is "open". */
658 TreeViewIcon *activeIcons; /* Tk images displayed for the entry.
659 * The first image is the icon
660 * displayed to the left of the
661 * entry's label. The second is icon
662 * displayed when entry is "open". */
665 short int iconHeight; /* Maximum dimensions for icons and
666 * buttons for this entry. This is
667 * used to align the button, icon, and
674 short int labelWidth;
675 short int labelHeight;
677 UID labelUid; /* Text displayed right of the icon. */
679 Tk_Font font; /* Font of label. Overrides global
680 * font specification. */
685 Tcl_Obj *dataObjPtr; /* pre-fetched data for sorting */
687 XColor *color; /* Color of label. Overrides default
688 * text color specification. */
693 TreeViewValue *values; /* List of column-related information
694 * for each data value in the node.
695 * Non-NULL only if there are value
697 TreeViewStyle *stylePtr; /* Effective style for entry. */
698 int hide; /* Entry is hidden. */
700 Tk_3DBorder border; /* Normal background color of entry. */
701 char *userData; /* user data. */
702 TextLayout *subTextPtr;
704 TreeViewStyle *realStylePtr; /* Default style for entry. */
711 * A button is the open/close indicator at the far left of the
712 * entry. It is displayed as a plus or minus in a solid
713 * colored box with optionally an border. It has both "active"
714 * and "normal" colors.
717 XColor *fgColor; /* Foreground color. */
719 Tk_3DBorder border; /* Background color. */
721 XColor *activeFgColor; /* Active foreground color. */
723 Tk_3DBorder activeBorder; /* Active background color. */
732 int openRelief, closeRelief;
737 TreeViewIcon *activeicons;
753 * A TreeView is a widget that displays an hierarchical table
754 * of one or more entries.
756 * Entries are positioned in "world" coordinates, referring to
757 * the virtual treeview. Coordinate 0,0 is the upper-left corner
758 * of the root entry and the bottom is the end of the last entry.
759 * The widget's Tk window acts as view port into this virtual
760 * space. The treeview's xOffset and yOffset fields specify the
761 * location of the view port in the virtual world. Scrolling the
762 * viewport is therefore simply changing the xOffset and/or
763 * yOffset fields and redrawing.
765 * Note that world coordinates are integers, not signed short
766 * integers like X11 screen coordinates. It's very easy to
767 * create a hierarchy taller than 0x7FFF pixels.
769 struct TreeViewStruct {
772 Tcl_Command cmdToken; /* Token for widget's Tcl command. */
774 Blt_Tree tree; /* Token holding internal tree. */
775 Blt_Tree freeTree; /* Tree to free in configure. */
777 Blt_HashEntry *hashPtr;
779 /* TreeView specific fields. */
781 Tk_Window tkwin; /* Window that embodies the widget.
782 * NULL means that the window has been
783 * destroyed but the data structures
784 * haven't yet been cleaned up.*/
786 Display *display; /* Display containing widget; needed,
787 * among other things, to release
788 * resources after tkwin has already
791 Blt_HashTable entryTable; /* Table of entry information, keyed by
792 * the node pointer. */
794 Blt_HashTable columnTable; /* Table of column information. */
795 Blt_Chain *colChainPtr; /* Chain of columns. Same as the hash
796 * table above but maintains the order
797 * in which columns are displayed. */
799 unsigned int flags; /* For bitfield definitions, see below */
801 int insetX, insetY; /* Total width of all borders,
802 * including traversal highlight and
803 * 3-D border. Indicates how much
804 * interior stuff must be offset from
805 * outside edges to leave room for
812 Tk_3DBorder border; /* 3D border surrounding the window
815 int borderWidth; /* Width of 3D border. */
817 int relief; /* 3D border relief. */
820 int highlightWidth; /* Width in pixels of highlight to
821 * draw around widget when it has the
822 * focus. <= 0 means don't draw a
825 XColor *highlightBgColor; /* Color for drawing traversal
826 * highlight area when highlight is
829 XColor *highlightColor; /* Color for drawing traversal highlight. */
831 char *pathSep; /* Pathname separators */
833 char *trimLeft; /* Leading characters to trim from
837 * Entries are connected by horizontal and vertical lines. They
838 * may be drawn dashed or solid.
840 int lineWidth; /* Width of lines connecting entries */
842 int dashes; /* Dash on-off value. */
844 XColor *lineColor; /* Color of connecting lines. */
847 * Button Information:
849 * The button is the open/close indicator at the far left of the
850 * entry. It is usually displayed as a plus or minus in a solid
851 * colored box with optionally an border. It has both "active" and
854 TreeViewButton button;
857 * Selection Information:
859 * The selection is the rectangle that contains a selected entry.
860 * There may be many selected entries. It is displayed as a solid
861 * colored box with optionally a 3D border.
863 int selRelief; /* Relief of selected items. Currently
864 * is always raised. */
866 int selBorderWidth; /* Border width of a selected entry.*/
868 XColor *selInFocusFgColor; /* Text color of a selected entry. */
869 XColor *selOutFocusFgColor;
871 Tk_3DBorder selInFocusBorder;
872 Tk_3DBorder selOutFocusBorder;
875 TreeViewEntry *selAnchorPtr; /* Fixed end of selection (i.e. entry
876 * at which selection was started.) */
877 TreeViewEntry *selMarkPtr;
878 TreeViewColumn *selAnchorCol; /* Column for anchor */
880 int selectMode; /* Selection style: "single" or
883 char *selectCmd; /* Tcl script that's invoked whenever
884 * the selection changes. */
886 Blt_HashTable selectTable; /* Hash table of currently selected
889 Blt_Chain *selChainPtr; /* Chain of currently selected
890 * entries. Contains the same
891 * information as the above hash
892 * table, but maintains the order in
893 * which entries are selected.
896 int leader; /* Number of pixels padding between
899 Tk_Cursor cursor; /* X Cursor */
901 Tk_Cursor resizeCursor; /* Resize Cursor */
903 int reqWidth, reqHeight; /* Requested dimensions of the
904 * treeview widget's window. */
906 GC lineGC; /* GC for drawing dotted line between
909 XColor *disabledColor;
910 GC disabledGC; /* Graphics context for the disabled */
912 Tk_3DBorder disabledBorder;
914 Blt_Dashes focusDashes; /* Dash on-off value. */
916 GC focusGC; /* Graphics context for the active
921 TreeViewEntry *activePtr; /* Last active entry. */
923 TreeViewEntry *focusPtr; /* Entry that currently has focus. */
925 TreeViewEntry *activeButtonPtr; /* Pointer to last active button */
927 TreeViewEntry *fromPtr;
929 struct TreeViewValueStruct *activeValuePtr;/* Last active value. */
931 int xScrollUnits, yScrollUnits; /* # of pixels per scroll unit. */
933 /* Command strings to control horizontal and vertical
935 char *xScrollCmdPrefix, *yScrollCmdPrefix;
937 int scrollMode; /* Selects mode of scrolling: either
938 * BLT_SCROLL_MODE_HIERBOX,
939 * BLT_SCROLL_MODE_LISTBOX,
940 * or BLT_SCROLL_MODE_CANVAS. */
942 * Total size of all "open" entries. This represents the range of
945 int worldWidth, worldHeight;
947 int xOffset, yOffset; /* Translation between view port and
950 short int minHeight; /* Minimum entry height. Used to to
951 * compute what the y-scroll unit
953 short int titleHeight; /* Height of column titles. */
955 LevelInfo *levelInfo;
958 * Scanning information:
960 int scanAnchorX, scanAnchorY;
961 /* Scan anchor in screen coordinates. */
962 int scanX, scanY; /* X-Y world coordinate where the scan
965 Blt_HashTable iconTable; /* Table of Tk images */
967 Blt_HashTable uidTable; /* Table of strings. */
969 Blt_HashTable styleTable; /* Table of cell styles. */
971 TreeViewEntry *rootPtr; /* Root entry of tree. */
973 TreeViewEntry **visibleArr; /* Array of visible entries */
975 int nVisible; /* Number of entries in the above array */
977 int nEntries; /* Number of entries in tree. */
978 int treeWidth; /* Computed width of the tree. */
980 int buttonFlags; /* Global button indicator for all
981 * entries. This may be overridden by
982 * the entry's -button option. */
984 char *openCmd, *closeCmd; /* Tcl commands to invoke when entries
985 * are opened or closed. */
987 TreeViewIcon *icons; /* Tk images displayed for the entry.
988 * The first image is the icon
989 * displayed to the left of the
990 * entry's label. The second is icon
991 * displayed when entry is "open". */
992 TreeViewIcon *activeIcons; /* Tk images displayed for the entry.
993 * The first image is the icon
994 * displayed to the left of the
995 * entry's label. The second is icon
996 * displayed when entry is "open". */
997 TreeViewIcon *leafIcons; /* Tk images displayed for the leaf entry. */
998 TreeViewIcon *activeLeafIcons;/* Tk images displayed for the active leaf. */
1001 ClientData clientData;
1003 Blt_BindTable bindTable; /* Binding information for entries. */
1005 Blt_HashTable entryTagTable;
1006 Blt_HashTable buttonTagTable;
1007 Blt_HashTable columnTagTable;
1008 Blt_HashTable styleTagTable;
1010 TreeViewStyle *stylePtr; /* Default style for text cells */
1012 TreeViewColumn treeColumn;
1014 TreeViewColumn *activeColumnPtr;
1015 TreeViewColumn *activeTitleColumnPtr;
1016 /* Column title currently active. */
1018 TreeViewColumn *resizeColumnPtr;
1019 /* Column that is being resized. */
1023 int flatView; /* Indicates if the view of the tree
1024 * has been flattened. */
1026 TreeViewEntry **flatArr; /* Flattened array of entries. */
1028 char *sortField; /* Field to be sorted. */
1030 int sortType; /* Type of sorting to be performed. See
1031 * below for valid values. */
1033 char *sortCmd; /* Sort command. */
1035 int sortDecreasing; /* Indicates entries should be sorted
1036 * in decreasing order. */
1038 int viewIsDecreasing; /* Current sorting direction */
1040 TreeViewColumn *sortColumnPtr;/* Column to use for sorting criteria. */
1043 Pixmap drawable; /* Pixmap used to cache the entries
1044 * displayed. The pixmap is saved so
1045 * that only selected elements can be
1048 short int drawWidth, drawHeight;
1050 short int ruleAnchor, ruleMark;
1054 Blt_Tile tile; /* Tiled background */
1055 int scrollTile; /* Adjust the tile along with viewport
1056 * offsets as the widget is
1058 int ruleWidth; /* Width of rule under entries */
1060 TreeViewStyle *altStylePtr; /* Default style for odd row text cells */
1063 TreeViewStyle *emptyStylePtr; /* Style for empty text cells */
1066 int insertFirst; /* Preceeding lookups before doing reverse search of tree. */
1067 int actCol; /* Show active column in active color on select. */
1068 int actEntry; /* Show entry in active color on select. */
1069 int rootNodeNum; /* Node in tree to act as root. */
1070 Blt_TreeNode rootNode; /* Node in tree to act as root. */
1072 Blt_HashTable winTable; /* Table of all windows. */
1073 Blt_HashTable winCellTable; /* Table of windows indexed by cell. */
1074 char *styleCmd; /* Tcl script invoked when @style is created */
1077 Blt_Tile selectTile; /* Tiled background for selection. */
1082 TreeViewStyle *subStylePtr; /* Style for sublabel */
1084 int setFlatView; /* Indicates sort auto-switched tree to flat. */
1087 TreeViewStyle **levelStyles; /* List of styles for entries begining at level 1. */
1090 Tk_OptionTable buttonOptions;
1096 extern UID Blt_TreeViewGetUid _ANSI_ARGS_((TreeView *tvPtr,
1097 CONST char *string));
1098 extern void Blt_TreeViewFreeUid _ANSI_ARGS_((TreeView *tvPtr, UID uid));
1100 extern void Blt_TreeViewEventuallyRedraw _ANSI_ARGS_((TreeView *tvPtr));
1101 extern Tcl_ObjCmdProc Blt_TreeViewWidgetInstCmd;
1102 extern TreeViewEntry *Blt_TreeViewNearestEntry _ANSI_ARGS_((TreeView *tvPtr,
1103 int x, int y, int flags));
1104 extern char *Blt_TreeViewGetFullName _ANSI_ARGS_((TreeView *tvPtr,
1105 TreeViewEntry *entryPtr, int checkEntryLabel, Tcl_DString *dsPtr));
1106 extern void Blt_TreeViewSelectCmdProc _ANSI_ARGS_((ClientData clientData));
1107 extern void Blt_TreeViewInsertText _ANSI_ARGS_((TreeView *tvPtr,
1108 TreeViewEntry *entryPtr, char *string, int extra, int insertPos));
1109 extern int Blt_TreeViewComputeLayout _ANSI_ARGS_((TreeView *tvPtr));
1110 extern void Blt_TreeViewPercentSubst _ANSI_ARGS_((TreeView *tvPtr,
1111 TreeViewEntry *entryPtr, TreeViewColumn *columnPtr,
1112 char *command, char *value, Tcl_DString *resultPtr));
1113 extern int Blt_TreeViewDrawButton _ANSI_ARGS_((TreeView *tvPtr,
1114 TreeViewEntry *entryPtr, Drawable drawable, int x, int y));
1115 extern void Blt_TreeViewDrawValue _ANSI_ARGS_((TreeView *tvPtr,
1116 TreeViewEntry *entryPtr, TreeViewValue *valuePtr, Drawable drawable,
1117 int x, int y, int altRow, int ishid));
1118 extern void Blt_TreeViewDrawOuterBorders _ANSI_ARGS_((TreeView *tvPtr,
1119 Drawable drawable));
1120 extern int Blt_TreeViewDrawIcon _ANSI_ARGS_((TreeView *tvPtr,
1121 TreeViewEntry *entryPtr, Drawable drawable, int x, int y, int clear));
1122 extern void Blt_TreeViewDrawHeadings _ANSI_ARGS_((TreeView *tvPtr,
1123 Drawable drawable));
1124 extern void Blt_TreeViewDrawRule _ANSI_ARGS_((TreeView *tvPtr,
1125 TreeViewColumn *columnPtr, Drawable drawable));
1126 extern int Blt_TreeViewTextbox _ANSI_ARGS_((TreeView *tvPtr,
1127 TreeViewEntry *entryPtr, TreeViewColumn *columnPtr));
1129 extern void Blt_TreeViewConfigureButtons _ANSI_ARGS_((TreeView *tvPtr));
1130 extern int Blt_TreeViewUpdateWidget _ANSI_ARGS_((Tcl_Interp *interp,
1132 extern int Blt_TreeViewScreenToIndex _ANSI_ARGS_((TreeView *tvPtr,
1135 extern void Blt_TreeViewFreeIcon _ANSI_ARGS_((TreeView *tvPtr,
1136 TreeViewIcon icon));
1137 extern TreeViewIcon Blt_TreeViewGetIcon _ANSI_ARGS_((TreeView *tvPtr,
1138 CONST char *iconName));
1139 extern void Blt_TreeViewAddValue _ANSI_ARGS_((TreeViewEntry *entryPtr,
1140 TreeViewColumn *columnPtr));
1141 extern int Blt_TreeViewCreateColumn _ANSI_ARGS_((TreeView *tvPtr,
1142 TreeViewColumn *columnPtr, char *name, char *defaultLabel));
1143 extern void Blt_TreeViewDestroyValue _ANSI_ARGS_((TreeView *tvPtr,
1144 TreeViewEntry *entryPtr, TreeViewValue *valuePtr));
1145 extern void Blt_TreeViewDeleteValue(TreeViewEntry* entryPtr, Blt_TreeKey key);
1146 extern TreeViewValue *Blt_TreeViewFindValue _ANSI_ARGS_((
1147 TreeViewEntry *entryPtr, TreeViewColumn *columnPtr));
1148 extern void Blt_TreeViewConfigureColumns _ANSI_ARGS_((TreeView *tvPtr));
1149 extern void Blt_TreeViewDestroyColumns _ANSI_ARGS_((TreeView *tvPtr));
1150 extern void Blt_TreeViewAllocateColumnUids _ANSI_ARGS_((TreeView *tvPtr));
1151 extern void Blt_TreeViewFreeColumnUids _ANSI_ARGS_((TreeView *tvPtr));
1152 extern void Blt_TreeViewUpdateColumnGCs _ANSI_ARGS_((TreeView *tvPtr,
1153 TreeViewColumn *columnPtr));
1154 extern TreeViewColumn *Blt_TreeViewNearestColumn _ANSI_ARGS_((TreeView *tvPtr,
1155 int x, int y, ClientData *contextPtr));
1157 extern void Blt_TreeViewDrawRule _ANSI_ARGS_((TreeView *tvPtr,
1158 TreeViewColumn *columnPtr, Drawable drawable));
1159 extern int Blt_TreeViewTextOp _ANSI_ARGS_((TreeView *tvPtr, Tcl_Interp *interp,
1160 int objc, Tcl_Obj *CONST *objv));
1161 extern int Blt_TreeViewCombobox _ANSI_ARGS_((TreeView *tvPtr,
1162 TreeViewEntry *entryPtr, TreeViewColumn *columnPtr));
1163 extern int Blt_TreeViewCreateEntry _ANSI_ARGS_((TreeView *tvPtr,
1164 Blt_TreeNode node, int objc, Tcl_Obj *CONST *objv, int flags));
1165 extern int Blt_TreeViewConfigureEntry _ANSI_ARGS_((TreeView *tvPtr,
1166 TreeViewEntry *entryPtr, int objc, Tcl_Obj *CONST *objv, int flags));
1167 extern int Blt_TreeViewOpenEntry _ANSI_ARGS_((TreeView *tvPtr,
1168 TreeViewEntry *entryPtr));
1169 extern int Blt_TreeViewCloseEntry _ANSI_ARGS_((TreeView *tvPtr,
1170 TreeViewEntry *entryPtr));
1171 extern TreeViewEntry *Blt_TreeViewNextEntry _ANSI_ARGS_((
1172 TreeViewEntry *entryPtr, unsigned int mask));
1173 extern TreeViewEntry *Blt_TreeViewPrevEntry _ANSI_ARGS_((
1174 TreeViewEntry *entryPtr, unsigned int mask));
1175 extern int Blt_TreeViewGetEntry _ANSI_ARGS_((TreeView *tvPtr, Tcl_Obj *objPtr,
1176 TreeViewEntry **entryPtrPtr));
1177 extern int Blt_TreeViewEntryIsHidden _ANSI_ARGS_((TreeViewEntry *entryPtr));
1178 extern int Blt_TreeViewEntryIsMapped _ANSI_ARGS_((TreeViewEntry *entryPtr));
1179 extern TreeViewEntry *Blt_TreeViewNextSibling _ANSI_ARGS_((
1180 TreeViewEntry *entryPtr, unsigned int mask));
1181 extern TreeViewEntry *Blt_TreeViewPrevSibling _ANSI_ARGS_((
1182 TreeViewEntry *entryPtr, unsigned int mask));
1183 extern TreeViewEntry *Blt_TreeViewFirstChild _ANSI_ARGS_((
1184 TreeViewEntry *parentPtr, unsigned int mask));
1185 extern TreeViewEntry *Blt_TreeViewLastChild _ANSI_ARGS_((
1186 TreeViewEntry *entryPtr, unsigned int mask));
1187 extern TreeViewEntry *Blt_TreeViewParentEntry _ANSI_ARGS_((
1188 TreeViewEntry *entryPtr));
1190 typedef int (TreeViewApplyProc) _ANSI_ARGS_((TreeView *tvPtr,
1191 TreeViewEntry *entryPtr));
1193 extern int Blt_TreeViewApply _ANSI_ARGS_((TreeView *tvPtr,
1194 TreeViewEntry *entryPtr, TreeViewApplyProc *proc, unsigned int mask));
1196 extern int Blt_TreeViewColumnOp _ANSI_ARGS_((TreeView *tvPtr,
1197 Tcl_Interp *interp, int objc, Tcl_Obj *CONST *objv));
1198 extern int Blt_TreeViewSortOp _ANSI_ARGS_((TreeView *tvPtr, Tcl_Interp *interp,
1199 int objc, Tcl_Obj *CONST *objv));
1200 extern int Blt_TreeViewGetColumn _ANSI_ARGS_((Tcl_Interp *interp,
1201 TreeView *tvPtr, Tcl_Obj *objPtr, TreeViewColumn **columnPtrPtr));
1202 extern int Blt_TreeViewGetColumnKey _ANSI_ARGS_((Tcl_Interp *interp,
1203 TreeView *tvPtr, Tcl_Obj *objPtr, TreeViewColumn **columnPtrPtr, char **keyPtrPtr));
1205 extern void Blt_TreeViewSortFlatView _ANSI_ARGS_((TreeView *tvPtr));
1206 extern void Blt_TreeViewSortTreeView _ANSI_ARGS_((TreeView *tvPtr));
1208 extern int Blt_TreeViewEntryIsSelected _ANSI_ARGS_((TreeView *tvPtr,
1209 TreeViewEntry *entryPtr, TreeViewColumn *columnPtr));
1210 extern void Blt_TreeViewSelectEntry _ANSI_ARGS_((TreeView *tvPtr,
1211 TreeViewEntry *entryPtr, TreeViewColumn *columnPtr));
1212 extern void Blt_TreeViewDeselectEntry _ANSI_ARGS_((TreeView *tvPtr,
1213 TreeViewEntry *entryPtr, TreeViewColumn *columnPtr));
1214 extern void Blt_TreeViewPruneSelection _ANSI_ARGS_((TreeView *tvPtr,
1215 TreeViewEntry *entryPtr));
1216 extern void Blt_TreeViewClearSelection _ANSI_ARGS_((TreeView *tvPtr));
1217 extern void Blt_TreeViewClearTags _ANSI_ARGS_((TreeView *tvPtr,
1218 TreeViewEntry *entryPtr));
1219 extern int Blt_TreeViewFindTaggedEntries _ANSI_ARGS_((TreeView *tvPtr,
1220 Tcl_Obj *objPtr, TreeViewTagInfo *infoPtr));
1221 extern int Blt_TreeViewDoneTaggedEntries _ANSI_ARGS_((TreeViewTagInfo *infoPtr));
1222 extern TreeViewEntry *Blt_TreeViewFirstTaggedEntry _ANSI_ARGS_((
1223 TreeViewTagInfo *infoPtr));
1224 extern TreeViewEntry *Blt_TreeViewNextTaggedEntry _ANSI_ARGS_((
1225 TreeViewTagInfo *infoPtr));
1226 extern ClientData Blt_TreeViewButtonTag _ANSI_ARGS_((TreeView *tvPtr,
1227 CONST char *string));
1228 extern ClientData Blt_TreeViewEntryTag _ANSI_ARGS_((TreeView *tvPtr,
1229 CONST char *string));
1230 extern ClientData Blt_TreeViewColumnTag _ANSI_ARGS_((TreeView *tvPtr,
1231 CONST char *string));
1232 extern void Blt_TreeViewGetTags _ANSI_ARGS_((Tcl_Interp *interp,
1233 TreeView *tvPtr, TreeViewEntry *entryPtr, Blt_List list));
1234 extern void Blt_TreeViewTraceColumn _ANSI_ARGS_((TreeView *tvPtr,
1235 TreeViewColumn *columnPtr));
1236 extern TreeViewIcon Blt_TreeViewGetEntryIcon _ANSI_ARGS_((TreeView *tvPtr,
1237 TreeViewEntry *entryPtr));
1238 extern int Blt_TreeViewStyleIsFmt _ANSI_ARGS_((TreeView *tvPtr,
1239 TreeViewStyle *stylePtr));
1240 extern void Blt_TreeViewSetStyleIcon _ANSI_ARGS_((TreeView *tvPtr,
1241 TreeViewStyle *stylePtr, TreeViewIcon icon));
1242 extern int Blt_TreeViewGetStyle _ANSI_ARGS_((Tcl_Interp *interp,
1243 TreeView *tvPtr, char *styleName, TreeViewStyle **stylePtrPtr));
1244 extern int Blt_TreeViewGetStyleMake _ANSI_ARGS_((Tcl_Interp *interp,
1245 TreeView *tvPtr, char *styleName, TreeViewStyle **stylePtrPtr,
1246 TreeViewColumn *columnPtr, TreeViewEntry *entryPtr, TreeViewValue *valuePtr));
1247 extern void Blt_TreeViewFreeStyle _ANSI_ARGS_((TreeView *tvPtr,
1248 TreeViewStyle *stylePtr));
1249 extern TreeViewStyle *Blt_TreeViewCreateStyle _ANSI_ARGS_((Tcl_Interp *interp,
1250 TreeView *tvPtr, int type, char *styleName));
1251 extern void Blt_TreeViewUpdateStyleGCs _ANSI_ARGS_((TreeView *tvPtr,
1252 TreeViewStyle *stylePtr));
1253 extern void Blt_TreeViewUpdateStyles _ANSI_ARGS_((TreeView *tvPtr));
1254 extern Tk_3DBorder Blt_TreeViewGetStyleBorder _ANSI_ARGS_((TreeView *tvPtr,
1255 TreeViewStyle *stylePtr));
1256 extern GC Blt_TreeViewGetStyleGC _ANSI_ARGS_((TreeView *tvPtr,TreeViewStyle *stylePtr));
1257 extern Tk_Font Blt_TreeViewGetStyleFont _ANSI_ARGS_((TreeView *tvPtr,
1258 TreeViewColumn *columnPtr, TreeViewStyle *stylePtr));
1259 extern XColor *Blt_TreeViewGetStyleFg _ANSI_ARGS_((TreeView *tvPtr,
1260 TreeViewColumn *columnPtr, TreeViewStyle *stylePtr));
1261 extern TreeViewEntry *Blt_NodeToEntry _ANSI_ARGS_((TreeView *tvPtr,
1262 Blt_TreeNode node));
1263 extern int Blt_TreeViewStyleOp _ANSI_ARGS_((TreeView *tvPtr, Tcl_Interp *interp,
1264 int objc, Tcl_Obj *CONST *objv));
1265 extern void Blt_TreeViewTileChangedProc( ClientData clientData, Blt_Tile tile);
1266 extern void Blt_TreeViewMakeStyleDirty( TreeView *tvPtr );
1267 TreeViewValue * Blt_TreeViewMakeValue(TreeView *tvPtr, TreeViewColumn *columnPtr, TreeViewEntry *entryPtr);
1268 void Blt_TreeViewRelayout(TreeView *tvPtr);
1269 extern void Blt_TreeViewFill3DTile _ANSI_ARGS_((TreeView *tvPtr,
1270 Drawable drawable, Tk_3DBorder border, int x, int y, int width, int height,
1271 int borderWidth, int relief, Blt_Tile tile, int scrollTile, int flags));
1272 extern int Blt_TreeViewIsLeaf(TreeViewEntry *entryPtr);
1273 extern void Blt_TreeViewFreeWindows( TreeView *tvPtr);
1274 extern void Blt_TreeViewMarkWindows( TreeView *tvPtr, int flag);
1275 extern void Blt_TreeViewWindowUpdate(TreeViewEntry *entryPtr, TreeViewColumn *columnPtr);
1276 extern void Blt_TreeViewWindowRelease(TreeViewEntry *entryPtr, TreeViewColumn *columnPtr);
1277 extern void Blt_TreeViewColumnRekey(TreeView *tvPtr);
1278 extern void Blt_TreeViewChanged(TreeView *tvPtr);
1279 extern int Blt_TreeViewRerawIcon(TreeView *tvPtr, TreeViewEntry *entryPtr,
1280 TreeViewColumn *columnPtr, TreeViewIcon icon, int imageX,
1281 int imageY, int width, int height, Drawable drawable,
1282 int drawableX, int drawableY);
1284 extern void Blt_GetPriorityStyle _ANSI_ARGS_(( TreeViewStyle *stylePtr,
1285 TreeView *tvPtr, TreeViewColumn *columnPtr, TreeViewEntry *entryPtr,
1286 TreeViewValue *valuePtr, TreeViewStyle *inStylePtr, int flags));
1287 extern int Blt_TreeViewRedrawIcon _ANSI_ARGS_((TreeView *tvPtr, TreeViewEntry *entryPtr,
1288 TreeViewColumn *columnPtr, TreeViewIcon icon, int imageX,
1289 int imageY, int width, int height, Drawable drawable,
1290 int drawableX, int drawableY));
1291 void Blt_TreeViewFreeEntry _ANSI_ARGS_((TreeView *tvPtr, TreeViewEntry *entryPtr));
1293 #define CHOOSE(default, override) \
1294 (((override) == NULL) ? (default) : (override))
1296 #define CHOOSE3(default, override2, override1) \
1297 (((override1) == NULL) ? (CHOOSE(default, override2)) : (override1))
1299 #define CHOOSE4(default, override3, override2, override1) \
1300 (((override1) == NULL) ? (CHOOSE3(default, override3, override2)) : (override1))
1302 #define GETLABEL(e) \
1303 (((e)->labelUid != NULL) ? (e)->labelUid : Blt_TreeNodeLabel((e)->node))
1305 #define Blt_TreeViewGetData(entryPtr, key, objPtrPtr) \
1306 Blt_TreeGetValueByKey((Tcl_Interp *)NULL, (entryPtr)->tvPtr->tree, \
1307 (entryPtr)->node, key, objPtrPtr)
1309 extern Blt_CustomOption bltTreeViewUidOption;
1310 extern Blt_CustomOption bltTreeViewIconOption;
1311 extern Blt_CustomOption bltTreeViewStyleOption;
1312 extern Blt_CustomOption bltTreeViewStylesOption;
1313 extern Blt_CustomOption bltTreeViewTreeOption;
1314 extern Blt_CustomOption bltTreeViewColumnOption;
1315 extern Blt_CustomOption bltTreeViewLabelOption;
1316 extern Blt_CustomOption bltTreeViewDataOption;
1317 extern void Blt_TreeViewOptsInit(TreeView* tvPtr);
1321 #endif /* BLT_TREEVIEW_H */