Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/gui/GUIutil.h
Show First 20 Lines • Show All 126 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
// Private functions further ahead | // Private functions further ahead | ||||
friend class CGUI; | friend class CGUI; | ||||
friend class IGUIObject; | friend class IGUIObject; | ||||
public: | public: | ||||
NONCOPYABLE(GUI); | NONCOPYABLE(GUI); | ||||
/** | |||||
* Determines whether a setting with the given name is registered. | |||||
* This function may be used as a safeguard for GetSetting. | |||||
*/ | |||||
static bool HasSetting(const IGUIObject* pObject, const CStr& Setting); | |||||
/** | |||||
* Get a mutable reference to the setting. | |||||
* If no such setting exists, an exception of type std::out_of_range is thrown. | |||||
* | |||||
* If the value is modified, there is no GUIM_SETTINGS_UPDATED message sent. | |||||
* SetSetting should be used to modify the value if there is a use for the message. | |||||
*/ | |||||
static T& GetSetting(const IGUIObject* pObject, const CStr& Setting); | |||||
// Like GetSetting (below), but doesn't make a copy of the value | // Like GetSetting (below), but doesn't make a copy of the value | ||||
// (so it can be modified later) | // (so it can be modified later) | ||||
static PSRETURN GetSettingPointer(const IGUIObject* pObject, const CStr& Setting, T*& Value); | static PSRETURN GetSettingPointer(const IGUIObject* pObject, const CStr& Setting, T*& Value); | ||||
/** | /** | ||||
* Retrieves a setting by name from object pointer | * Copy-assigns the current setting value to the given reference. | ||||
* | * | ||||
* @param pObject Object pointer | * @param pObject Object pointer | ||||
* @param Setting Setting by name | * @param Setting Setting by name | ||||
* @param Value Stores value here, note type T! | * @param Value Stores value here, note type T! | ||||
*/ | */ | ||||
static PSRETURN GetSetting(const IGUIObject* pObject, const CStr& Setting, T& Value); | static PSRETURN GetSetting(const IGUIObject* pObject, const CStr& Setting, T& Value); | ||||
/** | /** | ||||
* Sets a value by name using a real datatype as input. | * Sets a value by name using a real datatype as input. | ||||
* | |||||
* This is the official way of setting a setting, no other | |||||
* way should only cautiously be used! | |||||
* | |||||
* This variant will use the move-assignment. | * This variant will use the move-assignment. | ||||
* | * | ||||
* @param pObject Object pointer | * @param pObject Object pointer | ||||
* @param Setting Setting by name | * @param Setting Setting by name | ||||
* @param Value Sets value to this, note type T! | * @param Value Sets value to this, note type T! | ||||
* @param SkipMessage Does not send a GUIM_SETTINGS_UPDATED if true | * @param SkipMessage Does not send a GUIM_SETTINGS_UPDATED if true | ||||
*/ | */ | ||||
static PSRETURN SetSetting(IGUIObject* pObject, const CStr& Setting, T& Value, const bool& SkipMessage = false); | static PSRETURN SetSetting(IGUIObject* pObject, const CStr& Setting, T& Value, const bool& SkipMessage = false); | ||||
▲ Show 20 Lines • Show All 172 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator