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

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

652  :
653  SetupItem(text, description, keyName, parent, eventName, mainConfig),
654  mHorizont(nullptr),
655  mLabel(nullptr),
656  mModel(model),
657  mDropDown(nullptr),
658  mWidth(width)
659 {
660  mValueType = VSTR;
661  createControls();
662 }
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 664 of file setupitem.cpp.

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

672  :
673  SetupItem(text, description, keyName, parent, eventName, def, mainConfig),
674  mHorizont(nullptr),
675  mLabel(nullptr),
676  mModel(model),
677  mDropDown(nullptr),
678  mWidth(width)
679 {
680  mValueType = VSTR;
681  createControls();
682 }
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 684 of file setupitem.cpp.

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

685 {
686  mHorizont = nullptr;
687  mWidget = nullptr;
688  mModel = nullptr;
689  mDropDown = nullptr;
690  mLabel = nullptr;
691 }
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 693 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().

694 {
695  load();
696  mHorizont = new HorizontContainer(this, 32, 2);
697 
698  mLabel = new Label(this, mText);
700  mDropDown = new DropDown(this,
701  mModel,
702  false,
703  Modal_false,
704  nullptr,
705  std::string());
710 
711  mWidget = mDropDown;
712  if (!mText.empty())
714  mHorizont->add(mLabel);
716 
717  mParent->getContainer()->add2(mHorizont, true, 4);
718  mParent->addControl(this);
719  mParent->addActionListener(this);
720  mWidget->addActionListener(this);
721 }
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 728 of file setupitem.cpp.

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

729 {
730  if (mDropDown == nullptr)
731  return;
732 
734 }
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 723 of file setupitem.cpp.

References SetupItem::mValue.

Referenced by createControls(), and toWidget().

724 {
725  return atoi(mValue.c_str());
726 }
std::string mValue
Definition: setupitem.h:138

◆ toWidget()

void SetupItemDropDown::toWidget ( )
virtual

Implements SetupItem.

Definition at line 736 of file setupitem.cpp.

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

737 {
738  if (mDropDown == nullptr)
739  return;
740 
742 }
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: