#include <uwidget.hpp>
Inheritance diagram for ufo::UWidget:
Public Types | |
enum | InputCondition { WhenFocused = 1, WhenAncestorFocused = 2 } |
enum | EventState { NoEvents = 0x0000, MouseEvents = 0x0001, MouseMotionEvents = 0x0002, MouseWheelEvents = 0x0004, KeyEvents = 0x0008, WidgetEvents = 0x0010, FocusEvents = 0x0020 } |
Public Member Functions | |
UWidget (ULayoutManager *layout) | |
virtual bool | isVisible () const |
virtual void | setVisible (bool v) |
void | setClipping (bool b) |
bool | hasClipping () const |
bool | isEnabled () const |
void | setEnabled (bool b) |
bool | isOpaque () const |
virtual void | setOpaque (bool o) |
virtual bool | isActive () const |
virtual bool | isInValidHierarchy () const |
bool | isValid () const |
virtual void | validate () |
virtual void | validateSelf () |
virtual void | invalidateSelf () |
void | invalidate () |
void | invalidateTree () |
int | getX () const |
int | getY () const |
int | getWidth () const |
int | getHeight () const |
void | setLocation (int x, int y) |
void | setLocation (const UPoint &p) |
virtual UPoint | getLocation () const |
void | setSize (int w, int h) |
void | setSize (const UDimension &d) |
virtual UDimension | getSize () const |
UDimension | getInnerSize () const |
virtual void | setBounds (int x, int y, int w, int h) |
void | setBounds (const URectangle &b) |
virtual URectangle | getBounds () const |
URectangle | getInnerBounds () const |
URectangle | getRootBounds () const |
URectangle | getClipBounds () const |
bool | contains (int x, int y) const |
bool | contains (const UPoint &p) const |
bool | containsRootPoint (int x, int y) const |
bool | containsRootPoint (const UPoint &p) const |
UPoint | pointToRootPoint (int x, int y) const |
UPoint | pointToRootPoint (const UPoint &p) const |
UPoint | rootPointToPoint (int x, int y) const |
UPoint | rootPointToPoint (const UPoint &p) const |
UPoint | getRootLocation () const |
virtual void | paint (UGraphics *g) |
void | repaint () |
virtual UStyleManager * | getStyleManager () const |
UStyle * | getStyle () const |
void | setStyle (UStyle *style) |
const UStyleHints * | getStyleHints () const |
void | setStyleHints (UStyleHints *hints) |
void | setCssType (const std::string &type) |
std::string | getCssType () const |
void | setCssClass (const std::string &cssClass) |
std::string | getCssClass () const |
UContext * | getContext () const |
void | setContext (UContext *context) |
UUIManager * | getUIManager () const |
UGraphics * | getGraphics () const |
float | getOpacity () const |
virtual void | setOpacity (float f) |
void | setPalette (const UPalette &palette) |
const UPalette & | getPalette () const |
void | setBackgroundColor (const UColor &col) |
const UColor & | getBackgroundColor () const |
void | setForegroundColor (const UColor &col) |
const UColor & | getForegroundColor () const |
bool | hasBackground () const |
void | setBackground (UDrawable *tex) |
UDrawable * | getBackground () const |
void | setFont (const UFont &font) |
const UFont & | getFont () const |
void | setBorder (BorderType borderType) |
BorderType | getBorder () const |
void | setMargin (const UInsets &margin) |
void | setMargin (int top, int left, int bottom, int right) |
const UInsets & | getMargin () const |
virtual UInsets | getInsets () const |
void | setMinimumSize (const UDimension &minimumSize) |
UDimension | getMinimumSize () const |
void | setPreferredSize (const UDimension &preferredSize) |
void | setMaximumSize (const UDimension &maximumSize) |
UDimension | getMaximumSize () const |
void | setHorizontalAlignment (Alignment alignX) |
Alignment | getHorizontalAlignment () const |
void | setVerticalAlignment (Alignment alignY) |
Alignment | getVerticalAlignment () const |
void | setDirection (Direction dir) |
Direction | getDirection () const |
void | setOrientation (Orientation orientation) |
Orientation | getOrientation () const |
virtual bool | isFocused () const |
virtual bool | isChildFocused () const |
virtual bool | isAncestorFocused () const |
virtual UWidget * | requestFocus () |
virtual bool | releaseFocus () |
virtual bool | isFocusable () const |
virtual void | setFocusable (bool focusable) |
bool | hasMouseFocus () const |
void | dispatchEvent (UEvent *e) |
void | setPopupMenu (UPopupMenu *popupMenu) |
virtual UPopupMenu * | getPopupMenu () const |
virtual bool | remove (UWidget *w) |
virtual bool | remove (unsigned int n) |
virtual UWidget * | removeAndReturn (unsigned int n) |
virtual unsigned int | removeAll () |
void | add (UWidget *w, int index=-1) |
void | add (UWidget *w, UObject *constraints, int index=-1) |
void | add (UWidget *w, const UObject *constraints, int index=-1) |
virtual URootPane * | getRootPane (bool topmost=false) const |
UWidget * | getParent () const |
int | getIndexOf (const UWidget *w) const |
void | setIndexOf (UWidget *w, int index) |
UWidget * | getWidget (unsigned int n) const |
UWidget * | getWidgetAt (int x, int y) const |
virtual UWidget * | getWidgetAt (const UPoint &p) const |
UWidget * | getVisibleWidgetAt (int x, int y) const |
virtual UWidget * | getVisibleWidgetAt (const UPoint &p) const |
unsigned int | getWidgetCount () const |
const std::vector< UWidget * > & | getWidgets () const |
std::vector< UWidget * > & | getWidgets () |
ULayoutManager * | getLayout () const |
void | setLayout (ULayoutManager *layout) |
virtual UDimension | getPreferredSize () const |
virtual UDimension | getPreferredSize (const UDimension &maxSize) const |
void | put (const std::string &key, UObject *value) |
void | put (const std::string &key, const std::string &value) |
UObject * | get (const std::string &key) const |
std::string | getString (const std::string &key) const |
UInputMap * | getInputMap (InputCondition conditionA=WhenFocused) |
void | setInputMap (UInputMap *newInputMapA, InputCondition conditionA=WhenFocused) |
void | setEventState (UEvent::Type type, bool b) |
bool | isEventEnabled (UEvent::Type type) const |
const UWidgetModel * | getModel () const |
void | grabShortcut (const UKeyStroke &stroke) |
void | releaseShortcut (const UKeyStroke &stroke) |
void | releaseAllShortcuts () |
bool | testState (uint32_t state) const |
void | setState (uint32_t state, bool b=true) |
void | setStates (uint32_t states) |
uint32_t | getStates () const |
USignal1< UMouseEvent * > & | sigMouseEntered () |
USignal1< UMouseEvent * > & | sigMouseExited () |
USignal1< UMouseEvent * > & | sigMouseMoved () |
USignal1< UMouseEvent * > & | sigMouseDragged () |
USignal1< UMouseEvent * > & | sigMousePressed () |
USignal1< UMouseEvent * > & | sigMouseReleased () |
USignal1< UMouseEvent * > & | sigMouseClicked () |
USignal1< UMouseWheelEvent * > & | sigMouseWheel () |
USignal1< UKeyEvent * > & | sigKeyPressed () |
USignal1< UKeyEvent * > & | sigKeyReleased () |
USignal1< UKeyEvent * > & | sigKeyTyped () |
USignal1< UWidgetEvent * > & | sigWidgetMoved () |
USignal1< UWidgetEvent * > & | sigWidgetResized () |
USignal1< UWidgetEvent * > & | sigWidgetShown () |
USignal1< UWidgetEvent * > & | sigWidgetHidden () |
USignal1< UWidgetEvent * > & | sigWidgetAdded () |
USignal1< UWidgetEvent * > & | sigWidgetRemoved () |
USignal1< UFocusEvent * > & | sigFocusGained () |
USignal1< UFocusEvent * > & | sigFocusLost () |
Static Public Member Functions | |
UWidget * | getFocusedWidget () |
UWidget * | getMouseFocusWidget () |
Protected Member Functions | |
virtual std::ostream & | paramString (std::ostream &os) const |
virtual void | addImpl (UWidget *w, UObject *constraints, int index) |
virtual bool | removeImpl (int index) |
virtual void | addedToHierarchy () |
virtual void | removedFromHierarchy () |
void | doLayout () |
virtual void | paintWidget (UGraphics *g) |
virtual void | paintBorder (UGraphics *g) |
virtual void | paintChildren (UGraphics *g) |
virtual void | processEvent (UEvent *e) |
virtual void | processMouseEvent (UMouseEvent *e) |
virtual void | processMouseWheelEvent (UMouseWheelEvent *e) |
virtual void | processKeyEvent (UKeyEvent *e) |
virtual void | processShortcutEvent (UShortcutEvent *e) |
virtual void | processFocusEvent (UFocusEvent *e) |
virtual void | processWidgetEvent (UWidgetEvent *e) |
virtual void | processStyleHintChange (uint32_t styleHint) |
virtual void | processStateChangeEvent (uint32_t state) |
bool | firePropertyChangeEvent (const std::string &prop, UObject *oldValue, UObject *newValue) |
bool | fireMouseEvent (UMouseEvent *e) |
bool | fireKeyEvent (UKeyEvent *e) |
bool | fireFocusEvent (UFocusEvent *e) |
bool | fireWidgetEvent (UWidgetEvent *e) |
bool | notifyKeyBindingAction (const UKeyStroke &ks, UKeyEvent *e, InputCondition condition) |
virtual bool | processKeyBindings (UKeyEvent *e) |
void | resetFocus () |
virtual UDimension | getContentsSize (const UDimension &maxSize) const |
void | detachStyleHints () |
Protected Attributes | |
UContext * | m_context |
UWidgetModel * | m_model |
Static Protected Attributes | |
UWidget * | sm_inputFocusWidget |
UWidget * | sm_mouseFocusWidget |
UWidget * | sm_dragWidget |
Every UFO widget is derived from UWidget. All base functionality is provided by this class, i.e. input event processing, sizing, container functionality (adding other widgets), layouting (using layout managers, default is UBoxLayout), several widget attributes, ...
|
add a sub widget at the specified index
|
|
add a sub widget at the specified index
|
|
Adds a sub widget at the specified index
|
|
Notifies recursively all childs that they have been added to a valid containment hierarchy. Reimplemented in ufo::URootPane.
|
|
Adds child widgets to this widget. This function should be overridden instead of other add functions
Reimplemented in ufo::ULayeredPane, ufo::UMenu, ufo::UStackWidget, and ufo::UViewport.
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. |
|
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. |
|
|
|
Dispatches any GUI Event. This gives a chance to preprocess some events by the widget. If event e is not enabled for this widget and e is an input event, event e is propagated to the parent of this widget. Events are processed by the internal process* functions |
|
Use validate() to layout child widgets. This class or method is obsolete, it is provided for compatibility only. |
|
notifies all focus listeners that a focus event of the specified type has occured |
|
notifies all key listeners that a key event has occured |
|
notifies all mouse listeners that a mouse event has occured |
|
notifies all property change listeners that a property change was performed |
|
notifies all widget listeners that a widget event of the specified type has occured |
|
|
|
|
|
|
|
|
|
|
|
Returns the bounding rectangle in root coordinates which should be used for clipping. Takes into account if a parent widget does also clipping. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This is a convenience method to get the bounding rectangle in coordinates of this widget minus the insets. That means for example the rectangle within a custom widget which is not covered by the border. |
|
|
|
Returns an input map of the given condition. You can modify ist data directly, so you do not have to set it as input map again. An input map registers all actions that should take place if a keyboard event occured. So far, there are two conditions: WHEN_FOCUSED conditions fires action when the key event occurred while this widget was focused. WHEN_ANCESTOR_FOCUSED conditions fires action when the key event occurred while this widget or an ancestor was focused. |
|
returns all insets, i.e. insets of a possible border and margin
|
|
|
|
|
|
returns a possible margin between the widget content and a border |
|
|
|
|
|
You shouldn't need to call this method! It's supposed to be UFO internal.
|
|
|
|
|
|
|
|
|
|
Returns the popup menu. |
|
In difference to
|
|
This method returns a size hint used by the layout manager to compute desired extensions of widget and to layout child widgets. If an explicit preferred size was set, return that one. Otherwise the preferred size is calculated via the UI object, the layout manager or other size resources.
|
|
This is a convenience method. It returns the bounds of this widget relative to the top-most root pane. It takes the root location and the size of this widget. |
|
|
|
Returns the root pane object for this widget. If topmost is true, this function returns the top most root pane object, which is normally nested in an UXFrame. If topmost is false, this function could return the rootpane of an internal frame.
|
|
|
|
This method is for convenience
|
|
|
|
|
|
|
|
|
|
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Reimplemented in ufo::URootPane.
|
|
Returns the top most visible child widget at the given position. The point should be in the coordinate system of this widget
|
|
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. |
|
Returns the top most child widget at the given position. The point should be in the coordinate system of this widget
|
|
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. |
|
|
|
|
|
|
|
|
|
As soon as a widget is visible and focused, all key strokes which are equal to the given one fire a shortcut event to this widget. It can be processed via processShortcutEvent. Every key stroke which match a shortcut fires exactly one shortcut event to one widget. If more than one widget registered for the same shortcut, UShortcutEvent::isAmbiguous() returns true. Pressing the stroke again dispatches a newly created event to the next listener.
|
|
|
|
Returns true when clipping is enabled. |
|
Returns true when the mouse pointer is over this widget. |
|
Calls invalidateSelf and invalidates the parent widget. |
|
Invalidates the specified attributes of this widget and forces a relayout of child widgets. This is called by invalidate.
Reimplemented in ufo::UMenu.
|
|
invalidates all child widgets and this widget itsself. |
|
Returns whether this widget is active. Mostly this means that the current widget has mouse focus. But this may differ from widget to widget (e.g. text widget are active if they have keyboard focus). This is not really an isolated widget state but the combination of other states. It is used as style hint for the UI object. Reimplemented in ufo::UButton, and ufo::UInternalFrame.
|
|
|
|
|
|
Checks whether this widget is enabled or not |
|
Returns whether an event is enabled and processed by this widget. |
|
|
|
Many attributes of a widget can only be stated when it is within a valid containment hierarchy (and mapped to screen). For example, the correct UI object can be determined only if the top level widget belongs to a UFO context.
|
|
|
|
Returns true if the layout manager has laid out all children. |
|
|
|
The main paint function. Calls (in the following order) paintWidget, paintBorder and paintChildren. You shouldn't override this methods directly, but paintWidget. This methods checks for clipping, set the translation and the font attribute. If you want to repaint this widget, call repaint.
|
|
Paints the widget's border. |
|
Paints recursively the child widgets. Reimplemented in ufo::UViewport.
|
|
Paints the widget itsself. Normally, this means drawing the UI. This is the method which should be overriden if you want to use your own drawing code (and don't want to create custom UI classes). Reimplemented in ufo::UListBox.
|
|
Prints some useful internal data to the ostream os. This method is meant only for debugging purposes. Reimplemented from ufo::UObject.
Reimplemented in ufo::UCompound, and ufo::UMenu.
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. |
|
Transforms the coordinates of the given point from the coord system relative to this widget to the coord system relative to top-level rootpane
|
|
Process the event by invoking a appropriate process* functions |
|
Processes key events. Primarily, it is used to notify listeners. |
|
Processes key bindings in input maps.
|
|
Processes key events. Primarily, it is used to notify listeners. Reimplemented in ufo::UButton, ufo::UComboBox, ufo::ULineEdit, ufo::UListBox, ufo::UMenuItem, and ufo::UTextEdit.
|
|
Processes focus events. Primarily, it is used to notify listeners. Reimplemented in ufo::UButton, ufo::UComboBox, ufo::UInternalFrame, ufo::UListBox, ufo::UMenuItem, ufo::UScrollBar, ufo::USlider, ufo::USpinBox, ufo::UTextEdit, and ufo::UTextWidget.
|
|
Processes focus events. Primarily, it is used to notify listeners. Reimplemented in ufo::UAbstractSlider, and ufo::UScrollPane.
|
|
Processes widget events. Primarily, it is used to notify listeners. Reimplemented in ufo::UDesktopPane, ufo::UInternalFrame, ufo::UListBox, and ufo::UScrollPane.
|
|
const std::string wrapper for put(const std::string &, UObject *);
|
|
puts a property in the local UProperty object
|
|
Releases all previously grabbed shortcuts.
|
|
Releases the focus. Returns true on success. |
|
Releases a previously grabbed shortcut.
|
|
removes the n īth widget
|
|
if this is a parent of w, w will be removed of the children list
|
|
Removes all child widgets.
|
|
removes the n īth widget
|
|
|
|
Removes the widget at the given index.
Reimplemented in ufo::UStackWidget.
|
|
Registers this widget as dirty widget at the repaint manager and schedules a repaint event. |
|
tries to get input focus.
|
|
Resets input and mouse focus settings. Called after hiding or removing widget. |
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. |
|
Transforms the coordinates of the given point from the coord system relative to top-level rootpane to the coord system relative to this widget
|
|
Instead of filling the backgound with the background color, draw the given drawable. |
|
Sets the background color for this widget. Changes internally the background colors of all color groups. It is better to use the color groups directly.
|
|
Sets the border hint for the UI object |
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. |
|
Sets the bounds of this widget. May call invalidate and fires widget events. |
|
Switches clipping. If b is true, you can only draw within the rectangle given by the bounds of this widget. Default value is true for clipping. |
|
Sets the context for this widget. This class or method is obsolete, it is provided for compatibility only. (This is used by widgets which are not added to a parent widget(like labels) but which are used to render some text via its paint method). |
|
Sets the cascading style sheet (CSS) class for this widget. This affects GUI with custom style sheets.
|
|
Sets the cascading style sheet (CSS) type for this widget. This affects only XUL interpreted GUIs- |
|
Sets the Direction of this widget. There are two valid direction: |
|
Enables or disables this widget. A disabled widget does not receive input events (mouse, keyboard) and is usually drawn with a different colorgroup (e.g. gray). Default value is true! Calling setEnabled(false) on a widget implicetly disables all child widgets. They are reenabled on calling setEnabled(true) on the same widget. |
|
Sets whether an event is enabled and should be processed by this widget. If an event is not enabled, it will be propagated to its parent. |
|
Sets whether this widget is focusable. Default is true. |
|
Sets the font style hint. |
|
Sets the foreground color for this widget. Changes internally the background colors of all color groups. It is better to use the color groups directly.
|
|
Sets the style hint for horizontal layouts. This influences the lay out of child widgets or visible parts like icons and text. |
|
This methods moves the widget within the children vector. The widget w has to be a child of this widget If index is -1 or greater than the child vector size, the widget is moved to back.
|
|
|
|
Sets the layout manager for this widget. The default layout manager is UBoxLayout
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. |
|
Sets the location within its parent widget. Calls setBounds. |
|
Sets an insets style hint used as empty margin between widget content and widget border |
|
Sets an insets style hint used as empty margin between widget content and widget border |
|
Sets the preferred size of the widget. |
|
Sets a hint about the minimum size for the layout manager. |
|
Sets the opacity of the widget background. 1.0 means fully opaque which is the default. This effect might show unwanted result when used with more complex widgets or when using a different look and feel. |
|
Sets the background opacity to 1 (fully opaque) if
|
|
Sets the Orientation of this widget.
|
|
Sets the palette for this widget. |
|
Sets the popup menu. This is used for pull right menus for normal widgets or for menu bar popups |
|
Sets an explicit preferred size hint for this widget. This size hint is used by the parent's layout manager. If you do not use layout managers, use
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. |
|
Sets the size of this widget. Calls setBounds. |
|
Explicetly sets the style for this widget. It is not recommend to use this method directly and to set specific styles for certain widgets. |
|
Explicetly sets the style hints object for this widget. |
|
Sets the vertical alignment of this widget. This influences the lay out of child widgets or visible parts like icons and text. |
|
If
If Reimplemented in ufo::UPopupMenu.
|
|
This signal is fired when this widget gained input (keyboard) focus. |
|
This signal is fired when this widget lost input (keyboard) focus. |
|
This signal is fired when a key was pressed while this widget has been focused. |
|
This signal is fired when a key was released while this widget has been focused. |
|
This signal is fired when a key was pressed and released while this widget has been focused. |
|
This signal is fired when a mouse button has been pressed and released on this widget. |
|
This signal is fired when a mouse button was pressed on this button and - while still pressed - the mouse was moved anywhere on the context. |
|
This signal is fired when the mouse has entered this widget. |
|
This signal is fired when the mouse has left this widget. |
|
This signal is fired when the mouse was moved over this widget and no mouse button was pressed. |
|
This signal is fired when a mouse button has been pressed on this widget. |
|
This signal is fired when a mouse button has been released on this widget. |
|
This signal is fired when a mouse wheel was used while the mouse has been over this widget. |
|
This signal is fired when this(!) widget was added to a valid containment hierarchy, i.e. the top-level parent belongs to a UFO context. Furthermore, this means that the UI object is now valid and you can get serious values by getPreferredSize. (Please note that this signal does not mean that another widget was added to this widget). |
|
This signal is fired when this widget has been hidden |
|
This signal is fired when this widget has been moved |
|
This signal is fired when this widget has been removed from a parent. |
|
This signal is fired when this widget has been resized |
|
This signal is fired when this widget has been shown |
|
Relayouts the container.
|
|
this is the context at which the widget is currently registered |
|
The dragged widget (currentyl not used) |
|
The widget with input (keyboard) focus |
|
The widget with mouse focus |