00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef _CEGUIStaticImage_h_
00027 #define _CEGUIStaticImage_h_
00028
00029 #include "elements/CEGUIStatic.h"
00030 #include "CEGUIRenderableImage.h"
00031 #include "elements/CEGUIStaticImageProperties.h"
00032
00033
00034 #if defined(_MSC_VER)
00035 # pragma warning(push)
00036 # pragma warning(disable : 4251)
00037 #endif
00038
00039
00040
00041 namespace CEGUI
00042 {
00050 class CEGUIEXPORT StaticImage : public Static
00051 {
00052 public:
00053 static const String EventNamespace;
00054
00055
00056
00057
00058
00063 enum HorzFormatting
00064 {
00065 LeftAligned,
00066 RightAligned,
00067 HorzCentred,
00068 HorzStretched,
00069 HorzTiled
00070 };
00071
00072
00077 enum VertFormatting
00078 {
00079 TopAligned,
00080 BottomAligned,
00081 VertCentred,
00082 VertStretched,
00083 VertTiled
00084 };
00085
00086
00087
00088
00089
00094 StaticImage(const String& type, const String& name);
00095
00096
00101 virtual ~StaticImage(void);
00102
00103
00104
00105
00106
00114 const Image* getImage(void) const {return d_image.getImage();}
00115
00116
00124 ColourRect getImageColours(void) const {return d_imageCols;}
00125
00126
00134 HorzFormatting getHorizontalFormatting(void) const {return (HorzFormatting)d_image.getHorzFormatting();}
00135
00136
00144 VertFormatting getVerticalFormatting(void) const {return (VertFormatting)d_image.getVertFormatting();}
00145
00146
00147
00148
00149
00160 void setImage(const Image* image);
00161
00162
00178 void setImage(const String& imageset, const String& image);
00179
00180
00191 void setImageColours(const ColourRect& colours);
00192
00193
00213 void setImageColours(const colour& top_left_colour, const colour& top_right_colour, const colour& bottom_left_colour, const colour& bottom_right_colour);
00214
00215
00226 void setImageColours(const colour& col) {setImageColours(col, col, col, col);}
00227
00228
00242 void setFormatting(HorzFormatting h_fmt, VertFormatting v_fmt);
00243
00244
00255 void setVerticalFormatting(VertFormatting v_fmt);
00256
00257
00268 void setHorizontalFormatting(HorzFormatting h_fmt);
00269
00270
00271 protected:
00272
00273
00274
00275 virtual void populateRenderCache();
00276
00277
00278
00279
00280
00281 virtual void onSized(WindowEventArgs& e);
00282 virtual void onAlphaChanged(WindowEventArgs& e);
00283 virtual void onStaticFrameChanged(WindowEventArgs& e);
00284
00285
00286
00287
00288
00294 void updateRenderableImageColours(void);
00295
00296
00307 virtual bool testClassName_impl(const String& class_name) const
00308 {
00309 if (class_name==(const utf8*)"StaticImage") return true;
00310 return Static::testClassName_impl(class_name);
00311 }
00312
00313
00314
00315
00316
00317 RenderableImage d_image;
00318 ColourRect d_imageCols;
00319
00320
00321 private:
00322
00323
00324
00325 static StaticImageProperties::Image d_imageProperty;
00326 static StaticImageProperties::ImageColours d_imageColoursProperty;
00327 static StaticImageProperties::VertFormatting d_vertFormattingProperty;
00328 static StaticImageProperties::HorzFormatting d_horzFormattingProperty;
00329
00330
00331
00332
00333
00334 void addStaticImageProperties(void);
00335 };
00336
00337 }
00338
00339 #if defined(_MSC_VER)
00340 # pragma warning(pop)
00341 #endif
00342
00343 #endif // end of guard _CEGUIStaticImage_h_