MyGUI
3.0.1
Main Page
Related Pages
Namespaces
Data Structures
Files
Examples
File List
Globals
MyGUIEngine
include
MyGUI_StaticImage.h
Go to the documentation of this file.
1
7
/*
8
This file is part of MyGUI.
9
10
MyGUI is free software: you can redistribute it and/or modify
11
it under the terms of the GNU Lesser General Public License as published by
12
the Free Software Foundation, either version 3 of the License, or
13
(at your option) any later version.
14
15
MyGUI is distributed in the hope that it will be useful,
16
but WITHOUT ANY WARRANTY; without even the implied warranty of
17
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
GNU Lesser General Public License for more details.
19
20
You should have received a copy of the GNU Lesser General Public License
21
along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
22
*/
23
#ifndef __MYGUI_STATIC_IMAGE_H__
24
#define __MYGUI_STATIC_IMAGE_H__
25
26
#include "
MyGUI_Prerequest.h
"
27
#include "
MyGUI_Widget.h
"
28
#include "
MyGUI_ResourceImageSet.h
"
29
#include "
MyGUI_ImageInfo.h
"
30
#include "
MyGUI_Guid.h
"
31
32
namespace
MyGUI
33
{
34
35
class
MYGUI_EXPORT
StaticImage
:
36
public
Widget
37
{
38
MYGUI_RTTI_DERIVED
(
StaticImage
)
39
40
public:
41
StaticImage
();
42
43
//------------------------------------------------------------------------------//
44
// The simple interface
45
//------------------------------------------------------------------------------//
46
47
/* Set texture and size of image _tile
48
@param _texture file name or texture name
49
@param _coord - part of texture where we take tiles
50
@param _tile size
51
*/
52
void
setImageInfo(const std::
string
& _texture, const
IntCoord
& _coord, const
IntSize
& _tile);
53
54
/* Set texture
55
@param _texture file name or texture name
56
*/
57
void
setImageTexture(const std::
string
& _value);
58
60
void
setImageRect(const
IntRect
& _value);
61
63
void
setImageCoord(const
IntCoord
& _value);
64
66
void
setImageTile(const
IntSize
& _value);
67
80
void
setImageIndex(
size_t
_index);
82
size_t
getImageIndex();
83
84
//------------------------------------------------------------------------------//
85
// The expanded interface
86
//------------------------------------------------------------------------------//
87
89
size_t
getItemCount()
const
{
return
mItems.size(); }
90
92
void
setItemSelect(
size_t
_index);
94
size_t
getItemSelect
() {
return
mIndexSelect; }
96
void
resetItemSelect
() { setItemSelect(
ITEM_NONE
); }
97
99
void
insertItem(
size_t
_index,
const
IntCoord
& _item);
101
void
addItem
(
const
IntCoord
& _item) { insertItem(
ITEM_NONE
, _item); }
103
void
setItem(
size_t
_index,
const
IntCoord
& _item);
104
106
void
deleteItem(
size_t
_index);
108
void
deleteAllItems();
109
110
// работа с фреймами анимированных индексов
115
void
addItemFrame(
size_t
_index,
const
IntCoord
& _item);
116
122
void
insertItemFrame(
size_t
_index,
size_t
_indexFrame,
const
IntCoord
& _item);
123
128
void
addItemFrameDublicate(
size_t
_index,
size_t
_indexSourceFrame);
129
135
void
insertItemFrameDublicate(
size_t
_index,
size_t
_indexFrame,
size_t
_indexSourceFrame);
136
142
void
setItemFrame(
size_t
_index,
size_t
_indexFrame,
const
IntCoord
& _item);
143
148
void
deleteItemFrame(
size_t
_index,
size_t
_indexFrame);
149
153
void
deleteAllItemFrames(
size_t
_index);
154
159
void
setItemFrameRate(
size_t
_index,
float
_rate);
160
164
float
getItemFrameRate(
size_t
_index);
165
166
//------------------------------------------------------------------------------//
167
// The interface with support of resources
168
//------------------------------------------------------------------------------//
169
174
bool
setItemResource(
const
Guid
& _id);
175
180
bool
setItemResource(
const
std::string& _name);
181
183
void
setItemGroup(
const
std::string& _value);
185
void
setItemName(
const
std::string& _value);
186
190
void
setItemResourcePtr(
ResourceImageSetPtr
_resource);
192
void
setItemResourceInfo(
const
ImageIndexInfo
& _info);
193
195
ResourceImageSetPtr
getItemResource
() {
return
mResource; }
197
void
setItemResourceInfo(
ResourceImageSetPtr
_resource,
const
std::string& _group,
const
std::string& _name);
198
200
virtual
void
setProperty(
const
std::string& _key,
const
std::string& _value);
201
202
/*internal:*/
203
virtual
void
_initialise(
WidgetStyle
_style,
const
IntCoord
& _coord,
Align
_align,
ResourceSkin
* _info,
Widget
* _parent,
ICroppedRectangle
* _croppedParent,
IWidgetCreator
* _creator,
const
std::string& _name);
204
205
protected
:
206
virtual
~
StaticImage
();
207
208
void
baseChangeWidgetSkin(
ResourceSkin
* _info);
209
210
private
:
211
void
initialiseWidgetSkin(
ResourceSkin
* _info);
212
void
shutdownWidgetSkin();
213
214
void
frameEntered(
float
_frame);
215
216
void
recalcIndexes();
217
void
updateSelectIndex(
size_t
_index);
218
219
void
frameAdvise(
bool
_advise);
220
221
private
:
222
// кусок в текстуре наших картинок
223
IntRect
mRectImage;
224
// размер одной картинки
225
IntSize
mSizeTile;
226
// размер текстуры
227
IntSize
mSizeTexture;
228
// текущая картинка
229
size_t
mIndexSelect;
230
231
VectorImages
mItems;
232
233
bool
mFrameAdvise;
234
float
mCurrentTime;
235
size_t
mCurrentFrame;
236
237
ResourceImageSetPtr
mResource;
238
std::string mItemName;
239
std::string mItemGroup;
240
std::string mCurrentTextureName;
241
242
};
243
244
}
// namespace MyGUI
245
246
#endif // __MYGUI_STATIC_IMAGE_H__
Generated by
1.8.1.2