- Your Widget Set For OpenGL
Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | Related Pages

ufo::UWidget Class Reference

The base class for all widgets. More...

#include <uwidget.hpp>

Inheritance diagram for ufo::UWidget:

ufo::UObject ufo::UCollectable ufo::UAbstractSlider ufo::UComboBox ufo::UCompound ufo::UDockWidget ufo::UInternalFrame ufo::ULayeredPane ufo::UPopupMenu ufo::UProgressBar ufo::URootPane ufo::UScrollableWidget ufo::UScrollPane ufo::USeparator ufo::USpinBox ufo::UStackWidget ufo::UTabBar ufo::UTabWidget ufo::UViewport List of all members.

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 UStyleManagergetStyleManager () const
UStylegetStyle () const
void setStyle (UStyle *style)
const UStyleHintsgetStyleHints () 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
UContextgetContext () const
void setContext (UContext *context)
UUIManager * getUIManager () const
UGraphicsgetGraphics () const
float getOpacity () const
virtual void setOpacity (float f)
void setPalette (const UPalette &palette)
const UPalettegetPalette () const
void setBackgroundColor (const UColor &col)
const UColorgetBackgroundColor () const
void setForegroundColor (const UColor &col)
const UColorgetForegroundColor () const
bool hasBackground () const
void setBackground (UDrawable *tex)
UDrawablegetBackground () const
void setFont (const UFont &font)
const UFontgetFont () const
void setBorder (BorderType borderType)
BorderType getBorder () const
void setMargin (const UInsets &margin)
void setMargin (int top, int left, int bottom, int right)
const UInsetsgetMargin () 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 UWidgetrequestFocus ()
virtual bool releaseFocus ()
virtual bool isFocusable () const
virtual void setFocusable (bool focusable)
bool hasMouseFocus () const
void dispatchEvent (UEvent *e)
void setPopupMenu (UPopupMenu *popupMenu)
virtual UPopupMenugetPopupMenu () const
virtual bool remove (UWidget *w)
virtual bool remove (unsigned int n)
virtual UWidgetremoveAndReturn (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 URootPanegetRootPane (bool topmost=false) const
UWidgetgetParent () const
int getIndexOf (const UWidget *w) const
void setIndexOf (UWidget *w, int index)
UWidgetgetWidget (unsigned int n) const
UWidgetgetWidgetAt (int x, int y) const
virtual UWidgetgetWidgetAt (const UPoint &p) const
UWidgetgetVisibleWidgetAt (int x, int y) const
virtual UWidgetgetVisibleWidgetAt (const UPoint &p) const
unsigned int getWidgetCount () const
const std::vector< UWidget * > & getWidgets () const
std::vector< UWidget * > & getWidgets ()
ULayoutManagergetLayout () 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)
UObjectget (const std::string &key) const
std::string getString (const std::string &key) const
UInputMapgetInputMap (InputCondition conditionA=WhenFocused)
void setInputMap (UInputMap *newInputMapA, InputCondition conditionA=WhenFocused)
void setEventState (UEvent::Type type, bool b)
bool isEventEnabled (UEvent::Type type) const
const UWidgetModelgetModel () 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

UWidgetgetFocusedWidget ()
UWidgetgetMouseFocusWidget ()

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

UContextm_context
UWidgetModelm_model

Static Protected Attributes

UWidgetsm_inputFocusWidget
UWidgetsm_mouseFocusWidget
UWidgetsm_dragWidget

Detailed Description

The base class for all widgets.

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, ...

See also:
UBoxLayout
Author:
Johannes Schmidt


Member Function Documentation

void ufo::UWidget::add UWidget w,
const UObject constraints,
int  index = -1
 

add a sub widget at the specified index

Parameters:
w the widget, which should be added
constraints the constraints object is a Object which describes the layout options. Internally, it invokes put("layout", w); to set the property. Currently this is only used by UBorderlayout.
index if index is -1 or isnīt set, the widget will be added at the end of the container
See also:
put

UBorderLayout

void ufo::UWidget::add UWidget w,
UObject constraints,
int  index = -1
[inline]
 

add a sub widget at the specified index

Parameters:
w The widget which should be added
constraints the constraints object is a Object which describes the layout options. Internally, it invokes put("layout", w); to set the property. Currently this is only used by UBorderlayout.
index if index is -1 or isnīt set, the widget will be added at the end of the container
See also:
put

UBorderLayout

void ufo::UWidget::add UWidget w,
int  index = -1
[inline]
 

Adds a sub widget at the specified index

Parameters:
w The widget which should be added
index if index is -1 or isnīt set, the widget will be added at the "end" of the container

virtual void ufo::UWidget::addedToHierarchy  )  [protected, virtual]
 

Notifies recursively all childs that they have been added to a valid containment hierarchy.

Reimplemented in ufo::URootPane.

virtual void ufo::UWidget::addImpl UWidget w,
UObject constraints,
int  index
[protected, virtual]
 

Adds child widgets to this widget. This function should be overridden instead of other add functions

Parameters:
w The widget which should be added
index If index is -1, the widget will be added at the end of the container
constraints The constraints object is a Object which describes the layout options. Internally, it invokes put("layout", w); to set the property. Currently this is only used by UBorderlayout.
See also:
put

UBorderLayout

Reimplemented in ufo::ULayeredPane, ufo::UMenu, ufo::UStackWidget, and ufo::UViewport.

bool ufo::UWidget::contains const UPoint p  )  const [inline]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

bool ufo::UWidget::contains int  x,
int  y
const [inline]
 

Returns:
true if the given point (relative to this widget) is within this widget. Otherwise false.

bool ufo::UWidget::containsRootPoint const UPoint p  )  const [inline]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

bool ufo::UWidget::containsRootPoint int  x,
int  y
const [inline]
 

Returns:
true if the given point (relative to the top level root pane) is within this widget. Otherwise false.

void ufo::UWidget::dispatchEvent UEvent e  ) 
 

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

void ufo::UWidget::doLayout  )  [protected]
 

Use validate() to layout child widgets. This class or method is obsolete, it is provided for compatibility only.

bool ufo::UWidget::fireFocusEvent UFocusEvent e  )  [protected]
 

notifies all focus listeners that a focus event of the specified type has occured

bool ufo::UWidget::fireKeyEvent UKeyEvent e  )  [protected]
 

notifies all key listeners that a key event has occured

bool ufo::UWidget::fireMouseEvent UMouseEvent e  )  [protected]
 

notifies all mouse listeners that a mouse event has occured

bool ufo::UWidget::firePropertyChangeEvent const std::string &  prop,
UObject oldValue,
UObject newValue
[protected]
 

notifies all property change listeners that a property change was performed

bool ufo::UWidget::fireWidgetEvent UWidgetEvent e  )  [protected]
 

notifies all widget listeners that a widget event of the specified type has occured

UObject* ufo::UWidget::get const std::string &  key  )  const
 

Returns:
the value object that was set by put(const std::string & key, UObject * value); or NULL
Parameters:
key The key that belongs to the desired value
See also:
put

UDrawable* ufo::UWidget::getBackground  )  const
 

Returns:
The current back ground or NULL if none was set

const UColor& ufo::UWidget::getBackgroundColor  )  const
 

Returns:
the backround color

BorderType ufo::UWidget::getBorder  )  const
 

Returns:
The border type

virtual URectangle ufo::UWidget::getBounds  )  const [virtual]
 

Returns:
The bounding rectangle in coordinates of the parent widget.

URectangle ufo::UWidget::getClipBounds  )  const
 

Returns the bounding rectangle in root coordinates which should be used for clipping. Takes into account if a parent widget does also clipping.

UContext* ufo::UWidget::getContext  )  const
 

Returns:
The rendering context for this widget, may be NULL for invalid widgets.

std::string ufo::UWidget::getCssClass  )  const
 

Returns:
The cascading style sheet (CSS) class for this widget.

std::string ufo::UWidget::getCssType  )  const
 

Returns:
The cascading style sheet (CSS) type for this widget.

Direction ufo::UWidget::getDirection  )  const
 

See also:
setDirection

UWidget* ufo::UWidget::getFocusedWidget  )  [static]
 

Returns:
The widget which has (keyboard) input focus

const UFont& ufo::UWidget::getFont  )  const
 

Returns:
The font style hint used for this widget.

const UColor& ufo::UWidget::getForegroundColor  )  const
 

Returns:
the foreround color

UGraphics* ufo::UWidget::getGraphics  )  const
 

Deprecated:

int ufo::UWidget::getHeight  )  const [inline]
 

Returns:
The height of this widget

Alignment ufo::UWidget::getHorizontalAlignment  )  const
 

