18#ifndef INCLUDED_CGUISETTINGS
19#define INCLUDED_CGUISETTINGS
41 bool FromString(
const CStrW& value,
const bool sendMessage);
95 template<
typename... Args>
115 void Set(
T value,
bool sendMessage)
Wraps a T.
Definition: CGUISetting.h:93
CGUISimpleSetting(IGUIObject *pObject, const CStr &name, Args &&... args)
Definition: CGUISetting.h:96
void ToJSVal(const ScriptRequest &rq, JS::MutableHandleValue value) override
Converts the setting data to a JS::Value using Script::ToJSVal.
Definition: CGUISetting.cpp:102
T m_Setting
Definition: CGUISetting.h:126
NONCOPYABLE(CGUISimpleSetting)
CGUISimpleSetting & operator=(CGUISimpleSetting &&)=delete
CGUISimpleSetting(CGUISimpleSetting &&)=default
T & GetMutable()
'Uglified' getter when you want direct access without triggering messages.
Definition: CGUISetting.h:110
const T * operator->() const
Definition: CGUISetting.h:105
void Set(T value, bool sendMessage)
'Uglified' operator=, so that SendMessage is explicit.
Definition: CGUISetting.h:115
bool DoFromString(const CStrW &value) override
Definition: CGUISetting.cpp:71
const T & operator*() const
Definition: CGUISetting.h:104
bool DoFromJSVal(const ScriptRequest &rq, JS::HandleValue value) override
Definition: CGUISetting.cpp:96
GUI object such as a button or an input-box.
Definition: IGUIObject.h:60
This setting interface allows GUI objects to call setting function functions without having to know t...
Definition: CGUISetting.h:33
IGUISetting & operator=(IGUISetting &&other)=delete
virtual ~IGUISetting()=default
bool FromString(const CStrW &value, const bool sendMessage)
Parses the given string and assigns to the setting value.
Definition: CGUISetting.cpp:44
virtual void ToJSVal(const ScriptRequest &rq, JS::MutableHandleValue value)=0
Converts the setting data to a JS::Value using Script::ToJSVal.
virtual bool DoFromJSVal(const ScriptRequest &rq, JS::HandleValue value)=0
IGUIObject & m_Object
The object that stores this setting.
Definition: CGUISetting.h:80
virtual void OnSettingChange(const CStr &setting, bool sendMessage)
Triggers the IGUIObject logic when a setting changes.
Definition: CGUISetting.cpp:65
const CStr & GetName() const
Return the name of the setting, from JS.
Definition: CGUISetting.h:72
virtual bool DoFromString(const CStrW &value)=0
bool FromJSVal(const ScriptRequest &rq, JS::HandleValue value, const bool sendMessage)
Parses the given JS::Value using Script::FromJSVal and assigns it to the setting data.
Definition: CGUISetting.cpp:56
CStr m_Name
Definition: CGUISetting.h:83
IGUISetting(const CStr &name, IGUIObject *owner)
Definition: CGUISetting.cpp:34
Spidermonkey maintains some 'local' state via the JSContext* object.
Definition: ScriptRequest.h:60
#define T(string_literal)
Definition: secure_crt.cpp:77