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

Ars::XBox Class Reference

#include <xbox.h>

Inheritance diagram for Ars::XBox:

Inheritance graph
[legend]
Collaboration diagram for Ars::XBox:

Collaboration graph
[legend]

Public Member Functions

 XBox (void)
 ~XBox (void)
const RGBColor GetBorderColor (void) const
void DrawFocus (const XRect &r, RGBColor c)
virtual void Draw (void)
 Renders the Window Text, and clips to the Window Rect.

virtual void DrawRaised (const XRect &r, const RGBColor &c)
virtual void DrawSunken (const XRect &r, const RGBColor &c)

Constructor & Destructor Documentation

Ars::XBox::XBox void   ) 
 

Construct a new Box

Parameters:
WindowRect A CRect that defines the outer limits of the control
aStr the rest of the resource to initialize the object

Definition at line 6 of file xbox.cpp.

00007 {
00008 }

Ars::XBox::~XBox void   ) 
 

Definition at line 10 of file xbox.cpp.

00011 {
00012 }


Member Function Documentation

void Ars::XBox::Draw void   )  [virtual]
 

Renders the Window Text, and clips to the Window Rect.

Reimplemented from Ars::Window.

Reimplemented in Ars::XButtonImage, Ars::XCheckBox, Ars::XEditBox, Ars::XGroupBox, Ars::XImage, Ars::XLabel, Ars::XListBox, Ars::XProgress, Ars::XScrollBar, and Ars::XTextBox.

Definition at line 14 of file xbox.cpp.

References Ars::XRect::Bottom(), DrawFocus(), Ars::HPaint::DrawHLine(), DrawRaised(), Ars::HPaint::DrawRect(), DrawSunken(), Ars::HPaint::DrawVLine(), Ars::RGBColor::FadeColor(), Ars::Thing::GetBgColor(), GetBorderColor(), Ars::HPaint::GetGDI(), Ars::Painter::GetStates(), Ars::Thing::GetWindowRect(), Ars::XRect::Grow(), Ars::XRect::Right(), S_BORDER, S_FOCUS, S_OUTLINED, S_RAISED, S_SELECTED, S_SHADOWED, and S_SUNKEN.

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 }

void Ars::XBox::DrawFocus const XRect r,
RGBColor  c
 

Definition at line 72 of file xbox.cpp.

References Ars::XRect::Bottom(), Ars::HPaint::DrawPoint(), and Ars::XRect::Right().

Referenced by Draw().

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 }

void Ars::XBox::DrawRaised const XRect r,
const RGBColor c
[virtual]
 

Definition at line 86 of file xbox.cpp.

References Ars::XRect::Bottom(), Ars::XRect::BottomLeft(), Ars::XRect::BottomRight(), Ars::HPaint::DrawHLine(), Ars::HPaint::DrawPoint(), Ars::HPaint::DrawVLine(), Ars::RGBColor::FadeColor(), Ars::XRect::Right(), Ars::XRect::TopLeft(), and Ars::XRect::TopRight().

Referenced by Ars::XScrollBar::Draw(), Ars::XProgress::Draw(), Ars::XGroupBox::Draw(), and Draw().

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 }

void Ars::XBox::DrawSunken const XRect r,
const RGBColor c
[virtual]
 

Definition at line 98 of file xbox.cpp.

References Ars::XRect::Bottom(), Ars::XRect::BottomLeft(), Ars::XRect::BottomRight(), Ars::HPaint::DrawHLine(), Ars::HPaint::DrawPoint(), Ars::HPaint::DrawVLine(), Ars::RGBColor::FadeColor(), Ars::XRect::Right(), Ars::XRect::TopLeft(), and Ars::XRect::TopRight().

Referenced by Ars::XGroupBox::Draw(), Ars::XCheckBox::Draw(), and Draw().

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 }

const RGBColor Ars::XBox::GetBorderColor void   )  const [inline]
 

Definition at line 16 of file xbox.h.

References Ars::Thing::GetFgColor().

Referenced by Draw().

00016 {       return GetFgColor();    }


The documentation for this class was generated from the following files:
Generated on Fri Dec 5 04:06:53 2003 for Borqueror by doxygen 1.3.3