See also:
setHorizontalAlignment

int ufo::UWidget::getIndexOf const UWidget w  )  const
 

Returns:
The index of the widget within the children vector

URectangle ufo::UWidget::getInnerBounds  )  const [inline]
 

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.

UDimension ufo::UWidget::getInnerSize  )  const [inline]
 

Returns:
The size minus insets of this widget

UInputMap* ufo::UWidget::getInputMap InputCondition  conditionA = WhenFocused  ) 
 

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.

virtual UInsets ufo::UWidget::getInsets  )  const [virtual]
 

returns all insets, i.e. insets of a possible border and margin

See also:
setMargin

ULayoutManager* ufo::UWidget::getLayout  )  const
 

Returns:
The layout manager used by this widget.

UPoint ufo::UWidget::getLocation  )  const [inline, virtual]
 

Returns:
The location within its parent widget

const UInsets& ufo::UWidget::getMargin  )  const
 

returns a possible margin between the widget content and a border

See also:
setMargin

getInsets

UDimension ufo::UWidget::getMaximumSize  )  const
 

See also:
setMaximumSize

UDimension ufo::UWidget::getMinimumSize  )  const
 

Returns:
The minimum size

const UWidgetModel* ufo::UWidget::getModel  )  const
 

You shouldn't need to call this method! It's supposed to be UFO internal.

Returns:
The widget model.

UWidget* ufo::UWidget::getMouseFocusWidget  )  [static]
 

Returns:
The widget which has mouse focus

Orientation ufo::UWidget::getOrientation  )  const
 

See also:
setOrientation

const UPalette& ufo::UWidget::getPalette  )  const
 

Returns:
The palette for this widget.

UWidget* ufo::UWidget::getParent  )  const
 

Returns:
The parent widget or NULL if this widget is not nested in a widget hierarchy.

virtual UPopupMenu* ufo::UWidget::getPopupMenu  )  const [virtual]
 

Returns the popup menu.

virtual UDimension ufo::UWidget::getPreferredSize const UDimension maxSize  )  const [virtual]
 

In difference to getPreferredSize, this method does its calculations using the given maximal size. For example, some widgets may expand their height if the desired width would be bigger than the maximal width. It is guaranteed that the returned size is smaller than the given maximal size. If you pass UDimension::maxDimension, you should get the same return value as with getPreferredSize.

Parameters:
maxSize The maximal size for the calculated preferred size
Returns:
The size hint used by the parent's layout manager
See also:
setPreferredSize

setUI

virtual UDimension ufo::UWidget::getPreferredSize  )  const [virtual]
 

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.

Returns:
The size hint used by the parent's layout manager
See also:
setPreferredSize

setUI

URectangle ufo::UWidget::getRootBounds  )  const [inline]
 

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.

UPoint ufo::UWidget::getRootLocation  )  const
 

Returns:
The location of this widget relative to the top level root pane.

virtual URootPane* ufo::UWidget::getRootPane bool  topmost = false  )  const [virtual]
 

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.

Parameters:
topmost If true, returns the top most root pane.
Returns:
the root pane which has this widget as child or NULL if no top level root pane is owner of this widget

UDimension ufo::UWidget::getSize  )  const [inline, virtual]
 

Returns:
The size of this widget

std::string ufo::UWidget::getString const std::string &  key  )  const
 

This method is for convenience

Returns:
The string value object that was set by put or ""
Parameters:
key The key that belongs to the desired value
See also:
put

UStyle* ufo::UWidget::getStyle  )  const
 

Returns:
The style object used to paint this widget.

const UStyleHints* ufo::UWidget::getStyleHints  )  const
 

Returns:
The style hints object used to paint this widget.

virtual UStyleManager* ufo::UWidget::getStyleManager  )  const [virtual]
 

Returns:
The style manager used to inquire style and style hints.

UUIManager* ufo::UWidget::getUIManager  )  const
 

Deprecated:

Alignment ufo::UWidget::getVerticalAlignment  )  const
 

See also:
setVerticalAlignment

virtual UWidget* ufo::UWidget::getVisibleWidgetAt const UPoint p  )  const [virtual]
 

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.

UWidget* ufo::UWidget::getVisibleWidgetAt int  x,
int  y
const
 

Returns the top most visible child widget at the given position. The point should be in the coordinate system of this widget

