ManaPlus
Public Member Functions | Protected Member Functions | Protected Attributes
Widget2 Class Reference

#include <widget2.h>

Inheritance diagram for Widget2:
PlayerTableModel SetupItem Widget SetupActionDropDown SetupButtonItem SetupItemCheckBox SetupItemDropDown SetupItemDropDownStr SetupItemIntTextField SetupItemLabel SetupItemSlider SetupItemSlider2 SetupItemSliderList SetupItemTextField SetupQuickItem BasicContainer BrowserBox Button CheckBox EmotePage GuiTable Icon ItemContainer Label ListBox PlayerBox ProgressBar ProgressIndicator RadioButton ShortcutContainer SkillRectangleListBox Slider StaticBrowserBox TextBox TextField TextPreview

Public Member Functions

virtual ~Widget2 ()
 
const ColorgetThemeColor (const ThemeColorIdT type, const unsigned int alpha=255U) const A_INLINE
 
const ColorgetThemeCharColor (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)
 
WidgetgetWindow () const
 
virtual void setWindow (Widget *const window)
 

Protected Member Functions

 Widget2 (const Widget2 *const widget)
 

Protected Attributes

int mPaletteOffset
 
WidgetmWindow
 
Color mForegroundColor2
 

Detailed Description

Definition at line 35 of file widget2.h.

Constructor & Destructor Documentation

◆ ~Widget2()

virtual Widget2::~Widget2 ( )
inlinevirtual

Definition at line 40 of file widget2.h.

41  {
42  }

◆ Widget2()

Widget2::Widget2 ( const Widget2 *const  widget)
inlineexplicitprotected

Definition at line 102 of file widget2.h.

References checkPalette().

102  :
103  mPaletteOffset(widget != nullptr ? widget->mPaletteOffset : 0),
104  mWindow(widget != nullptr ? widget->getWindow() : nullptr),
106  {
107  checkPalette();
108  }
void checkPalette()
Definition: widget2.h:76
Widget * getWindow() const
Definition: widget2.h:91
Widget * mWindow
Definition: widget2.h:111
int mPaletteOffset
Definition: widget2.h:110
Color mForegroundColor2
Definition: widget2.h:112

Member Function Documentation

◆ checkPalette()

void Widget2::checkPalette ( )
inline

Definition at line 76 of file widget2.h.

References CAST_S32, mPaletteOffset, ThemeColorId::THEME_COLORS_END, and THEME_PALETTES.

Referenced by setPalette(), and Widget2().

