Torque2D Reference
Loading...
Searching...
No Matches
GuiProfileTheme Class Reference

#include <guiProfileTheme.h>

Inheritance diagram for GuiProfileTheme:

Classes

struct  ProfileCategory
struct  BorderCategory
struct  CursorCategory

Public Types

typedef void(* StampProfileFn) (GuiProfileTheme *theme, GuiControlProfile *profile)
typedef void(* StampBorderFn) (GuiProfileTheme *theme, GuiBorderProfile *border)
typedef void(* StampCursorFn) (GuiProfileTheme *theme, GuiCursor *cursor)
Public Types inherited from SimObject
enum  WriteFlags { SelectedOnly = BIT(0) }
enum  CopyFieldsFlags { CopyFields_SkipName = BIT(0) , CopyFields_SkipParentGroup = BIT(1) , CopyFields_SkipScriptClass = BIT(2) }
 What copyFieldsFrom may be told to leave alone. More...

Public Member Functions

 DECLARE_CONOBJECT (GuiProfileTheme)
 GuiProfileTheme ()
bool onAdd ()
 Called when the object is added to the sim.
void onRemove ()
 Called when the object is removed from the sim.
virtual void onStaticModified (const char *slotName, const char *newValue=NULL)
virtual void onDeleteNotify (SimObject *object)
virtual U32 getTamlChildCount (void) const
 Called when Taml attempts to compile a list of children.
virtual SimObjectgetTamlChild (const U32 childIndex) const
 Called when Taml attempts to compile a list of children.
virtual void addTamlChild (SimObject *pSimObject)
 Called when Taml attempts to populate an objects children during a read.
virtual void onTamlPreRead (void)
 Called prior to Taml reading the object.
virtual void onTamlPostRead (const TamlCustomNodes &customNodes)
S32 getProfileCount () const
const Vector< GuiControlProfile * > & getExtraProfiles () const
const Vector< GuiBorderProfile * > & getExtraBorders () const
const Vector< GuiCursor * > & getExtraCursors () const
GuiControlProfilegetProfile (StringTableEntry categoryName) const
 The category's default member.
GuiBorderProfilegetBorder (StringTableEntry categoryName) const
 The border category's default member.
GuiCursorgetCursor (StringTableEntry categoryName) const
 The cursor category's default member.
GuiControlProfilecreateProfile (const char *categoryName, const char *objectName)
 Create an extra profile in a category.
bool removeProfile (GuiControlProfile *profile)
 Delete an extra; defaults are refused.
GuiBorderProfilecreateBorder (const char *objectName)
 Create a single-use custom border owned by the theme.
bool removeBorder (GuiBorderProfile *border)
 Delete a custom border.
GuiCursorcreateCursor (const char *categoryName, const char *objectName)
 Create an extra cursor in a category.
bool removeCursor (GuiCursor *cursor)
 Delete an extra; defaults are refused.
void restamp ()
bool renameTheme (const char *newName)
StringTableEntry getFontBody () const
StringTableEntry getFontTitle () const
StringTableEntry getFontCode () const
StringTableEntry getFontDirectory () const
StringTableEntry getCursorDirectory () const
S32 getFontSize () const
const ColorIgetColorBackground () const
const ColorIgetColorSurface () const
const ColorIgetColorForeground () const
const ColorIgetColorAccent () const
const ColorIgetColorHighlight () const
const ColorIgetColorWarning () const
S32 getBorderSize () const
Public Member Functions inherited from SimObject
StringTableEntry getClassNamespace () const
StringTableEntry getSuperClassNamespace () const
void setClassNamespace (const char *classNamespace)
void setSuperClassNamespace (const char *superClassNamespace)
void pushScriptCallbackGuard (void)
void popScriptCallbackGuard (void)
S32 getScriptCallbackGuard (void)
virtual SimObjectfindObject (const char *name)
NamespacegetNamespace ()
 Return the object's namespace.
const char * tabComplete (const char *prevText, S32 baseLen, bool)
virtual void dump ()
virtual void dumpClassHierarchy ()
SimObjectclone (const bool copyDynamicFields)
virtual void copyTo (SimObject *object)
SimObjectdeepClone ()
template<typename T>
bool isType (void)
virtual bool handlesConsoleMethod (const char *fname, S32 *routingId)
 DECLARE_CONOBJECT (SimObject)
