All widgets inherit from this.
|
Public Types |
| enum | State { STATE_DISABLED,
STATE_ENABLED,
STATE_SELECTED,
STATE_ACTIVE
} |
| | Widget state. More...
|
| enum | Rotation { ROT_0 = 0,
ROT_90 = 1,
ROT_180 = 2,
ROT_270 = 3
} |
| | Rotation of the widget coordinate system relative to parent. More...
|
| enum | TextDirection { DIR_LEFTTORIGHT = 0,
DIR_TOPTOBOTTOM = 1,
DIR_RIGHTTOLEFT = 2,
DIR_BOTTOMTOTOP = 3
} |
| | Direction for text drawing. More...
|
| enum | TextAlignment { ALIGN_CENTER,
ALIGN_LEFT,
ALIGN_RIGHT
} |
| | Horizontal alignment for text drawing. More...
|
| enum | ReliefType { RELIEF_NONE,
RELIEF_SIMPLE,
RELIEF_RAISED,
RELIEF_SUNKEN
} |
| | Relief (border) type. More...
|
Public Member Functions |
| | BWidget (BWidget *parent, const BRect &frame) |
| | Construct a widget.
|
| virtual | ~BWidget () |
| const BRect & | frame () const |
| | Return the frame in parent coordinates.
|
| virtual void | setFrame (const BRect &frame) |
| | Set the frame in parent coordinates.
|
| virtual State | state () const |
| | Return the widget's current state.
|
| virtual void | setState (State state) |
| | Set the widget's current state.
|
| void | setTag (int tag) |
| int | tag () |
| virtual TextDirection | textDirectionRelativeToScreen () const |
| virtual TextDirection | textDirection () const |
| virtual void | setTextDirection (TextDirection dir) |
| TextAlignment | textAlignment () const |
| virtual void | setTextAlignment (TextAlignment align) |
| ReliefType | reliefType () const |
| virtual void | setReliefType (ReliefType relief) |
| unsigned int | vPadding () const |
| virtual void | setVPadding (unsigned int padding) |
| unsigned int | hPadding () const |
| virtual void | setHPadding (unsigned int padding) |
| virtual void | draw (BImage &img) |
| | Draw the widget onto the given image.
|
| virtual void | setNeedsRedraw (bool needs) |
| | Set or reset the redraw flag.
|
| virtual bool | needsRedraw () |
| | Returns true if the widget or one of its children needs redraw.
|
| virtual bool | isShown () |
| virtual void | hide () |
| virtual void | show () |
| void | handleEvent (const BEvent &event) |
| | Handle the given event. Override if necessary.
|
|
| virtual Rotation | rotation () const |
| virtual void | setRotation (Rotation rot) |
| virtual Rotation | accumulatedRotation () const |
| BPoint | transformUp (BPoint pt, bool global=true) const |
| | Transform the given point up in the widget hierarchy.
|
| BPoint | transformDown (const BPoint &pt, bool global=true) const |
| | Transform the given point down in the widget hierarchy.
|
| BRect | transformUp (const BRect &r, bool global=true) const |
| | Transform the given rect up in the widget hierarchy.
|
| BRect | transformDown (const BRect &r, bool global=true) const |
| | Transform the given rect down in the widget hierarchy.
|
|
This flag causes a 5-pixel grid and a widget coordinate system (red axis = x, green axis = y) to be drawn in the widget, for easier draw debugging and children positioning
|
| bool | drawsDebugStuff () const |
| virtual void | setDrawsDebugStuff (bool debug) |
|
| uint16 | backgroundColor () const |
| virtual void | setBackgroundColor (uint16 color, bool recursive=false) |
| uint8 | backgroundAlpha () const |
| virtual void | setBackgroundAlpha (uint8 alpha) |
| uint8 | widgetAlpha () const |
| virtual void | setWidgetAlpha (uint8 alpha) |
| BFont * | font () const |
| virtual void | setFont (BFont *font) |
| uint16 | textColor () |
| virtual void | setTextColor (uint16 color, bool recursive=false) |
| uint16 | selectedTextColor () |
| virtual void | setSelectedTextColor (uint16 color) |
|
| std::vector< BWidget * > & | children () |
| | Return the widget's children vector.
|
| bool | deletesChildren () |
| | Whether the widget deletes its children.
|
| void | setDeletesChildren (bool yesno) |
| | Set the widget to delete its children upon destruction.
|
| void | deleteChildren () |
| | Tell the widget to delete its children now.
|
| BWidget * | parent () |
| | Return the widget's parent, or NULL.
|
| BScreen * | screen () |
| | Return the widget's screen (or it's parent's screen, recursively), or NULL.
|
| void | setScreen (BScreen *screen) |
| | Set the widget's screen. Don't use directly.
|
Protected Member Functions |
| virtual void | addChild (BWidget *w) |
| virtual void | removeChild (BWidget *w) |
Protected Attributes |
| std::vector< BWidget * > | _children |
| BRect | _frame |
| ReliefType | _relief |
| unsigned int | _vpadding |
| unsigned int | _hpadding |
| uint16 | _bgcolor |
| uint16 | _textcolor |
| uint16 | _selectedtextcolor |
| uint8 | _bgalpha |
| uint8 | _widgetalpha |
| bool | _needsRedraw |
| bool | _debug |
| bool | _shown |
| BFont * | _font |
| BWidget * | _parent |
| BScreen * | _screen |
| State | _state |
| TextDirection | _tdir |
| Rotation | _rot |
| TextAlignment | _align |
| int | _tag |
| bool | _deleteChildren |