class SideTree : public BView, public BInvoker

SideTree object class

Inheritance:


Public Methods

SideTree(BRect, char *, SIDETREE_VIEW_TYPE, uint32, uint32, short)
Constructs a SideTree Object
void Init()
Initializes SideTree to start working
~SideTree(void)
Class Destructor
AddItem(ST_TRANSACTION *)
Adds an Item
RemoveItem(ST_TRANSACTION *)
Removes an Item
SelectItem(ST_TRANSACTION *)
Selects an item
SelectItem(ST_TRANSACTION *stToParent, int32 *sons, int32 nsons, bool extend = false)
Selects a group of items of one or more members
SelectRange(ST_TRANSACTION *stToParent, int32 start, int32 end, bool extend = false)
Selects a range of items of one or more members
void DeselectAll()
Desellects the complete current selection
void Deselect(ST_TRANSACTION *)
Deselects an Item
int32* CurrentSelection(ST_TRANSACTION *stToParent, size_t *numElems)
Obtains the Currect Selection from the object
bool IsSelectionEqualToCurrent(ST_TRANSACTION *stt, int32 *sons, size_t numSons)
Compares specified selection with current Selection
bool IsPathToParentEqualToCurrent(ST_TRANSACTION *)
Compares node to parent node of the current selection
void GetItem(ST_TRANSACTION *)
Gets item name and data
virtual void MessageReceived(BMessage *)
Received Messages and proces them
virtual void SetSelectionMessage(BMessage *)
Specifies a selection message to send to a target
BMessage* SelectionMessage()
Gets the selection message
uint32 SelectionCommand()
Gets the what member of the selection message
virtual void SetInvocationMessage(BMessage *)
Sets the invocation message
BMessage* InvocationMessage()
Obtains the invocation message
uint32 InvocationCommand()
Returns the what member of the invocation message
virtual void TargetedByScrollView(BScrollView *)
Notes the fact that the SideTree is the target of the of a BScrollView and keeps track of it
virtual void AttachedToWindow()
Perfomorms scroll positioning if SideTree is being targeted by a scroll view

Documentation

SideTree object class. It inherits from BView and BInvoker. A SideTree object displays trees and hierarchies of Items, that users can select and invoke, in a Side-by-Side fashion. Each node is repesented as a list's Item and can have several sons. Those nodes who are parents display a triangle in the right to reflect this state. When the parent node is selected, a new list is created next to the parent's list, where the parent's sons are displayed.
SideTree(BRect, char *, SIDETREE_VIEW_TYPE, uint32, uint32, short)
Constructs a SideTree Object. It does this with r as the rectangle, name as the name of the object, type specifying either multiple selection trees or single selection trees, and cols the number of columns that will fit in the display of the class.

void Init()
Initializes SideTree to start working. this method must be called by yourself always, after SideTree has become part of the Window's hierarchy and before the object is displayed.

~SideTree(void)
Class Destructor. Frees all memory allocated by the items added, besides internal class cleanup.

AddItem(ST_TRANSACTION *)
Adds an Item. Adds an Item with path and level specified in stToParent describing the path of the tree the item should be added in, including the item itself. The item index (the last index in the path array) is ignored since Add always adds an element to the end of the child list.

RemoveItem(ST_TRANSACTION *)
Removes an Item. The item has the same path and level upto the node that is specified in a pointer to a ST_TRANSACTION passed as an argument.

SelectItem(ST_TRANSACTION *)
Selects an item. The item is specified in the pointer to a ST_TRANSACTION structure, where the path and level upto the item are specified.

SelectItem(ST_TRANSACTION *stToParent, int32 *sons, int32 nsons, bool extend = false)
Selects a group of items of one or more members. The items to be selected are to be passed in the sons array as indexes of the parent's child list, and they can be discontinuous. The number of items in the array are passed in nsons, and the parent is specified in stToParent structure where the path and level are upto the parent itself. If extend is false, any previously selected items, will be deselected and the new selection will only be part of the items specified in sons, otherwise the items specified in sons will be added to the current selection if and only if the current selection shares the same direct parent as in the stToParent.

