20 #include <ubit/uattr.hpp> 21 #include <ubit/uupdate.hpp> 22 #include <ubit/uargs.hpp> 23 #include <ubit/ustr.hpp> 92 virtual int getDisplayType()
const {
return INLINE;}
138 template <
class ATTR>
145 template <
class ATTR>
147 {ATTR* a; _attributes.
findClass(a);
if (!a)
addAttr(a =
new ATTR);
return *a;}
223 UElem&
remove(
UNode& child,
bool auto_delete =
true);
237 UElem&
remove(
int pos,
bool auto_delete =
true);
259 UChildren& getChildren()
const {
return children();}
264 int getChildCount()
const {
return children().size();}
269 UChildIter child(
int pos)
const {
return children().at(pos);}
336 virtual void show(
bool =
true);
431 virtual UElem&
setEnabled(
bool state =
true,
bool call_callbacks =
true);
448 bool isSelected()
const {
return emodes.
IS_SELECTED;}
451 UElem& setSelectable(
bool state =
true);
455 bool isArmed()
const;
463 UElem& setArmable(
bool state =
true);
467 UElem& setAutoRepeat(
bool state =
true);
471 UElem& setCrossable(
bool state =
true);
473 UElem& setBrowsable(
bool =
true);
476 bool isDragged()
const;
478 UElem& setDraggable(
bool =
true);
481 UElem& setDroppable(
bool =
true);
486 bool isFloating()
const {
return emodes.
IS_FLOATING;}
487 bool isVertical()
const {
return emodes.
IS_VERTICAL;}
488 bool isWidthResizable()
const {
return !emodes.IS_WIDTH_UNRESIZABLE;}
489 bool isHeightResizable()
const {
return !emodes.IS_HEIGHT_UNRESIZABLE;}
490 virtual bool isSubWin()
const {
return false;}
513 unsigned IS_WIDTH_UNRESIZABLE:1;
514 unsigned IS_HEIGHT_UNRESIZABLE:1;
517 unsigned HAS_ORIENT:1;
521 unsigned DONT_CLOSE_MENUS:1;
522 unsigned OBSERVE_EVENTS:1;
525 CATCH_MOUSE_MASK = 1<<0, CATCH_MOUSE_MOVE_MASK = 1<<1,
526 CATCH_WHEEL_MASK = 1<<2, CATCH_KEY_MASK = 1<<3
531 enum {REMOVE_FROM_PARENTS = -1};
533 bool isBrowsingGroup() {
return emodes.IS_BROWSABLE;}
538 virtual UChildren& children()
const {
return _children;}
543 virtual UChildren& attributes()
const {
return _attributes;}
548 UChildIter abegin()
const {
return attributes().begin();}
554 UChildIter aend()
const {
return attributes().end();}
557 UObject::State getInterState()
const {
return ostate;}
560 void setInterState(UObject::State);
566 virtual void deleteViewsInside(
const std::vector<UView*>& parent_views);
568 virtual void initView(
UView* parent_view);
569 virtual void initChildViews(
UElem*);
570 virtual void highlight(
bool state) {};
572 virtual int retrieveRelatedViews(std::vector<UView*>& collating_vector)
const;
588 UElem& _setArmableAndSelectable(
bool state);
597 virtual void keyPressBehavior(
UKeyEvent&);
598 virtual void keyReleaseBehavior(
UKeyEvent&);
599 virtual void enterBehavior(
UInputEvent&,
bool is_browing);
600 virtual void leaveBehavior(
UInputEvent&,
bool is_browing);
601 virtual void armBehavior(
UInputEvent&,
bool is_browing);
602 virtual void disarmBehavior(
UInputEvent&,
bool is_browing);
608 friend class UChildEventFlag;
622 mutable Modes emodes;
625 virtual int _getTextLength(
bool recursive)
const;
626 virtual char* _getTextData(
char *ptr,
bool recursive)
const;
UChildReverseIter crbegin() const
returns a reverse iterator pointing to the beginning of the child list (
Definition: uelem.hpp:296
unsigned IS_FLOATING
has a UPos attr in floating mode.
Definition: uelem.hpp:515
Base class for attributes.
Definition: uattr.hpp:97
ATTR & obtainAttr()
retrieves or creates the element's attribute that derives from the "ATTR" C++ class.
Definition: uelem.hpp:146
keyboard events
Definition: uevent.hpp:316
bool isIgnoringEvents() const
returns true if events are ignored by this object;
Definition: uelem.hpp:417
Widget position.
Definition: uboxgeom.hpp:91
UElem & removeAttr(UNode &attribute, bool auto_delete=true)
removes/deletes an attribute (and its descendants) from the ATTRIBUTE list.
Definition: uelem.cpp:386
static const UUpdate layoutAndPaint
layout then paint: prefined constant for UUpdate(LAYOUT|PAINT);
Definition: uupdate.hpp:50
unsigned IS_DRAGGABLE
can be dragged (with button 1 or button2)
Definition: uelem.hpp:507
unsigned HAS_TIP
has a tool tip.
Definition: uelem.hpp:520
Box tool tip.
Definition: uattr.hpp:197
virtual void initNode(UDoc *context)
initialises the XML context of this node.
Definition: uelem.hpp:94
unsigned IS_TEXT_SELECTABLE
can select included text
Definition: uelem.hpp:511
virtual bool addImpl1(const UChild &node, UChildIter pos, UChildren &in_list)
Definition: uelem.cpp:166
static const UUpdate paint
paint only: prefined constant for UUpdate(PAINT);
Definition: uupdate.hpp:47
Base class of objects that can be added to the UBIT scene graph (SEE DETAILS!).
Definition: unode.hpp:38
Ubit Event class.
Definition: uevent.hpp:30
unsigned IS_SELECTABLE
can be selected (as for a checkbox)
Definition: uelem.hpp:509
UElem & enable(bool state=true)
shortcut for setEnabled(bool state = true).
Definition: uelem.hpp:428
unsigned IS_VERTICAL
has a vertical orientation (see HAS_ORIENT).
Definition: uelem.hpp:516
static UStyle * createStyle()
static function that returns the style of this class.
Definition: uelem.cpp:58
virtual UElem & setEnabled(bool state=true, bool call_callbacks=true)
specifies whether this object is enabled.
Definition: uelem.cpp:887
Display Context.
Definition: udisp.hpp:44
UChildReverseIter crend() const
returns a reverse iterator pionting to the end of the child list (
Definition: uelem.hpp:299
UElem & setAttr(UNode &attribute)
adds or replaces this attribute in the ATTRIBUTE list.
Definition: uelem.cpp:366
const UStyle & getStyle(UUpdateContext *) const
virtual function that returns the style of this object.
Definition: uelem.cpp:38
unsigned IS_CROSSABLE
detects (and shows) UOn::enter and UOn::leave conditions
Definition: uelem.hpp:504
UElem & removeAllAttrs(bool auto_delete=true)
removes/deletes all attributes (and their descendants) in the ATTRIBUTE list.
Definition: uelem.cpp:392
Definition: uupdatecontext.hpp:98
unsigned IS_SELECTED
this object is currently selected.
Definition: uelem.hpp:510
virtual UElem * toElem()
dynamic cast: returns this object if it derives from UElem and null otherwise.
Definition: uelem.hpp:70
virtual int getNodeType() const
returns the XML node type.
Definition: uelem.hpp:86
UElem & add(const UArgs &children)
adds one or several objects to the end of the CHILD list of this element.
Text editing and caret controller.
Definition: uedit.hpp:30
UChildIter cbegin() const
returns the child at this position.
Definition: uelem.hpp:281
UElem & ignoreEvents(bool state=true)
if arg is true, this element and (its children) ignore events.
Definition: uelem.cpp:717
specifies how to update UElem, UBox, UWin objects and subclasses.
Definition: uupdate.hpp:25
void disableMenuClosing(bool s=true)
this object and its children wont close menus when clicked if argument is true.
Definition: uelem.hpp:492
bool isArmable() const
specifies whether this object can be armed.
Definition: uelem.hpp:457
unsigned CATCH_EVENTS
this object can catch mouse events.
Definition: uelem.hpp:528
bool isMenuClosingDisabled() const
true if this object and its children do not close menus when clicked.
Definition: uelem.hpp:495
unsigned IS_BROWSABLE
can browse (as for lists and menus)
Definition: uelem.hpp:503
bool getAttrValue(UStr &value, const UStr &attr_name) const
retrieves the value of the attribute which class name is 'attr_name'.
Definition: uelem.cpp:352
virtual bool fire(UEvent &) const
fires callback functions that match this event.
Definition: uelem.cpp:816
Generic Document.
Definition: udoc.hpp:122
lightweight general purpose container.
Definition: uelem.hpp:44
Child (or attribute) list.
Definition: uchild.hpp:79
virtual const UElem * toElem() const
dynamic cast: returns this object if it derives from UElem and null otherwise.
Definition: uelem.hpp:71
virtual bool isShown() const
returns true if this object is shown.
Definition: uelem.cpp:489
virtual const UStr & getNodeName() const
return the XML node name (which is the class name).
Definition: uelem.hpp:89
unsigned IS_ARMABLE
can be armed
Definition: uelem.hpp:505
virtual UElem & setSelected(bool state=true, bool call_callbacks=true)
specifies whether this object is selected.
Definition: uelem.cpp:896
Argument list (for passing arguments to constructor or add functions).
Definition: uargs.hpp:43
virtual void destructs()
unlinks the object from its parents and destroys its children.
Definition: uelem.cpp:109
Callback conditions.
Definition: uon.hpp:35
Widget Orientation.
Definition: uboxgeom.hpp:365
void update()
indicates that this object will be layed out and repainted (when the main loop becomes idle)...
Definition: uelem.hpp:349
unsigned HAS_LAYOUT
has a layout attr.
Definition: uelem.hpp:519
UElem & addAttr(const UArgs &attributes)
adds one or several attributes (deriving from UAttr) to the ATTRIBUTE list.
Definition: uelem.cpp:382
Event Flow.
Definition: ueventflow.hpp:34
void setShowable(bool s) const
synonym for show(bool).
Definition: uelem.hpp:333
Box View.
Definition: uview.hpp:65
ATTR * getAttr() const
retrieves the attribute node that derives from the "ATTR" C++ class.
Definition: uelem.hpp:139
Specifies the View Style of an UBox.
Definition: uview.hpp:42
UElem & observeChildrenEvents(const UChild &condition_callback_expr)
observe events that occur in children.
Definition: uelem.cpp:752
Definition: uupdatecontext.hpp:32
unsigned IGNORE_EVENTS
this object ignores events.
Definition: uelem.hpp:523
unsigned IS_TEXT_EDITABLE
can edit included text (ie. the group contains a UEdit brick)
Definition: uelem.hpp:512
virtual bool isParentOf(const UNode &possible_child) const
returns true if this object a direct or indirect parent of 'child'.
Definition: uelem.cpp:296
Definition: uhardfont.hpp:31
bool isEnabled() const
returns true if this object is currently enabled;
Definition: uelem.cpp:665
virtual const UStr * getTextSeparator() const
returns the text separator used by retrieveText() for separating enclosed children ...
Definition: uelem.cpp:34
static const UArgs none
the empty arglist.
Definition: uargs.hpp:45
unsigned IS_SHOWABLE
can be shown if parents are shown (see isShowable() and isShown())
Definition: uelem.hpp:502
unsigned HAS_CURSOR
has a cursor attr.
Definition: uelem.hpp:518
unsigned IS_AUTO_REPEAT
auto-repeats UOn::arm while armed
Definition: uelem.hpp:506
UElem & removeAll(bool auto_delete=true)
removes/deletes all children (and their descendants) in the CHILD list.
Definition: uelem.cpp:335
unsigned IS_DROPPABLE
can be dropped
Definition: uelem.hpp:508
virtual const UClass & getClass() const
instance method that returns the metaclass of this object.
Definition: uobject.hpp:134
Base class for windows and menus.
Definition: uwin.hpp:47
bool hasCallback(long callback_id) const
true if thie object has such a callback.
Definition: uelem.cpp:812
bool isShowable() const
returns true if this object can be shown.
Definition: uelem.hpp:325
static void closeWin(UInputEvent &, int status)
closes the first window (UDialog, UMenu...) that contains this element.
Definition: uelem.cpp:438
Mouse cursor property.
Definition: ucursor.hpp:31
Widget Size.
Definition: uboxgeom.hpp:228
void repaint()
indicates that this object will be repainted (when the main loop becomes idle).
Definition: uelem.hpp:346
virtual UStr retrieveText(bool recursive=true) const
collates and returns the text that is enclosed in this object.
UChildIter findClass(CC *&c)
returns an iterator to the first child that derives from this class.
Definition: uchild.hpp:105
Compiled Object Style.
Definition: ustyle.hpp:44
virtual void show(bool=true)
shows/hides this object.
Definition: uelem.cpp:468
const UStr & getName() const
returns the class name.
Definition: uclass.hpp:95
virtual ~UElem()
destructor, note that children are recursively destroyed except if pointed elsewhere ( ...
Definition: uelem.cpp:95
Ubit String.
Definition: ustr.hpp:72
UElem & catchEvents(const UChild &condition_callback_expr)
catches certain events before they reach the object's children.
Definition: uelem.cpp:724
[impl] Internal implementation of a child node.
Definition: uchild.hpp:23
Definition: uelem.hpp:501
UNode * getChild(int pos) const
returns an iterator pointing to the child at this position.
Definition: uelem.cpp:300
UChildIter cend() const
returns a forward iterator pointing to the end of the child list (
Definition: uelem.hpp:293