Basic interactive button on screen. More...

#include <Control.h>

Inheritance diagram for Graphics::Control:
Collaboration diagram for Graphics::Control:

Classes

class  List
 

Public Types

enum  Flag { Flag::enabled, Flag::active, Flag::selected, Flag::dirty }
 
enum  Element { Element::border, Element::back, Element::text }
 
- Public Types inherited from Graphics::Object
enum  Kind { Kind::XX }
 
using List = LinkedObjectListTemplate< Object >
 
using OwnedList = OwnedLinkedObjectListTemplate< Object >
 
- Public Types inherited from LinkedObjectTemplate< Object >
using Iterator = IteratorTemplate< Object, Object *, Object & >
 
using ConstIterator = IteratorTemplate< const Object, const Object *, const Object & >
 

Public Member Functions

 Control ()
 
 Control (const Rect &bounds)
 
 Control (const Rect &bounds, const String &caption)
 
RenderercreateRenderer (const Location &location) const override
 Create a software renderer for this object. More...
 
virtual void draw (SceneObject &scene) const =0
 
void write (MetaWriter &meta) const override
 
String getCaption () const
 
void setCaption (const String &value)
 
void enable (bool state)
 
void select (bool state)
 
void setPos (Point pos)
 
void resize (Size size)
 
void setBounds (const Rect &r)
 
Rect getBounds () const
 
bool isEnabled () const
 
bool isSelected () const
 
bool isDirty () const
 
void setDirty ()
 
virtual FontgetFont () const
 
virtual Color getColor (Element element) const
 
virtual Align getTextAlign () const
 
- Public Member Functions inherited from Graphics::ObjectTemplate< object_kind >
Kind kind () const override
 
- Public Member Functions inherited from Graphics::Object
bool operator== (const Object &other) const
 
virtual String getTypeStr () const
 
- Public Member Functions inherited from LinkedObjectTemplate< Object >
Object * getNext () const
 
bool insertAfter (Object *object)
 
Iterator begin () const
 
Iterator end () const
 
Iterator cbegin () const
 
Iterator cend () const
 
- Public Member Functions inherited from LinkedObject
virtual ~LinkedObject ()
 
virtual LinkedObjectnext () const
 
bool insertAfter (LinkedObject *object)
 
bool operator== (const LinkedObject &other) const
 
bool operator!= (const LinkedObject &other) const
 

Protected Member Functions

void setFlag (Flag flag, bool state)
 

Protected Attributes

Rect bounds
 
CString caption
 
BitSet< uint8_t, Flagflags
 

Friends

class Screen
 

Detailed Description

Basic interactive button on screen.

Responsible for drawing area within designated rectangle

Member Enumeration Documentation

◆ Element

Enumerator
border 
back 
text 

◆ Flag

Enumerator
enabled 

Can be interacted with.

active 

i.e. pressed

selected 

e.g. ON

dirty 

Requires repainting.

Constructor & Destructor Documentation

◆ Control() [1/3]

Graphics::Control::Control ( )
inline

◆ Control() [2/3]

Graphics::Control::Control ( const Rect bounds)
inline

◆ Control() [3/3]

Graphics::Control::Control ( const Rect bounds,
const String caption 
)
inline

Member Function Documentation

◆ createRenderer()

Renderer* Graphics::Control::createRenderer ( const Location location) const
overridevirtual

Create a software renderer for this object.

Parameters
location
Return values
rendererReturned renderer object

Return nullptr if object cannot/should not be rendered

Implements Graphics::Object.

◆ draw()

virtual void Graphics::Control::draw ( SceneObject scene) const
pure virtual

◆ enable()

void Graphics::Control::enable ( bool  state)
inline

◆ getBounds()

Rect Graphics::Control::getBounds ( ) const
inline

◆ getCaption()

String Graphics::Control::getCaption ( ) const
inline

◆ getColor()

virtual Color Graphics::Control::getColor ( Element  element) const
virtual

Reimplemented in Graphics::Label.

◆ getFont()

virtual Font* Graphics::Control::getFont ( ) const
inlinevirtual

◆ getTextAlign()

virtual Align Graphics::Control::getTextAlign ( ) const
inlinevirtual

◆ isDirty()

bool Graphics::Control::isDirty ( ) const
inline

◆ isEnabled()

bool Graphics::Control::isEnabled ( ) const
inline

◆ isSelected()

bool Graphics::Control::isSelected ( ) const
inline

◆ resize()

void Graphics::Control::resize ( Size  size)
inline

◆ select()

void Graphics::Control::select ( bool  state)
inline

◆ setBounds()

void Graphics::Control::setBounds ( const Rect r)
inline

◆ setCaption()

void Graphics::Control::setCaption ( const String value)
inline

◆ setDirty()

void Graphics::Control::setDirty ( )
inline

◆ setFlag()

void Graphics::Control::setFlag ( Flag  flag,
bool  state 
)
inlineprotected

◆ setPos()

void Graphics::Control::setPos ( Point  pos)
inline

◆ write()

void Graphics::Control::write ( MetaWriter meta) const
inlineoverridevirtual

Implements Graphics::Object.

Friends And Related Function Documentation

◆ Screen

friend class Screen
friend

Member Data Documentation

◆ bounds

Rect Graphics::Control::bounds
protected

◆ caption

CString Graphics::Control::caption
protected

◆ flags

BitSet<uint8_t, Flag> Graphics::Control::flags
mutableprotected

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