ManaPlus
Public Member Functions | Protected Attributes
SetupActionDropDown Class Reference

#include <setuptouchitem.h>

Inheritance diagram for SetupActionDropDown:
SetupItem ActionListener Widget2

Public Member Functions

 SetupActionDropDown (const std::string &text, const std::string &description, const std::string &keyName, SetupTabScroll *const parent, const std::string &eventName, TouchActionsModel *const model, const int width, const MainConfig mainConfig)
 
 SetupActionDropDown (const std::string &text, const std::string &description, const std::string &keyName, SetupTabScroll *const parent, const std::string &eventName, TouchActionsModel *const model, const int width, const std::string &def, const MainConfig mainConfig)
 
 ~SetupActionDropDown ()
 
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

HorizontContainermHorizont
 
LabelmLabel
 
TouchActionsModelmModel
 
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 28 of file setuptouchitem.h.

Constructor & Destructor Documentation

◆ SetupActionDropDown() [1/2]

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

Definition at line 36 of file setuptouchitem.cpp.

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

45  :
46  SetupItem(text, description, keyName, parent, eventName, mainConfig),
47  mHorizont(nullptr),
48  mLabel(nullptr),
49  mModel(model),
50  mDropDown(nullptr),
51  mWidth(width)
52 {
53  mValueType = VSTR;
55 }
HorizontContainer * mHorizont
TouchActionsModel * mModel
int mValueType
Definition: setupitem.h:146
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

◆ SetupActionDropDown() [2/2]

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

Definition at line 57 of file setuptouchitem.cpp.

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

67  :
68  SetupItem(text, description, keyName, parent, eventName, def, mainConfig),
69  mHorizont(nullptr),
70  mLabel(nullptr),
71  mModel(model),
72  mDropDown(nullptr),
73  mWidth(width)
74 {
75  mValueType = VSTR;
77 }
HorizontContainer * mHorizont
TouchActionsModel * mModel
int mValueType
Definition: setupitem.h:146
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

◆ ~SetupActionDropDown()

SetupActionDropDown::~SetupActionDropDown ( )

Definition at line 79 of file setuptouchitem.cpp.

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

80 {
81  mHorizont = nullptr;
82  mWidget = nullptr;
83  mModel = nullptr;
84  mDropDown = nullptr;
85  mLabel = nullptr;
86 }
HorizontContainer * mHorizont
TouchActionsModel * mModel
Widget * mWidget
Definition: setupitem.h:142

Member Function Documentation

◆ createControls()

void SetupActionDropDown::createControls ( )

Definition at line 88 of file setuptouchitem.cpp.

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

Referenced by SetupActionDropDown().

89 {
90  if (mModel == nullptr)
91  return;
92 
93  load();
94  mHorizont = new HorizontContainer(this, 32, 2);
95 
96  mLabel = new Label(this, mText);
98  mDropDown = new DropDown(this,
99  mModel,
100  false,
101  Modal_false,
102  nullptr,
103  std::string());
108  static_cast<InputActionT>(atoi(mValue.c_str()))));
109 
110  mWidget = mDropDown;
112  mHorizont->add(mLabel);
114 
115  mParent->getContainer()->add2(mHorizont, true, 4);
116  mParent->addControl(this);
117  mParent->addActionListener(this);
118  mWidget->addActionListener(this);
119 }
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
std::string mValue
Definition: setupitem.h:138
HorizontContainer * mHorizont
void addActionListener(ActionListener *const actionListener)
Definition: widget.cpp:251
std::string mDescription
Definition: setupitem.h:130
TouchActionsModel * mModel
void setActionEventId(const std::string &actionEventId)
Definition: widget.h:595
VertContainer * getContainer() const
int getSelectionFromAction(const InputActionT action) 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
std::string mText
Definition: setupitem.h:128

◆ fromWidget()

void SetupActionDropDown::fromWidget ( )
virtual

Implements SetupItem.

Definition at line 121 of file setuptouchitem.cpp.

References CAST_S32, TouchActionsModel::getActionFromSelection(), DropDown::getSelected(), mDropDown, mModel, SetupItem::mValue, and Catch::toString().

122 {
123  if ((mDropDown == nullptr) || (mModel == nullptr))
124  return;
125 
127  mDropDown->getSelected())));
128 }
std::string mValue
Definition: setupitem.h:138
TouchActionsModel * mModel
#define CAST_S32
Definition: cast.h:29
std::string toString(T const &value)
converts any type to a string
Definition: catch.hpp:1774
InputActionT getActionFromSelection(const int sel) const
int getSelected() const
Definition: dropdown.cpp:509

◆ toWidget()

void SetupActionDropDown::toWidget ( )
virtual

Implements SetupItem.

Definition at line 130 of file setuptouchitem.cpp.

References TouchActionsModel::getSelectionFromAction(), mDropDown, mModel, SetupItem::mValue, and DropDown::setSelected().

131 {
132  if ((mDropDown == nullptr) || (mModel == nullptr))
133  return;
134 
136  static_cast<InputActionT>(atoi(mValue.c_str()))));
137 }
std::string mValue
Definition: setupitem.h:138
TouchActionsModel * mModel
int getSelectionFromAction(const InputActionT action) const
void setSelected(int selected)
Definition: dropdown.cpp:514

Field Documentation

◆ mDropDown

DropDown* SetupActionDropDown::mDropDown
protected

Definition at line 63 of file setuptouchitem.h.

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

◆ mHorizont

HorizontContainer* SetupActionDropDown::mHorizont
protected

Definition at line 60 of file setuptouchitem.h.

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

◆ mLabel

Label* SetupActionDropDown::mLabel
protected

Definition at line 61 of file setuptouchitem.h.

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

◆ mModel

TouchActionsModel* SetupActionDropDown::mModel
protected

Definition at line 62 of file setuptouchitem.h.

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

◆ mWidth

int SetupActionDropDown::mWidth
protected

Definition at line 64 of file setuptouchitem.h.

Referenced by createControls().


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