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 516 of file setupitem.h.

Constructor & Destructor Documentation

◆ ~SetupItemSliderList()

SetupItemSliderList::~SetupItemSliderList ( )

Definition at line 1222 of file setupitem.cpp.

1223 {
1224  mHorizont = nullptr;
1225  mWidget = nullptr;
1226  mSlider = nullptr;
1227  mLabel = nullptr;
1228 }
SliderList * mSlider
Definition: setupitem.h:559
HorizontContainer * mHorizont
Definition: setupitem.h:557
Widget * mWidget
Definition: setupitem.h:143

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

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

1188  :
1189  SetupItem(text, description, keyName, parent, eventName, mainConfig),
1190  mHorizont(nullptr),
1191  mLabel(nullptr),
1192  mSlider(nullptr),
1193  mModel(model),
1194  mWidth(width),
1195  mOnTheFly(onTheFly)
1196 {
1197  mValueType = VSTR;
1198 }
ListModel * mModel
Definition: setupitem.h:560
OnTheFly mOnTheFly
Definition: setupitem.h:562
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 SetupItem::mValueType, and SetupItem::VSTR.

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

1210  :
1211  SetupItem(text, description, keyName, parent, eventName, def, mainConfig),
1212  mHorizont(nullptr),
1213  mLabel(nullptr),
1214  mSlider(nullptr),
1215  mModel(model),
1216  mWidth(width),
1217  mOnTheFly(onTheFly)
1218 {
1219  mValueType = VSTR;
1220 }

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

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

1272 {
1273  fromWidget();
1274  if (mOnTheFly == OnTheFly_true)
1275  save();
1276 }
virtual void save()
Definition: setupitem.cpp:146
const bool OnTheFly_true
Definition: onthefly.h:30

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

Referenced by SetupItemSound::action().

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

1279 {
1280  if (eventName != mEventName)
1281  return;
1282 
1283  fromWidget();
1284  save();
1285 }
std::string mEventName
Definition: setupitem.h:137

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

◆ createControls()

void SetupItemSliderList::createControls ( )

Definition at line 1230 of file setupitem.cpp.

1231 {
1232  load();
1233  mHorizont = new HorizontContainer(this, 32, 2);
1234 
1235  mLabel = new Label(this, mText);
1237  mSlider = new SliderList(this, mModel);
1240  mSlider->adjustSize();
1241 
1242  mWidget = mSlider;
1244  mHorizont->add(mLabel, 5);
1245  mHorizont->add(mSlider);
1246 
1247  addMoreControls();
1248 
1249  mParent->getContainer()->add2(mHorizont, true, 4);
1250  mParent->addControl(this);
1251  mParent->addActionListener(this);
1252  mWidget->addActionListener(this);
1253 }
void add(Widget *const widget)
Definition: label.h:91
virtual void addMoreControls()=0
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
void addControl(SetupItem *const widget)
VertContainer * getContainer() const
void setSelectedString(const std::string &str)
Definition: sliderlist.cpp:190
void adjustSize()
Definition: sliderlist.cpp:227
void postInit2(ActionListener *const listener, const std::string &eventId)
Definition: sliderlist.cpp:56
void setToolTip(const std::string &str)
void add2(Widget *const widget, const bool resizable, const int spacing)
void addActionListener(ActionListener *const actionListener)
Definition: widget.cpp:252

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

◆ fromWidget()

void SetupItemSliderList::fromWidget ( )
virtual

Implements SetupItem.

Reimplemented in SetupItemSliderInt.

Definition at line 1255 of file setupitem.cpp.

1256 {
1257  if (mSlider == nullptr)
1258  return;
1259 
1261 }
std::string getSelectedString() const
Definition: sliderlist.cpp:205

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

Referenced by action(), and apply().

◆ toWidget()

void SetupItemSliderList::toWidget ( )
virtual

Implements SetupItem.

Reimplemented in SetupItemSliderInt.

Definition at line 1263 of file setupitem.cpp.

1264 {
1265  if (mSlider == nullptr)
1266  return;
1267 
1269 }

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

Field Documentation

◆ mHorizont

HorizontContainer* SetupItemSliderList::mHorizont
protected

◆ mLabel

Label* SetupItemSliderList::mLabel
protected

Definition at line 558 of file setupitem.h.

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

◆ mModel

ListModel* SetupItemSliderList::mModel
protected

Definition at line 560 of file setupitem.h.

Referenced by createControls().

◆ mOnTheFly

OnTheFly SetupItemSliderList::mOnTheFly
protected

Definition at line 562 of file setupitem.h.

Referenced by action().

◆ mSlider

SliderList* SetupItemSliderList::mSlider
protected

◆ mWidth

int SetupItemSliderList::mWidth
protected

Definition at line 561 of file setupitem.h.


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