Clarisse 5.0 SP8 SDK  5.0.5.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Classes | Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
AppPreferences Class Reference

Application Preferences API. More...

Inheritance diagram for AppPreferences:
EventObject CoreCustomData CoreBaseObject CoreBaseType

Public Types

enum  ValueType {
  VALUE_TYPE_BOOL,
  VALUE_TYPE_LONG,
  VALUE_TYPE_DOUBLE,
  VALUE_TYPE_STRING,
  VALUE_TYPE_UNKNOWN
}
 
enum  ColorDepth {
  COLOR_DEPTH_RGB,
  COLOR_DEPTH_RGBA,
  COLOR_DEPTH_L,
  COLOR_DEPTH_LA,
  COLOR_DEPTH_UNKNOWN
}
 
enum  Mode {
  MODE_APPLICATION,
  MODE_PROJECT
}
 
typedef bool(* InitPrefCallback )(AppObject &app, AppPreferences &prefs, const CoreString category, CoreString attr, void *data)
 
typedef bool(* ChangePrefCallback )(AppObject &app, AppPreferences &prefs, const CoreString category, const CoreString attr, void *data)
 
- Public Types inherited from EventObject
typedef void(* EventInfoFunction )(EventObject &, const EventInfo &, void *)
 event callback signature for free functions / static methods.
 
typedef void(EventObject::* EventInfoMethod )(EventObject &, const EventInfo &, void *)
 event callback signature for methods.
 
typedef void(* EventFunction )(EventObject &, const CoreString &, void *)
 
typedef void(EventObject::* EventMethod )(EventObject &, const CoreString &, void *)
 

Public Member Functions

 AppPreferences (AppObject &app, const Mode &mode)
 
const Mode & get_mode () const
 
AppCategoryPreferences add_category (const CoreString &name)
 
AppItemPreferences add_bool (const CoreString &category, const CoreString &name, const bool &value, InitPrefCallback callback_init=0, ChangePrefCallback callback_changed=0, const CoreString &group="", void *callback_data=0)
 
AppItemPreferences add_long (const CoreString &category, const CoreString &name, const long &value, const CoreString &unit="", InitPrefCallback callback_init=0, ChangePrefCallback callback_changed=0, const CoreString &group="", void *callback_data=0)
 
AppItemPreferences add_double (const CoreString &category, const CoreString &name, const double &value, const CoreString &unit="", InitPrefCallback callback_init=0, ChangePrefCallback callback_changed=0, const CoreString &group="", void *callback_data=0)
 
AppItemPreferences add_string (const CoreString &category, const CoreString &name, const CoreString &value, InitPrefCallback callback_init=0, ChangePrefCallback callback_changed=0, const CoreString &group="", void *callback_data=0)
 
AppItemPreferences add_open_file (const CoreString &category, const CoreString &name, const CoreString &value, InitPrefCallback callback_init=0, ChangePrefCallback callback_changed=0, const CoreString &group="", void *callback_data=0)
 
AppItemPreferences add_open_folder (const CoreString &category, const CoreString &name, const CoreString &value, InitPrefCallback callback_init=0, ChangePrefCallback callback_changed=0, const CoreString &group="", void *callback_data=0)
 
AppItemPreferences add_save_file (const CoreString &category, const CoreString &name, const CoreString &value, InitPrefCallback callback_init=0, ChangePrefCallback callback_changed=0, const CoreString &group="", void *callback_data=0)
 
AppItemPreferences add_color (const CoreString &category, const CoreString &name, const ColorDepth &depth, AppPreferences::InitPrefCallback callback_init=0, AppPreferences::ChangePrefCallback callback_changed=0, const CoreString &group="", void *callback_data=0)
 
AppItemPreferences add_vec2d (const CoreString &category, const CoreString &name, const GMathVec2d &value, const CoreString &unit="", InitPrefCallback callback_init=0, ChangePrefCallback callback_changed=0, const CoreString &group="", void *callback_data=0)
 
bool set_bool_value (const CoreString &category, const CoreString &name, const bool &value)
 
bool set_long_value (const CoreString &category, const CoreString &name, const long &value)
 
