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
00027 #ifndef OSDL_TEXT_WIDGET_H_
00028 #define OSDL_TEXT_WIDGET_H_
00029
00030
00031 #include "OSDLBackBufferedWidget.h"
00032 #include "OSDLFont.h"
00033
00034 #include <string>
00035
00036
00037
00038
00039 namespace OSDL
00040 {
00041
00042
00043
00044 namespace Video
00045 {
00046
00047
00048
00049 namespace TwoDimensional
00050 {
00051
00052
00053
00054 namespace Text
00055 {
00056
00057
00058 class Font ;
00059
00060 }
00061
00062
00063
00064
00073 class OSDL_DLL TextWidget: public BackBufferedWidget
00074 {
00075
00076
00077 public:
00078
00079
00080
00088 enum Shape { SquareCorners, RoundCorners } ;
00089
00090
00091
00093 static const Length DefaultEdgeWidth ;
00094
00095
00096
00097
00202 TextWidget( Surface & container,
00203 const Point2D & relativePosition,
00204 Length width,
00205 Length maximumHeight,
00206 Shape shape,
00207 Pixels::ColorDefinition textColor,
00208 Pixels::ColorDefinition edgeColor,
00209 Pixels::ColorDefinition backgroundColor,
00210 const std::string & text,
00211 Text::Font & font,
00212 bool minimumHeight = true,
00213 bool verticallyAligned = true,
00214 bool justified = true,
00215 Text::Font::RenderQuality quality = Text::Font::Blended,
00216 const std::string & title = "",
00217 bool minMaximizable = false,
00218 bool draggable = false,
00219 bool wrappable = false,
00220 bool closable = false ) ;
00221
00222
00223
00225 virtual ~TextWidget() throw() ;
00226
00227
00228
00236 virtual void setText( const std::string & newText ) ;
00237
00238
00239
00245 virtual const std::string & getText() const ;
00246
00247
00248
00262 virtual Text::TextIndex getRenderIndex() const ;
00263
00264
00265
00274 virtual void redrawBackBuffer() ;
00275
00276
00277
00290 virtual const std::string toString(
00291 Ceylan::VerbosityLevels level = Ceylan::high ) const ;
00292
00293
00294
00295
00296 protected:
00297
00298
00299
00305 virtual void updateClientArea() ;
00306
00307
00308
00310 static const Length _TextWidthOffset ;
00311
00312
00314 static const Length _TextHeightOffset ;
00315
00316
00317
00323 Length _minimumHeight ;
00324
00325
00326
00328 Length _maximumHeight ;
00329
00330
00331
00333 Shape _shape ;
00334
00335
00337 Pixels::ColorDefinition _textColor ;
00338
00339
00341 Pixels::ColorDefinition _edgeColor ;
00342
00343
00344
00350 Pixels::ColorDefinition _backColorForRoundCorners ;
00351
00352
00353
00362 Length _roundOffset ;
00363
00364
00365
00367 std::string _text ;
00368
00369
00371 Text::Font * _font ;
00372
00373
00374
00376 bool _verticallyAligned ;
00377
00378
00380 bool _justified ;
00381
00382
00383
00384
00386 Text::Font::RenderQuality _quality ;
00387
00388
00389
00396 Text::TextIndex _currentIndex ;
00397
00398
00399
00400
00401 private:
00402
00403
00404
00413 explicit TextWidget( const TextWidget & source ) ;
00414
00415
00416
00425 TextWidget & operator = ( const TextWidget & source ) ;
00426
00427
00428 } ;
00429
00430
00431 }
00432
00433 }
00434
00435 }
00436
00437
00438
00439 #endif // OSDL_TEXT_WIDGET_H_
00440