GClasses
GClasses::GWidgetTextLabel Class Reference

Detailed Description

A text label.

#include <GWidgets.h>

Inheritance diagram for GClasses::GWidgetTextLabel:
GClasses::GWidgetAtomic GClasses::GWidget

Public Member Functions

 GWidgetTextLabel (GWidgetGroup *pParent, int x, int y, int w, int h, const char *szText, unsigned int c=0xffffffff, unsigned int background=0x00000000, float fontSize=1.0f)
 
virtual ~GWidgetTextLabel ()
 
unsigned int backgroundColor ()
 Gets the text color. More...
 
virtual void draw (GImage *pCanvas, int x, int y)
 Draws this widget on pCanvas at (x,y) More...
 
unsigned int foregroundColor ()
 Gets the text color. More...
 
void setAlignLeft (bool bAlignLeft)
 Specifies whether the text is left-justified (true) or right-justified (false) More...
 
void setBackgroundColor (unsigned int c)
 The default background color is transparent. If you want an opaque or semi-opaque background then you should call this method. More...
 
void setFontSize (float f)
 Sets the size of the font. More...
 
void setForegroundColor (unsigned int c)
 Sets the text color. More...
 
void setText (const char *szText)
 Sets the label text. More...
 
const std::string & text ()
 Returns the label text. More...
 
virtual WidgetType type ()
 
void wrap ()
 Insert newline characters into the current text at good locations to make the text wrap within its rect. More...
 
- Public Member Functions inherited from GClasses::GWidgetAtomic
 GWidgetAtomic (GWidgetGroup *pParent, int x, int y, int w, int h)
 
virtual ~GWidgetAtomic ()
 
virtual bool isAtomic ()
 
virtual bool isClickable ()
 
virtual void onChar (char c)
 
virtual void onGetFocus ()
 
virtual void onLoseFocus ()
 
virtual void onMouseMove (int dx, int dy)
 
virtual void onSpecialKey (int key)
 
- Public Member Functions inherited from GClasses::GWidget
 GWidget (GWidgetGroup *m_pParent, int x, int y, int w, int h)
 
virtual ~GWidget ()
 
int id ()
 
GWidgetGroupparent ()
 
GRectrect ()
 
void setPos (int x, int y)
 

Protected Member Functions

virtual void grab (int button, int x, int y)
 
virtual void release (int button)
 

Protected Attributes

bool m_alignLeft
 
bool m_bGrabbed
 
unsigned int m_cBackground
 
unsigned int m_cForeground
 
float m_fontSize
 
std::string m_text
 
- Protected Attributes inherited from GClasses::GWidget
GWidgetCommonm_common
 
int m_nID
 
GWidgetGroupm_pParent
 
GRect m_rect
 

Additional Inherited Members

- Public Types inherited from GClasses::GWidget

Constructor & Destructor Documentation

GClasses::GWidgetTextLabel::GWidgetTextLabel ( GWidgetGroup pParent,
int  x,
int  y,
int  w,
int  h,
const char *  szText,
unsigned int  c = 0xffffffff,
unsigned int  background = 0x00000000,
float  fontSize = 1.0f 
)
virtual GClasses::GWidgetTextLabel::~GWidgetTextLabel ( )
virtual

Member Function Documentation

unsigned int GClasses::GWidgetTextLabel::backgroundColor ( )
inline

Gets the text color.

virtual void GClasses::GWidgetTextLabel::draw ( GImage pCanvas,
int  x,
int  y 
)
virtual

Draws this widget on pCanvas at (x,y)

Implements GClasses::GWidget.

unsigned int GClasses::GWidgetTextLabel::foregroundColor ( )
inline

Gets the text color.

virtual void GClasses::GWidgetTextLabel::grab ( int  button,
int  x,
int  y 
)
protectedvirtual

Reimplemented from GClasses::GWidgetAtomic.

virtual void GClasses::GWidgetTextLabel::release ( int  button)
protectedvirtual

Reimplemented from GClasses::GWidgetAtomic.

void GClasses::GWidgetTextLabel::setAlignLeft ( bool  bAlignLeft)

Specifies whether the text is left-justified (true) or right-justified (false)

void GClasses::GWidgetTextLabel::setBackgroundColor ( unsigned int  c)

The default background color is transparent. If you want an opaque or semi-opaque background then you should call this method.

void GClasses::GWidgetTextLabel::setFontSize ( float  f)
inline

Sets the size of the font.

void GClasses::GWidgetTextLabel::setForegroundColor ( unsigned int  c)

Sets the text color.

void GClasses::GWidgetTextLabel::setText ( const char *  szText)

Sets the label text.

const std::string& GClasses::GWidgetTextLabel::text ( )
inline

Returns the label text.

virtual WidgetType GClasses::GWidgetTextLabel::type ( )
inlinevirtual

Implements GClasses::GWidget.

void GClasses::GWidgetTextLabel::wrap ( )

Insert newline characters into the current text at good locations to make the text wrap within its rect.

Member Data Documentation

bool GClasses::GWidgetTextLabel::m_alignLeft
protected
bool GClasses::GWidgetTextLabel::m_bGrabbed
protected
unsigned int GClasses::GWidgetTextLabel::m_cBackground
protected
unsigned int GClasses::GWidgetTextLabel::m_cForeground
protected
float GClasses::GWidgetTextLabel::m_fontSize
protected
std::string GClasses::GWidgetTextLabel::m_text
protected