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 CEGUIEXPORT 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 HorzJustified,
00065 WordWrapLeftAligned,
00066 WordWrapRightAligned,
00067 WordWrapCentred,
00068 WordWrapJustified
00069 };
00070
00071
00076 enum VertFormatting
00077 {
00078 TopAligned,
00079 BottomAligned,
00080 VertCentred
00081 };
00082
00083
00084
00085
00086
00091 StaticText(const String& type, const String& name);
00092
00093
00098 virtual ~StaticText(void);
00099
00100
00101
00102
00103
00111 ColourRect getTextColours(void) const {return d_textCols;}
00112
00113
00121 HorzFormatting getHorizontalFormatting(void) const {return d_horzFormatting;}
00122
00123
00131 VertFormatting getVerticalFormatting(void) const {return d_vertFormatting;}
00132
00133
00142 bool isVerticalScrollbarEnabled(void) const;
00143
00144
00153 bool isHorizontalScrollbarEnabled(void) const;
00154
00155
00156
00157 virtual Rect getUnclippedInnerRect(void) const;
00158
00159
00160
00161
00162
00173 virtual void initialise(void);
00174
00175
00186 void setTextColours(const ColourRect& colours);
00187
00188
00208 void setTextColours(const colour& top_left_colour, const colour& top_right_colour, const colour& bottom_left_colour, const colour& bottom_right_colour);
00209
00210
00221 void setTextColours(const colour& col) {setTextColours(col, col, col, col);}
00222
00223
00237 void setFormatting(HorzFormatting h_fmt, VertFormatting v_fmt);
00238
00239
00250 void setVerticalFormatting(VertFormatting v_fmt);
00251
00252
00263 void setHorizontalFormatting(HorzFormatting h_fmt);
00264
00265
00274 void setVerticalScrollbarEnabled(bool setting);
00275
00276
00285 void setHorizontalScrollbarEnabled(bool setting);
00286
00287
00288 protected:
00289
00290
00291
00292 virtual void populateRenderCache();
00293
00294
00295
00296
00297
00298 virtual void onTextChanged(WindowEventArgs& e);
00299 virtual void onSized(WindowEventArgs& e);
00300 virtual void onFontChanged(WindowEventArgs& e);
00301 virtual void onMouseWheel(MouseEventArgs& e);
00302
00303
00304
00305
00306
00315 virtual Rect getTextRenderArea(void) const;
00316
00317
00322 void configureScrollbars(void);
00323
00324
00335 virtual bool testClassName_impl(const String& class_name) const
00336 {
00337 if (class_name==(const utf8*)"StaticText") return true;
00338 return Static::testClassName_impl(class_name);
00339 }
00340
00341
00342
00343
00344
00355 virtual Scrollbar* createVertScrollbar(const String& name) const = 0;
00356
00357
00368 virtual Scrollbar* createHorzScrollbar(const String& name) const = 0;
00369
00370
00371
00372
00373
00374 bool handleScrollbarChange(const EventArgs& e);
00375
00376
00377
00378
00379
00380 HorzFormatting d_horzFormatting;
00381 VertFormatting d_vertFormatting;
00382 ColourRect d_textCols;
00383 Scrollbar* d_vertScrollbar;
00384 Scrollbar* d_horzScrollbar;
00385 bool d_enableVertScrollbar;
00386 bool d_enableHorzScrollbar;
00387
00388 private:
00389
00390
00391
00392 static StaticTextProperties::TextColours d_textColoursProperty;
00393 static StaticTextProperties::VertFormatting d_vertFormattingProperty;
00394 static StaticTextProperties::HorzFormatting d_horzFormattingProperty;
00395 static StaticTextProperties::VertScrollbar d_vertScrollbarProperty;
00396 static StaticTextProperties::HorzScrollbar d_horzScrollbarProperty;
00397
00398
00399
00400
00401
00402 void addStaticTextProperties(void);
00403 };
00404
00405 }
00406
00407 #if defined(_MSC_VER)
00408 # pragma warning(pop)
00409 #endif
00410
00411 #endif // end of guard _CEGUIStaticText_h_