Main Page | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals

xbox.cpp

Go to the documentation of this file.
00001 #include "SdlArs.h"
00002 
00003 namespace Ars
00004 {
00005 
00006 XBox::XBox( void )
00007 {
00008 }
00009 
00010 XBox::~XBox( void )
00011 {
00012 }
00013 
00014 void XBox::Draw( void ) 
00015 {
00016         Window::Draw();
00017 
00018         if( GetGDI() )
00019         {
00020                 XRect   r( GetWindowRect() );
00021                 if( GetStates() & S_OUTLINED )
00022                 {
00023                         DrawRect( r , false , GetBorderColor() , GetBorderColor() );
00024                         r.Grow( -3 );
00025                 }
00026                 if( (GetStates() & S_SHADOWED) == S_SHADOWED && (GetStates() & S_SELECTED) != S_SELECTED )
00027                 {
00028                         RGBColor        b = GetBgColor().FadeColor( -32 );
00029                         for( int i = 0 ; i < 3 ; i++ )
00030                         {
00031                                 DrawVLine( r.y + 6 - i , r.Bottom() - i , r.Right() - i , GetBgColor().FadeColor( -16 - 16 * i ) );
00032                                 DrawHLine( r.x + 6 - i , r.Right() - i , r.Bottom() - i , GetBgColor().FadeColor( -16 - 16 * i ) );
00033                         }
00034                         r.Grow( -3 );
00035                         DrawRect( r , false , GetBorderColor() , GetBorderColor() );
00036                 }
00037                 if( GetStates() & S_BORDER )
00038                 {
00039                         DrawRect( r , false , GetBorderColor() , GetBorderColor() );
00040                         r.Grow( -1 );
00041                 }
00042                 if( GetStates() & S_FOCUS )
00043                 {
00044                         r.Grow( -2 );
00045                         DrawFocus( r , GetBorderColor() );
00046                         r.Grow( 2 );
00047                 }
00048                 if( (GetStates() & S_RAISED) == S_RAISED && (GetStates() & S_SELECTED) != S_SELECTED )
00049                 {
00050                         DrawRaised( r , GetBgColor() );
00051                 }
00052                 if( (GetStates() & S_SUNKEN) == S_SUNKEN && (GetStates() & S_SELECTED) != S_SELECTED )
00053                 {
00054                         DrawSunken( r , GetBgColor() );
00055                 }
00056 
00057                 //      Adapt the client rect to the inner box without the border...
00058 /*
00059                 if( r.Width() != clientRect.Width() )
00060                 {
00061                         XRect   &c = clientRect;
00062                         c.x = r.x - x;
00063                         c.y = r.y - y;
00064                         c.w = r.Width();
00065                         c.h = r.Height();
00066                 }
00067 */
00068         }
00069 
00070 }
00071 
00072 void XBox::DrawFocus( const XRect &r , RGBColor c )
00073 {
00074         for( int i = r.x + 1 ; i < r.Right() ; i += 2 ) 
00075         {
00076                 DrawPoint( XPoint( i , r.y ) , c );
00077                 DrawPoint( XPoint( i , r.Bottom() ) , c );
00078         }
00079         for( i = r.y + 1 ; i < r.Bottom() ; i += 2 ) 
00080         {
00081                 DrawPoint( XPoint( r.x , i ) , c );
00082                 DrawPoint( XPoint( r.Right() , i ) , c );
00083         }
00084 }
00085 
00086 void XBox::DrawRaised( const XRect &r , const RGBColor &c ) 
00087 {
00088         DrawHLine( r.x + 1 , r.Right() - 1 , r.y , c.FadeColor( 32 ) );
00089         DrawVLine( r.y + 1 , r.Bottom() - 1 , r.x , c.FadeColor( 32 ) );
00090         DrawHLine( r.x + 1 , r.Right() - 1 , r.Bottom() , c.FadeColor( -32 ) );
00091         DrawVLine( r.y + 1 , r.Bottom() - 1 , r.Right() , c.FadeColor(  -32 ) );
00092         DrawPoint( r.TopLeft() , c.FadeColor( 64 )  );
00093         DrawPoint( r.TopRight() , c  );
00094         DrawPoint( r.BottomLeft() , c );
00095         DrawPoint( r.BottomRight() , c.FadeColor( -64 )  );
00096 }
00097 
00098 void XBox::DrawSunken( const XRect &r , const RGBColor &c ) 
00099 {
00100         DrawHLine( r.x + 1 , r.Right() - 1 , r.y , c.FadeColor(  -32 ) );
00101         DrawVLine( r.y + 1 , r.Bottom() - 1 , r.x , c.FadeColor( -32 ) );
00102         DrawHLine( r.x + 1 , r.Right() - 1 , r.Bottom() , c.FadeColor( 32 ) );
00103         DrawVLine( r.y + 1 , r.Bottom() - 1 , r.Right() , c.FadeColor( 32 ) );
00104         DrawPoint( r.TopLeft() , c.FadeColor( -64 )  );
00105         DrawPoint( r.TopRight() , c  );
00106         DrawPoint( r.BottomLeft() , c );
00107         DrawPoint( r.BottomRight() , c.FadeColor( 64 )  );
00108 }
00109 
00110 }

Generated on Fri Dec 5 04:06:00 2003 for Borqueror by doxygen 1.3.3