ubit::UGroup Class Reference

Logical "grouping" container. More...

#include <ugroup.hpp>

Inheritance diagram for ubit::UGroup:

ubit::UControl ubit::UBrick ubit::UObject ubit::UBox ubit::UMessagePort ubit::UTrow ubit::UAlertbox ubit::UBar ubit::UButton ubit::UCardbox ubit::UFinder ubit::UFlowbox ubit::UHbox ubit::UItem ubit::ULabel ubit::UListbox ubit::UScrollbar ubit::UScrollpane ubit::USepar ubit::USlider ubit::USpinbox ubit::UStatusbar ubit::UTable ubit::UTextbox ubit::UVbox ubit::UWin List of all members.

Public Types

 REMOVE_FROM_PARENTS = -1
enum  { REMOVE_FROM_PARENTS = -1 }

Public Member Functions

const UStylegetStyle (UContext *) const
 virtual function that returns the UStyle of this object.
 UGroup (const UArgs &=UArgs::none)
 creates a new UGroup; see also the ugroup() shortcut.
virtual ~UGroup ()
 recursive destructor.
virtual UGroupgroupCast ()
 dynamic cast.
virtual unsigned short getNodeType () const
 returns the XML node type.
virtual const UStrgetNodeName () const
 return the XML node name.
virtual const UStrgetNodeValue () const
 return the XML node value.
virtual void initNode (UDoc *context)
 initialises the XML context of this node.
virtual bool isParentOf (const UBrick &possible_child) const
 returns true if this object a direct or indirect parent of 'child'.
virtual UGroupaddlist (const UArgs &child_list)
 adds a list of arguments to the end the child list.
virtual UChildIter add (const UChild &)
 adds an object (deriving from UBrick) to the end of the child list.
virtual UChildIter add (const UChild &, int position)
virtual UChildIter add (const UChild &, UChildIter position)
virtual UChildIter remove (UBrick &, bool auto_delete=true)
 removes/deletes an object (and its descendants) from the child list.
virtual UChildIter removeNC (UBrick &, bool auto_delete=true)
 removes/deletes an object (and its descendants) from the child list.
virtual UChildIter remove (int position, bool auto_delete=true)
 removes/deletes an object (and its descendants) at this position in the child list.
virtual UChildIter remove (UChildIter position, bool auto_delete=true)
 removes/deletes an object (and its descendants) at this position in the child list.
virtual void removeAll (bool auto_delete=true)
 removes/delete all children and their descendants.
UChildIter cbegin () const
 returns a forward iterator pointing to the beginning of the child list.
