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 _CEGUIStaticText_h_
00027 #define _CEGUIStaticText_h_
00028
00029 #include "elements/CEGUIStatic.h"
00030 #include "elements/CEGUIStaticTextProperties.h"
00031
00032
00033 #if defined(_MSC_VER)
00034 # pragma warning(push)
00035 # pragma warning(disable : 4251)
00036 #endif
00037
00038
00039
00040 namespace CEGUI
00041 {
00046 class CEGUIBASE_API StaticText : public Static
00047 {
00048 public:
00049 static const String EventNamespace;
00050
00051
00052
00053
00054
00059 enum HorzFormatting
00060 {
00061 LeftAligned,
00062 RightAligned,
00063 HorzCentred,
00064 WordWrapLeftAligned,
00065 WordWrapRightAligned,
00066 WordWrapCentred,
00067 };
00068
00069
00074 enum VertFormatting
00075 {
00076 TopAligned,
00077 BottomAligned,
00078 VertCentred,
00079 };
00080
00081
00082
00083
00084
00089 StaticText(const String& type, const String& name);
00090
00091
00096 virtual ~StaticText(void);
00097
00098
00099
00100
00101
00109 ColourRect getTextColours(void) const {return d_textCols;}
00110
00111
00119 HorzFormatting getHorizontalFormatting(void) const {return d_horzFormatting;}
00120
00121
00129 VertFormatting getVerticalFormatting(void) const {return d_vertFormatting;}
00130
00131
00140 bool isVerticalScrollbarEnabled(void) const;
00141
00142
00151 bool isHorizontalScrollbarEnabled(void) const;
00152
00153
00154
00155 virtual Rect getUnclippedInnerRect(void) const;
00156
00157
00158
00159
00160
00171 virtual void initialise(void);
00172
00173
00184 void setTextColours(const ColourRect& colours);
00185
00186
00206 void setTextColours(const colour& top_left_colour, const colour& top_right_colour, const colour& bottom_left_colour, const colour& bottom_right_colour);
00207
00208
00219 void setTextColours(const colour& col) {setTextColours(col, col, col, col);}
00220
00221
00235 void setFormatting(HorzFormatting h_fmt, VertFormatting v_fmt);
00236
00237
00248 void setVerticalFormatting(VertFormatting v_fmt);
00249
00250
00261 void setHorizontalFormatting(HorzFormatting h_fmt);
00262
00263
00272 void setVerticalScrollbarEnabled(bool setting);
00273
00274
00283 void setHorizontalScrollbarEnabled(bool setting);
00284
00285
00286 protected:
00287
00288
00289
00300 virtual void drawSelf(float z);
00301
00302
00303
00304
00305
00306 virtual void onTextChanged(WindowEventArgs& e);
00307 virtual void onSized(WindowEventArgs& e);
00308 virtual void onFontChanged(WindowEventArgs& e);
00309 virtual void onMouseWheel(MouseEventArgs& e);
00310
00311
00312
00313
00314
00323 virtual Rect getTextRenderArea(void) const;
00324
00325
00333 virtual void layoutComponentWidgets();
00334
00335
00340 void configureScrollbars(void);
00341
00342
00343
00344
00345
00353 virtual Scrollbar* createVertScrollbar(void) const = 0;
00354
00355
00363 virtual Scrollbar* createHorzScrollbar(void) const = 0;
00364
00365
00366
00367
00368
00369 bool handleScrollbarChange(const EventArgs& e);
00370
00371
00372
00373
00374
00375 HorzFormatting d_horzFormatting;
00376 VertFormatting d_vertFormatting;
00377 ColourRect d_textCols;
00378 Scrollbar* d_vertScrollbar;
00379 Scrollbar* d_horzScrollbar;
00380 bool d_enableVertScrollbar;
00381 bool d_enableHorzScrollbar;
00382
00383 private:
00384
00385
00386
00387 static StaticTextProperties::TextColours d_textColoursProperty;
00388 static StaticTextProperties::VertFormatting d_vertFormattingProperty;
00389 static StaticTextProperties::HorzFormatting d_horzFormattingProperty;
00390 static StaticTextProperties::VertScrollbar d_vertScrollbarProperty;
00391 static StaticTextProperties::HorzScrollbar d_horzScrollbarProperty;
00392
00393
00394
00395
00396
00397 void addStaticTextProperties(void);
00398 };
00399
00400 }
00401
00402 #if defined(_MSC_VER)
00403 # pragma warning(pop)
00404 #endif
00405
00406 #endif // end of guard _CEGUIStaticText_h_