#include <label.h>
Inheritance diagram for Label:
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 | |
Text * | txt_label |
bool | hidden |
Private Attributes | |
Font * | font |
const Color & | font_color |
bool | center |
bool | shadowed |
Definition at line 30 of file label.h.
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:
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 |
void Label::SetSizePosition | ( | const Rectanglei & | rect | ) | [virtual] |
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:
bool Label::center [private] |
Font* Label::font [private] |
const Color& Label::font_color [private] |
bool Label::hidden [protected] |
bool Label::shadowed [private] |
Text* Label::txt_label [protected] |