UChildIter cend () const
 returns a forward iterator pointing to the end of the child list (
UChildReverseIter crbegin () const
 returns a reverse iterator pointing to the beginning of the child list (
UChildReverseIter crend () const
 returns a reverse iterator pionting to the end of the child list (
virtual UChildrenchildren () const
 return the child list.
UChildIter child (int position) const
 returns an iterator pointing to the child at this position; returns cend() if position is out of bounds (
UBrickgetChild (int position) const
 returns the child at this position; returns null if position is out of bounds (
virtual UStr retrieveText (bool recursive=true) const
virtual void retrieveText (UStr &to, bool recursive=true) const
 collates and returns the text that is enclosed in this object.
virtual void addAttr (const UChild &attribute)
 adds an attribute (that should derive from UAttribute) to the end of the attribute list.
virtual void removeAttr (UBrick &attribute, bool auto_delete=true)
 removes an object from the attribute list (may DELETE 'x' AND its descendants if 'auto_delete' is true).
virtual void removeAttrNC (UBrick &attr, bool auto_delete=true)
virtual void removeAllAttrs (bool auto_del=true)
 removes *or* DELETES all attributes AND their descendants.
UChildIter abegin () const
 returns an iterator to the beginning the attribute list.
UChildIter aend () const
 returns an iterator to the end of the attribute list (
virtual UChildrenattributes () const
 returns the attribute list (
virtual const UStrgetAttr (const UStr &name, bool ignore_case=true) const
 returns the value of this attribute (null if not found).
virtual const UPropgetAttrNode (const UStr &name, bool ignore_case=true) const
 returns the node of this attribute (null if not found).
virtual UPropgetAttrNode (const UStr &name, bool ignore_case=true)
 returns the node of this attribute (null if not found).
virtual UPropsetAttrNode (UProp *)
 changes an attribute.
virtual void repaint ()
 specifies that this object must be repainted.
virtual void update ()
 specifies that the layout and the paint of this object must be updated.
virtual void update (const UUpdate &)
 specifies that the layout and/or the paint of this object must be updated.
UGroupautoUpdate (bool state)
 specify auto update policy:
virtual void show (bool=true)
 show/hide this object.
void hide ()
 shortcut for show(false).
virtual void close (int status=0)
 hides and "closes" this object By default, close() is equivalent to hide() but it is redefined by certain subclasses to perform appropriate actions.
virtual void closeWin (int status=0)
 closes the first window (UDialog, UMenu.
virtual const UStrgetTextSeparator () const
 returns the text separator used by retrieveText() for separating enclosed children
virtual UChildIter addImpl (UChildren &, const UChild &, UChildIter, bool update, bool *should_update)
 implementation of all add methods; must be overriden if a subclass need to redefine add() methods.
virtual UChildIter removeImpl (UChildren &, UChildIter, int rem_mode, bool update, bool *should_update)
 implementation of all remove methods; must be overriden if a subclass need to redefine remove() methods.
virtual bool fire (UEvent &, const UOn &) const
 fires callback functions that matches this UOn condition.
virtual int getRelatedViews (std::vector< UView * > &) const
 [impl] returns the views that are related to this object.

Static Public Member Functions

static UStylecreateStyle ()
 < important: all subclasses MUST contain this declaration. static function that returns the UStyle of this class (see details!).
static void closeWinCB (UEvent &, int status)

Friends

UGroupugroup (const UArgs &a=UArgs::none)
 creator shortcut: returns *new UGroup().

Detailed Description

Logical "grouping" container.

This class is a very lightweight and general container. In contrast with UBox (and its subclasses) UGroup objects do not control UViews and do not manage screen rendering directly (they are just genuine containers)

IMPORTANT NOTE ON RECURSIVE DESTRUCTION AND SMART POINTERS: When a "group" is destroyed, its direct and indirect children are ALSO destroyed EXCEPT if they have other parents OR if they are pointed by a uptr<> (Ubit Smart Pointer). See class UBrick for details.

Notes:


Constructor & Destructor Documentation

ubit::UGroup::~UGroup (  )  [virtual]

recursive destructor.

children are automatically destroyed if not pointed elsewhere in the instance graph or by a uptr<>. see class UBrick for details.


Member Function Documentation

UChildIter ubit::UGroup::abegin (  )  const

returns an iterator to the beginning the attribute list.

UChildIter is a child iterator. It is compatible with standard STL algorithms. This example prints the class name of the attributes of an object :

    UBrick* obj = ...;
    for (UChildIter c = obj->abegin(); c != obj->aend(); ++c)
        cout << (*c)->getClassName() << endl;
 
See also:
also: attributes(), aend(), pbegin(), pend()

Reimplemented from ubit::UBrick.

UChildIter ubit::UGroup::add ( const UChild  )  [virtual]

adds an object (deriving from UBrick) to the end of the child list.

Returns an iterator that points to the inserted object. Note that the same object can be added several times to the same parent.

void ubit::UGroup::addAttr ( const UChild attribute  )  [virtual]

adds an attribute (that should derive from UAttribute) to the end of the attribute list.

the argument can also be a conditionnal expression such as: UOn::selected / UColor::red or UOn::action / ucall(obj, &MyObj::callback)

See also:
: UBrick::operator/().

Reimplemented from ubit::UBrick.

UGroup & ubit::UGroup::addlist ( const UArgs child_list  )  [virtual]

adds a list of arguments to the end the child list.

Exemple:

   UGroup* g = new UGroup(); 
   g->addlist( UColor::red + UFont::bold + "abcd" );
 

Reimplemented in ubit::UBox, and ubit::UWin.

UChildIter ubit::UGroup::aend (  )  const

returns an iterator to the end of the attribute list (

See also:
abegin()).

Reimplemented from ubit::UBrick.

virtual UChildren& ubit::UGroup::attributes (  )  const [virtual]

returns the attribute list (

See also:
abegin()).

Reimplemented from ubit::UBrick.

UGroup& ubit::UGroup::autoUpdate ( bool  state  ) 

specify auto update policy:

See also:
UBrick::autoUpdate()

Reimplemented from ubit::UBrick.

UChildIter ubit::UGroup::cbegin (  )  const

returns a forward iterator pointing to the beginning of the child list.

UChildIter is a child iterator. It is compatible with standard STL algorithms. This example prints the children class names:

    UGroup* obj = ...;
    for (UChildIter i = obj->cbegin(); i != obj->cend(); ++i)
        cout << (*i)->getClassName() << endl;
 
See also:
also: children(), cend(), crbegin(), crend(), abegin(), aend(), pbegin(), pend().

UChildIter ubit::UGroup::cend (  )  const

returns a forward iterator pointing to the end of the child list (

See also:
cbegin()).

UChildIter ubit::UGroup::child ( int  position  )  const

returns an iterator pointing to the child at this position; returns cend() if position is out of bounds (

See also:
also: UChildren find*() functions).

virtual UChildren& ubit::UGroup::children (  )  const [virtual]

return the child list.

See also:
also: child(), getChild(), cbegin(), cend(), crbegin(), crend()

void ubit::UGroup::close ( int  status = 0  )  [virtual]

hides and "closes" this object By default, close() is equivalent to hide() but it is redefined by certain subclasses to perform appropriate actions.

If the object is a window (UWin subclass) this function is called when the "Close" button of the window decoration is clicked (see UWin::close())

Reimplemented in ubit::UWin, and ubit::UFrame.

void ubit::UGroup::closeWin ( int  status = 0  )  [virtual]

closes the first window (UDialog, UMenu.

..) that contains this object. See UWin::close() for details on the 'status' arg.

UChildReverseIter ubit::UGroup::crbegin (  )  const

returns a reverse iterator pointing to the beginning of the child list (

See also:
cbegin()).

UStyle * ubit::UGroup::createStyle (  )  [static]

< important: all subclasses MUST contain this declaration. static function that returns the UStyle of this class (see details!).

this macro defines the UClass that corresponds to this class and:

Reimplemented in ubit::UBox, ubit::UVbox, ubit::UHbox, ubit::UFlowbox, ubit::UCardbox, ubit::UAlertbox, ubit::UBar, ubit::UStatusbar, ubit::USepar, ubit::ULabel, ubit::UItem, ubit::UButton, ubit::UTabbutton, ubit::UFlatbutton, ubit::ULinkbutton, ubit::URadiobutton, ubit::UCheckbox, ubit::USpinbox, ubit::UCtlmenu, ubit::UIconbox, ubit::UListbox, ubit::UCombobox, ubit::UMenubar, ubit::UMenu, ubit::UPopmenu, ubit::UPiemenu, ubit::UScrollbar, ubit::UScrollpane, ubit::USlider, ubit::UTable, ubit::UTrow, ubit::UTcell, ubit::UTextbox, ubit::UTextfield, ubit::UTextarea, ubit::UWin, ubit::UDialog, and ubit::UFrame.

UChildReverseIter ubit::UGroup::crend (  )  const

returns a reverse iterator pionting to the end of the child list (

See also:
cbegin()).

UBrick * ubit::UGroup::getChild ( int  position  )  const

returns the child at this position; returns null if position is out of bounds (

See also:
also: UChildren find*() functions).

const UStyle & ubit::UGroup::getStyle ( UContext  )  const

virtual function that returns the UStyle of this object.

this function calls createStyle() the first time it is called.

UChildIter ubit::UGroup::remove ( UChildIter  position,
bool  auto_delete = true 
) [virtual]

removes/deletes an object (and its descendants) at this position in the child list.

See also:
: remove(UBrick&, bool) for important details on removal vs. deletion.

UChildIter ubit::UGroup::remove ( int  position,
bool  auto_delete = true 
) [virtual]

removes/deletes an object (and its descendants) at this position in the child list.

the position is an integer (0 is the position of the first child).

See also:
: remove(UBrick&, bool) for important details on removal vs. deletion.

UChildIter ubit::UGroup::remove ( UBrick ,
bool  auto_delete = true 
) [virtual]

removes/deletes an object (and its descendants) from the child list.

void ubit::UGroup::removeAll ( bool  auto_delete = true  )  [virtual]

removes/delete all children and their descendants.

See remove(UBrick&, bool) for details

void ubit::UGroup::removeAllAttrs ( bool  auto_del = true  )  [virtual]

removes *or* DELETES all attributes AND their descendants.

works in the same way as removeAll()

Reimplemented from ubit::UBrick.

void ubit::UGroup::removeAttr ( UBrick attribute,
bool  auto_delete = true 
) [virtual]

removes an object from the attribute list (may DELETE 'x' AND its descendants if 'auto_delete' is true).

the functions work in the same way as remove(UBrick&, bool)

UChildIter ubit::UGroup::removeNC ( UBrick ,
bool  auto_delete = true 
) [virtual]

removes/deletes an object (and its descendants) from the child list.

Same as remove(UBrick&, bool) except that no error message is issued if the object does not belong toe the child list

virtual void ubit::UGroup::repaint (  )  [virtual]

specifies that this object must be repainted.

note that actual painting is generally delayed (

See also:
UUpdate). this function is a shortcut for: update(UUpdate::paint)

Reimplemented in ubit::UBox, and ubit::UWin.

void ubit::UGroup::retrieveText ( UStr to,
bool  recursive = true 
) const [virtual]

collates and returns the text that is enclosed in this object.

'recursive' means that the text included in descendants is also collated.

void ubit::UGroup::show ( bool  = true  )  [virtual]

show/hide this object.

objects are shown by default (except UWin subclasses).

See also:
: UControl::isShown(), UControl::isShowable()

Reimplemented in ubit::UAlertbox, ubit::UMenu, ubit::UPiemenu, ubit::UWin, ubit::UDialog, and ubit::UFrame.

void ubit::UGroup::update ( const UUpdate  )  [virtual]

specifies that the layout and/or the paint of this object must be updated.

the specific actions that will take place depend on the UUpdate argument. Note that these actions are generally delayed:

See also:
UUpdate for details.

Implements ubit::UControl.

Reimplemented in ubit::UBox, and ubit::UWin.

virtual void ubit::UGroup::update (  )  [virtual]

specifies that the layout and the paint of this object must be updated.

note that these actions are generally delayed (

See also:
UUpdate). this function is a shortcut for: update(UUpdate::layoutAndPaint)

Reimplemented from ubit::UControl.

Reimplemented in ubit::UBox, and ubit::UWin.


Friends And Related Function Documentation

UGroup& ugroup ( const UArgs a = UArgs::none  )  [friend]

creator shortcut: returns *new UGroup().

Note: watch the case: UGroup is a class while ugroup() is a function!


The documentation for this class was generated from the following files:
Generated on Mon Jan 29 00:20:51 2007 for Ubit by  doxygen 1.4.7