ROLAND
0.70
Amstrad Emulator based on Caprice Source rewritten in C++.
|
Baseclass for all Widgets. More...
#include <widget.h>
Public Member Functions | |
Widget (Canvas *const canvas) | |
Constructor with Canvas. More... | |
Widget (Widget *const parent=nullptr) | |
Constructor with parent Widget. More... | |
virtual | ~Widget () ROLAND_DEFAULT virtual void draw()=0 |
Standarddestructor. More... | |
virtual void | onMouseMotion (SDL_MouseMotionEvent *event) |
Catch MouseMotion events. More... | |
virtual void | onMouseButton (SDL_MouseButtonEvent *event) |
Catch MouseButton events. More... | |
virtual bool | onKeyboard (SDL_KeyboardEvent *event) |
Catch Keyboard events. More... | |
virtual bool | onUser (SDL_UserEvent *event) |
Catch UserEvents. More... | |
virtual void | setPos (int x, int y) |
Sets the Position. More... | |
virtual void | setSize (int width, int height) |
Sets the Size. More... | |
virtual void | setCanvas (Canvas *const canvas) |
Sets the Canvas to draw on. More... | |
void | setParent (Widget *const parent) |
Sets the parent Widget. More... | |
const Widget * | parent () const |
Returns the parent. More... | |
void | setColor (const Color &color) |
Sets the Color of the Widget by Color. More... | |
void | setColor (int r, int g, int b, int a=255) |
Sets the Color of the Widget by RGB(A) More... | |
Color | color () const |
Returns the Color of the Widget. More... | |
void | setEnabled (bool val) |
Set Widget enabled. More... | |
void | setWantEvents (bool val) |
Sets whether to catch Events. More... | |
void | setMouseOver (bool val) |
Sets whehther to catch MouseOver. More... | |
bool | enabled () const |
Returns whether the Widget is enabled. More... | |
bool | wantEvents () const |
Returns whether the Widget wants Events. More... | |
bool | mouseOver () const |
Returns whether the Widget receives MouseOver. More... | |
bool | hasMouseGrab () const |
Returns whether the Widget has MouseGrab. More... | |
Sint16 | x () const |
Returns the x position of the upper left corner. More... | |
Sint16 | y () const |
Returns the y position of the upper left corner. More... | |
Point | pos () const |
Returns the position of the upper left corner. More... | |
Uint16 | width () const |
Returns the width of the Widget. More... | |
Uint16 | height () const |
Returns the height of the Widget. More... | |
Size | size () const |
Returns the Size of the Widget. More... | |
Point | relativePos (Sint16 x, Sint16 y) const |
void | relativePos (Sint16 x, Sint16 y, Point &target) const |
const Rect & | rect () const |
const Rect & | canvasrect () const |
Protected Attributes | |
Canvas * | mCanvas |
Widget * | mParent |
Rect | mRect |
Rect | mCanvasRect |
Color | mColor |
bool | mEnabled |
bool | mMouseOver |
bool | mMouseGrab |
bool | mWantEvents |
Baseclass for all Widgets.
Constructor with Canvas.
References Widget::mColor, Widget::mRect, Color::set(), and Rect::set().
Constructor with parent Widget.
References Widget::mColor, Widget::mRect, Color::set(), and Rect::set().
|
pure virtual |
Standarddestructor.
Draw thes widget
|
inline |
References Widget::mCanvasRect.
|
inline |
Returns the Color of the Widget.
References Widget::mColor.
Referenced by Label::getText(), Label::setBorderColor(), Widget::setColor(), and Button::setHighlightColor().
|
inline |
Returns whether the Widget is enabled.
References Widget::mEnabled.
Referenced by mainloop(), and ListItem::onMouseButton().
|
inline |
Returns whether the Widget has MouseGrab.
References Widget::mMouseGrab.
|
inline |
Returns the height of the Widget.
References Rect::height(), and Widget::mRect.
Referenced by List::add(), List::draw(), initGui(), and List::reposition().
|
inline |
Returns whether the Widget receives MouseOver.
References Widget::mMouseOver.
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
Catch UserEvents.
Reimplemented in List.
|
inline |
Returns the parent.
References Widget::mParent.
Referenced by ListItem::onMouseButton(), and Widget::setParent().
|
inline |
Returns the position of the upper left corner.
References Widget::mRect, and Rect::pos().
|
inline |
References Widget::mRect.
|
inline |
References Widget::mRect, Rect::x(), and Rect::y.
Referenced by Label::moveInit().
|
inline |
References Widget::mRect, Rect::x(), and Rect::y.
|
virtual |
Sets the Canvas to draw on.
References Widget::mCanvas.
Referenced by Gui::add(), and Widget::setSize().
|
inline |
Sets the Color of the Widget by Color.
References Widget::color(), and Widget::mColor.
Referenced by initGui(), and ListItem::ListItem().
|
inline |
Sets the Color of the Widget by RGB(A)
References Widget::mColor, and Color::set().
|
inline |
Set Widget enabled.
References Widget::mEnabled.
Referenced by display(), FileList::FileList(), initGui(), and mainloop().
|
inline |
Sets whehther to catch MouseOver.
References Widget::mMouseOver.
|
inline |
Sets the parent Widget.
References Widget::mParent, and Widget::parent().
Referenced by List::add().
|
inlinevirtual |
Sets the Position.
Reimplemented in Label.
References Widget::mRect, Rect::setX(), and Rect::setY().
Referenced by FileList::FileList().
|
inlinevirtual |
Sets the Size.
References Widget::mRect, Widget::setCanvas(), Rect::setHeight(), and Rect::setWidth().
Referenced by FileList::FileList(), and initGui().
|
inline |
|
inline |
Returns the Size of the Widget.
References Widget::mRect, and Rect::size.
|
inline |
Returns whether the Widget wants Events.
References Widget::mWantEvents.
|
inline |
Returns the width of the Widget.
References Widget::mRect, and Rect::width().
Referenced by List::add(), and initGui().
|
inline |
Returns the x position of the upper left corner.
References Widget::mRect, and Rect::x().
Referenced by List::add().
|
inline |
Returns the y position of the upper left corner.
References Widget::mRect, and Rect::y.
Referenced by List::add(), and List::reposition().
|
protected |
|
protected |
Referenced by Widget::canvasrect(), Label::drawBackground(), Label::drawText(), and Label::setBorder().
|
protected |
|
protected |
|
protected |
Referenced by Widget::hasMouseGrab(), and Label::moveInit().
|
protected |
Referenced by Widget::mouseOver(), Button::onMouseButton(), and Widget::setMouseOver().
|
protected |
Referenced by Widget::parent(), and Widget::setParent().
|
protected |
Referenced by List::add(), Label::draw(), List::draw(), Label::drawBackground(), Widget::height(), Label::Label(), Label::move(), Widget::pos(), Widget::rect(), Widget::relativePos(), List::reposition(), ListItem::reset(), Label::setBorder(), Label::setImage(), Label::setPos(), Widget::setPos(), Widget::setSize(), Widget::size(), Widget::Widget(), Widget::width(), Widget::x(), and Widget::y().
|
protected |
Referenced by Label::Label(), Widget::setWantEvents(), and Widget::wantEvents().