bool set_double_value (const CoreString &category, const CoreString &name, const double &value)
 
bool set_string_value (const CoreString &category, const CoreString &name, const CoreString &value)
 
bool set_color_value (const CoreString &category, const CoreString &name, const double &value, const unsigned int &index)
 
bool set_vec2d_value (const CoreString &category, const CoreString &name, const GMathVec2d &value)
 
bool set_rgba_value (const CoreString &category, const CoreString &name, const GMathVec4d &value)
 
bool set_preset_value (const CoreString &category, const CoreString &name, const CoreString &str_value)
 
bool set_preset_value (const CoreString &category, const CoreString &name, const unsigned int &index)
 
bool add_preset_value (const CoreString &category, const CoreString &name, const CoreString &title, const CoreString &value)
 
bool set_numeric_range (const CoreString &category, const CoreString &name, const double &min, const double &max)
 
bool enable_range (const CoreString &category, const CoreString &name, const bool &value)
 
bool set_numeric_ui_range (const CoreString &category, const CoreString &name, const double &min, const double &max)
 
bool enable_ui_range (const CoreString &category, const CoreString &name, const bool &value)
 
bool set_read_only (const CoreString &category, const CoreString &name, const bool &value)
 
bool set_doc (const CoreString &category, const CoreString &name, const CoreString &text)
 
bool set_hidden (const CoreString &category, const CoreString &name, const bool &value)
 
bool set_filename_extensions (const CoreString &category, const CoreString &name, const CoreVector< CoreString > &extensions)
 
bool set_saveable (const CoreString &category, const CoreString &name, const bool &flag)
 
AppCategoryPreferences get_category (const CoreString &name)
 
AppItemPreferences get_item (const CoreString &category, const CoreString &name)
 
bool category_exists (const CoreString &category) const
 
bool category_exists (const Mode &force_mode, const CoreString &category) const
 
bool item_exists (const CoreString &category, const CoreString &name) const
 
bool item_exists (const Mode &force_mode, const CoreString &category, const CoreString &name) const
 
bool get_bool_value (const CoreString &category, const CoreString &name) const
 
long get_long_value (const CoreString &category, const CoreString &name) const
 
double get_double_value (const CoreString &category, const CoreString &name) const
 
CoreString get_string_value (const CoreString &category, const CoreString &name) const
 
double get_color_value (const CoreString &category, const CoreString &name, const unsigned int &index) const
 
GMathVec2d get_vec2d_value (const CoreString &category, const CoreString &name) const
 
CoreString get_preset_label (const CoreString &category, const CoreString &name, const unsigned int &index) const
 
CoreString get_preset_value (const CoreString &category, const CoreString &name, const unsigned int &index) const
 
int get_preset_value_count (const CoreString &category, const CoreString &name) const
 
bool remove_all_presets (const CoreString &category, const CoreString &name)
 
bool add_value_validator (const CoreString &category, const CoreString &name, OfAttr::ValidatorBool validator, void *data=0)
 
bool add_value_validator (const CoreString &category, const CoreString &name, OfAttr::ValidatorLong validator, void *data=0)
 
bool add_value_validator (const CoreString &category, const CoreString &name, OfAttr::ValidatorDouble validator, void *data=0)
 
bool add_value_validator (const CoreString &category, const CoreString &name, OfAttr::ValidatorString validator, void *data=0)
 
void on_prefs_attribute_change (OfObject &obj, const EventInfo &event, void *data)
 
bool connect_attrs_change (const CoreString &category, ChangePrefCallback object_change_callback, void *data=0)
 
bool disconnect_attrs_change (const CoreString &category, ChangePrefCallback object_change_callback, void *data=0)
 
ValueType get_item_value_type (const CoreString &category, const CoreString &name) const
 
bool remove_category (const CoreString &category, const bool &update_values_app_prefs=true)
 
void remove_all_category (const bool &update_values_from_app_prefs=true)
 
bool is_asleep () const
 
void asleep ()
 
void awake ()
 
void update_object_resolution_preset (OfAttr &preset_attr, OfAttr &resolution_attr, OfAttr &ratio_attr)
 Conform the specified resolution preset attribute to the current value of this preference.
 