virtual bool writeField (StringTableEntry fieldname, const char *value)
virtual void write (Stream &stream, U32 tabStop, U32 flags=0)
virtual void writeFields (Stream &stream, U32 tabStop)
virtual bool writeObject (Stream *stream)
virtual bool readObject (Stream *stream)
virtual void buildFilterList ()
void addFieldFilter (const char *fieldName)
void removeFieldFilter (const char *fieldName)
void clearFieldFilters ()
bool isFiltered (const char *fieldName)
void assignFieldsFrom (SimObject *obj)
void copyFieldsFrom (SimObject *obj, const U32 flags)
void assignDynamicFieldsFrom (SimObject *obj)
NotifyremoveNotify (void *ptr, Notify::Type)
 Remove a notification from the list.
void deleteNotify (SimObject *obj)
 Notify an object when we are deleted.
void clearNotify (SimObject *obj)
 Notify an object when we are cleared.
void clearAllNotifications ()
 Remove all notifications for this object.
void processDeleteNotifies ()
 Send out deletion notifications.
void registerReference (SimObject **obj)
void unregisterReference (SimObject **obj)
void addListener (std::string objID)
void removeListener (std::string objID)
void removeAllListeners ()
void postEvent (std::string eventName, std::string data)
const char * getDataField (StringTableEntry slotName, const char *array)
virtual void setDataField (StringTableEntry slotName, const char *array, const char *value)
const char * getPrefixedDataField (StringTableEntry fieldName, const char *array)
void setPrefixedDataField (StringTableEntry fieldName, const char *array, const char *value)
const char * getPrefixedDynamicDataField (StringTableEntry fieldName, const char *array, const S32 fieldType=-1)
void setPrefixedDynamicDataField (StringTableEntry fieldName, const char *array, const char *value, const S32 fieldType=-1)
StringTableEntry getDataFieldPrefix (StringTableEntry fieldName)
U32 getDataFieldType (StringTableEntry slotName, const char *array)
SimFieldDictionarygetFieldDictionary ()
void clearDynamicFields (void)
 Clear all dynamic fields.
void setCanSaveDynamicFields (bool bCanSave)
 Set whether fields created at runtime should be saved. Default is true.
bool getCanSaveDynamicFields (void) const
 Get whether fields created at runtime should be saved. Default is true.
void setInternalName (const char *newname)
StringTableEntry getInternalName ()
 Get the internal of of this control.
virtual bool save (const char *pcFilePath, bool bOnlySelected=false)
 Save object as a TorqueScript File.
virtual bool isMethod (const char *methodName)
 Check if a method exists in the objects current namespace.
SimObjectId getId (void) const
StringTableEntry getIdString (void) const
U32 getType () const
const StringTableEntry getName (void) const
void setId (SimObjectId id)
void assignName (const char *name)
SimGroupgetGroup () const
bool isChildOfGroup (SimGroup *pGroup)
bool isProperlyAdded () const
bool isDeleted () const
bool isRemoved () const
bool isLocked () const
void setLocked (bool b)
bool isHidden () const
void setHidden (bool b)
void setProgenitorFile (const char *pFile)
StringTableEntry getProgenitorFile (void) const
void setPeriodicTimerID (const S32 timerID)
S32 getPeriodicTimerID (void) const
bool isPeriodicTimerActive (void) const
bool isSelected () const
bool isExpanded () const
void setSelected (bool sel)
void setExpanded (bool exp)
void setModDynamicFields (bool dyn)
void setModStaticFields (bool sta)
 SimObject ()
virtual ~SimObject ()
virtual bool processArguments (S32 argc, const char **argv)
 Process constructor options. (ie, new SimObject(1,2,3)).
virtual void onGroupAdd ()
 Called when the object is added to a SimGroup.
virtual void onGroupRemove ()
 Called when the object is removed from a SimGroup.
virtual void onNameChange (const char *name)
 Called when the object's name is changed.
virtual void inspectPreApply ()
virtual void inspectPostApply ()
virtual void onEditorEnable ()
 Called when the editor is activated.
virtual void onEditorDisable ()
 Called when the editor is deactivated.
bool registerObject ()
bool registerObject (U32 id)
bool registerObject (const char *name)
bool registerObject (const char *name, U32 id)
void unregisterObject ()
void deleteObject ()
bool addToSet (SimObjectId)
bool addToSet (const char *)
bool removeFromSet (SimObjectId)
bool removeFromSet (const char *)
Public Member Functions inherited from ConsoleObject
const AbstractClassRep::FieldfindField (StringTableEntry fieldName) const
 Get a reference to a field by name.
virtual AbstractClassRepgetClassRep () const
 Gets the ClassRep.
bool setField (const char *fieldName, const char *value)
 Set the value of a field.
virtual ~ConsoleObject ()
const AbstractClassRep::FieldListgetFieldList () const
 Get a list of all the fields. This information cannot be modified.
