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 29 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 37 of file setuptouchitem.cpp.

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

◆ 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 58 of file setuptouchitem.cpp.

68  :
69  SetupItem(text, description, keyName, parent, eventName, def, mainConfig),
70  mHorizont(nullptr),
71  mLabel(nullptr),
72  mModel(model),
73  mDropDown(nullptr),
74  mWidth(width)
75 {
76  mValueType = VSTR;
78 }

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

◆ ~SetupActionDropDown()

SetupActionDropDown::~SetupActionDropDown ( )

Definition at line 80 of file setuptouchitem.cpp.

81 {
82  mHorizont = nullptr;
83  mWidget = nullptr;
84  mModel = nullptr;
85  mDropDown = nullptr;
86  mLabel = nullptr;
87 }
Widget * mWidget
Definition: setupitem.h:143

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

Member Function Documentation

◆ createControls()

void SetupActionDropDown::createControls ( )

Definition at line 89 of file setuptouchitem.cpp.

90 {
91  if (mModel == nullptr)
92  return;
93 
94  load();
95  mHorizont = new HorizontContainer(this, 32, 2);
96 
97  mLabel = new Label(this, mText);
99  mDropDown = new DropDown(this,
100  mModel,
101  false,
102  Modal_false,
103  nullptr,
104  std::string());
109  static_cast<InputActionT>(atoi(mValue.c_str()))));
110 
111  mWidget = mDropDown;
113  mHorizont->add(mLabel);
115 
116  mParent->getContainer()->add2(mHorizont, true, 4);
117  mParent->addControl(this);
118  mParent->addActionListener(this);
119  mWidget->addActionListener(this);
120 }
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
std::string mValue
Definition: setupitem.h:139
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)
int getSelectionFromAction(const InputActionT action) const
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
InputAction ::T InputActionT
Definition: inputaction.h:717
const bool Modal_false
Definition: modal.h:30

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

◆ fromWidget()

void SetupActionDropDown::fromWidget ( )
virtual

Implements SetupItem.

Definition at line 122 of file setuptouchitem.cpp.

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

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

◆ toWidget()

void SetupActionDropDown::toWidget ( )
virtual

Implements SetupItem.

Definition at line 131 of file setuptouchitem.cpp.

132 {
133  if ((mDropDown == nullptr) || (mModel == nullptr))
134  return;
135 
137  static_cast<InputActionT>(atoi(mValue.c_str()))));
138 }

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

Field Documentation

◆ mDropDown

DropDown* SetupActionDropDown::mDropDown
protected

Definition at line 64 of file setuptouchitem.h.

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

◆ mHorizont

HorizontContainer* SetupActionDropDown::mHorizont
protected

Definition at line 61 of file setuptouchitem.h.

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

◆ mLabel

Label* SetupActionDropDown::mLabel
protected

Definition at line 62 of file setuptouchitem.h.

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

◆ mModel

TouchActionsModel* SetupActionDropDown::mModel
protected

Definition at line 63 of file setuptouchitem.h.

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

◆ mWidth

int SetupActionDropDown::mWidth
protected

Definition at line 65 of file setuptouchitem.h.

Referenced by createControls().


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