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 311 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 653 of file setupitem.cpp.

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

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

◆ 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 672 of file setupitem.cpp.

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

680  :
681  SetupItem(text, description, keyName, parent, eventName, def, mainConfig),
682  mHorizont(nullptr),
683  mLabel(nullptr),
684  mModel(model),
685  mDropDown(nullptr),
686  mWidth(width)
687 {
688  mValueType = VSTR;
689  createControls();
690 }
int mValueType
Definition: setupitem.h:146
DropDown * mDropDown
Definition: setupitem.h:349
ListModel * mModel
Definition: setupitem.h:348
HorizontContainer * mHorizont
Definition: setupitem.h:346
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

◆ ~SetupItemDropDown()

SetupItemDropDown::~SetupItemDropDown ( )

Definition at line 692 of file setupitem.cpp.

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

693 {
694  mHorizont = nullptr;
695  mWidget = nullptr;
696  mModel = nullptr;
697  mDropDown = nullptr;
698  mLabel = nullptr;
699 }
Widget * mWidget
Definition: setupitem.h:142
DropDown * mDropDown
Definition: setupitem.h:349
ListModel * mModel
Definition: setupitem.h:348
HorizontContainer * mHorizont
Definition: setupitem.h:346

Member Function Documentation

◆ createControls()

void SetupItemDropDown::createControls ( )

Definition at line 701 of file setupitem.cpp.

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().

702 {
703  load();
704  mHorizont = new HorizontContainer(this, 32, 2);
705 
706  mLabel = new Label(this, mText);
708  mDropDown = new DropDown(this,
709  mModel,
710  false,
711  Modal_false,
712  nullptr,
713  std::string());
718 
719  mWidget = mDropDown;
720  if (!mText.empty())
722  mHorizont->add(mLabel);
724 
725  mParent->getContainer()->add2(mHorizont, true, 4);
726  mParent->addControl(this);
727  mParent->addActionListener(this);
728  mWidget->addActionListener(this);
729 }
void load()
Definition: setupitem.cpp:112
std::string mEventName
Definition: setupitem.h:136
void addControl(SetupItem *const widget)
void setWidth(const int width)
Definition: widget.cpp:132
void addActionListener(ActionListener *const actionListener)
Definition: widget.cpp:251
std::string mDescription
Definition: setupitem.h:130
void setActionEventId(const std::string &actionEventId)
Definition: widget.h:595
VertContainer * getContainer() const
void add2(Widget *const widget, const bool resizable, const int spacing)
Definition: label.h:87
Widget * mWidget
Definition: setupitem.h:142
SetupTabScroll * mParent
Definition: setupitem.h:134
void add(Widget *const widget)
void fixFirstItemSize(Widget *const widget)
Definition: setupitem.cpp:197
void setToolTip(const std::string &str)
void setSelected(int selected)
Definition: dropdown.cpp:514
DropDown * mDropDown
Definition: setupitem.h:349
ListModel * mModel
Definition: setupitem.h:348
HorizontContainer * mHorizont
Definition: setupitem.h:346
std::string mText
Definition: setupitem.h:128

◆ fromWidget()

void SetupItemDropDown::fromWidget ( )
virtual

Implements SetupItem.

Definition at line 736 of file setupitem.cpp.

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

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

◆ selectionByValue()

int SetupItemDropDown::selectionByValue ( )

Definition at line 731 of file setupitem.cpp.

References SetupItem::mValue.

Referenced by createControls(), and toWidget().

732 {
733  return atoi(mValue.c_str());
734 }
std::string mValue
Definition: setupitem.h:138

◆ toWidget()

void SetupItemDropDown::toWidget ( )
virtual

Implements SetupItem.

Definition at line 744 of file setupitem.cpp.

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

745 {
746  if (mDropDown == nullptr)
747  return;
748 
750 }
void setSelected(int selected)
Definition: dropdown.cpp:514
DropDown * mDropDown
Definition: setupitem.h:349

Field Documentation

◆ mDropDown

DropDown* SetupItemDropDown::mDropDown
protected

Definition at line 349 of file setupitem.h.

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

◆ mHorizont

HorizontContainer* SetupItemDropDown::mHorizont
protected

Definition at line 346 of file setupitem.h.

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

◆ mLabel

Label* SetupItemDropDown::mLabel
protected

Definition at line 347 of file setupitem.h.

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

◆ mModel

ListModel* SetupItemDropDown::mModel
protected

Definition at line 348 of file setupitem.h.

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

◆ mWidth

int SetupItemDropDown::mWidth
protected

Definition at line 350 of file setupitem.h.

Referenced by createControls().


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