AbstractClassRep::FieldListgetModifiableFieldList ()
bool & getDynamicGroupExpand ()
S32 getClassId (U32 netClassGroup) const
const char * getClassName () const

Static Public Member Functions

static void initPersistFields ()
static S32 getCategoryCount ()
static StringTableEntry getCategoryName (S32 index)
static S32 findCategoryIndex (StringTableEntry categoryName)
static S32 getBorderCategoryCount ()
static StringTableEntry getBorderCategoryName (S32 index)
static S32 findBorderCategoryIndex (StringTableEntry categoryName)
static S32 getCursorCategoryCount ()
static StringTableEntry getCursorCategoryName (S32 index)
static S32 findCursorCategoryIndex (StringTableEntry categoryName)
static const char * getCursorStockFile (S32 index)
static const char * getCursorCanonicalName (S32 index)
static ColorI adjustValue (const ColorI &color, F32 percent)
static ColorI setAlpha (const ColorI &color, S32 alpha)
 Replace a color's alpha byte, clamping to 0..255.
Static Public Member Functions inherited from SimObject
static void initPersistFields ()
Static Public Member Functions inherited from ConsoleObject
static const char * lookupClassName (const U32 in_classTag)
 Get the classname from a class tag.
static void initPersistFields ()
static void consoleInit ()
static AbstractClassRepgetStaticClassRep ()
 Get the abstract class information for this class.
static AbstractClassRepgetParentStaticClassRep ()
 Get the abstract class information for this class's superclass.
static ConsoleObjectcreate (const char *in_pClassName)
static ConsoleObjectcreate (const U32 groupId, const U32 typeId, const U32 in_classId)

Additional Inherited Members

static bool disableNameChanging = false
Protected Member Functions inherited from SimObject
virtual void onTamlPreWrite (void)
 Taml callbacks.
virtual void onTamlPostWrite (void)
 Called after Taml has finished writing the object.
virtual void onTamlAddParent (SimObject *pParentObject)
 Called after Taml has finished reading the object and has added the object to any parent.
virtual void onTamlCustomWrite (TamlCustomNodes &customNodes)
 Called during the writing of the object to allow custom properties to be written.
virtual void onTamlCustomRead (const TamlCustomNodes &customNodes)
 Called during the reading of the object to allow custom properties to be read.
void linkNamespaces ()
void unlinkNamespaces ()
virtual SimObjectallocClone ()
 A registered but empty object of this object's class.
void cloneInto (SimObject *clone)
virtual void deepCloneChildren (SimObject *clone)
Protected Member Functions inherited from ConsoleObject
 ConsoleObject ()
 ConsoleObject (const ConsoleObject &)
Static Protected Member Functions inherited from SimObject
static bool setClass (void *obj, const char *data)
static bool setSuperClass (void *obj, const char *data)
static bool writeObjectName (void *obj, StringTableEntry pFieldName)
static bool writeCanSaveDynamicFields (void *obj, StringTableEntry pFieldName)
static bool writeInternalName (void *obj, StringTableEntry pFieldName)
static bool setParentGroup (void *obj, const char *data)
static bool writeParentGroup (void *obj, StringTableEntry pFieldName)
static bool writeSuperclass (void *obj, StringTableEntry pFieldName)
static bool writeClass (void *obj, StringTableEntry pFieldName)
static bool setProtectedName (void *obj, const char *data)
static const char * getProtectedName (void *obj, const char *data)
static SimObject::NotifyallocNotify ()
 Get a free Notify structure.
static void freeNotify (SimObject::Notify *)
 Mark a Notify structure as free.