void update_class_resolution_preset (const CoreString &class_name, const CoreString &attr_mode, const CoreString &attr_preset, const CoreString &attr_resolution, const CoreString &attr_ratio)
 For all objects of given class, conform their resolution preset attribute to the current value of this preference, provided it is driven by preference.
 
- Public Member Functions inherited from EventObject
 EventObject ()
 Constructor.
 
 EventObject (const EventObject &src)
 Copy Constructor.
 
virtual ~EventObject () override
 Destructor.
 
void connect (EventObject &sender, const CoreString &event_id, EventInfoMethod event_cb, void *data=0)
 Connects this to an object to listen to a specific event.
 
void connect (EventObject &sender, EventInfoMethod event_cb, void *data=0)
 Connects this to an object to listen any of its events.
 
bool disconnect (EventObject &sender, const CoreString &event_id, EventInfoMethod event_cb, void *data=0)
 
bool disconnect_all (EventObject &sender)
 Disconnects from all objects sender was listening on.
 
void disconnect_all ()
 Disconnects from all objects we were listening on.
 
void remove_all_connection ()
 Disconnects object from other objects it is listening to, and also disconnects all objects listening to it.
 
void raise_event (const CoreString &event_id) const
 sends an event
 
void raise_event (const EventInfo &event_info) const
 sends an event
 
bool is_connected (EventObject &sender, const CoreString &event_id, void *data)
 
void set_mute (const bool &mute)
 Asks for object muting. This will increase or decrease the muting counter. Unmuting may not be immediat since it will happen only when counter reaches 0.
 
bool is_mute () const
 Returns if object is muted.
 
CoreArray< EventObject * > get_senders () const
 
unsigned int get_sender_count () const
 
unsigned int get_receiver_count () const
 
virtual size_t get_memory_size () const override
 
void connect (EventObject &sender, const CoreString &event_id, EventMethod event_cb, void *data=0)
 Connects this to an object to listen to a specific event.
 
void connect (EventObject &sender, EventMethod event_cb, void *data=0)
 Connects this to an object to listen any of its events.
 
bool disconnect (EventObject &sender, const CoreString &event_id, EventMethod event_cb, void *data=0)
 Disconnects this from an object for a specific event.
 
- Public Member Functions inherited from CoreCustomData
 CoreCustomData (const CoreCustomData &src)
 
void add_custom_data (void *key, const bool &data)
 
void add_custom_data (void *key, const int &data)
 
void add_custom_data (void *key, const unsigned int &data)
 
void add_custom_data (void *key, const char *data)
 
void add_custom_data (void *key, const CoreString &data)
 
void add_custom_data (void *key, const double &data)
 
void add_custom_data (void *key, void *data)
 
void remove_custom_data (void *key)
 
void remove_all_custom_data ()
 
void set_custom_data (void *key, const bool &data)
 
void set_custom_data (void *key, const int &data)
 
void set_custom_data (void *key, const unsigned int &data)
 
void set_custom_data (void *key, const double &data)
 
void set_custom_data (void *key, const char *data)
 
void set_custom_data (void *key, const CoreString &data)
 
void set_custom_data (void *key, void *data)
 
void get_custom_data (void *key, bool &data) const
 
void get_custom_data (void *key, int &data) const
 
void get_custom_data (void *key, unsigned int &data) const
 
void get_custom_data (void *key, double &data) const
 
void get_custom_data (void *key, CoreString &data) const
 
void get_custom_data (void *key, void *&data) const
 
- Public Member Functions inherited from CoreBaseObject
bool is_kindof (const CoreBaseObject &object) const
 
CoreString get_class_info_name () const
 
const unsigned long & get_class_info_id () const
 
virtual bool is_kindof (const CoreClassInfo &cinfo) const
 
virtual const CoreClassInfoget_class_info () const
 
template<class T >
T * cast ()
 
template<class T >
const T * cast () const
 
- Public Member Functions inherited from CoreBaseType
bool is_kindof (const CoreClassInfo &cinfo) const
 

Static Public Member Functions

static CoreString get_value_type_name (const ValueType &type)
 