Returns:
the widget at the specified position or NULL if there is no widget at this position

UWidget* ufo::UWidget::getWidget unsigned int  n  )  const
 

Returns:
the n īth child widget or NULL n is greater than the count of the child widgets

virtual UWidget* ufo::UWidget::getWidgetAt const UPoint p  )  const [virtual]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

UWidget* ufo::UWidget::getWidgetAt int  x,
int  y
const
 

Returns the top most child widget at the given position. The point should be in the coordinate system of this widget

Returns:
the widget at the specified position or NULL if there is no child widget at this position

unsigned int ufo::UWidget::getWidgetCount  )  const
 

Returns:
The number of child widgets this widget has

std::vector<UWidget*>& ufo::UWidget::getWidgets  ) 
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

const std::vector<UWidget*>& ufo::UWidget::getWidgets  )  const
 

Returns:
A vector with all child widgets.

int ufo::UWidget::getWidth  )  const [inline]
 

Returns:
The width of this widget

int ufo::UWidget::getX  )  const [inline]
 

Returns:
The x value in coordinates of the parent widget

int ufo::UWidget::getY  )  const [inline]
 

Returns:
The y value in coordinates of the parent widget

void ufo::UWidget::grabShortcut const UKeyStroke stroke  ) 
 

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.

See also:
UShortcutEvent::isAmbiguous

processShortcutEvent

bool ufo::UWidget::hasBackground  )  const
 

Returns:
True if a background drawable was set.
See also:
setBackground

bool ufo::UWidget::hasClipping  )  const
 

Returns true when clipping is enabled.

bool ufo::UWidget::hasMouseFocus  )  const
 

Returns true when the mouse pointer is over this widget.

void ufo::UWidget::invalidate  ) 
 

Calls invalidateSelf and invalidates the parent widget.

virtual void ufo::UWidget::invalidateSelf  )  [virtual]
 

Invalidates the specified attributes of this widget and forces a relayout of child widgets. This is called by invalidate.

See also:
invalidate

Reimplemented in ufo::UMenu.

void ufo::UWidget::invalidateTree  ) 
 

invalidates all child widgets and this widget itsself.

virtual bool ufo::UWidget::isActive  )  const [virtual]
 

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.

virtual bool ufo::UWidget::isAncestorFocused  )  const [virtual]
 

Returns:
True if a parent widget is focused.

virtual bool ufo::UWidget::isChildFocused  )  const [virtual]
 

Returns:
True if a child widget is focused.

bool ufo::UWidget::isEnabled  )  const
 

Checks whether this widget is enabled or not

bool ufo::UWidget::isEventEnabled UEvent::Type  type  )  const
 

Returns whether an event is enabled and processed by this widget.

virtual bool ufo::UWidget::isFocused  )  const [virtual]
 

Returns:
True if this widget is focused. There can be only one focused widget for all UFO contexts.

virtual bool ufo::UWidget::isInValidHierarchy  )  const [virtual]
 

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.

See also:
sigWidgetAdded

sigWidgetRemoved

Returns:
true if this widget is in a containment hierarchy visible on screen.

bool ufo::UWidget::isOpaque  )  const
 

Returns:
True if this widget if fully opaque (opacity == 1)
See also:
getOpacity()

bool ufo::UWidget::isValid  )  const
 

Returns true if the layout manager has laid out all children.

virtual bool ufo::UWidget::isVisible  )  const [virtual]
 

Returns:
True if this widget is currently visible on screen (mapped to screen). This means also, that all parent widgets are visible on screen.

virtual void ufo::UWidget::paint UGraphics g  )  [virtual]
 

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.

See also:
paintWidget

virtual void ufo::UWidget::paintBorder UGraphics g  )  [protected, virtual]
 

Paints the widget's border.

virtual void ufo::UWidget::paintChildren UGraphics g  )  [protected, virtual]
 

Paints recursively the child widgets.

Reimplemented in ufo::UViewport.

virtual void ufo::UWidget::paintWidget UGraphics g  )  [protected, virtual]
 

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.

virtual std::ostream& ufo::UWidget::paramString std::ostream &  os  )  const [protected, virtual]
 

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.

UPoint ufo::UWidget::pointToRootPoint const UPoint p  )  const [inline]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

UPoint ufo::UWidget::pointToRootPoint int  x,
int  y
const [inline]
 

Transforms the coordinates of the given point from the coord system relative to this widget to the coord system relative to top-level rootpane

