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) 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 36 of file widget2.h.

Constructor & Destructor Documentation

◆ ~Widget2()

virtual Widget2::~Widget2 ( )
inlinevirtual

Definition at line 41 of file widget2.h.

42  {
43  }

◆ Widget2()

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

Definition at line 103 of file widget2.h.

103  :
104  mPaletteOffset(widget != nullptr ? widget->mPaletteOffset : 0),
105  mWindow(widget != nullptr ? widget->getWindow() : nullptr),
107  {
108  checkPalette();
109  }
Widget * mWindow
Definition: widget2.h:112
Widget * getWindow() const
Definition: widget2.h:92
int mPaletteOffset
Definition: widget2.h:111
void checkPalette()
Definition: widget2.h:77
Color mForegroundColor2
Definition: widget2.h:113

References checkPalette().

Member Function Documentation

◆ checkPalette()

void Widget2::checkPalette ( )
inline

Definition at line 77 of file widget2.h.

78  {
79  if (mPaletteOffset < 0 ||
81  ThemeColorId::THEME_COLORS_END))
82  {
83  mPaletteOffset = 0;
84  }
85  }
#define CAST_S32
Definition: cast.h:30
const int THEME_PALETTES
Definition: theme.h:31

References CAST_S32, mPaletteOffset, and THEME_PALETTES.

Referenced by setPalette(), and Widget2().

◆ getThemeCharColor()

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

Definition at line 52 of file widget2.h.

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

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

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

◆ getThemeColor()

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

◆ getWindow()

Widget* Widget2::getWindow ( ) const
inline

Definition at line 92 of file widget2.h.

93  {
94  return mWindow;
95  }

References mWindow.

◆ setForegroundColor2()

void Widget2::setForegroundColor2 ( const Color color)
inline

Definition at line 87 of file widget2.h.

88  {
89  mForegroundColor2 = color;
90  }

References mForegroundColor2.

◆ setPalette()

void Widget2::setPalette ( int  palette)
inline

Definition at line 69 of file widget2.h.

70  {
71  mPaletteOffset = palette * CAST_S32(
72  ThemeColorId::THEME_COLORS_END);
73  checkPalette();
74  setWidget2(this);
75  }
virtual void setWidget2(const Widget2 *const widget)
Definition: widget2.h:64

References CAST_S32, checkPalette(), mPaletteOffset, and setWidget2().

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

◆ setWidget2()

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

Definition at line 64 of file widget2.h.

65  {
66  mPaletteOffset = widget != nullptr ? widget->mPaletteOffset : 0;
67  }

References mPaletteOffset.

Referenced by setPalette(), and ShortcutContainer::setSkin().

◆ setWindow()

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

Field Documentation

◆ mForegroundColor2

Color Widget2::mForegroundColor2
protected

◆ mPaletteOffset

int Widget2::mPaletteOffset
protected

Definition at line 111 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: