GClasses

GClasses::GWidgetTextLabel Class Reference

A text label. More...

#include <GWidgets.h>

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

List of all members.

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 ()
virtual WidgetType type ()
virtual void draw (GImage *pCanvas, int x, int y)
 Draws this widget on pCanvas at (x,y)
const std::string & text ()
 Returns the label text.
void setFontSize (float f)
 Sets the size of the font.
void setText (const char *szText)
 Sets the label text.
void setForegroundColor (unsigned int c)
 Sets the text color.
unsigned int foregroundColor ()
 Gets the text color.
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.
unsigned int backgroundColor ()
 Gets the text color.
void setAlignLeft (bool bAlignLeft)
 Specifies whether the text is left-justified (true) or right-justified (false)
void wrap ()
 Insert newline characters into the current text at good locations to make the text wrap within its rect.

Protected Member Functions

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

Protected Attributes

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

Detailed Description

A text label.


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 
) [protected, virtual]

Reimplemented from GClasses::GWidgetAtomic.

virtual void GClasses::GWidgetTextLabel::release ( int  button) [protected, virtual]

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 ( ) [inline, virtual]

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

std::string GClasses::GWidgetTextLabel::m_text [protected]