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_WIDGET_H_
00028 #define OSDL_WIDGET_H_
00029
00030
00031 #include "OSDLSurface.h"
00032 #include "OSDLPixel.h"
00033 #include "OSDLPoint2D.h"
00034 #include "OSDLFont.h"
00035
00036
00037 #include "Ceylan.h"
00038
00039
00040 #include <string>
00041
00042
00043
00044
00045 namespace OSDL
00046 {
00047
00048
00049
00050 namespace Video
00051 {
00052
00053
00054
00055 namespace TwoDimensional
00056 {
00057
00058
00059
00065 class OSDL_DLL RedrawRequestEvent : public SurfaceEvent
00066 {
00067 public:
00068
00069 RedrawRequestEvent( Ceylan::EventSource & source ) ;
00070
00071 virtual ~RedrawRequestEvent() throw() ;
00072 } ;
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00156 class OSDL_DLL Widget : public Surface,
00157 public Ceylan::EventListener
00158 {
00159
00160
00161 public:
00162
00163
00164
00179 enum BaseColorMode {
00180 BackgroundColor,
00181 Colorkey,
00182 None,
00183 NotInitialized } ;
00184
00185
00186
00268 Widget(
00269 Surface & container,
00270 const Point2D & relativePosition,
00271 Length width, Length height,
00272 BaseColorMode baseColorMode,
00273 Pixels::ColorDefinition baseColor,
00274 const std::string & title = "",
00275 bool minMaximizable = true, bool draggable = true,
00276 bool wrappable = true, bool closable = true ) ;
00277
00278
00279
00281 virtual ~Widget() throw() ;
00282
00283
00284
00285
00286
00287
00288
00299 virtual void setWidth( Length newWidth ) ;
00300
00301
00302
00313 virtual void setHeight( Length newHeight ) ;
00314
00315
00316
00338 virtual void resize( Length newWidth, Length newHeight,
00339 bool ignored = false ) ;
00340
00341
00342
00343
00344
00345
00346
00347
00352 virtual BaseColorMode getBaseColorMode() const ;
00353
00354
00355
00376 virtual void setBaseColorMode(
00377 BaseColorMode newBaseColorMode,
00378 Pixels::ColorDefinition newBaseColor ) ;
00379
00380
00381
00386 virtual Pixels::ColorDefinition getBaseColor() const ;
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00406 virtual void setDecorationStatus(
00407 bool newDecorationStatus ) ;
00408
00409
00410
00423 virtual const UprightRectangle & getClientArea() const ;
00424
00425
00426
00436 virtual bool clean() ;
00437
00438
00439
00448 virtual void beNotifiedOf(
00449 const Ceylan::Event & newEvent ) ;
00450
00451
00452
00460 virtual void setRedrawState( bool needsToBeRedrawn ) ;
00461
00462
00463
00474 virtual void redraw() ;
00475
00476
00477
00496 virtual void redrawInternal() ;
00497
00498
00499
00512 virtual const std::string toString(
00513 Ceylan::VerbosityLevels level = Ceylan::high ) const ;
00514
00515
00516
00517
00518
00519
00520
00521
00527 static Pixels::ColorDefinition GetEdgeColor() ;
00528
00529
00530
00538 static void SetEdgeColor(
00539 Pixels::ColorDefinition edgeColorDef ) ;
00540
00541
00542
00543
00544 protected:
00545
00546
00547
00553 virtual void updateDecorationFlag() ;
00554
00555
00556
00562 virtual void updateClientArea() ;
00563
00564
00565
00573 virtual Surface & getContainer() ;
00574
00575
00576
00589 virtual const Surface & getConstContainer() const ;
00590
00591
00592
00604 virtual void drawFundamentals( Surface & targetSurface ) ;
00605
00606
00607
00616 virtual bool isDecorated() const ;
00617
00618
00619
00633 virtual void drawDecorations( Surface & targetSurface ) ;
00634
00635
00636
00637
00638
00639
00640
00641
00647 Point2D _upperLeftCorner ;
00648
00649
00650
00659 UprightRectangle _clientArea ;
00660
00661
00662
00663
00669 bool _decorated ;
00670
00671
00672
00674 std::string _title ;
00675
00676
00677
00687 bool _minMaximizable ;
00688
00689
00690
00699 bool _draggable ;
00700
00701
00702
00712 bool _wrappable ;
00713
00714
00715
00724 bool _closable ;
00725
00726
00727
00735 bool _hasFocus ;
00736
00737
00738
00739
00747 BaseColorMode _baseColorMode ;
00748
00749
00750
00759 Pixels::ColorDefinition _baseColor ;
00760
00761
00762
00768 Pixels::PixelColor _actualBaseColor ;
00769
00770
00771
00772
00773
00774
00775
00776
00777
00778
00779
00780
00782 static Pixels::ColorDefinition _EdgeColor ;
00783
00784
00786 static Pixels::ColorDefinition _TitleColor ;
00787
00788
00789
00795 static Text::HorizontalAlignment _TitleHorizontalAlignment ;
00796
00797
00798
00804 static Text::VerticalAlignment _TitleVerticalAlignment ;
00805
00806
00807
00813 static Length _ClientOffsetWidth ;
00814
00815
00824 static Length _ClientOffsetHeight ;
00825
00826
00827
00834 static Coordinate _TitleOffsetAbscissa ;
00835
00836
00842 static Coordinate _TitleOffsetOrdinate ;
00843
00844
00845
00851 static Coordinate _TitleBarOffsetOrdinate ;
00852
00853
00854
00860 static std::string _DefaultTitle ;
00861
00862
00863
00864
00865 private:
00866
00867
00868
00877 explicit Widget( const Widget & source ) ;
00878
00879
00880
00889 Widget & operator = ( const Widget & source ) ;
00890
00891
00892 } ;
00893
00894
00895 }
00896
00897 }
00898
00899 }
00900
00901
00902
00903 #endif // OSDL_WIDGET_H_
00904