• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • Examples
  • File List
  • Globals

MyGUI_StaticImage.h

Go to the documentation of this file.
00001 
00007 /*
00008     This file is part of MyGUI.
00009     
00010     MyGUI is free software: you can redistribute it and/or modify
00011     it under the terms of the GNU Lesser General Public License as published by
00012     the Free Software Foundation, either version 3 of the License, or
00013     (at your option) any later version.
00014     
00015     MyGUI is distributed in the hope that it will be useful,
00016     but WITHOUT ANY WARRANTY; without even the implied warranty of
00017     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018     GNU Lesser General Public License for more details.
00019     
00020     You should have received a copy of the GNU Lesser General Public License
00021     along with MyGUI.  If not, see <http://www.gnu.org/licenses/>.
00022 */
00023 #ifndef __MYGUI_STATIC_IMAGE_H__
00024 #define __MYGUI_STATIC_IMAGE_H__
00025 
00026 #include "MyGUI_Prerequest.h"
00027 #include "MyGUI_Widget.h"
00028 #include "MyGUI_ResourceImageSet.h"
00029 #include "MyGUI_ImageInfo.h"
00030 #include "MyGUI_Guid.h"
00031 
00032 namespace MyGUI
00033 {
00034 
00035     class MYGUI_EXPORT StaticImage :
00036         public Widget
00037     {
00038         MYGUI_RTTI_DERIVED( StaticImage );
00039 
00040     public:
00041         StaticImage();
00042 
00043         //------------------------------------------------------------------------------//
00044         // The simple interface
00045         //------------------------------------------------------------------------------//
00046 
00047         /* Set texture and size of image _tile
00048             @param _texture file name or texture name
00049             @param _coord - part of texture where we take tiles
00050             @param _tile size
00051         */
00052         void setImageInfo(const std::string& _texture, const IntCoord& _coord, const IntSize& _tile);
00053 
00054         /* Set texture
00055             @param _texture file name or texture name
00056         */
00057         void setImageTexture(const std::string& _value);
00058 
00060         void setImageRect(const IntRect& _value);
00061 
00063         void setImageCoord(const IntCoord& _value);
00064 
00066         void setImageTile(const IntSize& _value);
00067 
00080         void setImageIndex(size_t _index);
00082         size_t getImageIndex();
00083 
00085         void setImageRot(const float angle);
00086 
00088         void setImageRotCenter(const IntPoint &_center);
00089 
00090         //------------------------------------------------------------------------------//
00091         // The expanded interface
00092         //------------------------------------------------------------------------------//
00093 
00095         size_t getItemCount() { return mItems.size(); }
00096 
00098         void setItemSelect(size_t _index);
00100         size_t getItemSelect() { return mIndexSelect; }
00102         void resetItemSelect() { setItemSelect(ITEM_NONE); }
00103 
00105         void insertItem(size_t _index, const IntCoord& _item);
00107         void addItem(const IntCoord& _item) { insertItem(ITEM_NONE, _item); }
00109         void setItem(size_t _index, const IntCoord& _item);
00110 
00112         void deleteItem(size_t _index);
00114         void deleteAllItems();
00115 
00116         // работа с фреймами анимированных индексов
00121         void addItemFrame(size_t _index, const IntCoord& _item);
00122 
00128         void insertItemFrame(size_t _index, size_t _indexFrame, const IntCoord& _item);
00129 
00134         void addItemFrameDublicate(size_t _index, size_t _indexSourceFrame);
00135 
00141         void insertItemFrameDublicate(size_t _index, size_t _indexFrame, size_t _indexSourceFrame);
00142 
00148         void setItemFrame(size_t _index, size_t _indexFrame, const IntCoord& _item);
00149 
00154         void deleteItemFrame(size_t _index, size_t _indexFrame);
00155 
00159         void deleteAllItemFrames(size_t _index);
00160 
00165         void setItemFrameRate(size_t _index, float _rate);
00166 
00170         float getItemFrameRate(size_t _index);
00171 
00172         //------------------------------------------------------------------------------//
00173         // The interface with support of resources
00174         //------------------------------------------------------------------------------//
00175 
00180         bool setItemResource(const Guid& _id);
00181 
00186         bool setItemResource(const std::string& _name);
00187 
00189         void setItemGroup(const std::string& _value);
00191         void setItemName(const std::string& _value);
00192 
00196         void setItemResourcePtr(ResourceImageSetPtr _resource);
00198         void setItemResourceInfo(const ImageIndexInfo& _info);
00199 
00201         ResourceImageSetPtr getItemResource() { return mResource; }
00203         void setItemResourceInfo(ResourceImageSetPtr _resource, const std::string& _group, const std::string& _name);
00204 
00206         virtual void setProperty(const std::string& _key, const std::string& _value);
00207 
00208     /*internal:*/
00209         virtual void _initialise(WidgetStyle _style, const IntCoord& _coord, Align _align, ResourceSkin* _info, WidgetPtr _parent, ICroppedRectangle * _croppedParent, IWidgetCreator * _creator, const std::string& _name);
00210 
00211     protected:
00212         virtual ~StaticImage();
00213 
00214         void baseChangeWidgetSkin(ResourceSkin* _info);
00215 
00216     private:
00217         void initialiseWidgetSkin(ResourceSkin* _info);
00218         void shutdownWidgetSkin();
00219 
00220         void frameEntered(float _frame);
00221 
00222         void recalcIndexes();
00223         void updateSelectIndex(size_t _index);
00224 
00225         void frameAdvise(bool _advise);
00226 
00227     private:
00228         // кусок в текстуре наших картинок
00229         IntRect mRectImage;
00230         // размер одной картинки
00231         IntSize mSizeTile;
00232         // размер текстуры
00233         IntSize mSizeTexture;
00234         // текущая картинка
00235         size_t mIndexSelect;
00236 
00237         VectorImages mItems;
00238 
00239         bool mFrameAdvise;
00240         float mCurrentTime;
00241         size_t mCurrentFrame;
00242 
00243         ResourceImageSetPtr mResource;
00244         std::string mItemName;
00245         std::string mItemGroup;
00246         std::string mCurrentTextureName;
00247 
00248     }; // class StaticImage : public Widget
00249 
00250 } // namespace MyGUI
00251 
00252 #endif // __MYGUI_STATIC_IMAGE_H__

Generated on Sun Jan 30 2011 for MyGUI by  doxygen 1.7.1