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 _CEGUIStatic_h_
00027 #define _CEGUIStatic_h_
00028
00029 #include "CEGUIBase.h"
00030 #include "CEGUIWindow.h"
00031 #include "CEGUIRenderableFrame.h"
00032 #include "elements/CEGUIStaticProperties.h"
00033
00034
00035 #if defined(_MSC_VER)
00036 # pragma warning(push)
00037 # pragma warning(disable : 4251)
00038 #endif
00039
00040
00041
00042 namespace CEGUI
00043 {
00048 class CEGUIEXPORT Static : public Window
00049 {
00050 public:
00051 static const String EventNamespace;
00052
00053
00054
00055
00056
00064 bool isFrameEnabled(void) const {return d_frameEnabled;}
00065
00066
00074 bool isBackgroundEnabled(void) const {return d_backgroundEnabled;}
00075
00076
00084 ColourRect getFrameColours(void) const {return d_frameCols;}
00085
00086
00094 ColourRect getBackgroundColours(void) const {return d_backgroundCols;}
00095
00096
00097
00098 virtual Rect getUnclippedInnerRect(void) const;
00099
00100
00112 const Image* getImageForFrameLocation(FrameLocation location) const;
00113
00114
00123 const Image* getBackgroundImage(void) const;
00124
00125
00126
00127
00128
00138 void setFrameEnabled(bool setting);
00139
00140
00172 void setFrameImages(const Image* topleft, const Image* topright, const Image* bottomleft, const Image* bottomright, const Image* left, const Image* top, const Image* right, const Image* bottom);
00173
00174
00185 void setFrameColours(const ColourRect& colours);
00186
00187
00207 void setFrameColours(const colour& top_left_colour, const colour& top_right_colour, const colour& bottom_left_colour, const colour& bottom_right_colour);
00208
00209
00220 void setFrameColours(const colour& col) {setFrameColours(col, col, col, col);}
00221
00222
00230 void setBackgroundEnabled(bool setting);
00231
00232
00243 void setBackgroundImage(const Image* image);
00244
00245
00261 void setBackgroundImage(const String& imageset, const String& image);
00262
00263
00274 void setBackgroundColours(const ColourRect& colours);
00275
00276
00296 void setBackgroundColours(const colour& top_left_colour, const colour& top_right_colour, const colour& bottom_left_colour, const colour& bottom_right_colour);
00297
00298
00309 void setBackgroundColours(const colour& col) {setBackgroundColours(col, col, col, col);}
00310
00311
00326 void setImageForFrameLocation(FrameLocation location, const Image* image);
00327
00328
00329
00330
00331
00336 Static(const String& type, const String& name);
00337
00338
00343 virtual ~Static(void);
00344
00345
00346 protected:
00347
00348
00349
00350 virtual void populateRenderCache();
00351
00352
00353
00354
00355
00356 virtual void onSized(WindowEventArgs& e);
00357 virtual void onAlphaChanged(WindowEventArgs& e);
00358
00359
00360
00361
00362
00368 void updateRenderableFrameColours(void);
00369
00370
00375 colour calculateModulatedAlphaColour(const colour& col, float alpha) const;
00376
00377
00385 virtual void onStaticFrameChanged(WindowEventArgs& e) {}
00386
00387
00398 virtual bool testClassName_impl(const String& class_name) const
00399 {
00400 if (class_name==(const utf8*)"Static") return true;
00401 return Window::testClassName_impl(class_name);
00402 }
00403
00404
00405
00406
00407 bool d_frameEnabled;
00408 ColourRect d_frameCols;
00409 RenderableFrame d_frame;
00410 bool d_backgroundEnabled;
00411 ColourRect d_backgroundCols;
00412 const Image* d_background;
00413
00414
00415 float d_left_width;
00416 float d_right_width;
00417 float d_top_height;
00418 float d_bottom_height;
00419
00420
00421 private:
00422
00423
00424
00425 static StaticProperties::FrameEnabled d_frameEnabledProperty;
00426 static StaticProperties::BackgroundEnabled d_backgroundEnabledProperty;
00427 static StaticProperties::FrameColours d_frameColoursProperty;
00428 static StaticProperties::BackgroundColours d_backgroundColoursProperty;
00429 static StaticProperties::BackgroundImage d_backgroundImageProperty;
00430 static StaticProperties::TopLeftFrameImage d_topLeftFrameProperty;
00431 static StaticProperties::TopRightFrameImage d_topRightFrameProperty;
00432 static StaticProperties::BottomLeftFrameImage d_bottomLeftFrameProperty;
00433 static StaticProperties::BottomRightFrameImage d_bottomRightFrameProperty;
00434 static StaticProperties::LeftFrameImage d_leftFrameProperty;
00435 static StaticProperties::RightFrameImage d_rightFrameProperty;
00436 static StaticProperties::TopFrameImage d_topFrameProperty;
00437 static StaticProperties::BottomFrameImage d_bottomFrameProperty;
00438
00439
00440
00441
00442
00443 void addStaticProperties(void);
00444 };
00445
00446
00447 }
00448
00449 #if defined(_MSC_VER)
00450 # pragma warning(pop)
00451 #endif
00452
00453 #endif // end of guard _CEGUIStatic_h_