ROLAND
0.70
Amstrad Emulator based on Caprice Source rewritten in C++.
|
A Widget with text and background color or image. More...
#include <label.h>
Public Member Functions | |
Label (Widget *parent=nullptr) | |
virtual | ~Label () |
virtual void | draw () |
virtual void | setPos (int x, int y) |
Sets the Position. More... | |
virtual void | onMouseMotion (SDL_MouseMotionEvent *event) |
Catch MouseMotion events. More... | |
virtual void | onMouseButton (SDL_MouseButtonEvent *event) |
Catch MouseButton events. More... | |
void | setImage (const String &fname, bool autosize=true, bool bg=false) |
void | setBorder (bool val) |
void | setBackground (bool val) |
void | setText (const String &text) |
void | setMoveable (bool moveable) |
void | setBorderColor (const Color &color, const Color &highlite) |
const String & | getText () const |
Public Member Functions inherited from Widget | |
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 bool | onKeyboard (SDL_KeyboardEvent *event) |
Catch Keyboard events. More... | |
virtual bool | onUser (SDL_UserEvent *event) |
Catch UserEvents. 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 Member Functions | |
void | drawBorder () |
void | drawBackground () |
void | drawBackground (const Color &color) |
void | drawText () |
void | moveInit (SDL_MouseButtonEvent *event) |
void | move (SDL_MouseMotionEvent *event) |
Protected Attributes | |
bool | mBorder |
bool | mBackground |
bool | mMoveable |
Image * | mImage |
String | mText |
Point | mTextPos |
Point | mTextOffset |
Point | mRelativeMousePos |
Point | mLeftTop |
Point | mRightTop |
Point | mRightBottom |
Point | mLeftBottom |
Color | mBorderColor1 |
Color | mBorderColor2 |
Protected Attributes inherited from Widget | |
Canvas * | mCanvas |
Widget * | mParent |
Rect | mRect |
Rect | mCanvasRect |
Color | mColor |
bool | mEnabled |
bool | mMouseOver |
bool | mMouseGrab |
bool | mWantEvents |
A Widget with text and background color or image.
|
virtual |
References Label::mImage.
|
virtual |
References Canvas::clearClipRect(), Label::drawBackground(), Label::drawBorder(), Label::drawText(), Canvas::end(), Widget::mCanvas, Widget::mColor, Widget::mRect, Canvas::setClipRect(), and Canvas::setColor().
Referenced by Button::onMouseButton().
|
protected |
References Canvas::fill(), Canvas::image(), Label::mBackground, Widget::mCanvas, Widget::mCanvasRect, Widget::mColor, Label::mImage, Widget::mRect, Rect::pos(), and Canvas::setColor().
Referenced by Label::draw(), Label::getText(), and Button::onMouseButton().
|
protected |
|
protected |
References Canvas::line(), Label::mBorder, Label::mBorderColor1, Label::mBorderColor2, Widget::mCanvas, Label::mLeftBottom, Label::mLeftTop, Label::mRightBottom, Label::mRightTop, and Canvas::setColor().
Referenced by Label::draw(), Label::getText(), and Button::onMouseButton().
|
protected |
References Rect::height(), Widget::mCanvas, Widget::mCanvasRect, Label::mText, Label::mTextOffset, Label::mTextPos, Rect::pos(), Canvas::textHeight(), Canvas::textSize(), Size::width(), Rect::width(), Canvas::write(), Rect::x(), Point::y, and Rect::y.
Referenced by Label::draw(), Label::getText(), and Button::onMouseButton().
|
inline |
References Widget::color(), Label::drawBackground(), Label::drawBorder(), Label::drawText(), Label::move(), Label::moveInit(), and Label::mText.
Referenced by ListItem::onMouseButton().
|
protected |
References Label::mBorder, Label::mMoveable, Widget::mRect, Label::mRelativeMousePos, Label::setBorder(), Rect::setX(), Rect::setY(), and Point::y.
Referenced by Label::getText(), Button::onMouseMotion(), and Label::onMouseMotion().
|
protected |
References Widget::mMouseGrab, Label::mMoveable, Label::mRelativeMousePos, and Widget::relativePos().
Referenced by Label::getText(), ListItem::onMouseButton(), Button::onMouseButton(), and Label::onMouseButton().
|
virtual |
Catch MouseButton events.
Reimplemented from Widget.
Reimplemented in Button, and ListItem.
References Label::moveInit().
Referenced by Label::setPos().
|
virtual |
Catch MouseMotion events.
Reimplemented from Widget.
Reimplemented in Button.
References Label::move().
Referenced by Label::setPos().
|
inline |
References Label::mBackground.
void setBorder | ( | bool | val | ) |
References Rect::height(), Label::mBorder, Label::mBorderColor1, Label::mBorderColor2, Widget::mCanvasRect, Label::mLeftBottom, Label::mLeftTop, Widget::mRect, Label::mRightBottom, Label::mRightTop, Rect::pos(), Color::set(), Rect::setHeight(), Rect::setWidth(), Rect::setX(), Rect::setY(), Rect::width(), Rect::x(), and Rect::y.
Referenced by List::add(), FileList::FileList(), initGui(), Label::move(), Label::setImage(), and Label::setPos().
References Widget::color(), Label::mBorderColor1, and Label::mBorderColor2.
void setImage | ( | const String & | fname, |
bool | autosize = true , |
||
bool | bg = false |
||
) |
References Label::mBackground, Label::mImage, Widget::mRect, Label::setBorder(), Rect::setSize(), and Image::size().
Referenced by initGui(), and Label::setPos().
|
inline |
References Label::mMoveable.
|
inlinevirtual |
Sets the Position.
Reimplemented from Widget.
References Label::mBorder, Widget::mRect, Label::onMouseButton(), Label::onMouseMotion(), Label::setBorder(), Label::setImage(), Rect::setX(), and Rect::setY().
Referenced by List::add(), and initGui().
|
inline |
References Label::mText.
|
protected |
Referenced by Label::drawBackground(), Label::Label(), Label::setBackground(), and Label::setImage().
|
protected |
Referenced by Label::drawBorder(), Label::Label(), Label::move(), Label::setBorder(), and Label::setPos().
|
protected |
Referenced by Label::drawBorder(), Button::onMouseButton(), Label::setBorder(), and Label::setBorderColor().
|
protected |
Referenced by Label::drawBorder(), Button::onMouseButton(), Label::setBorder(), and Label::setBorderColor().
|
protected |
Referenced by Label::drawBackground(), Label::Label(), Label::setImage(), and Label::~Label().
|
protected |
Referenced by Label::drawBorder(), and Label::setBorder().
|
protected |
Referenced by Label::drawBorder(), and Label::setBorder().
|
protected |
Referenced by Label::Label(), Label::move(), Label::moveInit(), and Label::setMoveable().
|
protected |
Referenced by Label::Label(), Label::move(), and Label::moveInit().
|
protected |
Referenced by Label::drawBorder(), and Label::setBorder().
|
protected |
Referenced by Label::drawBorder(), and Label::setBorder().
|
protected |
Referenced by Label::drawText(), Label::getText(), Label::Label(), and Label::setText().
|
protected |
Referenced by Label::drawText(), Label::Label(), and Button::onMouseButton().
|
protected |
Referenced by Label::drawText().