A list control that displays a tree structure
A TreeList is a view that displays a list of items the user can select and invoke. TreeList is heavily dependent on the TreeItem class. The TreeList is really a composite object consisting of two BScrollbars, a child view of class TreeView to render the graphics and a collection of TreeItems.The list keeps track of pointers to TreeItems. Adding an item to the list adds only the pointer; the data itself isn't copied. The TreeList provides methods to render list-wide aspects of the list such as the connecting lines, and the exploder boxes. It also keeps a track of the current item. However, much of what you may expect the TreeList to do is offloaded to the TreeItems. As a general policy, things that may change from item to item are atrributes of and methods on the items rather than the list.
When the contents of the list change, the TreeList makes sure the visible list on-screen is updated. TreeItems know that they are attached to a list, but in some circumstances you will have to manually ask to redraw the list by calling the TreeList::Redraw function or the TreeView's Invalidate.
The user can click an item in the list to select it and double-click an item to both select and invoke it. The user can also select and invoke items from the keyboard. The navigation keys (such as Down Arrow and Up Arrow) select items; Enter invokes the item that's currently selected.
The TreeList highlights the selected item, but otherwise it doesn't define what, if anything, should take place when an item is selected. You can determine that yourself by registering a "selection message" (a BMessage object) that should be delivered to a target destination whenever the user selects an item.
Similarly, the TreeList doesn't define what it means to "invoke" an item. You can register a separate "invocation message" that's posted whenever the user double-clicks an item or presses Enter while an item is selected. For example, if the user double-clicks an item in a list of file names, a message might be posted telling the BApplication object to open that file.
A TreeList doesn't have a default selection message or invocation message, invocation message functions are all inherited from BControl.
Invoke is not used directly as special values need to be set in the model message. You can overide this to avoid using BMessages, or to add data of your own. The parameter eventtype is an integer identification of the particular type of event (It would be nice if BControl handled this, but it doesn't). TreeItems and TreeLists only use values from the EventTypes enumeration, but any integer is OK, this may be useful in derived classes so that events the bases classes are unaware of can still be sent using the default implementation.
Internally this function adds two new pieces of information to the model BMessage, <I>eventtype</I> as a B_LONG_TYPE called "t_event" and "item" as a B_OBJECT_TYPE called "t_item". Because of the built in action of BControls Invoke you can also rely on "when" and more usefully "source" being added ("source" being a pointer to the TreeList).
This may have nothing to do with selection, although this is often updated as selection precedes.
Pass in true to get the image for a collapsed parent, false to get the image for an exploded one (I always wanted to explode my parents).
The base class will provide either the [+] [-] thingies or the rotating triangle thing.
The TreeList Control Documentation, HTML Edition, for Release 1.1d8 of the Be OS.
Copyright © 1996 Designer Logic (xyzzy). All rights reserved.
Be, the Be logo, BeBox, Be OS, Be Operating System, and GeekPort are trademarks of Be, Inc.
Last modified December 31, 1996.
generated by doc++