OSDLWidget.h

Go to the documentation of this file.
00001 #ifndef OSDL_WIDGET_H_
00002 #define OSDL_WIDGET_H_
00003 
00004 
00005 #include "OSDLSurface.h"   // for Surface, SurfaceEvent
00006 #include "OSDLPixel.h"     // for ColorDefinition
00007 #include "OSDLPoint2D.h"   // for Point2D
00008 #include "OSDLFont.h"      // for HorizontalAlignment, etc.
00009 
00010 
00011 #include "Ceylan.h"        // for EventSource
00012 
00013 
00014 #include <string>
00015 
00016 
00017 
00018 namespace OSDL
00019 {
00020 
00021     namespace Video
00022     {
00023         
00024         namespace TwoDimensional
00025         {
00026 
00027     
00028 
00034             class OSDL_DLL RedrawRequestEvent : public SurfaceEvent
00035             {
00036                 public:
00037                 
00038                     RedrawRequestEvent( Ceylan::EventSource & source ) throw() ;
00039                     virtual  ~RedrawRequestEvent() throw() ;
00040             } ;
00041 
00042 
00043 
00044             /* To be added later, maybe :
00045             class OSDL_DLL WidgetSettings : public Ceylan::TextDisplayable
00046             {
00047             
00048                 public:
00049                 
00050                     WidgetSettings() throw() ;
00051                     virtual ~WidgetSettings() throw() ;
00052                 private:
00053                 
00054             } ;
00055 
00056             */
00057 
00058 
00122             class OSDL_DLL Widget : public Surface, 
00123                 public Ceylan::EventListener
00124             {
00125             
00126                     
00127                 public:
00128                         
00129             
00144                     enum BaseColorMode { 
00145                         BackgroundColor, 
00146                         Colorkey, 
00147                         None, 
00148                         NotInitialized } ;
00149                     
00150                     
00151                     
00233                      Widget( 
00234                         Surface & container, 
00235                         const Point2D & relativePosition,
00236                         Length width, Length height,
00237                         BaseColorMode baseColorMode, 
00238                         Pixels::ColorDefinition baseColor,
00239                         const std::string & title = "",
00240                         bool minMaximizable = true, bool draggable = true, 
00241                         bool wrappable = true, bool closable = true ) 
00242                             throw( VideoException ) ;
00243                                 
00244                             
00246                      virtual ~Widget() throw() ;
00247                         
00248                         
00249                         
00250                      // Resize section.
00251                      
00252                             
00263                      virtual void setWidth( Length newWidth ) throw() ;
00264                 
00265                 
00276                      virtual void setHeight( Length newHeight ) throw() ;
00277                      
00278 
00300                     virtual void resize( Length newWidth, Length newHeight, 
00301                         bool ignored = false ) throw() ;
00302                       
00303                     
00304                     
00305                     // Base color (color key and background color) section.
00306                     
00307                       
00312                     virtual BaseColorMode getBaseColorMode() const throw() ;   
00313                     
00314                     
00335                     virtual void setBaseColorMode( 
00336                             BaseColorMode newBaseColorMode,
00337                             Pixels::ColorDefinition newBaseColor ) 
00338                         throw( VideoException ) ;
00339                     
00340                      
00341                      
00346                     virtual Pixels::ColorDefinition getBaseColor() 
00347                         const throw() ;
00348                                             
00349                     
00350                     /*
00351                      * No setBaseColor since it has to be modified thanks to
00352                      * 'setBaseColorMode'.
00353                      *
00354                      */
00355                                 
00356                                 
00357                                      
00366                     virtual void setDecorationStatus( 
00367                         bool newDecorationStatus ) throw() ; 
00368                      
00369                      
00370                      
00383                     virtual const UprightRectangle & getClientArea() 
00384                         const throw() ; 
00385                     
00386                                         
00396                     virtual bool clean() throw() ; 
00397                            
00398                            
00407                     virtual void beNotifiedOf( const Ceylan::Event & newEvent )
00408                         throw() ;
00409                         
00410 
00418                     virtual void setRedrawState( bool needsToBeRedrawn ) 
00419                         throw() ;
00420                                      
00421                                          
00432                     virtual void redraw() throw() ;
00433                 
00434                                             
00453                     virtual void redrawInternal() throw() ;
00454             
00455                     
00468                     virtual const std::string toString( 
00469                             Ceylan::VerbosityLevels level = Ceylan::high ) 
00470                         const throw() ;
00471                 
00472                 
00473                 
00474                     // Static section.
00475                 
00476                 
00482                     static Pixels::ColorDefinition GetEdgeColor() throw() ;
00483                     
00484                     
00492                     static void SetEdgeColor( 
00493                         Pixels::ColorDefinition edgeColorDef ) throw() ;
00494                     
00495                         
00496                             
00497                                             
00498                 protected:
00499                         
00500     
00501     
00507                     virtual void updateDecorationFlag() throw() ;
00508                                                 
00509                     
00515                     virtual void updateClientArea() throw() ;
00516                         
00517                         
00525                     virtual Surface & getContainer() throw() ;
00526                                 
00527                                                                 
00540                     virtual const Surface & getConstContainer() const throw() ;
00541                                                                 
00542                     
00554                     virtual void drawFundamentals( Surface & targetSurface )
00555                         throw() ;
00556                     
00557                     
00566                     virtual bool isDecorated() const throw() ;      
00567                     
00568                     
00582                     virtual void drawDecorations( Surface & targetSurface )
00583                         throw() ;
00584                             
00585                             
00586                             
00587                             
00588                     // Attributes section.      
00589                     
00590                     
00596                     Point2D _upperLeftCorner ;      
00597 
00598 
00607                     UprightRectangle _clientArea ;
00608                     
00609                                         
00610 
00616                     bool _decorated ;
00617                     
00618                     
00620                     std::string _title ;
00621 
00622 
00632                     bool _minMaximizable ;      
00633 
00634                             
00643                     bool _draggable ;       
00644                         
00645                                                                     
00655                     bool _wrappable ;       
00656                                                                     
00657                             
00666                     bool _closable ;        
00667     
00668     
00676                     bool _hasFocus ;                            
00677                     
00678                             
00679                     
00687                     BaseColorMode _baseColorMode ;
00688                     
00689                     
00698                     Pixels::ColorDefinition _baseColor ;
00699                     
00700                     
00706                     Pixels::PixelColor _actualBaseColor ;
00707                     
00708                     
00709                     /*
00710                      * Static attributes section.
00711                      *
00712                      * Most are non-const since may be modified at runtime.
00713                      *
00714                      */
00715                     
00716                     
00718                     static Pixels::ColorDefinition _EdgeColor ;
00719 
00721                     static Pixels::ColorDefinition _TitleColor ;
00722 
00723 
00729                     static Text::HorizontalAlignment _TitleHorizontalAlignment ;
00730 
00731 
00737                     static Text::VerticalAlignment _TitleVerticalAlignment ;
00738 
00739 
00740 
00746                     static Length _ClientOffsetWidth ;
00747                     
00748 
00757                     static Length _ClientOffsetHeight ;
00758                     
00759                 
00760 
00767                     static Coordinate _TitleOffsetAbscissa ;
00768                     
00769                     
00775                     static Coordinate _TitleOffsetOrdinate ;
00776                     
00777                     
00783                     static Coordinate _TitleBarOffsetOrdinate ;
00784                     
00785                     
00791                     static std::string _DefaultTitle ;
00792                     
00793                     
00794                     
00795                 private:    
00796 
00797 
00806                     explicit Widget( const Widget & source ) throw() ;
00807             
00808             
00817                     Widget & operator = ( const Widget & source ) throw() ;
00818                     
00819                     
00820             } ;         
00821                                             
00822         }
00823     
00824     }
00825 
00826 }               
00827 
00828 
00829 #endif // OSDL_WIDGET_H_
00830 

Generated on Fri Mar 30 14:47:00 2007 for OSDL by  doxygen 1.5.1