#include <ubox.hpp>
Inheritance diagram for ubit::UBox:
Public Member Functions | |
UBox (const UArgs &a=UArgs::none) | |
creates a new UBox; see also the ubox() shortcut. | |
virtual | ~UBox () |
recursive destructor. | |
virtual UBox * | boxCast () |
dynamic cast. | |
virtual UBorder * | getBorder () const |
virtual UBorder * | getBorder (bool create_if_none) |
gets the border of this box. | |
virtual UBox & | addlist (const UArgs &a) |
adds a list of arguments to the end the child list. | |
virtual UBox * | getChildAt (const UPoint &, UView *box_view=null) const |
return the direct child at this location in this box view. | |
virtual UBox * | findChildAt (const UPoint &, UView *box_view=null) const |
return the deepest indirect child at this location in this box view. | |
virtual UDimension | getViewSize (UView *box_view=null) const |
returns the size of this box view. | |
virtual UPoint | getViewPos (UView *box_view=null) const |
returns the position of the upper left corner of this box view. | |
virtual UPoint | getEventPos (const UMouseEvent &) const |
returns the position of this event in the box view that received it. | |
virtual int | getViewCount () const |
returns the number of views of this box. | |
virtual int | getViews (std::vector< UView * > &) const |
returns the views of this box (see DETAILS). | |
virtual int | getRelatedViews (std::vector< UView * > &v) const |
[impl] returns the views that are related to this object. | |
virtual UView * | getView (int n=0) const |
returns the Nth view of this box (see DETAILS). | |
virtual UView * | getViewAt (const UMouseEvent &) const |
returns the box view that contains this event (see also: getEventPos()). | |
virtual UView * | getViewContaining (const UView *child_view) const |
returns the box view that contains 'child_view'. | |
virtual UView * | getFirstViewInside (const UView *parent_view) const |
returns the first box view that is contained in 'parent_view'. | |
void | setViewModes (int view_modes, bool) |
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. | |
Static Public Member Functions | |
static UStyle * | createStyle () |
< important: all subclasses MUST contain this declaration. static function that returns the UStyle of this class (see details!). | |
Friends | |
UBox & | ubox (const UArgs &a=UArgs::none) |
creator shortcut: returns *new UBox(). |
This class is a lightweight container that controls one or several UViews on the screen. It is the base class for most interactors [e.g. UButton, UTextfield...], containers [UHbox, UVbox, UMenubar...] and windows [UWin UDialog, UMenu...]. Note that most methods are inherited from superclasses.
IMPORTANT NOTE ON RECURSIVE DESTRUCTION AND SMART POINTERS: When a "box" 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.
Multiple parents and multiple views:
Layout:
AutoResize:
virtual ubit::UBox::~UBox | ( | ) | [virtual] |
recursive destructor.
children are automatically destroyed if not pointed elsewhere (in the instance graph or by a uptr<>). see class UBrick for details.
adds a list of arguments to the end the child list.
Exemple:
UBox* b = new UBox(); b->addlist( UColor::red + UFont::bold + "abcd" );
Reimplemented from ubit::UGroup.
Reimplemented in ubit::UWin.
UStyle * ubit::UBox::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 from ubit::UGroup.
Reimplemented in 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::UTcell, ubit::UTextbox, ubit::UTextfield, ubit::UTextarea, ubit::UWin, ubit::UDialog, and ubit::UFrame.
return the deepest indirect child at this location in this box view.
a box can control several views. Returns the child at this position in the first view if 'box_view' = null
UBorder * ubit::UBox::getBorder | ( | bool | create_if_none | ) | [virtual] |
gets the border of this box.
creates a border if arg is true and this box has no border.
return the direct child at this location in this box view.
a box can control several views. Returns the child at this position in the first view if 'box_view' = null
UPoint ubit::UBox::getEventPos | ( | const UMouseEvent & | ) | const [virtual] |
returns the position of this event in the box view that received it.
getViewAt() returns the box view that received the event.
returns the first box view that is contained in 'parent_view'.
'parent_view' must be belong to a (direct or indirect) parent of this box null is returned otherwise.
UView * ubit::UBox::getView | ( | int | n = 0 |
) | const [virtual] |
returns the Nth view of this box (see DETAILS).
returns the first view if 'n' = 0 and the last view if 'n' = -1. Object views can be retreived as follows:
for (UView* v = obj->getView(); v!=null; v = v->getNext()) ....;
returns the box view that contains 'child_view'.
'child_view' must be belong to a (direct or indirect) child of this box. null is returned otherwise.
UPoint ubit::UBox::getViewPos | ( | UView * | box_view = null |
) | const [virtual] |
returns the position of the upper left corner of this box view.
a box can control several views. Returns the upper left corner of the first view if 'box_view' = null
int ubit::UBox::getViews | ( | std::vector< UView * > & | ) | const [virtual] |
returns the views of this box (see DETAILS).
The following example shows a more efficient way to retrieve views:
for (UView* v = obj->getView(); v!=null; v = v->getNext()) ....;
UDimension ubit::UBox::getViewSize | ( | UView * | box_view = null |
) | const [virtual] |
returns the size of this box view.
a box can control several views. Returns the size of the first view if 'box_view' = null
virtual void ubit::UBox::repaint | ( | ) | [virtual] |
specifies that this object must be repainted.
note that actual painting is generally delayed (
Reimplemented from ubit::UGroup.
Reimplemented in ubit::UWin.
void ubit::UBox::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:
Reimplemented from ubit::UGroup.
Reimplemented in ubit::UWin.
virtual void ubit::UBox::update | ( | ) | [virtual] |
specifies that the layout and the paint of this object must be updated.
note that these actions are generally delayed (
Reimplemented from ubit::UGroup.
Reimplemented in ubit::UWin.