Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

UBox Class Reference

Graphical "viewable" container. More...

#include <ubox.hpp>

Inheritance diagram for UBox:

UGroup UBar UButton UCheckbox UFlowbox UHbox UItem ULabel UListbox UPane UScrollbar USepar USpinbox UTable UTextbox UVbox UWin List of all members.

Public Member Functions

 UBox (const UArgs &a=UArgs::none)
 constructor; see also class UGroup, destructor UGroup::~UGroup() and the creator shortcut ubox().
virtual ~UBox ()
 see important notes on recursive deletion : see UGroup::~UGroup()
virtual const UStylegetStyle (UContext *) const
 returns the contextual UStyle of this object
UBoxaddlist (const UArgs &a)
 adds a list of children to the end of the object's child list.
virtual void update ()
virtual void update (UUpdate upmode)
 updates this object's paint and/or layout.
virtual UViewgetView (int no) const
virtual int getViewCount () const
virtual UView ** getViews () const
virtual UView ** getViews (int &view_count) const
virtual int getViews (std::vector< UView * > &) const
 get the views managed by this Box.
UViewgetViewContaining (UEvent &) const
 returns the Box's View that contains the Event location (null if none).
UViewgetViewContaining (UView *child_view) const
 returns the Box's View that contains this (direct or indirect) child view (null if none).
UViewgetFirstViewInside (UView *parent_view) const
 returns the first Box's View that is contained in this (direct) parent view.
virtual UBoxonPostChildEvent (const UArgs &)
 detect events that *have already* been received by children.

Static Public Member Functions

static const UStylemakeStyle ()
 creates the Style of this object.

Static Public Attributes

static UStylestyle = null
 corresponding Ubit UStyle

Friends

UBoxubox (const UArgs &a=UArgs::none)
 creator shortcut that is equivalent to: *new UBox()

Detailed Description

Graphical "viewable" container.

This class is a lightweight container that is able to control one or several Views (UView class) on the Screen. This class is the base for all interactive "gadgets" (UButton, etc.), visible containers (UHbox, UVbox, UMenubar, etc.) and Windows (UWin, UDialog, UMenu...)

Notes:

See:

Geometry:

Examples:


     UBox& r = uhbox( UFont::bold + "String" + ubutton("Button") + etc. );
     UBox* p = &uvbox( UColor::red + ubutton(UPix::folder + "Open") + etc. );
     uptr<UBox>smp = ubar( ubutton("Btn 1") + ubutton("Btn 2") + etc. );
 

These 3 examples show how to create objects in the heap (the dynamic memory). uhbox(), uvbox(), etc. are creator shortcuts that create a new object by calling primitive 'new': uhbox(...) equals *new UHbox(...) They can have a list of child objects as an argument (these children being separated by the + operator).

Notes:


Member Function Documentation

UBox& UBox::addlist const UArgs a  ) 
 

adds a list of children to the end of the object's child list.

Notes:

  • this function is NOT virtual and returns the object
  • this function updates graphics if the list contains UProp, UElem, or UGroup objects Exemple:
  • UGroup& g = ugroup(); g.addlist(UColor::red + UFont::bold + "abcd"):

Reimplemented from UGroup.

UView * UBox::getFirstViewInside UView parent_view  )  const
 

returns the first Box's View that is contained in this (direct) parent view.

Notes:

  • 'parent_view' must be a DIRECT parent
  • there will be several Box's views inside 'parent_view' if the Box has beed multiply added to this parent

virtual const UStyle& UBox::getStyle UContext *   )  const [virtual]
 

returns the contextual UStyle of this object

This virtual function calls the makeStyle() static function that was redefined for this specific class

Reimplemented from UGroup.

Reimplemented in UVbox, UHbox, UBar, UFlowbox, USepar, ULabel, UItem, UButton, UFlatbutton, ULinkbutton, URadiobutton, UCheckbox, UTextbox, UListbox, USpinbox, UMenubar, UMenu, UPopmenu, UPane, UScrollbar, UTable, UTcell, UWin, UDialog, UFrame, and UIncrust.

int UBox::getViews std::vector< UView * > &   )  const [virtual]
 

get the views managed by this Box.

these functions work in the same way as UGroup::getChidren()/getChild()

Reimplemented from UGroup.

const UStyle & UBox::makeStyle  )  [static]
 

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 from UGroup.

Reimplemented in UVbox, UHbox, UBar, UFlowbox, ULabel, UItem, UButton, UTextbox, UListbox, USpinbox, UMenubar, UMenu, UPopmenu, UPane, UTable, UTcell, UWin, UDialog, UFrame, and UIncrust.

UBox & UBox::onPostChildEvent const UArgs  )  [virtual]
 

detect events that *have already* been received by children.

intercepts events that have already bee received by the direct or indirect children of this UBox (or subclass):

  • events are first sent to children, then to this object
  • events which are not processed by children are lost (for instance a UOn::action condition can only be detected at this stage if the child has a UOn::action condition)
  • all UEvent methods (such as getSource(), getX(), getY() ...) are relative to the CHILD

See also:

  • the event condition: UOn::preChildEvent that detect events that *will* be received by children.

Example:

   box->onPostChildEvents( UOn::mmove :: ucall(arg1, func1) 
                          + UOn::mpress:: ucall(arg2, func2))
 

void UBox::update UUpdate  upmode  )  [virtual]
 

updates this object's paint and/or layout.

Arguments:

  • no argument: updates layout then repaints
  • 'upmode' argument : updates according to this argument. see class UUpdate for details

Note:

  • update() must be called after add() or remove() if their last argument was set to 'false'

Reimplemented from UGroup.

Reimplemented in UWin.


Friends And Related Function Documentation

UBox& ubox const UArgs a = UArgs::none  )  [friend]
 

creator shortcut that is equivalent to: *new UBox()

Note: watch the case: UBox is a class while ubox is a function!


The documentation for this class was generated from the following files:
Generated on Thu May 19 12:40:17 2005 for Ubit[Eric.Lecolinet@enst.fr] by  doxygen 1.4.2