guiImageList.h

Engine/source/gui/editor/guiImageList.h

More...

Classes:

Detailed Description

 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 _GUIIMAGELIST_H_
25#define _GUIIMAGELIST_H_
26
27#include "console/simDatablock.h"
28
29#ifndef _GUITYPES_H_
30#include "gui/core/guiTypes.h"
31#endif
32
33
34class GuiImageList : public SimObject
35{
36  private:
37   typedef SimObject Parent;
38
39  public:
40   typedef struct tag_TextureEntry
41   {
42      StringTableEntry TexturePath;
43      GFXTexHandle Handle;
44      U32 id;
45   }TextureEntry,*PTextureEntry;
46   
47   Vector<PTextureEntry> mTextures;
48
49  protected:
50
51
52    U32 mUniqueId;
53   
54  public:
55   GuiImageList();
56   
57   DECLARE_CONOBJECT(GuiImageList);
58   
59   static void initPersistFields();
60
61   // Image managing functions
62   bool Clear();
63   inline U32 Count() { return (U32)mTextures.size(); };
64   U32 Insert( const char* texturePath , GFXTextureProfile *Type = &GFXDefaultGUIProfile  );
65
66   bool FreeTextureEntry( U32 Index );
67   bool FreeTextureEntry( PTextureEntry Entry );
68
69   GFXTexHandle GetTextureHandle( U32 Index );
70   GFXTexHandle GetTextureHandle( const char* TexturePath );
71
72   const char * GetTexturePath( U32 Index );
73
74   U32 IndexFromId ( U32 Id );
75   U32 IndexFromPath ( const char* Path );
76
77};
78
79#endif //_GUIIMAGELISTCTRL_H_
80