Label Class Reference

#include <label.h>

Inheritance diagram for Label:

Inheritance graph
[legend]
Collaboration diagram for Label:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Label (const std::string &label, const Rectanglei &rect, Font &font, const Color &color=white_color, bool center=false, bool shadowed=true)
 ~Label ()
void Draw (const Point2i &mousePosition, Surface &surf) const
void SetSizePosition (const Rectanglei &rect)
void SetText (const std::string &new_txt)
const std::string & GetText () const
void SetVisible (bool visible)

Protected Attributes

Texttxt_label
bool hidden

Private Attributes

Fontfont
const Colorfont_color
bool center
bool shadowed

Detailed Description

Definition at line 30 of file label.h.


Constructor & Destructor Documentation

Label::Label ( const std::string &  label,
const Rectanglei rect,
Font font,
const Color color = white_color,
bool  center = false,
bool  shadowed = true 
)

Definition at line 24 of file label.cpp.

00026   : font_color(color)
00027 {
00028   position = rect.GetPosition();
00029   size = rect.GetSize();
00030   font = &_font;
00031   center = _center;
00032   shadowed = _shadowed;
00033   hidden = false;
00034   txt_label = new Text(label, font_color, &_font, shadowed);
00035   txt_label->SetMaxWidth(GetSizeX());
00036   size.y = txt_label->GetHeight();
00037 }

Here is the call graph for this function:

Label::~Label (  ) 

Definition at line 39 of file label.cpp.

00040 {
00041   delete txt_label;
00042 }


Member Function Documentation

void Label::Draw ( const Point2i mousePosition,
Surface surf 
) const [virtual]

Implements Widget.

Reimplemented in TextBox.

Definition at line 44 of file label.cpp.

00045 {
00046   if (!hidden) 
00047     {
00048       if (!center)
00049         txt_label->DrawTopLeft(position);
00050       else
00051         txt_label->DrawCenterTop(position.x + size.x/2, position.y);
00052     }
00053 }

Here is the call graph for this function:

Here is the caller graph for this function:

const std::string & Label::GetText (  )  const

Definition at line 70 of file label.cpp.

00071 {
00072   return txt_label->GetText();
00073 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Label::SetSizePosition ( const Rectanglei rect  )  [virtual]

Implements Widget.

Definition at line 55 of file label.cpp.

00056 {
00057   StdSetSizePosition(rect);
00058   txt_label->SetMaxWidth(GetSizeX());
00059   size.y = txt_label->GetHeight();
00060 }

Here is the call graph for this function:

void Label::SetText ( const std::string &  new_txt  ) 

Reimplemented in TextBox.

Definition at line 62 of file label.cpp.

00063 {
00064   need_redrawing = true;
00065   delete txt_label;
00066   txt_label = new Text(new_txt, font_color, font, shadowed);
00067   txt_label->SetMaxWidth(GetSizeX());
00068 }

Here is the call graph for this function:

Here is the caller graph for this function:

void Label::SetVisible ( bool  visible  ) 

Definition at line 75 of file label.cpp.

00076 {
00077   if (hidden == visible) {
00078     hidden = !visible;
00079     need_redrawing = true;
00080   }
00081 }

Here is the caller graph for this function:


Member Data Documentation

bool Label::center [private]

Definition at line 37 of file label.h.

Font* Label::font [private]

Definition at line 35 of file label.h.

const Color& Label::font_color [private]

Definition at line 36 of file label.h.

bool Label::hidden [protected]

Definition at line 33 of file label.h.

bool Label::shadowed [private]

Definition at line 38 of file label.h.

Text* Label::txt_label [protected]

Definition at line 32 of file label.h.


The documentation for this class was generated from the following files:
Generated on Mon Jan 1 13:55:24 2007 for Wormux by  doxygen 1.4.7