static CoreString get_color_depth_name (const ColorDepth &depth)
 
static CoreString get_mode_name (const Mode &mode)
 
static CoreString get_category_project_tag ()
 
static void sync_prefs (AppObject &app, const Mode &scr, const Mode &dst, const CoreString &category_name)
 Synchronize preferences from one mode to another (MODE_APPLICATION, MODE_PROJECT). Do not create missing preferences.
 
- Static Public Member Functions inherited from EventObject
static void connect (EventObject &sender, const CoreString &event_id, EventObject &receiver, EventInfoMethod event_cb, void *data=0)
 Static version of the above function.
 
static void connect (EventObject &sender, EventObject &receiver, EventInfoMethod event_cb, void *data=0)
 Static version of the above function.
 
static void connect (EventObject &sender, const CoreString &event_id, EventInfoFunction event_cb, void *data=0)
 Connects to an object to listen to a specific event.
 
static void connect (EventObject &sender, EventInfoFunction event_cb, void *data=0)
 Connects to an object to listen any of its events.
 
static bool disconnect (EventObject &sender, const CoreString &event_id, EventInfoFunction event_cb, void *data=0)
 
static void raise_event (EventObject &sender, const CoreString &event_id)
 Sends an event.
 
static void raise_event (EventObject &sender, const EventInfo &event_info)
 Sends an event.
 
static void connect (EventObject &sender, const CoreString &event_id, EventFunction event_cb, void *data=0)
 Connects to an object to listen to a specific event.
 
static void connect (EventObject &sender, EventFunction event_cb, void *data=0)
 Connects to an object to listen any of its events.
 
static void connect (EventObject &sender, const CoreString &event_id, EventObject &receiver, EventMethod event_cb, void *data=0)
 Static version of the above function.
 
static void connect (EventObject &sender, EventObject &receiver, EventMethod event_cb, void *data=0)
 Static version of the above function.
 
static bool disconnect (EventObject &sender, const CoreString &event_id, EventFunction event_cb, void *data=0)
 Disconnects this from an object for a specific event.
 
- Static Public Member Functions inherited from CoreCustomData
static void * get_custom_data_key (const CoreString &key)
 
- Static Public Member Functions inherited from CoreBaseObject
static const CoreClassInfoclass_info ()
 
template<class T >
static T * cast (CoreBaseObject *object)
 
template<class T >
static const T * cast (const CoreBaseObject *object)
 
- Static Public Member Functions inherited from CoreBaseType
static const CoreClassInfoclass_info ()
 Get the type descriptor of this instance.
 

Friends

class AppCategoryPreferences
 
class AppItemPreferences
 

Detailed Description

Application Preferences API.

Member Function Documentation

void AppPreferences::sync_prefs ( AppObject app,
const Mode &  scr,
const Mode &  dst,
const CoreString category_name 
)
static

Synchronize preferences from one mode to another (MODE_APPLICATION, MODE_PROJECT). Do not create missing preferences.

Parameters
[in]appapplication
[in]srcsource mode
[in]dstdestination mode
[in]category_namepreferences category to be merged (others will be ignored)
void AppPreferences::update_class_resolution_preset ( const CoreString class_name,
const CoreString attr_mode,
const CoreString attr_preset,
const CoreString attr_resolution,
const CoreString attr_ratio 
)

For all objects of given class, conform their resolution preset attribute to the current value of this preference, provided it is driven by preference.

Parameters
class_namethe class to update
attr_modethe attribute telling whether the resolution is driven by preference
attr_presetthe attribute holding the preset
attr_resolutionthe attribute holding the resolution (updated as well if preset is "custom")
attr_ratiothe attribute holding the aspect_ratio (updated as well if preset is "custom")
void AppPreferences::update_object_resolution_preset ( OfAttr preset_attr,
OfAttr resolution_attr,
OfAttr ratio_attr 
)

Conform the specified resolution preset attribute to the current value of this preference.

Parameters
preset_attrthe attribute holding the preset
resolution_attrthe attribute holding the resolution (updated as well if preset is "custom")
ratio_attrthe attribute holding the aspect_ratio (updated as well if preset is "custom")