ManaPlus
Public Member Functions | Protected Attributes
SetupItemDropDown Class Reference

#include <setupitem.h>

Inheritance diagram for SetupItemDropDown:
SetupItem ActionListener Widget2

Public Member Functions

 SetupItemDropDown (const std::string &text, const std::string &description, const std::string &keyName, SetupTabScroll *const parent, const std::string &eventName, ListModel *const model, const int width, const MainConfig mainConfig)
 
 SetupItemDropDown (const std::string &text, const std::string &description, const std::string &keyName, SetupTabScroll *const parent, const std::string &eventName, ListModel *const model, const int width, const std::string &def, const MainConfig mainConfig)
 
 ~SetupItemDropDown ()
 
void createControls ()
 
void fromWidget ()
 
void toWidget ()
 
int selectionByValue ()
 
- 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

HorizontContainermHorizont
 
LabelmLabel
 
ListModelmModel
 
DropDownmDropDown
 
int mWidth
 
- 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 312 of file setupitem.h.

Constructor & Destructor Documentation

◆ SetupItemDropDown() [1/2]

SetupItemDropDown::SetupItemDropDown ( const std::string &  text,
const std::string &  description,
const std::string &  keyName,
SetupTabScroll *const  parent,
const std::string &  eventName,
ListModel *const  model,
const int  width,
const MainConfig  mainConfig 
)

Definition at line 654 of file setupitem.cpp.

661  :
662  SetupItem(text, description, keyName, parent, eventName, mainConfig),
663  mHorizont(nullptr),
664  mLabel(nullptr),
665  mModel(model),
666  mDropDown(nullptr),
667  mWidth(width)
668 {
669  mValueType = VSTR;
670  createControls();
671 }
HorizontContainer * mHorizont
Definition: setupitem.h:347
ListModel * mModel
Definition: setupitem.h:349
DropDown * mDropDown
Definition: setupitem.h:350
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:55
int mValueType
Definition: setupitem.h:147

References createControls(), SetupItem::mValueType, and SetupItem::VSTR.

◆ SetupItemDropDown() [2/2]

SetupItemDropDown::SetupItemDropDown ( const std::string &  text,
const std::string &  description,
const std::string &  keyName,
SetupTabScroll *const  parent,
const std::string &  eventName,
ListModel *const  model,
const int  width,
const std::string &  def,
const MainConfig  mainConfig 
)

Definition at line 673 of file setupitem.cpp.

681  :
682  SetupItem(text, description, keyName, parent, eventName, def, mainConfig),
683  mHorizont(nullptr),
684  mLabel(nullptr),
685  mModel(model),
686  mDropDown(nullptr),
687  mWidth(width)
688 {
689  mValueType = VSTR;
690  createControls();
691 }

References createControls(), SetupItem::mValueType, and SetupItem::VSTR.

◆ ~SetupItemDropDown()

SetupItemDropDown::~SetupItemDropDown ( )

Definition at line 693 of file setupitem.cpp.

694 {
695  mHorizont = nullptr;
696  mWidget = nullptr;
697  mModel = nullptr;
698  mDropDown = nullptr;
699  mLabel = nullptr;
700 }
Widget * mWidget
Definition: setupitem.h:143

References mDropDown, mHorizont, mLabel, mModel, and SetupItem::mWidget.

Member Function Documentation

◆ createControls()

void SetupItemDropDown::createControls ( )

Definition at line 702 of file setupitem.cpp.

703 {
704  load();
705  mHorizont = new HorizontContainer(this, 32, 2);
706 
707  mLabel = new Label(this, mText);
709  mDropDown = new DropDown(this,
710  mModel,
711  false,
712  Modal_false,
713  nullptr,
714  std::string());
719 
720  mWidget = mDropDown;
721  if (!mText.empty())
723  mHorizont->add(mLabel);
725 
726  mParent->getContainer()->add2(mHorizont, true, 4);
727  mParent->addControl(this);
728  mParent->addActionListener(this);
729  mWidget->addActionListener(this);
730 }
void setSelected(int selected)
Definition: dropdown.cpp:514
void add(Widget *const widget)
Definition: label.h:91
SetupTabScroll * mParent
Definition: setupitem.h:135
std::string mDescription
Definition: setupitem.h:131
void fixFirstItemSize(Widget *const widget)
Definition: setupitem.cpp:198
std::string mText
Definition: setupitem.h:129
void load()
Definition: setupitem.cpp:113
std::string mEventName
Definition: setupitem.h:137
void addControl(SetupItem *const widget)
VertContainer * getContainer() const
void setToolTip(const std::string &str)
void add2(Widget *const widget, const bool resizable, const int spacing)
void setWidth(const int width)
Definition: widget.cpp:133
void setActionEventId(const std::string &actionEventId)
Definition: widget.h:596
void addActionListener(ActionListener *const actionListener)
Definition: widget.cpp:252
const bool Modal_false
Definition: modal.h:30

References HorizontContainer::add(), VertContainer::add2(), Widget::addActionListener(), SetupTabScroll::addControl(), SetupItem::fixFirstItemSize(), SetupTabScroll::getContainer(), SetupItem::load(), SetupItem::mDescription, mDropDown, SetupItem::mEventName, mHorizont, mLabel, mModel, Modal_false, SetupItem::mParent, SetupItem::mText, SetupItem::mWidget, mWidth, selectionByValue(), Widget::setActionEventId(), DropDown::setSelected(), ToolTipListener::setToolTip(), and Widget::setWidth().

Referenced by SetupItemDropDown().

◆ fromWidget()

void SetupItemDropDown::fromWidget ( )
virtual

Implements SetupItem.

Definition at line 737 of file setupitem.cpp.

738 {
739  if (mDropDown == nullptr)
740  return;
741 
743 }
int getSelected() const
Definition: dropdown.cpp:509
std::string mValue
Definition: setupitem.h:139
std::string toString(T const &value)
converts any type to a string
Definition: catch.hpp:1774

References DropDown::getSelected(), mDropDown, SetupItem::mValue, and Catch::toString().

◆ selectionByValue()

int SetupItemDropDown::selectionByValue ( )

Definition at line 732 of file setupitem.cpp.

733 {
734  return atoi(mValue.c_str());
735 }

References SetupItem::mValue.

Referenced by createControls(), and toWidget().

◆ toWidget()

void SetupItemDropDown::toWidget ( )
virtual

Implements SetupItem.

Definition at line 745 of file setupitem.cpp.

746 {
747  if (mDropDown == nullptr)
748  return;
749 
751 }

References mDropDown, selectionByValue(), and DropDown::setSelected().

Field Documentation

◆ mDropDown

DropDown* SetupItemDropDown::mDropDown
protected

Definition at line 350 of file setupitem.h.

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

◆ mHorizont

HorizontContainer* SetupItemDropDown::mHorizont
protected

Definition at line 347 of file setupitem.h.

Referenced by createControls(), and ~SetupItemDropDown().

◆ mLabel

Label* SetupItemDropDown::mLabel
protected

Definition at line 348 of file setupitem.h.

Referenced by createControls(), and ~SetupItemDropDown().

◆ mModel

ListModel* SetupItemDropDown::mModel
protected

Definition at line 349 of file setupitem.h.

Referenced by createControls(), and ~SetupItemDropDown().

◆ mWidth

int SetupItemDropDown::mWidth
protected

Definition at line 351 of file setupitem.h.

Referenced by createControls().


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