Returns:
The given point relative to the top level root pane

virtual void ufo::UWidget::processEvent UEvent e  )  [protected, virtual]
 

Process the event by invoking a appropriate process* functions

virtual void ufo::UWidget::processFocusEvent UFocusEvent e  )  [protected, virtual]
 

Processes key events. Primarily, it is used to notify listeners.

virtual bool ufo::UWidget::processKeyBindings UKeyEvent e  )  [protected, virtual]
 

Processes key bindings in input maps.

See also:
getInputMap

virtual void ufo::UWidget::processKeyEvent UKeyEvent e  )  [protected, virtual]
 

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.

virtual void ufo::UWidget::processMouseEvent UMouseEvent e  )  [protected, virtual]
 

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.

virtual void ufo::UWidget::processMouseWheelEvent UMouseWheelEvent e  )  [protected, virtual]
 

Processes focus events. Primarily, it is used to notify listeners.

Reimplemented in ufo::UAbstractSlider, and ufo::UScrollPane.

virtual void ufo::UWidget::processWidgetEvent UWidgetEvent e  )  [protected, virtual]
 

Processes widget events. Primarily, it is used to notify listeners.

Reimplemented in ufo::UDesktopPane, ufo::UInternalFrame, ufo::UListBox, and ufo::UScrollPane.

void ufo::UWidget::put const std::string &  key,
const std::string &  value
 

const std::string wrapper for put(const std::string &, UObject *);

See also:
put

void ufo::UWidget::put const std::string &  key,
UObject value
 

puts a property in the local UProperty object

Parameters:
key the string key that should be used to save the value
value The object value
See also:
get

void ufo::UWidget::releaseAllShortcuts  ) 
 

Releases all previously grabbed shortcuts.

See also:
grabShortcut

virtual bool ufo::UWidget::releaseFocus  )  [virtual]
 

Releases the focus. Returns true on success.

void ufo::UWidget::releaseShortcut const UKeyStroke stroke  ) 
 

Releases a previously grabbed shortcut.

See also:
grabShortcut

virtual bool ufo::UWidget::remove unsigned int  n  )  [virtual]
 

removes the n īth widget

Parameters:
n The index of the widget which should be removed. 0 is the first widget.
Returns:
True if the n'th widget was removed

virtual bool ufo::UWidget::remove UWidget w  )  [virtual]
 

if this is a parent of w, w will be removed of the children list

Parameters:
w The widget which should be removed
Returns:
True if w was a child widget and could be removed
See also:
remove(unsigned int)

virtual unsigned int ufo::UWidget::removeAll  )  [virtual]
 

Removes all child widgets.

Returns:
The number of the actual removed widgets.

virtual UWidget* ufo::UWidget::removeAndReturn unsigned int  n  )  [virtual]
 

removes the n īth widget

Parameters:
n The index of the widget which should be removed. 0 is the first widget.
Returns:
The n'th widget without decreasing the ref count. The user is responsible for deleting it later. NULL, if there are not n widgets or other errors occured.
See also:
remove( UWidget * w )

virtual void ufo::UWidget::removedFromHierarchy  )  [protected, virtual]
 

See also:
addedToHierarchy

virtual bool ufo::UWidget::removeImpl int  index  )  [protected, virtual]
 

Removes the widget at the given index.

Returns:
True if succesfull

Reimplemented in ufo::UStackWidget.

void ufo::UWidget::repaint  ) 
 

Registers this widget as dirty widget at the repaint manager and schedules a repaint event.

virtual UWidget* ufo::UWidget::requestFocus  )  [virtual]
 

tries to get input focus.

Returns:
The old focused widget or NULL

void ufo::UWidget::resetFocus  )  [protected]
 

Resets input and mouse focus settings. Called after hiding or removing widget.

UPoint ufo::UWidget::rootPointToPoint const UPoint p  )  const [inline]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

UPoint ufo::UWidget::rootPointToPoint int  x,
int  y
const [inline]
 

Transforms the coordinates of the given point from the coord system relative to top-level rootpane to the coord system relative to this widget

Returns:
The given point relative to the top level root pane

void ufo::UWidget::setBackground UDrawable tex  ) 
 

Instead of filling the backgound with the background color, draw the given drawable.

void ufo::UWidget::setBackgroundColor const UColor col  ) 
 

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.

