ManaPlus
Public Member Functions | Protected Member Functions | Protected Attributes
SetupItemSliderList Class Referenceabstract

#include <setupitem.h>

Inheritance diagram for SetupItemSliderList:
SetupItem ActionListener Widget2 SetupItemSliderInt SetupItemSound

Public Member Functions

 ~SetupItemSliderList ()
 
void createControls ()
 
void fromWidget ()
 
void toWidget ()
 
void action (const ActionEvent &event)
 
void apply (const std::string &eventName)
 
virtual void addMoreControls ()=0
 
- 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
 
virtual void doAction ()
 
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 Member Functions

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

Protected Attributes

HorizontContainermHorizont
 
LabelmLabel
 
SliderListmSlider
 
ListModelmModel
 
int mWidth
 
OnTheFly mOnTheFly
 
- 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 }
 

Detailed Description

Definition at line 515 of file setupitem.h.

Constructor & Destructor Documentation

◆ ~SetupItemSliderList()

SetupItemSliderList::~SetupItemSliderList ( )

Definition at line 1213 of file setupitem.cpp.

References mHorizont, mLabel, mSlider, and SetupItem::mWidget.

1214 {
1215  mHorizont = nullptr;
1216  mWidget = nullptr;
1217  mSlider = nullptr;
1218  mLabel = nullptr;
1219 }
HorizontContainer * mHorizont
Definition: setupitem.h:556
Widget * mWidget
Definition: setupitem.h:142
SliderList * mSlider
Definition: setupitem.h:558

◆ SetupItemSliderList() [1/2]

SetupItemSliderList::SetupItemSliderList ( 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 OnTheFly  onTheFly,
const MainConfig  mainConfig 
)
protected

Definition at line 1170 of file setupitem.cpp.

References SetupItem::mValueType, and SetupItem::VSTR.

1179  :
1180  SetupItem(text, description, keyName, parent, eventName, mainConfig),
1181  mHorizont(nullptr),
1182  mLabel(nullptr),
1183  mSlider(nullptr),
1184  mModel(model),
1185  mWidth(width),
1186  mOnTheFly(onTheFly)
1187 {
1188  mValueType = VSTR;
1189 }
HorizontContainer * mHorizont
Definition: setupitem.h:556
ListModel * mModel
Definition: setupitem.h:559
int mValueType
Definition: setupitem.h:146
OnTheFly mOnTheFly
Definition: setupitem.h:561
SliderList * mSlider
Definition: setupitem.h:558
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

◆ SetupItemSliderList() [2/2]

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

Definition at line 1191 of file setupitem.cpp.

References SetupItem::mValueType, and SetupItem::VSTR.

1201  :
1202  SetupItem(text, description, keyName, parent, eventName, def, mainConfig),
1203  mHorizont(nullptr),
1204  mLabel(nullptr),
1205  mSlider(nullptr),
1206  mModel(model),
1207  mWidth(width),
1208  mOnTheFly(onTheFly)
1209 {
1210  mValueType = VSTR;
1211 }
HorizontContainer * mHorizont
Definition: setupitem.h:556
ListModel * mModel
Definition: setupitem.h:559
int mValueType
Definition: setupitem.h:146
OnTheFly mOnTheFly
Definition: setupitem.h:561
SliderList * mSlider
Definition: setupitem.h:558
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

Member Function Documentation

◆ action()

void SetupItemSliderList::action ( const ActionEvent actionEvent)
virtual

Called when an action is recieved from a widget. It is used to be able to recieve a notification that an action has occured.

Parameters
actionEventThe event of the action.

Reimplemented from SetupItem.

Reimplemented in SetupItemSound.

Definition at line 1262 of file setupitem.cpp.

References fromWidget(), mOnTheFly, OnTheFly_true, and SetupItem::save().

Referenced by SetupItemSound::action().

1263 {
1264  fromWidget();
1265  if (mOnTheFly == OnTheFly_true)
1266  save();
1267 }
const bool OnTheFly_true
Definition: onthefly.h:29
OnTheFly mOnTheFly
Definition: setupitem.h:561
virtual void save()
Definition: setupitem.cpp:145

◆ addMoreControls()

virtual void SetupItemSliderList::addMoreControls ( )
pure virtual

Implemented in SetupItemSliderInt, and SetupItemSound.

Referenced by createControls().

◆ apply()

void SetupItemSliderList::apply ( const std::string &  eventName)
virtual

Reimplemented from SetupItem.

Definition at line 1269 of file setupitem.cpp.

References fromWidget(), SetupItem::mEventName, and SetupItem::save().

