MyGUI: MyGUI_ImageBox.h Source File

MyGUI 3.2.2

MyGUI_ImageBox.h
Go to the documentation of this file.
1 /*
2 * This source file is part of MyGUI. For the latest info, see http://mygui.info/
3 * Distributed under the MIT License
4 * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
5 */
6
7 #ifndef MYGUI_IMAGE_BOX_H_
8 #define MYGUI_IMAGE_BOX_H_
9
10 #include "MyGUI_Prerequest.h"
11 #include "MyGUI_Widget.h"
12 #include "MyGUI_ResourceImageSet.h"
13 #include "MyGUI_ImageInfo.h"
14
15 namespace MyGUI
16 {
17
21 class MYGUI_EXPORT ImageBox :
22 public Widget,
23 public MemberObsolete<ImageBox>
24 {
25 MYGUI_RTTI_DERIVED( ImageBox )
26
27 public:
28 ImageBox();
29
30 //------------------------------------------------------------------------------//
31 // The simple interface
32 //------------------------------------------------------------------------------//
33
34 /* Set texture and size of image _tile
35 @param _texture file name or texture name
36 @param _coord - part of texture where we take tiles
37 @param _tile size
38 */
39 void setImageInfo(const std::string& _texture, const IntCoord& _coord, const IntSize& _tile);
40
41 /* Set texture
42 @param _texture file name or texture name
43 */
44 void setImageTexture(const std::string& _value);
45
47 void setImageRect(const IntRect& _value);
48
50 void setImageCoord(const IntCoord& _value);
51
53 void setImageTile(const IntSize& _value);
54
67 void setImageIndex(size_t _index);
69 size_t getImageIndex() const;
70
72 IntSize getImageSize() const;
73
74 //------------------------------------------------------------------------------//
75 // The expanded interface
76 //------------------------------------------------------------------------------//
77
79 size_t getItemCount() const;
80
82 void setItemSelect(size_t _index);
84 size_t getItemSelect() const;
86 void resetItemSelect();
87
89 void insertItem(size_t _index, const IntCoord& _item);
91 void addItem(const IntCoord& _item);
93 void setItem(size_t _index, const IntCoord& _item);
94
96 void deleteItem(size_t _index);
98 void deleteAllItems();
99
100 // работа с фреймами анимированных индексов
105 void addItemFrame(size_t _index, const IntCoord& _item);
106
112 void insertItemFrame(size_t _index, size_t _indexFrame, const IntCoord& _item);
113
118 void addItemFrameDuplicate(size_t _index, size_t _indexSourceFrame);
119
125 void insertItemFrameDuplicate(size_t _index, size_t _indexFrame, size_t _indexSourceFrame);
126
132 void setItemFrame(size_t _index, size_t _indexFrame, const IntCoord& _item);
133
138 void deleteItemFrame(size_t _index, size_t _indexFrame);
139
143 void deleteAllItemFrames(size_t _index);
144
149 void setItemFrameRate(size_t _index, float _rate);
150
154 float getItemFrameRate(size_t _index);
155
156 //------------------------------------------------------------------------------//
157 // The interface with support of resources
158 //------------------------------------------------------------------------------//
159
164 bool setItemResource(const std::string& _name);
165
167 void setItemGroup(const std::string& _value);
169 void setItemName(const std::string& _value);
170
174 void setItemResourcePtr(ResourceImageSetPtr _resource);
176 void setItemResourceInfo(const ImageIndexInfo& _info);
177
179 ResourceImageSetPtr getItemResource() const;
181 void setItemResourceInfo(ResourceImageSetPtr _resource, const std::string& _group, const std::string& _name);
182
183 protected:
184 virtual void shutdownOverride();
185
186 virtual void setPropertyOverride(const std::string& _key, const std::string& _value);
187
188 private:
189 void frameEntered(float _frame);
190
191 void recalcIndexes();
192 void updateSelectIndex(size_t _index);
193
194 void frameAdvise(bool _advise);
195
196 void _setUVSet(const FloatRect& _rect);
197
198 private:
199 // кусок в текстуре наших картинок
200 IntRect mRectImage;
201 // размер одной картинки
202 IntSize mSizeTile;
203 // размер текстуры
204 IntSize mSizeTexture;
205 // текущая картинка
206 size_t mIndexSelect;
207
208 VectorImages mItems;
209
210 bool mFrameAdvise;
211 float mCurrentTime;
212 size_t mCurrentFrame;
213
214 ResourceImageSetPtr mResource;
215 std::string mItemName;
216 std::string mItemGroup;
217 std::string mCurrentTextureName;
218 };
219
220 } // namespace MyGUI
221
222 #endif // MYGUI_IMAGE_BOX_H_
MyGUI::ImageBox
ImageBox properties. Skin childs. ImageBox widget description should be here.
Definition: MyGUI_ImageBox.h:21
MyGUI::ResourceImageSet
Definition: MyGUI_ResourceImageSet.h:26
MyGUI_Widget.h
MyGUI::types::TRect< int >
MyGUI::Widget
Widget properties. Skin childs. Widget widget description should be here.
Definition: MyGUI_Widget.h:29
MyGUI_ResourceImageSet.h
MyGUI_Prerequest.h
MyGUI::ImageIndexInfo
Definition: MyGUI_ImageInfo.h:30
MYGUI_RTTI_DERIVED
#define MYGUI_RTTI_DERIVED(DerivedType)
Definition: MyGUI_RTTI.h:65
MyGUI::MemberObsolete
Definition: MyGUI_DeprecatedTypes.h:13
MyGUI::types::TSize< int >
MyGUI_ImageInfo.h
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition: MyGUI_Platform.h:103
MyGUI::VectorImages
std::vector< ImageItem > VectorImages
Definition: MyGUI_ImageInfo.h:28
MyGUI::types::TCoord< int >
MyGUI
Definition: MyGUI_ActionController.h:14