ROLAND  0.70
Amstrad Emulator based on Caprice Source rewritten in C++.
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Label Class Reference

A Widget with text and background color or image. More...

#include <label.h>

Inheritance diagram for Label:
Widget Button ListItem FileListItem

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 StringgetText () 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 Widgetparent () 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 Rectrect () const
 
const Rectcanvasrect () 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
 
ImagemImage
 
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
CanvasmCanvas
 
WidgetmParent
 
Rect mRect
 
Rect mCanvasRect
 
Color mColor
 
bool mEnabled
 
bool mMouseOver
 
bool mMouseGrab
 
bool mWantEvents
 

Detailed Description

A Widget with text and background color or image.

Constructor & Destructor Documentation

Label ( Widget parent = nullptr)
~Label ( )
virtual

References Label::mImage.

Member Function Documentation

void draw ( )
virtual
void drawBackground ( )
protected
void drawBackground ( const Color color)
protected
void drawBorder ( )
protected
void drawText ( )
protected
const String& getText ( ) const
inline
void move ( SDL_MouseMotionEvent *  event)
protected
void moveInit ( SDL_MouseButtonEvent *  event)
protected
void onMouseButton ( SDL_MouseButtonEvent *  event)
virtual

Catch MouseButton events.

Reimplemented from Widget.

Reimplemented in Button, and ListItem.

References Label::moveInit().

Referenced by Label::setPos().

void onMouseMotion ( SDL_MouseMotionEvent *  event)
virtual

Catch MouseMotion events.

Reimplemented from Widget.

Reimplemented in Button.

References Label::move().

Referenced by Label::setPos().

void setBackground ( bool  val)
inline

References Label::mBackground.

void setBorder ( bool  val)
void setBorderColor ( const Color color,
const Color highlite 
)
inline
void setImage ( const String fname,
bool  autosize = true,
bool  bg = false 
)
void setMoveable ( bool  moveable)
inline

References Label::mMoveable.

virtual void setPos ( int  x,
int  y 
)
inlinevirtual
void setText ( const String text)
inline

References Label::mText.

Referenced by display(), and initGui().

Member Data Documentation

bool mBackground
protected
bool mBorder
protected
Color mBorderColor1
protected
Color mBorderColor2
protected
Image* mImage
protected
Point mLeftBottom
protected
Point mLeftTop
protected
bool mMoveable
protected
Point mRelativeMousePos
protected
Point mRightBottom
protected
Point mRightTop
protected
String mText
protected
Point mTextOffset
protected
Point mTextPos
protected

Referenced by Label::drawText().


The documentation for this class was generated from the following files: