#include <ugroup.hpp>
Inheritance diagram for UGroup:
Public Types | |
enum | ChildListType { ATTR_LIST, ELEM_LIST } |
enum | RemoveMode { REMOVE_FROM_PARENTS = -1, NO_DEL = false, AUTO_DEL = true } |
Public Member Functions | |
UGroup (const UArgs &a=UArgs::none) | |
constructor; see also creator shortcut ugroup() | |
virtual | ~UGroup () |
see important notes on recursive deletion | |
virtual const UStyle & | getStyle (UContext *) const |
returns the contextual UStyle of this object | |
UGroup & | addlist (const UArgs &) |
adds a list of children to the end of the object's child list | |
virtual void | add (UBrick *child, bool update=true) |
virtual void | add (UBrick &child, bool update=true) |
virtual void | add (ULink *child, bool update=true) |
virtual void | add (ULink &child, bool update=true) |
adds a 'child' to the end of the object's child list | |
virtual void | addOnce (UBrick *child, bool update=true) |
virtual void | addOnce (UBrick &child, bool update=true) |
adds a 'child' if not already in the child list | |
virtual void | insert (int pos, UBrick *child, bool update=true) |
virtual void | insert (int pos, UBrick &child, bool update=true) |
virtual void | insert (int pos, ULink *child, bool update=true) |
virtual void | insert (int pos, ULink &child, bool update=true) |
insert a 'child' into the object's child list at this position | |
virtual void | remove (UBrick *child, bool auto_delete=true, bool update=true) |
virtual void | remove (UBrick &child, bool auto_delete=true, bool update=true) |
removes 'child' OR deletes 'child' and its descendants | |
virtual void | remove (int pos, bool auto_delete=true, bool update=true) |
removes OR deletes the child at position 'pos' and its descendants | |
virtual void | removeAll (bool auto_delete=true, bool update=true) |
removes all children OR deletes all children and their descendants | |
virtual int | getChildCount () const |
returns the number of children | |
virtual UBrick ** | getChildren () const |
virtual UBrick ** | getChildren (int &child_count) const |
returns a copy of the child list | |
virtual int | getChildren (std::vector< UBrick * > &) const |
returns a copy of the child list | |
virtual UBrick * | getChild (int pos) const |
returns the child at this position in the child list | |
virtual UBrick * | getChild (UListPos &) const |
efficient API to retreive children iteratively | |
virtual UBrick * | getChild (bool(predicate)(const UBrick *child), UListPos &=UListPos::none) const |
virtual UBrick * | getChild (UListCall &predicate, bool &status, UListPos &=UListPos::none) const |
searches for children that statisfy a certain condition | |
virtual int | getChildPos (const UBrick &obj, int nth=0) const |
virtual int | getChildPos (const UBrick *obj, int nth=0) const |
returns the position of the Nth occurence of 'obj' in the child list (returns -1 if not found) | |
virtual int | getChildPos (const UBrick *obj, UListPos &) const |
returns the position of the next occurence of 'obj' in the child list (returns -1 if not found) | |
virtual UBrick ** | getAttrs () const |
virtual UBrick ** | getAttrs (int &child_count) const |
returns a copy of the attribute list (works in the same way as getChildren()). | |
virtual int | getAttrCount () const |
returns the number of attributes. | |
virtual void | addAttr (UBrick *child, bool update=true) |
virtual void | addAttr (UBrick &child, bool update=true) |
virtual void | addAttr (ULink &child, bool update=true) |
adds an attribute (works in the same way as add()). | |
virtual void | insertAttr (int pos, UBrick *child, bool update=true) |
virtual void | insertAttr (int pos, UBrick &child, bool update=true) |
virtual void | insertAttr (int pos, ULink &child, bool update=true) |
adds an attribute (works in the same way as insert()). | |
virtual void | removeAttr (UBrick *child, bool auto_delete=true, bool update=true) |
virtual void | removeAttr (UBrick &child, bool auto_delete=true, bool update=true) |
removes an attribute (works in the same way as remove()). | |
virtual void | removeAllAttr (bool auto_delete=true, bool update=true) |
removes all attributes (works in the same way as removeAll()). | |
virtual UBrick * | getAttrChild (UListPos &from) const |
virtual UBrick * | getAttrChild (bool(predicate)(const UBrick *child), UListPos &=UListPos::none) const |
virtual UBrick * | getAttrChild (UListCall &predicate, bool &stat, UListPos &from) const |
searches in the attribute list (works in the same way as getChild()). | |
virtual UBrick * | getAnyChild (UListPos &from) const |
virtual UBrick * | getAnyChild (bool(predicate)(const UBrick *), UListPos &from=UListPos::none) const |
virtual UBrick * | getAnyChild (UListCall &predc, bool &stat, UListPos &from=UListPos::none) const |
searches in the attribute then in the element list (works in the same way as getChild()). | |
virtual UStr | copyText (bool recursive=true) const |
virtual void | copyText (UStr &, bool recursive=true) const |
collates and returns the text that is enclosed in this object | |
virtual int | getViews (std::vector< UView * > &) const |
virtual const UStr * | getTextSeparator () const |
text separator used by retreiveText() for separating enclosed children | |
virtual void | show (bool=true) |
shows the object if argument is true; hides it if false | |
virtual void | hide () |
same as: show(false) | |
virtual void | highlight (bool state) |
highlight the object (and brings it to the top if it is a window) | |
virtual void | update () |
virtual void | update (UUpdate upmode) |
updates this object's paint and/or layout | |
virtual void | close (int status) |
closes this object Default behavior: hides the object (same as show(false)) | |
virtual void | closeWin (int status) |
closes the first window (UDialog, UMenu...) that contains this object | |
virtual void | addImpl (ChildListType, UBrick *child, class ULink *childlink, int pos, bool update, bool *should_update) |
virtual void | removeImpl (ChildListType, UBrick *child, class ULink *prevlink, RemoveMode remove_mode, bool update, bool *should_update) |
ULink * | getChildImpl (ChildListType, const UBrick *child, int nth, class ULink *&prevlink, int *pos) const |
ULink * | getChildImpl (ChildListType, int pos, class ULink *&prevlink) const |
ULink * | getChildImpl (ChildListType, UListPos &from) const |
ULink * | getChildImpl (ChildListType, UListCall &, bool &status, UListPos &from) const |
[impl] implementation of public add/remove/getChild methods | |
virtual void | fire (class UEvent &, const class UOn &) const |
[impl] fires callback functions and callback methods. | |
virtual void | destructs () |
[impl] see important note on subclassing | |
Static Public Member Functions | |
const UStyle & | makeStyle () |
creates the Style of this object | |
void | closeWin (class UEvent &, int status) |
Static Public Attributes | |
UStyle * | style = null |
corresponding Ubit UStyle | |
Friends | |
UGroup & | ugroup (const UArgs &a=UArgs::none) |
creator shortcut that is equivalent to *new UGroup() | |
UCall & | ucloseWin (int status=0) |
callback that closes the first window (UDialog, UMenu...) that contains this object |
This class is used for grouping objects. it is a very lightweight and general container. by opposition to the UBox class (and subclasses) UGroup objects do not have Views and, thus, do not correspond to any specific location on the Screen (there are just genuine containers)
See:
|
constructor; see also creator shortcut ugroup() !init |
|
see important notes on recursive deletion refer to: UBrick::~UBrick() |
|
adds a 'child' to the end of the object's child list Arguments:
|
|
adds a list of children to the end of the object's child list Notes:
|
|
closes this object Default behavior: hides the object (same as show(false)) Can be redefined by subclasses for appropriate behaviors (such as object deletion, saving or freeing data, etc.) Note: status is only meaningful for UWin subclasses. See also: UBox::closeWin(), UWin::close() |
|
closes the first window (UDialog, UMenu...) that contains this object Notes:
|
|
collates and returns the text that is enclosed in this object 'recursive' means that the text included in descendants is also collated. Notes:
|
|
[impl] see important note on subclassing destructs() unlinks the object from its parents and destroys children (when applicable). Any class that redefines removingFrom() MUST HAVE A DESTRUCTOR that calls destructs(). |
|
searches for children that statisfy a certain condition usage:
Examples: |
|
efficient API to retreive children iteratively Notes:
Example:
|
|
returns the child at this position in the child list Arguments:
Note: use getChild(UListPos&) or getChildren() is you need to access many children in the child list: this will be more efficient than multiple calls to getChild(int pos) |
|
[impl] implementation of public add/remove/getChild methods these methods are called by add(), remove(), getChild() and operator delete. They can can possibly be redefined by subclasses. Note however its is generally necessary to redefine all of them simultaneously as these methods call each other |
|
returns the position of the next occurence of 'obj' in the child list (returns -1 if not found) works in the same way as getChild(UListPos&). |
|
returns the position of the Nth occurence of 'obj' in the child list (returns -1 if not found) 'Nth' = 0 means "search first occurence", 'Nth' = 1 "search second occurence", etc. See also: getChildPos(const UBrick*, UListPos&) for multiple calls. |
|
returns a copy of the child list returns the number of children and intializes the vector of children. Note: child_vect is not cleared : children are added to the child_vect argument if its is not empty See also: UBrick** getChildren() and getChild() (and other variants). |
|
returns a copy of the child list Returned value:
Note:
|
|
returns the contextual UStyle of this object This virtual function calls the makeStyle() static function that was redefined for this specific class
Reimplemented in UTrow. |
|
insert a 'child' into the object's child list at this position Arguments:
|
|
creates the Style of this object This static function is redefined by each class that derives from UGroup. It is called by the virtual function UGroup::getStyle()
Reimplemented in UTrow. |
|
removes OR deletes the child at position 'pos' and its descendants Works in the same way as: remove(UBrick&, bool, bool) except that:
|
|
removes 'child' OR deletes 'child' and its descendants Arguments:
|
|
removes all children OR deletes all children and their descendants Works in the same way as: remove(UBrick&, bool, bool). |
|
shows the object if argument is true; hides it if false see also: hide(), isShown(), isShowable() |
|
updates this object's paint and/or layout Arguments:
Note: |
|
callback that closes the first window (UDialog, UMenu...) that contains this object same effect as: UGroup::closeWin() |
|
creator shortcut that is equivalent to *new UGroup() Note: watch the case: UGroup is a class while ugroup() is a function! |