XII Release 0.1.0
Loading...
Searching...
No Matches
xiiPreferences Class Reference

#include <Preferences.h>

Inheritance diagram for xiiPreferences:
[legend]

Public Types

enum class  Domain { Application , Project , Document }

Public Member Functions

Domain GetDomain () const
 Whether the preferences are app, project or document specific.
xiiString GetName () const
 Within the same domain and visibility the name must be unique, but across those it can be reused.
const xiiDocument * GetDocumentAssociation () const
 If these preferences are per document, the pointer is valid, otherwise nullptr.
void TriggerPreferencesChangedEvent ()
 Call this to broadcast that this preference object was modified.
Public Member Functions inherited from xiiReflectedClass
virtual const xiiRTTI * GetDynamicRTTI () const
bool IsInstanceOf (const xiiRTTI *pType) const
 Returns whether the type of this instance is of the given type or derived from it.
template<typename T>
XII_ALWAYS_INLINE bool IsInstanceOf () const
 Returns whether the type of this instance is of the given type or derived from it.

Static Public Member Functions

template<typename TYPE>
static TYPE * QueryPreferences (const xiiDocument *pDocument=nullptr)
static xiiPreferences * QueryPreferences (const xiiRTTI *pRtti, const xiiDocument *pDocument=nullptr)
static void SaveDocumentPreferences (const xiiDocument *pDocument)
 Saves all preferences that are tied to the given document.
static void ClearDocumentPreferences (const xiiDocument *pDocument)
static void SaveProjectPreferences ()
 Saves all project specific preferences.
static void ClearProjectPreferences ()
static void SaveApplicationPreferences ()
 Saves all application specific preferences.
static void ClearApplicationPreferences ()
static void GatherAllPreferences (xiiHybridArray< xiiPreferences *, 16 > &out_allPreferences)
Static Public Member Functions inherited from xiiNoBase
static const xiiRTTI * GetStaticRTTI ()

Public Attributes

xiiEvent< xiiPreferences * > m_ChangedEvent
 A simple event that can be fired when any preference property changes. No specific change details are given.

Protected Member Functions

 xiiPreferences (Domain domain, const char *szUniqueName)
xiiString GetFilePath () const

Detailed Description

Base class for all preferences.

Derive from this to implement a custom class containing preferences. All properties in such a class are exposed in the preferences UI and are automatically stored and restored.

Pass the 'Domain' and 'Visibility' to the constructor to configure whether the preference class is per application, per project or per document, and whether the data is shared among all users or custom for every user.

Member Function Documentation

◆ ClearApplicationPreferences()

void xiiPreferences::ClearApplicationPreferences ( )
static

Removes all application specific preferences. Does not save them. Afterwards the preferences will not appear in the UI any further.

◆ ClearDocumentPreferences()

void xiiPreferences::ClearDocumentPreferences ( const xiiDocument * pDocument)
static

Removes all preferences for the given document. Does not save them. Afterwards the preferences will not appear in the UI any further.

◆ ClearProjectPreferences()

void xiiPreferences::ClearProjectPreferences ( )
static

Removes all project specific preferences. Does not save them. Afterwards the preferences will not appear in the UI any further.

◆ QueryPreferences() [1/2]

template<typename TYPE>
TYPE * xiiPreferences::QueryPreferences ( const xiiDocument * pDocument = nullptr)
inlinestatic

Static function to query a preferences object of the given type. If the instance does not exist yet, it is created and the data is restored from file.

◆ QueryPreferences() [2/2]

xiiPreferences * xiiPreferences::QueryPreferences ( const xiiRTTI * pRtti,
const xiiDocument * pDocument = nullptr )
static

Static function to query a preferences object of the given type. If the instance does not exist yet, it is created and the data is restored from file.


The documentation for this class was generated from the following files:
  • /home/runner/work/XII/XII/Source/Editor/EditorFramework/Preferences/Preferences.h
  • /home/runner/work/XII/XII/Source/Editor/EditorFramework/Preferences/Implementation/Preferences.cpp