1270 {
1271  if (eventName != mEventName)
1272  return;
1273 
1274  fromWidget();
1275  save();
1276 }
std::string mEventName
Definition: setupitem.h:136
virtual void save()
Definition: setupitem.cpp:145

◆ createControls()

void SetupItemSliderList::createControls ( )

Definition at line 1221 of file setupitem.cpp.

References HorizontContainer::add(), VertContainer::add2(), Widget::addActionListener(), SetupTabScroll::addControl(), addMoreControls(), SliderList::adjustSize(), SetupItem::fixFirstItemSize(), SetupTabScroll::getContainer(), SetupItem::load(), SetupItem::mDescription, SetupItem::mEventName, mHorizont, mLabel, mModel, SetupItem::mParent, mSlider, SetupItem::mText, SetupItem::mValue, SetupItem::mWidget, SliderList::postInit2(), SliderList::setSelectedString(), and ToolTipListener::setToolTip().

Referenced by SetupItemSliderInt::SetupItemSliderInt(), and SetupItemSound::SetupItemSound().

1222 {
1223  load();
1224  mHorizont = new HorizontContainer(this, 32, 2);
1225 
1226  mLabel = new Label(this, mText);
1228  mSlider = new SliderList(this, mModel);
1231  mSlider->adjustSize();
1232 
1233  mWidget = mSlider;
1235  mHorizont->add(mLabel, 5);
1236  mHorizont->add(mSlider);
1237 
1238  addMoreControls();
1239 
1240  mParent->getContainer()->add2(mHorizont, true, 4);
1241  mParent->addControl(this);
1242  mParent->addActionListener(this);
1243  mWidget->addActionListener(this);
1244 }
void load()
Definition: setupitem.cpp:112
std::string mEventName
Definition: setupitem.h:136
void addControl(SetupItem *const widget)
void adjustSize()
Definition: sliderlist.cpp:217
HorizontContainer * mHorizont
Definition: setupitem.h:556
std::string mValue
Definition: setupitem.h:138
void addActionListener(ActionListener *const actionListener)
Definition: widget.cpp:251
void postInit2(ActionListener *const listener, const std::string &eventId)
Definition: sliderlist.cpp:55
ListModel * mModel
Definition: setupitem.h:559
std::string mDescription
Definition: setupitem.h:130
VertContainer * getContainer() const
virtual void addMoreControls()=0
void add2(Widget *const widget, const bool resizable, const int spacing)
void setSelectedString(const std::string &str)
Definition: sliderlist.cpp:180
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)
SliderList * mSlider
Definition: setupitem.h:558
std::string mText
Definition: setupitem.h:128

◆ fromWidget()

void SetupItemSliderList::fromWidget ( )
virtual

Implements SetupItem.

Reimplemented in SetupItemSliderInt.

Definition at line 1246 of file setupitem.cpp.

References SliderList::getSelectedString(), mSlider, and SetupItem::mValue.

Referenced by action(), and apply().

1247 {
1248  if (mSlider == nullptr)
1249  return;
1250 
1252 }
std::string mValue
Definition: setupitem.h:138
SliderList * mSlider
Definition: setupitem.h:558
std::string getSelectedString() const
Definition: sliderlist.cpp:195

◆ toWidget()

void SetupItemSliderList::toWidget ( )
virtual

Implements SetupItem.

Reimplemented in SetupItemSliderInt.

Definition at line 1254 of file setupitem.cpp.

References mSlider, SetupItem::mValue, and SliderList::setSelectedString().

1255 {
1256  if (mSlider == nullptr)
1257  return;
1258 
1260 }
std::string mValue
Definition: setupitem.h:138
void setSelectedString(const std::string &str)
Definition: sliderlist.cpp:180
SliderList * mSlider
Definition: setupitem.h:558

Field Documentation

◆ mHorizont

HorizontContainer* SetupItemSliderList::mHorizont
protected

◆ mLabel

Label* SetupItemSliderList::mLabel
protected

Definition at line 557 of file setupitem.h.

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

◆ mModel

ListModel* SetupItemSliderList::mModel
protected

Definition at line 559 of file setupitem.h.

Referenced by createControls().

◆ mOnTheFly

OnTheFly SetupItemSliderList::mOnTheFly
protected

Definition at line 561 of file setupitem.h.

Referenced by action().

◆ mSlider

SliderList* SetupItemSliderList::mSlider
protected

◆ mWidth

int SetupItemSliderList::mWidth
protected

Definition at line 560 of file setupitem.h.


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