Torque3D Documentation / _generateds / editorIconRegistry.h

editorIconRegistry.h

Engine/source/gui/worldEditor/editorIconRegistry.h

More...

Classes:

class

This class is used to find the correct icon file path for different SimObject class types.

Public Variables

The global registry of editor icons.

Detailed Description

Public Variables

EditorIconRegistry gEditorIcons 

The global registry of editor icons.

 1
 2//-----------------------------------------------------------------------------
 3// Copyright (c) 2012 GarageGames, LLC
 4//
 5// Permission is hereby granted, free of charge, to any person obtaining a copy
 6// of this software and associated documentation files (the "Software"), to
 7// deal in the Software without restriction, including without limitation the
 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 9// sell copies of the Software, and to permit persons to whom the Software is
10// furnished to do so, subject to the following conditions:
11//
12// The above copyright notice and this permission notice shall be included in
13// all copies or substantial portions of the Software.
14//
15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21// IN THE SOFTWARE.
22//-----------------------------------------------------------------------------
23
24#ifndef _EDITORICONREGISTRY_H_
25#define _EDITORICONREGISTRY_H_
26
27#ifndef _GFXTEXTUREHANDLE_H_
28#include "gfx/gfxTextureHandle.h"
29#endif
30#ifndef _TDICTIONARY_H_
31#include "core/util/tDictionary.h"
32#endif 
33
34#include "console/engineAPI.h"
35
36class SimObject;
37class AbstractClassRep;
38
39
40/// This class is used to find the correct icon file 
41/// path for different SimObject class types.  It is
42/// typically used by the editors.
43class EditorIconRegistry
44{
45public:
46   DECLARE_STATIC_CLASS(EditorIconRegistry);
47
48   EditorIconRegistry();
49   ~EditorIconRegistry();
50
51   /// Loops thru all the AbstractClassReps looking for icons in the path.
52   void loadFromPath( const String &path, bool overwrite );
53
54   /// Adds a single icon to the registry.
55   void add( const String &className, const String &imageFile, bool overwrite );
56
57   /// Clears all the icons from the registry.
58   void clear();
59
60   /// Looks up an icon given an AbstractClassRep.
61   /// Other findIcon methods redirect to this.
62   GFXTexHandle findIcon( AbstractClassRep *classRep );
63
64   /// Looks up an icon given a SimObject.
65   GFXTexHandle findIcon( const SimObject *object );   
66
67   /// Looks up an icon given a className.
68   GFXTexHandle findIcon( const char *className );
69
70   /// Returns true if an icon is defined this object's class.
71   /// Does not recurse up the class hierarchy.
72   bool hasIconNoRecurse( const SimObject *object );
73
74protected:
75 
76   typedef HashTable<StringNoCase,GFXTexHandle> IconMap;
77   IconMap mIcons;
78
79   /// The default icon returned when no matching icon is found.
80   GFXTexHandle mDefaultIcon;
81};
82
83/// The global registry of editor icons.
84extern EditorIconRegistry gEditorIcons;
85
86#endif // _EDITORICONREGISTRY_H_
87