See also:
setPalette

void ufo::UWidget::setBorder BorderType  borderType  ) 
 

Sets the border hint for the UI object

void ufo::UWidget::setBounds const URectangle b  )  [inline]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

virtual void ufo::UWidget::setBounds int  x,
int  y,
int  w,
int  h
[virtual]
 

Sets the bounds of this widget. May call invalidate and fires widget events.

void ufo::UWidget::setClipping bool  b  ) 
 

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.

void ufo::UWidget::setContext UContext context  ) 
 

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).

void ufo::UWidget::setCssClass const std::string &  cssClass  ) 
 

Sets the cascading style sheet (CSS) class for this widget. This affects GUI with custom style sheets.

See also:
UStyleManager::loadStyleSheet

void ufo::UWidget::setCssType const std::string &  type  ) 
 

Sets the cascading style sheet (CSS) type for this widget. This affects only XUL interpreted GUIs-

void ufo::UWidget::setDirection Direction  dir  ) 
 

Sets the Direction of this widget. There are two valid direction: LeftToRight and RightToLeft. This influence the order of child widgets. Default value is LeftToRight

void ufo::UWidget::setEnabled bool  b  ) 
 

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.

void ufo::UWidget::setEventState UEvent::Type  type,
bool  b
 

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.

virtual void ufo::UWidget::setFocusable bool  focusable  )  [virtual]
 

Sets whether this widget is focusable. Default is true.

void ufo::UWidget::setFont const UFont font  ) 
 

Sets the font style hint.

void ufo::UWidget::setForegroundColor const UColor col  ) 
 

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.

See also:
setPalette

void ufo::UWidget::setHorizontalAlignment Alignment  alignX  ) 
 

Sets the style hint for horizontal layouts. This influences the lay out of child widgets or visible parts like icons and text.

void ufo::UWidget::setIndexOf UWidget w,
int  index
 

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.

Parameters:
w The child widget to move
index The new desired index.

void ufo::UWidget::setInputMap UInputMap newInputMapA,
InputCondition  conditionA = WhenFocused
 

See also:
getInputMap

void ufo::UWidget::setLayout ULayoutManager layout  ) 
 

Sets the layout manager for this widget. The default layout manager is UBoxLayout

See also:
UBoxLayout

void ufo::UWidget::setLocation const UPoint p  )  [inline]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

void ufo::UWidget::setLocation int  x,
int  y
[inline]
 

Sets the location within its parent widget. Calls setBounds.

void ufo::UWidget::setMargin int  top,
int  left,
int  bottom,
int  right
 

Sets an insets style hint used as empty margin between widget content and widget border

See also:
getMargin

getInsets

void ufo::UWidget::setMargin const UInsets margin  ) 
 

Sets an insets style hint used as empty margin between widget content and widget border

See also:
getMargin

getInsets

void ufo::UWidget::setMaximumSize const UDimension maximumSize  ) 
 

Sets the preferred size of the widget.

void ufo::UWidget::setMinimumSize const UDimension minimumSize  ) 
 

Sets a hint about the minimum size for the layout manager.

virtual void ufo::UWidget::setOpacity float  f  )  [virtual]
 

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.

virtual void ufo::UWidget::setOpaque bool  o  )  [virtual]
 

Sets the background opacity to 1 (fully opaque) if o is true otherwise sets the opacity to 0 which means fully transparent. The default value is 1.

See also:
setOpacity

void ufo::UWidget::setOrientation Orientation  orientation  ) 
 

Sets the Orientation of this widget.

  • Horizontal (default)
  • Vetical

void ufo::UWidget::setPalette const UPalette palette  ) 
 

Sets the palette for this widget.

void ufo::UWidget::setPopupMenu UPopupMenu popupMenu  ) 
 

Sets the popup menu. This is used for pull right menus for normal widgets or for menu bar popups

void ufo::UWidget::setPreferredSize const UDimension preferredSize  ) 
 

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 setSize or setBounds A preferredSize is equal to UDimenion::invalid, this size hint is ignored.

Parameters:
preferredSize The size hint used by the parent's layout manager
See also:
getPreferredSize

void ufo::UWidget::setSize const UDimension d  )  [inline]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

void ufo::UWidget::setSize int  w,
int  h
[inline]
 

Sets the size of this widget. Calls setBounds.

void ufo::UWidget::setStyle UStyle style  ) 
 

