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

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

1222 {
1223  mHorizont = nullptr;
1224  mWidget = nullptr;
1225  mSlider = nullptr;
1226  mLabel = nullptr;
1227 }
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 1178 of file setupitem.cpp.

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

1187  :
1188  SetupItem(text, description, keyName, parent, eventName, mainConfig),
1189  mHorizont(nullptr),
1190  mLabel(nullptr),
1191  mSlider(nullptr),
1192  mModel(model),
1193  mWidth(width),
1194  mOnTheFly(onTheFly)
1195 {
1196  mValueType = VSTR;
1197 }
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 1199 of file setupitem.cpp.

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

1209  :
1210  SetupItem(text, description, keyName, parent, eventName, def, mainConfig),
1211  mHorizont(nullptr),
1212  mLabel(nullptr),
1213  mSlider(nullptr),
1214  mModel(model),
1215  mWidth(width),
1216  mOnTheFly(onTheFly)
1217 {
1218  mValueType = VSTR;
1219 }
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 1270 of file setupitem.cpp.

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

Referenced by SetupItemSound::action().

1271 {
1272  fromWidget();
1273  if (mOnTheFly == OnTheFly_true)
1274  save();
1275 }
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 1277 of file setupitem.cpp.

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

1278 {
1279  if (eventName != mEventName)
1280  return;
1281 
1282  fromWidget();
1283  save();
1284 }
std::string mEventName
Definition: setupitem.h:136
virtual void save()
Definition: setupitem.cpp:145

◆ createControls()

void SetupItemSliderList::createControls ( )

Definition at line 1229 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().

1230 {
1231  load();
1232  mHorizont = new HorizontContainer(this, 32, 2);
1233 
1234  mLabel = new Label(this, mText);
1236  mSlider = new SliderList(this, mModel);
1239  mSlider->adjustSize();
1240 
1241  mWidget = mSlider;
1243  mHorizont->add(mLabel, 5);
1244  mHorizont->add(mSlider);
1245 
1246  addMoreControls();
1247 
1248  mParent->getContainer()->add2(mHorizont, true, 4);
1249  mParent->addControl(this);
1250  mParent->addActionListener(this);
1251  mWidget->addActionListener(this);
1252 }
void load()
Definition: setupitem.cpp:112
std::string mEventName
Definition: setupitem.h:136
void addControl(SetupItem *const widget)
void adjustSize()
Definition: sliderlist.cpp:226
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:189
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 1254 of file setupitem.cpp.

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

Referenced by action(), and apply().

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

◆ toWidget()

void SetupItemSliderList::toWidget ( )
virtual

Implements SetupItem.

Reimplemented in SetupItemSliderInt.

Definition at line 1262 of file setupitem.cpp.

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

1263 {
1264  if (mSlider == nullptr)
1265  return;
1266 
1268 }
std::string mValue
Definition: setupitem.h:138
void setSelectedString(const std::string &str)
Definition: sliderlist.cpp:189
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: