ManaPlus
Public Member Functions | Protected Attributes
SetupItemCheckBox Class Reference

#include <setupitem.h>

Inheritance diagram for SetupItemCheckBox:
SetupItem ActionListener Widget2

Public Member Functions

 SetupItemCheckBox (const std::string &text, const std::string &description, const std::string &keyName, SetupTabScroll *const parent, const std::string &eventName, const MainConfig mainConfig)
 
 SetupItemCheckBox (const std::string &text, const std::string &description, const std::string &keyName, SetupTabScroll *const parent, const std::string &eventName, const std::string &def, const MainConfig mainConfig)
 
 ~SetupItemCheckBox ()
 
void createControls ()
 
void fromWidget ()
 
void toWidget ()
 
- Public Member Functions inherited from SetupItem
 ~SetupItem ()
 
void load ()
 
virtual void save ()
 
void setWidget (Widget *widget)
 
WidgetgetWidget () const
 
ConfigurationgetConfig () const
 
virtual std::string getActionEventId () const
 
void action (const ActionEvent &event)
 
virtual void doAction ()
 
virtual void apply (const std::string &eventName)
 
virtual void cancel (const std::string &eventName)
 
virtual void externalUpdated (const std::string &eventName)
 
virtual void externalUnloaded (const std::string &eventName)
 
MainConfig isMainConfig () const
 
void fixFirstItemSize (Widget *const widget)
 
virtual void rereadValue ()
 
void setValue (const std::string &str)
 
std::string getValue () const
 
std::string getEventName () const
 
- Public Member Functions inherited from ActionListener
virtual ~ActionListener ()
 
- Public Member Functions inherited from Widget2
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 Attributes

CheckBoxmCheckBox
 
- Protected Attributes inherited from SetupItem
std::string mText
 
std::string mDescription
 
std::string mKeyName
 
SetupTabScrollmParent
 
std::string mEventName
 
std::string mValue
 
std::string mDefault
 
WidgetmWidget
 
std::list< Widget * > mTempWidgets
 
int mValueType
 
MainConfig mMainConfig
 
bool mUseDefault
 
- Protected Attributes inherited from Widget2
int mPaletteOffset
 
WidgetmWindow
 
Color mForegroundColor2
 

Additional Inherited Members

- Public Types inherited from SetupItem
enum  { VBOOL = 0, VSTR, VINT, VNONE }
 
- Protected Member Functions inherited from SetupItem
 SetupItem (const std::string &text, const std::string &description, const std::string &keyName, SetupTabScroll *const parent, const std::string &eventName, const MainConfig mainConfig)
 
 SetupItem (const std::string &text, const std::string &description, const std::string &keyName, SetupTabScroll *const parent, const std::string &eventName, const std::string &def, const MainConfig mainConfig)
 
- Protected Member Functions inherited from ActionListener
 ActionListener ()
 
- Protected Member Functions inherited from Widget2
 Widget2 (const Widget2 *const widget)
 

Detailed Description

Definition at line 153 of file setupitem.h.

Constructor & Destructor Documentation

◆ SetupItemCheckBox() [1/2]

SetupItemCheckBox::SetupItemCheckBox ( const std::string &  text,
const std::string &  description,
const std::string &  keyName,
SetupTabScroll *const  parent,
const std::string &  eventName,
const MainConfig  mainConfig 
)

Definition at line 212 of file setupitem.cpp.

References createControls().

217  :
218  SetupItem(text, description, keyName, parent, eventName, mainConfig),
219  mCheckBox(nullptr)
220 {
221  createControls();
222 }
CheckBox * mCheckBox
Definition: setupitem.h:182
SetupItem(const std::string &text, const std::string &description, const std::string &keyName, SetupTabScroll *const parent, const std::string &eventName, const MainConfig mainConfig)
Definition: setupitem.cpp:54

◆ SetupItemCheckBox() [2/2]

SetupItemCheckBox::SetupItemCheckBox ( const std::string &  text,
const std::string &  description,
const std::string &  keyName,
SetupTabScroll *const  parent,
const std::string &  eventName,
const std::string &  def,
const MainConfig  mainConfig 
)

Definition at line 224 of file setupitem.cpp.

References createControls().

230  :
231  SetupItem(text, description, keyName, parent, eventName, def, mainConfig),
232  mCheckBox(nullptr)
233 {
234  createControls();
235 }
CheckBox * mCheckBox
Definition: setupitem.h:182
SetupItem(const std::string &text, const std::string &description, const std::string &keyName, SetupTabScroll *const parent, const std::string &eventName, const MainConfig mainConfig)
Definition: setupitem.cpp:54

◆ ~SetupItemCheckBox()

SetupItemCheckBox::~SetupItemCheckBox ( )

Definition at line 237 of file setupitem.cpp.

References SetupItem::mWidget.

238 {
239  mWidget = nullptr;
240 }
Widget * mWidget
Definition: setupitem.h:142

Member Function Documentation

◆ createControls()

void SetupItemCheckBox::createControls ( )

Definition at line 242 of file setupitem.cpp.

References VertContainer::add1(), Widget::addActionListener(), SetupTabScroll::addControl(), SetupTabScroll::getContainer(), SetupItem::load(), mCheckBox, SetupItem::mDescription, SetupItem::mEventName, SetupItem::mParent, SetupItem::mText, SetupItem::mValue, SetupItem::mWidget, and ToolTipListener::setToolTip().

Referenced by SetupItemCheckBox().

243 {
244  load();
245  mCheckBox = new CheckBox(this, mText, mValue != "0", mParent, mEventName);
247  mWidget = mCheckBox;
248  mParent->getContainer()->add1(mWidget, -1);
249  mParent->addControl(this);
250  mParent->addActionListener(this);
251  mWidget->addActionListener(this);
252 }
void load()
Definition: setupitem.cpp:112
std::string mEventName
Definition: setupitem.h:136
void addControl(SetupItem *const widget)
std::string mValue
Definition: setupitem.h:138
void addActionListener(ActionListener *const actionListener)
Definition: widget.cpp:251
std::string mDescription
Definition: setupitem.h:130
CheckBox * mCheckBox
Definition: setupitem.h:182
VertContainer * getContainer() const
void add1(Widget *const widget, const int spacing)
Widget * mWidget
Definition: setupitem.h:142
SetupTabScroll * mParent
Definition: setupitem.h:134
void setToolTip(const std::string &str)
std::string mText
Definition: setupitem.h:128

◆ fromWidget()

void SetupItemCheckBox::fromWidget ( )
virtual

Implements SetupItem.

Definition at line 254 of file setupitem.cpp.

References CheckBox::isSelected(), mCheckBox, and SetupItem::mValue.

255 {
256  if (mCheckBox == nullptr)
257  return;
258 
259  if (mCheckBox->isSelected())
260  mValue = "1";
261  else
262  mValue = "0";
263 }
std::string mValue
Definition: setupitem.h:138
CheckBox * mCheckBox
Definition: setupitem.h:182
bool isSelected() const
Definition: checkbox.h:146

◆ toWidget()

void SetupItemCheckBox::toWidget ( )
virtual

Implements SetupItem.

Definition at line 265 of file setupitem.cpp.

References mCheckBox, SetupItem::mValue, and CheckBox::setSelected().

266 {
267  if (mCheckBox == nullptr)
268  return;
269 
270  mCheckBox->setSelected(mValue != "0");
271 }
std::string mValue
Definition: setupitem.h:138
CheckBox * mCheckBox
Definition: setupitem.h:182
void setSelected(const bool selected)
Definition: checkbox.h:155

Field Documentation

◆ mCheckBox

CheckBox* SetupItemCheckBox::mCheckBox
protected

Definition at line 182 of file setupitem.h.

Referenced by createControls(), fromWidget(), and toWidget().


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