Explicetly sets the style for this widget. It is not recommend to use this method directly and to set specific styles for certain widgets.

void ufo::UWidget::setStyleHints UStyleHints hints  ) 
 

Explicetly sets the style hints object for this widget.

void ufo::UWidget::setVerticalAlignment Alignment  alignY  ) 
 

Sets the vertical alignment of this widget. This influences the lay out of child widgets or visible parts like icons and text.

virtual void ufo::UWidget::setVisible bool  v  )  [virtual]
 

If v is true and the parent widget returns true on isVisible, maps this widget all child widget to screen. If a child widget was hidden with setVisible(false), it remains hidden.

If v is false, this widget and all child widget will disappear from screen.

Reimplemented in ufo::UPopupMenu.

USignal1< UFocusEvent * > & ufo::UWidget::sigFocusGained  )  [inline]
 

This signal is fired when this widget gained input (keyboard) focus.

USignal1< UFocusEvent * > & ufo::UWidget::sigFocusLost  )  [inline]
 

This signal is fired when this widget lost input (keyboard) focus.

USignal1< UKeyEvent * > & ufo::UWidget::sigKeyPressed  )  [inline]
 

This signal is fired when a key was pressed while this widget has been focused.

USignal1< UKeyEvent * > & ufo::UWidget::sigKeyReleased  )  [inline]
 

This signal is fired when a key was released while this widget has been focused.

USignal1< UKeyEvent * > & ufo::UWidget::sigKeyTyped  )  [inline]
 

This signal is fired when a key was pressed and released while this widget has been focused.

USignal1< UMouseEvent * > & ufo::UWidget::sigMouseClicked  )  [inline]
 

This signal is fired when a mouse button has been pressed and released on this widget.

USignal1< UMouseEvent * > & ufo::UWidget::sigMouseDragged  )  [inline]
 

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.

USignal1< UMouseEvent * > & ufo::UWidget::sigMouseEntered  )  [inline]
 

This signal is fired when the mouse has entered this widget.

USignal1< UMouseEvent * > & ufo::UWidget::sigMouseExited  )  [inline]
 

This signal is fired when the mouse has left this widget.

USignal1< UMouseEvent * > & ufo::UWidget::sigMouseMoved  )  [inline]
 

This signal is fired when the mouse was moved over this widget and no mouse button was pressed.

USignal1< UMouseEvent * > & ufo::UWidget::sigMousePressed  )  [inline]
 

This signal is fired when a mouse button has been pressed on this widget.

USignal1< UMouseEvent * > & ufo::UWidget::sigMouseReleased  )  [inline]
 

This signal is fired when a mouse button has been released on this widget.

USignal1< UMouseWheelEvent * > & ufo::UWidget::sigMouseWheel  )  [inline]
 

This signal is fired when a mouse wheel was used while the mouse has been over this widget.

USignal1< UWidgetEvent * > & ufo::UWidget::sigWidgetAdded  )  [inline]
 

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).

USignal1< UWidgetEvent * > & ufo::UWidget::sigWidgetHidden  )  [inline]
 

This signal is fired when this widget has been hidden

USignal1< UWidgetEvent * > & ufo::UWidget::sigWidgetMoved  )  [inline]
 

This signal is fired when this widget has been moved

USignal1< UWidgetEvent * > & ufo::UWidget::sigWidgetRemoved  )  [inline]
 

This signal is fired when this widget has been removed from a parent.

USignal1< UWidgetEvent * > & ufo::UWidget::sigWidgetResized  )  [inline]
 

This signal is fired when this widget has been resized

USignal1< UWidgetEvent * > & ufo::UWidget::sigWidgetShown  )  [inline]
 

This signal is fired when this widget has been shown

virtual void ufo::UWidget::validate  )  [virtual]
 

Relayouts the container.

See also:
ULayoutManager


Member Data Documentation

UContext* ufo::UWidget::m_context [protected]
 

this is the context at which the widget is currently registered

UWidget* ufo::UWidget::sm_dragWidget [static, protected]
 

The dragged widget (currentyl not used)

UWidget* ufo::UWidget::sm_inputFocusWidget [static, protected]
 

The widget with input (keyboard) focus

UWidget* ufo::UWidget::sm_mouseFocusWidget [static, protected]
 

The widget with mouse focus


The documentation for this class was generated from the following file:
The libUFO Project - written by Johannes Schmidt