MyGUI: MyGUI_ImageBox.h Source File

MyGUI 3.4.3

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
15namespace MyGUI
16{
17
21 class MYGUI_EXPORT ImageBox : public Widget, public MemberObsolete<ImageBox>
22 {
23 MYGUI_RTTI_DERIVED(ImageBox)
24
25 public:
26 //------------------------------------------------------------------------------//
27 // The simple interface
28 //------------------------------------------------------------------------------//
29
30 /* Set texture and size of image _tile
31 @param _texture file name or texture name
32 @param _coord - part of texture where we take tiles
33 @param _tile size
34 */
35 void setImageInfo(std::string_view _texture, const IntCoord& _coord, const IntSize& _tile);
36
37 /* Set texture
38 @param _texture file name or texture name
39 */
40 void setImageTexture(std::string_view _texture);
41
43 void setImageRect(const IntRect& _rect);
44
46 void setImageCoord(const IntCoord& _coord);
47
49 void setImageTile(const IntSize& _tile);
50
63 void setImageIndex(size_t _index);
65 size_t getImageIndex() const;
66
68 IntSize getImageSize() const;
69
70 //------------------------------------------------------------------------------//
71 // The expanded interface
72 //------------------------------------------------------------------------------//
73
75 size_t getItemCount() const;
76
78 void setItemSelect(size_t _index);
80 size_t getItemSelect() const;
82 void resetItemSelect();
83
85 void insertItem(size_t _index, const IntCoord& _item);
87 void addItem(const IntCoord& _item);
89 void setItem(size_t _index, const IntCoord& _item);
90
92 void deleteItem(size_t _index);
94 void deleteAllItems();
95
96 // работа с фреймами анимированных индексов
101 void addItemFrame(size_t _index, const IntCoord& _item);
102
108 void insertItemFrame(size_t _index, size_t _indexFrame, const IntCoord& _item);
109
114 void addItemFrameDuplicate(size_t _index, size_t _indexSourceFrame);
115
121 void insertItemFrameDuplicate(size_t _index, size_t _indexFrame, size_t _indexSourceFrame);
122
128 void setItemFrame(size_t _index, size_t _indexFrame, const IntCoord& _item);
129
134 void deleteItemFrame(size_t _index, size_t _indexFrame);
135
139 void deleteAllItemFrames(size_t _index);
140
145 void setItemFrameRate(size_t _index, float _rate);
146
150 float getItemFrameRate(size_t _index) const;
151
152 //------------------------------------------------------------------------------//
153 // The interface with support of resources
154 //------------------------------------------------------------------------------//
155
160 bool setItemResource(std::string_view _name);
161
163 void setItemGroup(std::string_view _group);
165 void setItemName(std::string_view _name);
166
170 void setItemResourcePtr(ResourceImageSetPtr _resource);
172 void setItemResourceInfo(const ImageIndexInfo& _info);
173
175 ResourceImageSetPtr getItemResource() const;
177 void setItemResourceInfo(ResourceImageSetPtr _resource, std::string_view _group, std::string_view _name);
178
179 protected:
180 void shutdownOverride() override;
181
182 void setPropertyOverride(std::string_view _key, std::string_view _value) override;
183
184 private:
185 void frameEntered(float _frame);
186
187 void recalcIndexes();
188 void updateSelectIndex(size_t _index);
189
190 void frameAdvise(bool _advise);
191
192 void _setUVSet(const FloatRect& _rect);
193
194 private:
195 // кусок в текстуре наших картинок
196 IntRect mRectImage;
197 // размер одной картинки
198 IntSize mSizeTile;
199 // размер текстуры
200 IntSize mSizeTexture;
201 // текущая картинка
202 size_t mIndexSelect{ITEM_NONE};
203
204 VectorImages mItems;
205
206 bool mFrameAdvise{false};
207 float mCurrentTime{0};
208 size_t mCurrentFrame{0};
209
210 ResourceImageSetPtr mResource{nullptr};
211 std::string mItemName;
212 std::string mItemGroup;
213 std::string mCurrentTextureName;
214 };
215
216} // namespace MyGUI
217
218#endif // MYGUI_IMAGE_BOX_H_
MyGUI_ImageInfo.h
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition MyGUI_Platform.h:77
MyGUI_Prerequest.h
MYGUI_RTTI_DERIVED
#define MYGUI_RTTI_DERIVED(DerivedType)
Definition MyGUI_RTTI.h:69
MyGUI_ResourceImageSet.h
MyGUI_Widget.h
MyGUI::ImageBox
widget description should be here.
Definition MyGUI_ImageBox.h:22
MyGUI::ImageBox::setItemGroup
void setItemGroup(std::string_view _group)
Definition MyGUI_ImageBox.cpp:407
MyGUI::ImageBox::setItemFrame
void setItemFrame(size_t _index, size_t _indexFrame, const IntCoord &_item)
Definition MyGUI_ImageBox.cpp:309
MyGUI::ImageBox::getImageSize
IntSize getImageSize() const
Definition MyGUI_ImageBox.cpp:472
MyGUI::ImageBox::setItemFrameRate
void setItemFrameRate(size_t _index, float _rate)
Definition MyGUI_ImageBox.cpp:258
MyGUI::ImageBox::setImageTexture
void setImageTexture(std::string_view _texture)
Definition MyGUI_ImageBox.cpp:83
MyGUI::ImageBox::insertItemFrame
void insertItemFrame(size_t _index, size_t _indexFrame, const IntCoord &_item)
Definition MyGUI_ImageBox.cpp:281
MyGUI::ImageBox::shutdownOverride
void shutdownOverride() override
Definition MyGUI_ImageBox.cpp:21
MyGUI::ImageBox::deleteAllItemFrames
void deleteAllItemFrames(size_t _index)
Definition MyGUI_ImageBox.cpp:244
MyGUI::ImageBox::setItemResource
bool setItemResource(std::string_view _name)
Definition MyGUI_ImageBox.cpp:355
MyGUI::ImageBox::resetItemSelect
void resetItemSelect()
Reset item selection.
Definition MyGUI_ImageBox.cpp:538
MyGUI::ImageBox::setPropertyOverride
void setPropertyOverride(std::string_view _key, std::string_view _value) override
Definition MyGUI_ImageBox.cpp:489
MyGUI::ImageBox::setItemSelect
void setItemSelect(size_t _index)
Select specified _index.
Definition MyGUI_ImageBox.cpp:477
MyGUI::ImageBox::setItemName
void setItemName(std::string_view _name)
Definition MyGUI_ImageBox.cpp:419
MyGUI::ImageBox::setImageIndex
void setImageIndex(size_t _index)
Definition MyGUI_ImageBox.cpp:462
MyGUI::ImageBox::setItemResourcePtr
void setItemResourcePtr(ResourceImageSetPtr _resource)
Definition MyGUI_ImageBox.cpp:362
MyGUI::ImageBox::setImageInfo
void setImageInfo(std::string_view _texture, const IntCoord &_coord, const IntSize &_tile)
Definition MyGUI_ImageBox.cpp:28
MyGUI::ImageBox::setItemResourceInfo
void setItemResourceInfo(const ImageIndexInfo &_info)
Definition MyGUI_ImageBox.cpp:331
MyGUI::ImageBox::getItemResource
ResourceImageSetPtr getItemResource() const
Definition MyGUI_ImageBox.cpp:548
MyGUI::ImageBox::insertItem
void insertItem(size_t _index, const IntCoord &_item)
Insert an item into a list at a specified position.
Definition MyGUI_ImageBox.cpp:194
MyGUI::ImageBox::insertItemFrameDuplicate
void insertItemFrameDuplicate(size_t _index, size_t _indexFrame, size_t _indexSourceFrame)
Definition MyGUI_ImageBox.cpp:295
MyGUI::ImageBox::deleteItemFrame
void deleteItemFrame(size_t _index, size_t _indexFrame)
Definition MyGUI_ImageBox.cpp:319
MyGUI::ImageBox::getItemCount
size_t getItemCount() const
Get number of items.
Definition MyGUI_ImageBox.cpp:528
MyGUI::ImageBox::getItemFrameRate
float getItemFrameRate(size_t _index) const
Definition MyGUI_ImageBox.cpp:265
MyGUI::ImageBox::addItemFrameDuplicate
void addItemFrameDuplicate(size_t _index, size_t _indexSourceFrame)
Definition MyGUI_ImageBox.cpp:272
MyGUI::ImageBox::deleteAllItems
void deleteAllItems()
Delete all items.
Definition MyGUI_ImageBox.cpp:188
MyGUI::ImageBox::setImageCoord
void setImageCoord(const IntCoord &_coord)
Definition MyGUI_ImageBox.cpp:58
MyGUI::ImageBox::addItemFrame
void addItemFrame(size_t _index, const IntCoord &_item)
Definition MyGUI_ImageBox.cpp:251
MyGUI::ImageBox::setImageRect
void setImageRect(const IntRect &_rect)
Definition MyGUI_ImageBox.cpp:68
MyGUI::ImageBox::setImageTile
void setImageTile(const IntSize &_tile)
Definition MyGUI_ImageBox.cpp:43
MyGUI::ImageBox::getItemSelect
size_t getItemSelect() const
Get index of selected item (ITEM_NONE if none selected)
Definition MyGUI_ImageBox.cpp:533
MyGUI::ImageBox::deleteItem
void deleteItem(size_t _index)
Delete item at a specified position.
Definition MyGUI_ImageBox.cpp:173
MyGUI::ImageBox::addItem
void addItem(const IntCoord &_item)
Add an item to the end of a list.
Definition MyGUI_ImageBox.cpp:543
MyGUI::ImageBox::setItem
void setItem(size_t _index, const IntCoord &_item)
Replace an item at a specified position.
Definition MyGUI_ImageBox.cpp:208
MyGUI::ImageBox::getImageIndex
size_t getImageIndex() const
Definition MyGUI_ImageBox.cpp:467
MyGUI::MemberObsolete
Definition MyGUI_DeprecatedTypes.h:14
MyGUI::Widget
widget description should be here.
Definition MyGUI_Widget.h:40
MyGUI
Definition MyGUI_ActionController.h:15
MyGUI::IntRect
types::TRect< int > IntRect
Definition MyGUI_Types.h:33
MyGUI::ResourceImageSetPtr
ResourceImageSet * ResourceImageSetPtr
Definition MyGUI_ResourceImageSet.h:24
MyGUI::FloatRect
types::TRect< float > FloatRect
Definition MyGUI_Types.h:34
MyGUI::ITEM_NONE
constexpr size_t ITEM_NONE
Definition MyGUI_Macros.h:19
MyGUI::IntCoord
types::TCoord< int > IntCoord
Definition MyGUI_Types.h:36
MyGUI::IntSize
types::TSize< int > IntSize
Definition MyGUI_Types.h:30
MyGUI::VectorImages
std::vector< ImageItem > VectorImages
Definition MyGUI_ImageInfo.h:22
MyGUI::ImageIndexInfo
Definition MyGUI_ImageInfo.h:25