00001 #ifndef OSDL_TEXT_WIDGET_H_
00002 #define OSDL_TEXT_WIDGET_H_
00003
00004
00005 #include "OSDLBackBufferedWidget.h"
00006 #include "OSDLFont.h"
00007
00008 #include <string>
00009
00010
00011
00012 namespace OSDL
00013 {
00014
00015 namespace Video
00016 {
00017
00018
00019 namespace TwoDimensional
00020 {
00021
00022
00023 namespace Text
00024 {
00025
00026
00027 class Font ;
00028
00029 }
00030
00031
00032
00041 class OSDL_DLL TextWidget : public BackBufferedWidget
00042 {
00043
00044
00045 public:
00046
00047
00055 enum Shape { SquareCorners, RoundCorners } ;
00056
00057
00059 static const Length DefaultEdgeWidth ;
00060
00061
00166 TextWidget( Surface & container,
00167 const Point2D & relativePosition,
00168 Length width,
00169 Length maximumHeight,
00170 Shape shape,
00171 Pixels::ColorDefinition textColor,
00172 Pixels::ColorDefinition edgeColor,
00173 Pixels::ColorDefinition backgroundColor,
00174 const std::string & text,
00175 Text::Font & font,
00176 bool minimumHeight = true,
00177 bool verticallyAligned = true,
00178 bool justified = true,
00179 Text::Font::RenderQuality quality = Text::Font::Blended,
00180 const std::string & title = "",
00181 bool minMaximizable = false,
00182 bool draggable = false,
00183 bool wrappable = false,
00184 bool closable = false ) throw( VideoException ) ;
00185
00186
00188 virtual ~TextWidget() throw() ;
00189
00190
00198 virtual void setText( const std::string & newText )
00199 throw() ;
00200
00201
00207 virtual const std::string & getText() const throw() ;
00208
00209
00223 virtual Text::TextIndex getRenderIndex() const throw() ;
00224
00225
00234 virtual void redrawBackBuffer() throw() ;
00235
00236
00249 virtual const std::string toString(
00250 Ceylan::VerbosityLevels level = Ceylan::high )
00251 const throw() ;
00252
00253
00254
00255 protected:
00256
00257
00263 virtual void updateClientArea() throw() ;
00264
00265
00267 static const Length _TextWidthOffset ;
00268
00270 static const Length _TextHeightOffset ;
00271
00272
00278 Length _minimumHeight ;
00279
00280
00282 Length _maximumHeight ;
00283
00284
00286 Shape _shape ;
00287
00289 Pixels::ColorDefinition _textColor ;
00290
00292 Pixels::ColorDefinition _edgeColor ;
00293
00294
00300 Pixels::ColorDefinition _backColorForRoundCorners ;
00301
00302
00311 Length _roundOffset ;
00312
00313
00315 std::string _text ;
00316
00318 Text::Font * _font ;
00319
00320
00322 bool _verticallyAligned ;
00323
00325 bool _justified ;
00326
00327
00328
00330 Text::Font::RenderQuality _quality ;
00331
00332
00339 Text::TextIndex _currentIndex ;
00340
00341
00342
00343
00344 private:
00345
00346
00355 explicit TextWidget( const TextWidget & source ) throw() ;
00356
00357
00366 TextWidget & operator = ( const TextWidget & source )
00367 throw() ;
00368
00369
00370 } ;
00371
00372 }
00373
00374 }
00375
00376 }
00377
00378
00379 #endif // OSDL_TEXT_WIDGET_H_
00380