SelectRange(ST_TRANSACTION *stToParent, int32 start, int32 end, bool extend = false)
Selects a range of items of one or more members. The items to be selected are delimited by start and end, and therefore all items with indexes in the parent's child list between start and end will be selected without exclisions. The parent of the items is specified in stToParent structure where the path and level are upto the parent itself. If extend is false, any previously selected items, will be deselected and the new selection will only be part of the items specified in sons, otherwise the items specified in sons will be added to the current selection if and only if the current selection shares the same direct parent as in the stToParent.

void DeselectAll()
Desellects the complete current selection. Therefore the SideTree object will only display the first list of items, without any selection.

void Deselect(ST_TRANSACTION *)
Deselects an Item. The Item is specified in the pointer to a ST_TRANSACTION struct passed as an argument, where the path and level are upto the item itself.

int32* CurrentSelection(ST_TRANSACTION *stToParent, size_t *numElems)
Obtains the Currect Selection from the object. It will store the parent of the selected item(s) in stToParent struct, and the number of selected elements in numElems. The return value is an array of the indexes of the item(s) selected.

bool IsSelectionEqualToCurrent(ST_TRANSACTION *stt, int32 *sons, size_t numSons)
Compares specified selection with current Selection. the selection is specified with stt giving the parent of the items selected, sons storing the indexes in array form, and numSons the number of items in the supposed selection. It the selections are equal, meaning they have the same parent and same items selected, it return true. Otherwise it returns false.

bool IsPathToParentEqualToCurrent(ST_TRANSACTION *)
Compares node to parent node of the current selection. It the path and level specified in the pointer to ST_TRANSACTION passed as an argument, to the parent of the current selected items. If theya re equal the method returns true, otherwise it returns false.

void GetItem(ST_TRANSACTION *)
Gets item name and data. It completes the a ST_TRANSACTION structure with the information the SideTree object has about the item. The item is specified in the ST_TRANSACITON pointer with path and level upto the item itself. if the item exist, its name field is copied to that of ST_TRANSACITON.

virtual void MessageReceived(BMessage *)
Received Messages and proces them. It will include in the futre messages for scripting. Currently if it doesn't recognize a message it calls BView version of the function. No message is currently specified.

virtual void SetSelectionMessage(BMessage *)
Specifies a selection message to send to a target. The message becomes the responsability of the SideTree object. If a new selecition message is specified, the old message is deleted and the new one will take its place. It null is provided the old message will be deleted an SideTree will no longer have a seleciton message until a new one is set. Whenever a item or items are selected in the SideTree object, it sends this message if provided, to the target object. Before sending the message, the SideTree object adds some fields to the BMessage which contains information about the selection that has just took place. This fields are: "pathToParent", which contains an array of int16s specifiying the path upto the parent, "level" an int16 specifiying the level the parent node is in, "indexSon" an array on int32s specifiyin the selected items indexes, "when" a int64 specifying when the selection was made in microseconds since 12:00 AM 1970, and "source" specifying the object in this case the SideTree object, which generated the message.

BMessage* SelectionMessage()
Gets the selection message. If one was never provided it returns NULL.

uint32 SelectionCommand()
Gets the what member of the selection message. Don't try it if a message hasn't been specified!!!.

virtual void SetInvocationMessage(BMessage *)
Sets the invocation message. If a message was specified before this call, the old message is deleted, and the new one will took its place. If null is provided it will delete the old message and the SideTree object will no longer have a invocation message until it is set again. Whenever an item or items is invoked this message is sent to the target with some extra fields describing the item(s) selected. SetSelectionMessage() list the fields and the data they contain.
See Also:
SetSelectionMessage()

BMessage* InvocationMessage()
Obtains the invocation message. If it hasn't been set it returns null.

uint32 InvocationCommand()
Returns the what member of the invocation message. Don't try it if a message hasn't been specified!!!.

virtual void TargetedByScrollView(BScrollView *)
Notes the fact that the SideTree is the target of the of a BScrollView and keeps track of it. The method receives a pointer to the BScrollView that is being target of.

virtual void AttachedToWindow()
Perfomorms scroll positioning if SideTree is being targeted by a scroll view. This function is called for you when SideTree becomes part of a window's hierarchy.


This class has no child classes.

alphabetic index hierarchy of classes


Copyright by Gerardo Díaz
Use of this software is restricted to terms in the License Agreement.

Please Cantact gdiaz@blackbox.cegs.itesm.mx for any questions, suggestions, negociations, agreements, and specially to tell me that you use SideTree.

generated by doc++