77  {
78  if (mPaletteOffset < 0 ||
81  {
82  mPaletteOffset = 0;
83  }
84  }
#define CAST_S32
Definition: cast.h:29
int mPaletteOffset
Definition: widget2.h:110
const int THEME_PALETTES
Definition: theme.h:30

◆ getThemeCharColor()

const Color& Widget2::getThemeCharColor ( const signed char  c,
bool valid 
) const
inline

Definition at line 51 of file widget2.h.

References Palette::BLACK, Theme::getColor(), Theme::getIdByChar(), mPaletteOffset, theme, and anonymous_namespace{libxml.cpp}::valid.

Referenced by BrowserBox::calcHeight(), and StaticBrowserBox::updateHeight().

54  {
55  if (theme == nullptr)
56  return Palette::BLACK;
57  const ThemeColorIdT colorId = theme->getIdByChar(c, valid);
58  if (valid)
59  return theme->getColor(colorId + mPaletteOffset, 255U);
60  return Palette::BLACK;
61  }
ThemeColorIdT getIdByChar(const signed char c, bool &valid) const
Definition: theme.cpp:1272
static const Color BLACK
Definition: palette.h:47
ThemeColorId ::T ThemeColorIdT
Definition: themecolorid.h:256
const Color & getColor(ThemeColorIdT type, const unsigned int alpha=255U)
Definition: theme.h:136
int mPaletteOffset
Definition: widget2.h:110
Theme * theme
Definition: theme.cpp:61

◆ getThemeColor()

const Color& Widget2::getThemeColor ( const ThemeColorIdT  type,
const unsigned int  alpha = 255U 
) const
inline

Definition at line 44 of file widget2.h.

References Theme::getColor(), mPaletteOffset, and theme.

Referenced by BeingPopup::addLabels(), AvatarListBox::AvatarListBox(), BrowserBox::BrowserBox(), CheckBox::CheckBox(), TradeWindow::clear(), MiniStatusWindow::createBar(), Desktop::Desktop(), TextPreview::draw(), DropDown::DropDown(), GuiTable::GuiTable(), Label::init(), InventoryWindow::InventoryWindow(), ItemPopup::ItemPopup(), ListBox::ListBox(), OutfitWindow::OutfitWindow(), TextPopup::postInit(), ProgressBar::ProgressBar(), RadioButton::RadioButton(), TradeWindow::reset(), ServersListBox::ServersListBox(), ItemPopup::setLabelColor(), TradeWindow::setMoney(), SpeechBubble::setText(), Setup_Relations::Setup_Relations(), ItemShortcutContainer::setWidget2(), SpellShortcutContainer::setWidget2(), VirtShortcutContainer::setWidget2(), EmoteShortcutContainer::setWidget2(), ShopListBox::ShopListBox(), ShortcutContainer::ShortcutContainer(), BeingPopup::show(), SkillListBox::SkillListBox(), SkillPopup::SkillPopup(), SocialGuildTab::SocialGuildTab(), SocialGuildTab2::SocialGuildTab2(), SocialPartyTab::SocialPartyTab(), SpeechBubble::SpeechBubble(), SpellPopup::SpellPopup(), StaticBrowserBox::StaticBrowserBox(), StatusWindow::StatusWindow(), TextBox::TextBox(), TextField::TextField(), StatusWindow::updateMPBar(), StatusWindow::updateStatusBar(), and Window::Window().

47  {
48  return theme->getColor(type + mPaletteOffset, alpha);
49  }
const Color & getColor(ThemeColorIdT type, const unsigned int alpha=255U)
Definition: theme.h:136
int mPaletteOffset
Definition: widget2.h:110
Theme * theme
Definition: theme.cpp:61

◆ getWindow()

Widget* Widget2::getWindow ( ) const
inline

Definition at line 91 of file widget2.h.

References mWindow.

92  {
93  return mWindow;
94  }
Widget * mWindow
Definition: widget2.h:111

◆ setForegroundColor2()

void Widget2::setForegroundColor2 ( const Color color)
inline

Definition at line 86 of file widget2.h.

References mForegroundColor2.

87  {
88  mForegroundColor2 = color;
89  }
Color mForegroundColor2
Definition: widget2.h:112

◆ setPalette()

void Widget2::setPalette ( int  palette)
inline

Definition at line 68 of file widget2.h.

References CAST_S32, checkPalette(), mPaletteOffset, setWidget2(), and ThemeColorId::THEME_COLORS_END.

Referenced by Popup::Popup(), and Window::Window().

69  {
70  mPaletteOffset = palette * CAST_S32(
72  checkPalette();
73  setWidget2(this);
74  }
void checkPalette()
Definition: widget2.h:76
virtual void setWidget2(const Widget2 *const widget)
Definition: widget2.h:63
#define CAST_S32
Definition: cast.h:29
int mPaletteOffset
Definition: widget2.h:110

◆ setWidget2()

virtual void Widget2::setWidget2 ( const Widget2 *const  widget)
inlinevirtual

◆ setWindow()

virtual void Widget2::setWindow ( Widget *const  window)
inlinevirtual

Field Documentation

◆ mForegroundColor2

Color Widget2::mForegroundColor2
protected

◆ mPaletteOffset

int Widget2::mPaletteOffset
protected

Definition at line 110 of file widget2.h.

Referenced by checkPalette(), getThemeCharColor(), getThemeColor(), setPalette(), and setWidget2().

◆ mWindow

Widget* Widget2::mWindow
protected

The documentation for this class was generated from the following file: