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

xlabel.cpp

Go to the documentation of this file.
00001 #include "SdlArs.h"
00002 
00003 namespace Ars
00004 {
00005 
00006 XLabel::XLabel( void )
00007 {
00008 }       
00009 
00010 XLabel::~XLabel( void )
00011 {
00012 }
00013 
00014 const bool XLabel::SetupWindow( const Message &msg )
00015 {
00016         XBox::SetupWindow( msg );
00017 
00018         MessageServer::Instance().RegisterMessageClient( this , Message::MOUSE_MOVE );
00019         
00020         return true;
00021 }
00022 
00023 void XLabel::Draw( void )
00024 {
00025         XBox::Draw();
00026 
00027         TextOutStr( GetWindowRect() ,  GetWindowText() , GetFgColor() );
00028 }
00029 
00030 void XLabel::SetWndText( const std::string &sWindowText )
00031 {
00032         XBox::SetWndText( sWindowText );
00033 
00034         SetDirty( true );
00035 
00036         UpdateWindow();
00037 }
00038 
00039 void XLabel::AppendWindowText( const std::string &sWindowText )
00040 {
00041         SetWndText( GetWindowText() + sWindowText );
00042 }
00043 
00044 void XLabel::AdjustColors( void )
00045 {
00046         if( GetStates() & S_DISABLED )
00047                 SetFgColor( GetFgColor().FadeColor( -32 ) );
00048         else if( (GetStates() & (S_HIGHLIGHT|S_SELECTED)) != 0 )
00049                 if( GetStates() & S_INVERTONFOLLOW )
00050                 {
00051                         RGBColor        c = GetFgColor();
00052                         SetFgColor( GetBgColor() );
00053                         SetBgColor( c );
00054                 }
00055                 else
00056                         SetFgColor( GetFgColor().FadeColor( 32 ) );
00057         XBox::AdjustColors();
00058 }
00059 
00060 void XLabel::RestoreColors( void )
00061 {
00062         if( GetStates() & S_DISABLED )
00063                 SetFgColor( GetFgColor().FadeColor( 32 ) );
00064         else if( (GetStates() & (S_HIGHLIGHT|S_SELECTED)) != 0 )
00065                 if( GetStates() & S_INVERTONFOLLOW )
00066                 {
00067                         RGBColor        c = GetFgColor();
00068                         SetFgColor( GetBgColor() );
00069                         SetBgColor( c );
00070                 }
00071                 else
00072                         SetFgColor( GetFgColor().FadeColor( -32 ) );
00073 
00074         XBox::RestoreColors();
00075 }
00076 
00077 const bool XLabel::evMouseMove( const MouseMessage &msg )
00078 {
00079         bool ans = XBox::evMouseMove( msg );
00080 
00081         if( FindWindow( &msg.Point ) == this )
00082                 SetState( S_HIGHLIGHT );
00083         else
00084                 ResetState( S_HIGHLIGHT );
00085 
00086         return ans;
00087 }
00088 
00089 }
00090 

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