ManaPlus
Public Member Functions | Protected Attributes
SetupItemSound Class Reference

#include <setupitem.h>

Inheritance diagram for SetupItemSound:
SetupItemSliderList SetupItem ActionListener Widget2

Public Member Functions

 SetupItemSound (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)
 
void action (const ActionEvent &event)
 
void addMoreControls ()
 
- Public Member Functions inherited from SetupItemSliderList
 ~SetupItemSliderList ()
 
void createControls ()
 
void fromWidget ()
 
void toWidget ()
 
void apply (const std::string &eventName)
 
- 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 Attributes

ButtonmButton
 
- Protected Attributes inherited from SetupItemSliderList
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 }
 
- Protected Member Functions inherited from 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)
 
 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)
 

Detailed Description

Definition at line 565 of file setupitem.h.

Constructor & Destructor Documentation

◆ SetupItemSound()

SetupItemSound::SetupItemSound ( 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 
)

Definition at line 1287 of file setupitem.cpp.

1295  :
1296  SetupItemSliderList(text, description, keyName, parent, eventName,
1297  model, width, onTheFly, mainConfig),
1298  mButton(nullptr)
1299 {
1300  createControls();
1301 }
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)
Definition: setupitem.cpp:1179
Button * mButton
Definition: setupitem.h:585

References SetupItemSliderList::createControls().

Member Function Documentation

◆ action()

void SetupItemSound::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 SetupItemSliderList.

Definition at line 1315 of file setupitem.cpp.

1316 {
1317  if (event.getId() == mEventName + "_PLAY")
1318  {
1319  if ((mSlider != nullptr) && (mSlider->getSelected() != 0))
1320  {
1322  "systemsounds"),
1323  mSlider->getSelectedString()).append(".ogg"));
1324  }
1325  }
1326  else
1327  {
1329  }
1330 }
std::string getStringValue(const std::string &key) const
void action(const ActionEvent &event)
Definition: setupitem.cpp:1271
SliderList * mSlider
Definition: setupitem.h:559
std::string mEventName
Definition: setupitem.h:137
int getSelected() const
Definition: sliderlist.h:73
std::string getSelectedString() const
Definition: sliderlist.cpp:205
void playGuiSfx(const std::string &path)
Configuration branding
SoundManager soundManager
std::string pathJoin(std::string str1, const std::string &str2)

References SetupItemSliderList::action(), branding, ActionEvent::getId(), SliderList::getSelected(), SliderList::getSelectedString(), Configuration::getStringValue(), SetupItem::mEventName, SetupItemSliderList::mSlider, pathJoin(), SoundManager::playGuiSfx(), and soundManager.

◆ addMoreControls()

void SetupItemSound::addMoreControls ( )
virtual

Implements SetupItemSliderList.

Definition at line 1303 of file setupitem.cpp.

1304 {
1305  mButton = new Button(this,
1306  BUTTON_PLAY,
1307  16, 16,
1308  mEventName + "_PLAY",
1309  BUTTON_SKIN,
1310  this);
1311  if (mHorizont != nullptr)
1312  mHorizont->add(mButton);
1313 }
const std::string BUTTON_SKIN
Definition: button.h:89
const std::string BUTTON_PLAY
Definition: button.h:88
Definition: button.h:102
void add(Widget *const widget)
HorizontContainer * mHorizont
Definition: setupitem.h:557

References HorizontContainer::add(), BUTTON_PLAY, BUTTON_SKIN, mButton, SetupItem::mEventName, and SetupItemSliderList::mHorizont.

Field Documentation

◆ mButton

Button* SetupItemSound::mButton
protected

Definition at line 585 of file setupitem.h.

Referenced by addMoreControls().


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