static void addGroup (const char *in_pGroupname, const char *in_pGroupDocs=NULL)
static void endGroup (const char *in_pGroupname)
static void addField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, const U32 in_elementCount=1, EnumTable *in_table=NULL, const char *in_pFieldDocs=NULL)
static void addField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, AbstractClassRep::WriteDataNotify in_writeDataFn, const U32 in_elementCount=1, EnumTable *in_table=NULL, const char *in_pFieldDocs=NULL)
static void addField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, const char *in_pFieldDocs)
static void addField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, AbstractClassRep::WriteDataNotify in_writeDataFn, const char *in_pFieldDocs)
static void addFieldV (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, ConsoleTypeValidator *v, const char *in_pFieldDocs=NULL)
static void addProtectedField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, AbstractClassRep::SetDataNotify in_setDataFn, AbstractClassRep::GetDataNotify in_getDataFn=&defaultProtectedGetFn, const U32 in_elementCount=1, EnumTable *in_table=NULL, const char *in_pFieldDocs=NULL)
static void addProtectedField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, AbstractClassRep::SetDataNotify in_setDataFn, AbstractClassRep::GetDataNotify in_getDataFn=&defaultProtectedGetFn, AbstractClassRep::WriteDataNotify in_writeDataFn=&defaultProtectedWriteFn, const U32 in_elementCount=1, EnumTable *in_table=NULL, const char *in_pFieldDocs=NULL)
static void addProtectedField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, AbstractClassRep::SetDataNotify in_setDataFn, AbstractClassRep::GetDataNotify in_getDataFn=&defaultProtectedGetFn, const char *in_pFieldDocs=NULL)
static void addProtectedField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, AbstractClassRep::SetDataNotify in_setDataFn, AbstractClassRep::GetDataNotify in_getDataFn=&defaultProtectedGetFn, AbstractClassRep::WriteDataNotify in_writeDataFn=&defaultProtectedWriteFn, const char *in_pFieldDocs=NULL)
static void addDepricatedField (const char *fieldName)
static bool removeField (const char *in_pFieldname)
Protected Attributes inherited from SimObject
SimObjectId mId
 Id number for this object.
StringTableEntry mIdString
NamespacemNameSpace
U32 mTypeMask
S32 mScriptCallbackGuard
 Whether the object is executing a script callback.
bool mCanSaveFieldDictionary
 true if dynamic fields (added at runtime) should be saved, defaults to true
StringTableEntry mInternalName
 Stores object Internal Name.
StringTableEntry mClassName
 Stores the class name to link script class namespaces.
StringTableEntry mSuperClassName
 Stores super class name to link script class namespaces.
static SimObject::NotifymNotifyFreeList = NULL

Detailed Description

A set of theme-wide values (fonts, palette colors, border size) from which a complete family of GuiControlProfile / GuiBorderProfile objects is derived. Formalizes in C++ the theme pattern used by the script-side editor themes and AppCore profile helpers.

On registration the theme creates one member profile per entry of the engine-defined category table (and one border per border category), named <ThemeName><Suffix>, and stamps every profile field with values derived from the theme. Changing a theme value restamps all members, skipping any field a member has explicitly overridden. The theme owns its members and deletes them on removal; a deleted default member is recreated at the next restamp, so a theme is always complete.

Member Typedef Documentation

◆ StampBorderFn

typedef void(* StampBorderFn) (GuiProfileTheme *theme, GuiBorderProfile *border)

◆ StampCursorFn

typedef void(* StampCursorFn) (GuiProfileTheme *theme, GuiCursor *cursor)

◆ StampProfileFn

typedef void(* StampProfileFn) (GuiProfileTheme *theme, GuiControlProfile *profile)

Constructor & Destructor Documentation

◆ GuiProfileTheme()

Member Function Documentation

◆ addTamlChild()

void addTamlChild ( SimObject * pSimObject)
virtual

Called when Taml attempts to populate an objects children during a read.

Implements TamlChildren.

◆ adjustValue()

ColorI adjustValue ( const ColorI & color,
F32 percent )
static

Shift a color's HSV value (brightness) by percent (positive brightens, negative darkens), preserving hue and alpha. The value fraction is clamped to 0..1, so over-brightening saturates without hue wash-out. Black, having no hue, brightens along the neutral gray rail.

◆ createBorder()

GuiBorderProfile * createBorder ( const char * objectName)

Create a single-use custom border owned by the theme.

◆ createCursor()

GuiCursor * createCursor ( const char * categoryName,
const char * objectName )

Create an extra cursor in a category.

◆ createProfile()

GuiControlProfile * createProfile ( const char * categoryName,
const char * objectName )

Create an extra profile in a category.

◆ DECLARE_CONOBJECT()

DECLARE_CONOBJECT ( GuiProfileTheme )

◆ findBorderCategoryIndex()

S32 findBorderCategoryIndex ( StringTableEntry categoryName)
static

◆ findCategoryIndex()

S32 findCategoryIndex ( StringTableEntry categoryName)
static

◆ findCursorCategoryIndex()

S32 findCursorCategoryIndex ( StringTableEntry categoryName)
static

◆ getBorder()

GuiBorderProfile * getBorder ( StringTableEntry categoryName) const

The border category's default member.

◆ getBorderCategoryCount()

S32 getBorderCategoryCount ( )
inlinestatic

◆ getBorderCategoryName()

StringTableEntry getBorderCategoryName ( S32 index)
static

◆ getBorderSize()

S32 getBorderSize ( ) const
inline

◆ getCategoryCount()

S32 getCategoryCount ( )
inlinestatic

◆ getCategoryName()

StringTableEntry getCategoryName ( S32 index)
static

◆ getColorAccent()

const ColorI & getColorAccent ( ) const
inline

◆ getColorBackground()

const ColorI & getColorBackground ( ) const
inline

◆ getColorForeground()

const ColorI & getColorForeground ( ) const
inline

◆ getColorHighlight()

const ColorI & getColorHighlight ( ) const
inline

◆ getColorSurface()

const ColorI & getColorSurface ( ) const
inline

◆ getColorWarning()

const ColorI & getColorWarning ( ) const
inline

◆ getCursor()

GuiCursor * getCursor ( StringTableEntry categoryName) const

The cursor category's default member.

◆ getCursorCanonicalName()

const char * getCursorCanonicalName ( S32 index)
static

The name the engine falls back to for a cursor category ("EditCursor"). Also the member-name suffix, which is why a member is findable both ways.

◆ getCursorCategoryCount()

S32 getCursorCategoryCount ( )
inlinestatic

◆ getCursorCategoryName()

StringTableEntry getCursorCategoryName ( S32 index)
static

◆ getCursorDirectory()

StringTableEntry getCursorDirectory ( ) const
inline

◆ getCursorStockFile()

const char * getCursorStockFile ( S32 index)
static

The stock art file name for a cursor category ("defaultCursor.png"). The editor asks so it can seed a theme's cursor folder; the theme itself never copies files.

◆ getExtraBorders()

const Vector< GuiBorderProfile * > & getExtraBorders ( ) const
inline

◆ getExtraCursors()

const Vector< GuiCursor * > & getExtraCursors ( ) const
inline

◆ getExtraProfiles()

const Vector< GuiControlProfile * > & getExtraProfiles ( ) const
inline

◆ getFontBody()

StringTableEntry getFontBody ( ) const
inline

◆ getFontCode()

StringTableEntry getFontCode ( ) const
inline

◆ getFontDirectory()

StringTableEntry getFontDirectory ( ) const
inline

◆ getFontSize()

S32 getFontSize ( ) const
inline

◆ getFontTitle()

StringTableEntry getFontTitle ( ) const
inline

◆ getProfile()

GuiControlProfile * getProfile ( StringTableEntry categoryName) const

The category's default member.

◆ getProfileCount()

S32 getProfileCount ( ) const

◆ getTamlChild()

SimObject * getTamlChild ( const U32 childIndex) const
virtual

Called when Taml attempts to compile a list of children.

Implements TamlChildren.

◆ getTamlChildCount()

U32 getTamlChildCount ( void ) const
virtual

Called when Taml attempts to compile a list of children.

Implements TamlChildren.

◆ initPersistFields()

void initPersistFields ( )
static

◆ onAdd()

bool onAdd ( void )
virtual

Called when the object is added to the sim.

Reimplemented from SimObject.

◆ onDeleteNotify()

void onDeleteNotify ( SimObject * object)
virtual

Called when a SimObject is deleted.

When you are on the notification list for another object and it is deleted, this method is called.

Reimplemented from SimObject.

◆ onRemove()

void onRemove ( )
virtual

Called when the object is removed from the sim.

Reimplemented from SimObject.

◆ onStaticModified()

void onStaticModified ( const char * slotName,
const char * newValue = NULL )
virtual

Called when a static field is modified.

Reimplemented from SimObject.

◆ onTamlPostRead()

void onTamlPostRead ( const TamlCustomNodes & customNodes)
virtual

Called after Taml has finished reading the object. The custom properties is additionally passed here for object who want to process it at the end of reading.

Reimplemented from SimObject.

◆ onTamlPreRead()

void onTamlPreRead ( void )
virtual

Called prior to Taml reading the object.

Reimplemented from SimObject.

◆ removeBorder()

bool removeBorder ( GuiBorderProfile * border)

Delete a custom border.

◆ removeCursor()

bool removeCursor ( GuiCursor * cursor)

Delete an extra; defaults are refused.

◆ removeProfile()

bool removeProfile ( GuiControlProfile * profile)

Delete an extra; defaults are refused.

◆ renameTheme()

bool renameTheme ( const char * newName)

Rename the theme and every member following the <ThemeName><Suffix> pattern (extras rename only when their name starts with the old theme name), updating overridden border-name references that point at this theme's borders. All-or-nothing: any target-name collision refuses the whole rename and returns false.

< 0 left, 1 right, 2 top, 3 bottom.

◆ restamp()

void restamp ( )

Create any missing default members and re-derive every non-overridden field of every member from the current theme values.

◆ setAlpha()

ColorI setAlpha ( const ColorI & color,
S32 alpha )
static

Replace a color's alpha byte, clamping to 0..255.


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