ManaPlus
|
#include <label.h>
Public Member Functions | |
Label (const Widget2 *const widget) | |
Label (const Widget2 *const widget, const std::string &caption) | |
~Label () | |
void | init () |
void | draw (Graphics *const graphics) |
void | safeDraw (Graphics *const graphics) |
void | adjustSize () |
void | setForegroundColor (const Color &color) |
void | setForegroundColorAll (const Color &color1, const Color &color2) |
void | resizeTo (const int maxSize, const int minSize) |
const std::string & | getCaption () const |
void | setCaption (const std::string &caption) |
void | setAlignment (Graphics::Alignment alignment) |
Graphics::Alignment | getAlignment () const |
void | setParent (Widget *const widget) |
void | setWindow (Widget *const widget) |
void | widgetHidden (const Event &event) |
Public Member Functions inherited from Widget | |
Widget (const Widget2 *const widget) | |
~Widget () | |
virtual void | drawFrame (Graphics *graphics) |
virtual void | safeDrawFrame (Graphics *graphics) |
void | setFrameSize (const unsigned int frameSize) |
unsigned int | getFrameSize () const |
virtual void | logic () |
Widget * | getParent () const |
void | setWidth (const int width) |
int | getWidth () const |
void | setHeight (const int height) |
int | getHeight () const |
void | setSize (const int width, const int height) |
void | setX (const int x) |
int | getX () const |
void | setY (const int y) |
int | getY () const |
void | setPosition (const int x, const int y) |
void | setDimension (const Rect &dimension) |
const Rect & | getDimension () const |
void | setFocusable (const bool focusable) |
bool | isFocusable () const |
virtual bool | isFocused () const |
void | setEnabled (const bool enabled) |
bool | isEnabled () const |
void | setVisible (Visible visible) |
bool | isVisible () const |
void | setBaseColor (const Color &color) |
const Color & | getBaseColor () const |
void | setForegroundColor (const Color &color) |
const Color & | getForegroundColor () const |
void | setBackgroundColor (const Color &color) |
const Color & | getBackgroundColor () const |
virtual void | requestFocus () |
virtual void | requestMoveToTop () |
virtual void | requestMoveToBottom () |
virtual void | setFocusHandler (FocusHandler *const focusHandler) |
FocusHandler * | getFocusHandler () |
void | addActionListener (ActionListener *const actionListener) |
void | removeActionListener (ActionListener *const actionListener) |
void | addDeathListener (WidgetDeathListener *const deathListener) |
void | removeDeathListener (WidgetDeathListener *const deathListener) |
void | addMouseListener (MouseListener *const mouseListener) |
void | removeMouseListener (MouseListener *const mouseListener) |
void | addKeyListener (KeyListener *const keyListener) |
void | removeKeyListener (KeyListener *const keyListener) |
void | addFocusListener (FocusListener *const focusListener) |
void | removeFocusListener (FocusListener *const focusListener) |
void | addWidgetListener (WidgetListener *const widgetListener) |
void | removeWidgetListener (WidgetListener *const widgetListener) |
void | setActionEventId (const std::string &actionEventId) |
const std::string & | getActionEventId () const |
virtual void | getAbsolutePosition (int &x, int &y) const |
Font * | getFont () const |
void | setFont (Font *const font) |
virtual void | fontChanged () |
bool | isTabInEnabled () const |
void | setTabInEnabled (const bool enabled) |
bool | isTabOutEnabled () const |
void | setTabOutEnabled (const bool enabled) |
void | requestModalFocus () |
virtual void | requestModalMouseInputFocus () |
virtual void | releaseModalFocus () |
virtual void | releaseModalMouseInputFocus () |
virtual bool | isModalFocused () const |
virtual bool | isModalMouseInputFocused () const |
virtual Widget * | getWidgetAt (int x, int y) |
const std::list< MouseListener * > & | getMouseListeners () const A_CONST |
const std::list< KeyListener * > & | getKeyListeners () const A_CONST |
const std::list< FocusListener * > & | getFocusListeners () const A_CONST |
virtual Rect | getChildrenArea () |
virtual FocusHandler * | getInternalFocusHandler () |
void | setInternalFocusHandler (FocusHandler *const internalFocusHandler) |
virtual void | moveToTop (Widget *widget) |
virtual void | moveToBottom (Widget *widget) |
virtual void | focusNext () |
virtual void | focusPrevious () |
virtual void | showWidgetPart (Widget *const widget, const Rect &area) |
void | setId (const std::string &id) |
const std::string & | getId () const |
virtual void | showPart (const Rect &rectangle) |
bool | isAllowLogic () const |
void | setMouseConsume (const bool b) |
bool | isMouseConsume () const |
void | setRedraw (const bool b) |
virtual bool | isSelectable () const |
void | setSelectable (const bool selectable) |
void | windowResized () |
virtual void | postInit () |
Public Member Functions inherited from Widget2 | |
virtual | ~Widget2 () |
const Color & | getThemeColor (const ThemeColorIdT type, const unsigned int alpha) const A_INLINE |
const Color & | getThemeCharColor (const signed char c, bool &valid) const A_INLINE |
virtual void | setWidget2 (const Widget2 *const widget) |
void | setPalette (int palette) |
void | checkPalette () |
void | setForegroundColor2 (const Color &color) |
Widget * | getWindow () const |
Public Member Functions inherited from WidgetListener | |
virtual | ~WidgetListener () |
virtual void | widgetResized (const Event &event) |
virtual void | widgetMoved (const Event &event) |
virtual void | widgetShown (const Event &event) |
Public Member Functions inherited from ToolTipListener | |
ToolTipListener () | |
void | setToolTip (const std::string &str) |
std::string | getToolTip () const |
void | mouseMoved (MouseEvent &event) |
void | mouseExited (MouseEvent &event) |
Public Member Functions inherited from MouseListener | |
virtual | ~MouseListener () |
virtual void | mouseEntered (MouseEvent &event) |
virtual void | mousePressed (MouseEvent &event) |
virtual void | mouseReleased (MouseEvent &event) |
virtual void | mouseClicked (MouseEvent &event) |
virtual void | mouseWheelMovedUp (MouseEvent &event) |
virtual void | mouseWheelMovedDown (MouseEvent &event) |
virtual void | mouseDragged (MouseEvent &event) |
Static Public Member Functions | |
static void | finalCleanup () |
Static Public Member Functions inherited from Widget | |
static void | setGlobalFont (Font *const font) |
static Font * | getGloablFont () |
static void | cleanGlobalFont () |
static bool | widgetExists (const Widget *const widget) |
static void | distributeWindowResizeEvent () |
static Widget * | callPostInit (Widget *const widget) |
Static Public Attributes | |
static Skin * | mSkin = 0 |
static int | mInstances = 0 |
Private Attributes | |
std::string | mCaption |
TextChunk | mTextChunk |
Graphics::Alignment | mAlignment |
int | mPadding |
bool | mTextChanged |
Label widget. Same as the Guichan label but modified to use the palette system.
|
explicit |
Label::Label | ( | const Widget2 *const | widget, |
const std::string & | caption | ||
) |
Constructor. This version of the constructor sets the label with an inintialization string.
Definition at line 91 of file label.cpp.
References Widget::getFont(), Font::getHeight(), Font::getWidth(), init(), Widget::setHeight(), and Widget::setWidth().
Label::~Label | ( | ) |
Definition at line 108 of file label.cpp.
References TextChunk::deleteImage(), gui, mInstances, mSkin, mTextChunk, Widget2::mWindow, Gui::removeDragged(), Widget::removeMouseListener(), Widget::removeWidgetListener(), theme, and Theme::unload().
void Label::adjustSize | ( | ) |
Definition at line 200 of file label.cpp.
References Widget::getFont(), Font::getHeight(), Font::getWidth(), mCaption, mPadding, Widget::setHeight(), and Widget::setWidth().
Referenced by StatsPageBasic::attributeChanged(), StatusWindow::attributeChanged(), BankWindow::BankWindow(), CharacterDisplay::CharacterDisplay(), CharacterViewSmall::CharacterViewSmall(), SetupQuickItem::createControls(), BuyDialog::init(), MapDebugTab::logic(), TargetDebugTab::logic(), UpdaterWindow::logic(), LoginDialog::LoginDialog(), Tab::setCaption(), SpeechBubble::setCaption(), ItemPopup::setItem(), SpellPopup::setItem(), Tab::setLabelFont(), StatusPopup::setLabelText(), TradeWindow::setMoney(), CharacterViewSmall::show(), BeingPopup::show(), TextPopup::show(), SkillPopup::show(), StatDebugTab::StatDebugTab(), StatsPageBasic::StatsPageBasic(), StatusWindow::StatusWindow(), SetupQuickItem::toWidget(), KillStats::update(), SkillDialog::update(), StatsClanTab::updateClan(), RelationClanTab::updateClan(), SocialWindow::updateCounter(), SliderList::updateLabel(), StatusWindow::updateLevelLabel(), and CharCreateDialog::updateSliders().
|
virtual |
Draws the label.
Implements Widget.
Definition at line 151 of file label.cpp.
References BLOCK_END, BLOCK_START, Graphics::CENTER, TextChunk::color, TextChunk::color2, TextChunk::deleteImage(), Graphics::drawImage(), Font::generate(), Widget::getFont(), Font::getHeight(), Font::getWidth(), Rect::height, TextChunk::img, Graphics::LEFT, mAlignment, mCaption, Widget::mDimension, Widget::mForegroundColor, Widget2::mForegroundColor2, mPadding, mTextChanged, mTextChunk, Graphics::RIGHT, TextChunk::text, TextChunk::textFont, and Rect::width.
Referenced by safeDraw().
|
static |
|
inline |
Gets the alignment of the caption. The alignment is relative to the center of the label.
Definition at line 163 of file label.h.
References mAlignment.
|
inline |
Gets the caption of the label.
Definition at line 133 of file label.h.
References mCaption.
Referenced by Tab::getCaption(), AttrDisplay::getValue(), UpdaterWindow::logic(), CharacterDisplay::mouseMoved(), SpellPopup::setItem(), and BeingPopup::show().
void Label::init | ( | ) |
Definition at line 126 of file label.cpp.
References Widget::addMouseListener(), Skin::getPadding(), Widget2::getThemeColor(), Theme::getThemePath(), GradientType::LABEL, Theme::load(), Widget::mAllowLogic, Widget::mForegroundColor, Widget2::mForegroundColor2, mInstances, mPadding, mSkin, Widget::setSelectable(), and theme.
Referenced by Label().
void Label::resizeTo | ( | const int | maxSize, |
const int | minSize | ||
) |
Definition at line 227 of file label.cpp.
References Widget::getFont(), Font::getHeight(), Font::getWidth(), mCaption, mPadding, setCaption(), Widget::setHeight(), and Widget::setWidth().
Referenced by CharacterDisplay::update(), CharCreateDialog::updateHair(), and CharCreateDialog::updateLook().
|
virtual |
|
inline |
Sets the alignment of the caption. The alignment is relative to the center of the label.
alignment | The alignment of the caption of the label. |
Definition at line 153 of file label.h.
References mAlignment.
Referenced by AttrDisplay::AttrDisplay(), CharacterDisplay::CharacterDisplay(), BuyDialog::init(), OutfitWindow::OutfitWindow(), and SellDialog::postInit().
void Label::setCaption | ( | const std::string & | caption | ) |
Sets the caption of the label. It's advisable to call adjustSize after setting of the caption to adjust the label's size to fit the caption.
caption | The caption of the label. |
Definition at line 264 of file label.cpp.
References mCaption, and mTextChanged.
Referenced by Setup_Joystick::action(), Setup_Video::action(), KillStats::action(), StatsPageBasic::attributeChanged(), KillStats::attributeChanged(), StatusWindow::attributeChanged(), BankWindow::bankMoneyChanged(), Setup_Video::cancel(), CharacterViewSmall::CharacterViewSmall(), KillStats::gainXp(), MapDebugTab::logic(), NetDebugTab::logic(), StatDebugTab::logic(), TargetDebugTab::logic(), ServerDialog::logic(), UpdaterWindow::logic(), MailViewWindow::removeMoney(), InfoClanTab::resetClan(), resizeTo(), Tab::setCaption(), SpeechBubble::setCaption(), ItemPopup::setItem(), SpellPopup::setItem(), StatusPopup::setLabelText(), TradeWindow::setMoney(), Setup_Colors::Setup_Colors(), Setup_Video::Setup_Video(), CharacterViewSmall::show(), BeingPopup::show(), TextPopup::show(), SkillPopup::show(), OutfitWindow::showCurrentOutfit(), StatsPageBasic::StatsPageBasic(), StatusWindow::StatusWindow(), SetupQuickItem::toWidget(), AttrDisplay::update(), ChangeDisplay::update(), CharacterDisplay::update(), KillStats::update(), SkillDialog::update(), SellDialog::updateButtonsAndLabels(), BuyDialog::updateButtonsAndLabels(), InfoClanTab::updateClan(), SocialWindow::updateCounter(), Setup_Colors::updateGradType(), CharCreateDialog::updateHair(), SetupItemSlider2::updateLabel(), SliderList::updateLabel(), StatusWindow::updateLevelLabel(), CharCreateDialog::updateLook(), CharCreateDialog::updateSliders(), and Setup_Colors::valueChanged().
void Label::setForegroundColor | ( | const Color & | color | ) |
Definition at line 208 of file label.cpp.
References Widget::mForegroundColor, Widget2::mForegroundColor2, and mTextChanged.
Definition at line 217 of file label.cpp.
References Widget::mForegroundColor, Widget2::mForegroundColor2, and mTextChanged.
Referenced by BeingPopup::addLabels(), TradeWindow::clear(), Tab::draw(), TextPopup::postInit(), TradeWindow::reset(), Tab::safeDraw(), SpeechBubble::setCaption(), ItemPopup::setLabelColor(), TradeWindow::setMoney(), BeingPopup::show(), SkillPopup::SkillPopup(), and SpellPopup::SpellPopup().
|
virtual |
Sets the parent of the widget. A parent must be a BasicContainer.
WARNING: This function is used internally and should not be called or overloaded unless you know what you are doing.
parent | The parent of the widget. |
Reimplemented from Widget.
Definition at line 271 of file label.cpp.
References Widget::addWidgetListener(), Widget2::mWindow, and Widget::setParent().
|
virtual |
Reimplemented from Widget2.
Definition at line 278 of file label.cpp.
References Widget2::mWindow, Widget::removeWidgetListener(), and Widget2::setWindow().
|
virtual |
Invoked when a widget is hidden, i.e it's set to be not visible.
event | Describes the event. |
Reimplemented from WidgetListener.
Definition at line 291 of file label.cpp.
References TextChunk::deleteImage(), mTextChanged, and mTextChunk.
|
private |
Holds the alignment of the caption.
Definition at line 189 of file label.h.
Referenced by draw(), getAlignment(), and setAlignment().
|
private |
Holds the caption of the label.
Definition at line 182 of file label.h.
Referenced by adjustSize(), draw(), getCaption(), resizeTo(), and setCaption().
|
static |
|
private |
Definition at line 191 of file label.h.
Referenced by adjustSize(), draw(), init(), and resizeTo().
|
static |
Definition at line 172 of file label.h.
Referenced by finalCleanup(), init(), and ~Label().
|
private |
Definition at line 193 of file label.h.
Referenced by draw(), setCaption(), setForegroundColor(), setForegroundColorAll(), and widgetHidden().
|
private |
Definition at line 184 of file label.h.
Referenced by draw(), widgetHidden(), and ~Label().