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

Ars::Window Class Reference

#include <arswindow.h>

Inheritance diagram for Ars::Window:

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

Collaboration graph
[legend]

Public Member Functions

 Window (void)
virtual ~Window (void)
virtual const bool SetupWindow (const Message &msg)
 Deregister the setup_window message.

virtual void Init (icstring &aStr)
const bool IsVisible (void) const
virtual const bool ShowWindow (void)
 Set the visibility of the control, and all of it's children.

virtual const bool HideWindow (void)
 Set the invisibility of the control, and all of it's children.

XRect GetClientRect (void)
virtual void SetWindowRect (const XRect &WindowRect)
virtual const bool SetParent (Window *pNewParent)
virtual const bool ResetChildren (void)
 Remove all children from the list.

virtual WindowGetParent (void) const
WindowGetRoot (void) const
virtual void SetWndText (const std::string &sText)
virtual void SetWndText (const int val)
virtual std::string GetWindowText (void)
virtual void UpdateWindow (const bool aNow=false)
 sends or post a wm_paint message

virtual void DrawBG (void)
virtual void Draw (void)
 Render the control itself.

virtual void DrawChildren (void)
 Call DrawProc() for any children of the current windows.

virtual const bool DrawProc (void)
virtual const bool wmPaint (const Message &msg)
 This calls DrawProc, then updates the relevant screen area.

virtual void AdjustColors (void)
virtual void RestoreColors (void)
virtual const bool HandleMessage (const Message &msg)
virtual const bool evMouseButtonUp (const MouseMessage &msg)
virtual const bool evMouseButtonDown (const MouseMessage &msg)
WindowFindWindow (const XPoint *Pt)
const bool IsChild (Window *wnd)

Protected Member Functions

void RegisterChildWindow (Window *pWindow)
void DeregisterChildWindow (Window *pWindow)
virtual const bool DeregChild (const CtrlMessage &msg)
const bool RelposInside (const XPoint *p)

Protected Attributes

XRect clientRect
unsigned int m_MouseButton
 The last mouse button to be pushed over the control, it's used internally.


Private Attributes

bool paintAlreadySent
 set to true when a wm_paint message is sent and the paint not yet done. avoid several paint to be sent

std::string text
 The Window Text (not directly used by Window).

WindowparentWindow
 Pointer to the parent window.

XToolTiptoolTip
icstring soundName
SDL_Surface * bkgnd

Friends

class View
class XBox

Constructor & Destructor Documentation

Ars::Window::Window void   ) 
 

Definition at line 5 of file arswindow.cpp.

00006 : clientRect( 0 , 0 , 0 , 0 ) , m_MouseButton( 0 )
00007 , paintAlreadySent( false ) , parentWindow( 0 ) , bkgnd( 0 ) , toolTip( 0 )
00008 {
00009         MessageServer::Instance().RegisterMessageClient( this , Message::SETUP_WINDOW );
00010 }

Ars::Window::~Window void   )  [virtual]
 

Definition at line 12 of file arswindow.cpp.

References bkgnd, Ars::HPaint::GetGDI(), SetParent(), toolTip, and TraceIf.

00013 {
00014         MessageServer::Instance().DeregisterMessageClient( this );
00015 
00016         if( bkgnd )
00017         {       
00018                 if( GetGDI() )
00019                 {
00020                         XRect   r( 0 , 0 , bkgnd->w , bkgnd->h );
00021                         SDL_BlitSurface( bkgnd , &r , GetGDI() , static_cast<SDL_Rect *>( this ) );
00022                 }
00023                 SDL_FreeSurface( bkgnd );
00024         }
00025         bkgnd = 0;
00026 
00027         // Each child window is deleted, and should in their destructors call back to this object to Deregister themselves
00028         unsigned int iSanityCheck = static_cast<unsigned int>( size() );
00029         while( size() > 0 && iSanityCheck > 0 )
00030         {
00031                 Window  *w = *(begin());
00032                 delete w;
00033                 --iSanityCheck;
00034         }
00035         TraceIf( iSanityCheck != 0, "Sanity check failed in CWindow destructor!" );
00036         TraceIf( !empty(), "CWindow children not empty at end of destructor!" );
00037         clear();
00038         SetParent( 0 );
00039 
00040         if( toolTip )
00041                 delete toolTip;
00042         toolTip = 0;
00043 }


Member Function Documentation

virtual void Ars::Window::AdjustColors void   )  [inline, virtual]
 

Reimplemented in Ars::XLabel.

Definition at line 113 of file arswindow.h.

Referenced by DrawProc().

00113 {};

const bool Ars::Window::DeregChild const CtrlMessage msg  )  [protected, virtual]
 

Reimplemented from Ars::MessageClient.

Definition at line 169 of file arswindow.cpp.

References DeregisterChildWindow(), and Ars::CtrlMessage::source.

00170 {
00171         DeregisterChildWindow( (Window *)msg.source );
00172         return true;
00173 }

void Ars::Window::DeregisterChildWindow Window pWindow  )  [protected]
 

Deregister pWindow as a child

Parameters:
pWindow A pointer to the child window

Definition at line 164 of file arswindow.cpp.

Referenced by DeregChild(), and SetParent().

00165 {
00166         remove( window );
00167 }

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

Render the control itself.

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

Definition at line 202 of file arswindow.cpp.

Referenced by DrawProc().

00203 {
00204 }

void Ars::Window::DrawBG void   )  [virtual]
 

Render the background for the control Draws the background as a filled CRect

Reimplemented in Ars::XListBox, and Ars::XTextBox.

Definition at line 186 of file arswindow.cpp.

References bkgnd, Ars::HPaint::DrawRect(), Ars::Thing::GetBgColor(), Ars::HPaint::GetGDI(), Ars::Painter::GetStates(), Ars::Thing::GetWindowRect(), Ars::XRect::Height(), S_TRANSPARENT, and Ars::XRect::Width().

Referenced by Ars::XButtonImage::Draw(), and DrawProc().

00187 {
00188         if( bkgnd == 0 && GetGDI() )
00189         {
00190                 bkgnd = Graf::NewSurface( Width() + 1 , Height() + 1 , GetGDI() );
00191                 XRect   r( 0 , 0 , bkgnd->w , bkgnd->h );
00192                 XRect   t( *this );
00193                 t.w += 1;
00194                 t.h += 1;
00195                 SDL_BlitSurface( GetGDI() , &t , bkgnd , &r );
00196         }
00197 
00198         if( (GetStates() & S_TRANSPARENT) == 0 ) 
00199                 DrawRect( GetWindowRect() , true , GetBgColor() , GetBgColor() );
00200 }

void Ars::Window::DrawChildren void   )  [virtual]
 

Call DrawProc() for any children of the current windows.

Definition at line 206 of file arswindow.cpp.

Referenced by DrawProc().

00207 {
00208         if( !empty() )
00209         {
00210                 int     n = size();
00211                 for_each( begin() , end() , mem_fun( &Window::DrawProc ) );
00212         }
00213 }

const bool Ars::Window::DrawProc void   )  [virtual]
 

The rendering chain for windows DrawProc() is the primary draw method and calls the other draw methods

Definition at line 215 of file arswindow.cpp.

References AdjustColors(), Draw(), DrawBG(), DrawChildren(), IsVisible(), RestoreColors(), and Ars::Thing::SetDirty().

Referenced by wmPaint().

00216 {
00217         if( IsVisible() )
00218         {
00219                 AdjustColors();
00220 
00221                 DrawBG();
00222                 Draw();
00223 
00224                 RestoreColors();
00225 
00226                 DrawChildren();
00227         }
00228         
00229         SetDirty( false );
00230 
00231         return IsVisible();
00232 }

const bool Ars::Window::evMouseButtonDown const MouseMessage msg  )  [virtual]
 

Reimplemented from Ars::MessageClient.

Reimplemented in Ars::XButton, Ars::XEditBox, Ars::XListBox, and Ars::XScrollBar.

Definition at line 271 of file arswindow.cpp.

References Ars::MouseMessage::Button, FindWindow(), Ars::Thing::GetFlags(), Ars::Painter::GetStates(), m_MouseButton, MAY_GAINFOCUS, Ars::MouseMessage::Point, and S_DISABLED.

00272 {
00273         bool ans = Painter::evMouseButtonDown( msg );
00274 
00275         if( (GetStates() & S_DISABLED) != S_DISABLED )
00276         {
00277                 if( FindWindow( &msg.Point ) == this )
00278                 {               
00279                         m_MouseButton = msg.Button;
00280                 
00281                         if( ArsApplication::GetInstance()->GetKeyFocus() != this && (GetFlags() & MAY_GAINFOCUS) != 0 )
00282                                 ArsApplication::GetInstance()->SetKeyFocus( this );
00283 
00284                         ans = true;
00285                 }
00286         }
00287         return ans;
00288 }

const bool Ars::Window::evMouseButtonUp const MouseMessage msg  )  [virtual]
 

Reimplemented from Ars::MessageClient.

Reimplemented in Ars::XButton, Ars::XCheckBox, Ars::XEditBox, Ars::XListBox, and Ars::XScrollBar.

Definition at line 290 of file arswindow.cpp.

References ArsSendMessage, Ars::MouseMessage::Button, FindWindow(), Ars::GetSound(), Ars::Painter::GetStates(), m_MouseButton, Ars::Sounds::Play(), Ars::MouseMessage::Point, S_DISABLED, and soundName.

00291 {
00292         bool ans = Painter::evMouseButtonUp( msg );
00293 
00294         if( (GetStates() & S_DISABLED) != S_DISABLED )
00295         {
00296                 if( FindWindow( &msg.Point ) == this && m_MouseButton == msg.Button  )
00297                 {
00298                         Message::EMessageType MessageType =  Message::UNKNOWN;
00299                         switch( m_MouseButton )
00300                         {
00301                         case MouseMessage::LEFT:
00302                                 // send an extra message to itself
00303                                 MessageType = Message::CTRL_LCLICK;
00304                                 break;
00305                         case MouseMessage::RIGHT:
00306                                 MessageType = Message::CTRL_RCLICK;
00307                                 break;
00308                         case MouseMessage::MIDDLE:
00309                                 MessageType = Message::CTRL_MCLICK;
00310                                 break;
00311                         }
00312                         if( !soundName.empty() )
00313                                 GetSound( soundName ).Play();
00314                         
00315                         ArsSendMessage( CtrlMessage( MessageType , this , this, 0 ) );
00316 
00317                         ans = true;
00318                 }
00319         }
00320         return ans;
00321 }

Window * Ars::Window::FindWindow const XPoint Pt  ) 
 

Definition at line 328 of file arswindow.cpp.

References Ars::XRect::HitTest(), and Ars::XRect::RELPOS_INSIDE.

Referenced by Ars::XEditBox::evMouseButtonDown(), Ars::XButton::evMouseButtonDown(), evMouseButtonDown(), evMouseButtonUp(), Ars::XLabel::evMouseMove(), Ars::XEditBox::evMouseMove(), Ars::XButton::evMouseMove(), and Ars::XToolTip::evMouseMove().

00329 {
00330         if( HitTest( *pt ) == RELPOS_INSIDE )
00331         {
00332                 std::list<Window *>::iterator at = find_if( begin() , end() , bind2nd( mem_fun( &Window::RelposInside ) , pt ) );
00333                 if( at != end() && (*at)->IsVisible() )
00334                         return(*at)->FindWindow( pt );
00335                 return this;
00336         }
00337         return 0;
00338 }

XRect Ars::Window::GetClientRect void   ) 
 

The ClientRect describes the internal area of the control By default, this is initialized to the value of the WindowRect The ClientRect is useful for windows that will contain other windows Internally it's represented via the window's coordinates

Returns:
The client area CRect

Definition at line 92 of file arswindow.cpp.

References Ars::XRect::BottomRight(), clientRect, Ars::XRect::ClipTo(), Ars::Thing::GetWindowRect(), and Ars::XRect::TopLeft().

Referenced by Ars::XTextBox::Draw(), Ars::XListBox::Draw(), Ars::XListBox::evKeyDown(), Ars::XListBox::evMouseButtonDown(), Ars::XEditBox::evMouseButtonDown(), Ars::XListBox::evMouseButtonUp(), Ars::XScrollBar::evMouseMove(), Ars::XEditBox::evMouseMove(), Ars::XScrollBar::SetPosition(), and Ars::XScrollBar::SetupWindow().

00093 {
00094         XRect ClientRect( GetWindowRect().TopLeft() + clientRect.TopLeft(), GetWindowRect().TopLeft() + clientRect.BottomRight());
00095         ClientRect.ClipTo( GetWindowRect() );
00096         return ClientRect;
00097 }

virtual Window* Ars::Window::GetParent void   )  const [inline, virtual]
 

Reimplemented in Ars::XToolTip.

Definition at line 80 of file arswindow.h.

References parentWindow.

Referenced by Ars::XEditBox::evKeyDown(), Ars::XScrollBar::evMouseButtonUp(), Ars::XListBox::evMouseButtonUp(), Ars::XScrollBar::evMouseLClick(), Ars::XCheckBox::evMouseLClick(), Ars::XScrollBar::evMouseMove(), Ars::XToolTip::evMouseMove(), Ars::XDropDown::evValueChange(), GetRoot(), Ars::MessageServer::HandleTillRoot(), and Ars::Form::HandleTillRoot().

00080 {       return parentWindow;    }

Window * Ars::Window::GetRoot void   )  const
 

Definition at line 99 of file arswindow.cpp.

References GetParent(), and parentWindow.

Referenced by SetParent().

00100 {
00101         if( parentWindow )
00102         {
00103                 Window *pWindow = GetParent();
00104 
00105                 while( pWindow->GetParent() )
00106                         pWindow = pWindow->GetParent();
00107 
00108                 return pWindow;
00109         }
00110         else
00111                 return const_cast< Window *>( this );
00112 }

virtual std::string Ars::Window::GetWindowText void   )  [inline, virtual]
 

Return the WindowText for the current window

Returns:
The WindowText

Definition at line 91 of file arswindow.h.

References text.

Referenced by Ars::XLabel::AppendWindowText(), Ars::XLabel::Draw(), Ars::XGroupBox::Draw(), Ars::XEditBox::Draw(), Ars::XButtonImage::Draw(), Ars::XEditBox::evKeyDown(), Ars::XEditBox::evMouseButtonDown(), Ars::XEditBox::evMouseMove(), Ars::XEditBox::GetSelText(), Ars::XScrollBar::Init(), Init(), Ars::View::SetWndText(), and Ars::XToolTip::SetWndText().

00091 { return text; }

const bool Ars::Window::HandleMessage const Message msg  )  [virtual]
 

This is the callback used by the Message Server to distribute messages The client must first register with the server and indicate any messages it wishes to recieve

See also:
CMessageServer::RegisterMessageClient()
Returns:
true if the message was processed and nobody needs to process it.

Reimplemented from Ars::MessageClient.

Definition at line 260 of file arswindow.cpp.

References Ars::Thing::IsDirty(), Ars::Message::MessageType(), and UpdateWindow().

00261 {
00262         const bool ans = Thing::HandleMessage( msg );
00263         
00264         if( msg.MessageType() != Message::SETUP_WINDOW )
00265                 if( IsDirty() )
00266                         UpdateWindow( true );
00267 
00268         return ans;
00269 }

const bool Ars::Window::HideWindow void   )  [virtual]
 

Set the invisibility of the control, and all of it's children.

Definition at line 84 of file arswindow.cpp.

References F_HIDETREE, and Ars::Thing::SetFlags().

Referenced by Ars::XDropDown::HideListBox(), and Ars::XToolTip::HideTip().

00085 {
00086         SetFlags( F_HIDETREE );
00087         for_each( begin() , end() , mem_fun( &Window::HideWindow ) );
00088 
00089         return true;
00090 }

void Ars::Window::Init icstring aStr  )  [virtual]
 

Initialize the thing object via a string the CAR identifiers used are: str: string (tooltip <s-expression> ): tooltip description

Reimplemented from Ars::Painter.

Reimplemented in Ars::XButtonImage, Ars::XDropDown, Ars::XImage, Ars::XListBox, Ars::XMPEG, Ars::XProgress, Ars::XScrollBar, and Ars::XTextBox.

Definition at line 57 of file arswindow.cpp.

References GetWindowText(), icstring, SetWndText(), soundName, and toolTip.

Referenced by Ars::ArsApplication::Exec(), and Ars::Rsrc::Load().

00058 {
00059         Painter::Init( aStr );
00060         icstring tmp = Rsrc::FindCrdOf( aStr , "str" );
00061         SetWndText( Rsrc::GetStr( tmp , GetWindowText() ) );
00062         
00063         tmp = Rsrc::FindCrdOf( aStr , "sound" );
00064         soundName = Rsrc::GetId(tmp );
00065 
00066         tmp = Rsrc::FindCrdOf( aStr , "tooltip" );
00067         if( !tmp.empty() )
00068         {
00069 
00070                 toolTip = new XToolTip( this );
00071                 //      next one in sequence
00072                 toolTip->Init( tmp );
00073         }
00074 }

const bool Ars::Window::IsChild Window wnd  ) 
 

Definition at line 340 of file arswindow.cpp.

Referenced by Ars::Form::ProcessMessage(), and Ars::XDropDown::wmLostFocus().

00341 {
00342         if( !empty() )
00343                 for( std::list<Window *>::iterator it = begin() ; it != end() ; ++it )
00344                         if( (*it) == wnd )
00345                                 return true;
00346                         else if( (*it)->IsChild( wnd ) )
00347                                 return true;
00348         return false;
00349 }

const bool Ars::Window::IsVisible void   )  const [inline, virtual]
 

Get the visibility of the control

Returns:
true if the control is visible

Reimplemented from Ars::Thing.

Definition at line 50 of file arswindow.h.

References F_HIDETREE, and Ars::Thing::GetFlags().

Referenced by DrawProc(), Ars::XDropDown::evMouseLClick(), Ars::XToolTip::evMouseMove(), Ars::XDropDown::HideListBox(), Ars::XDropDown::ShowListBox(), Ars::XToolTip::ShowTip(), Ars::XDropDown::wmLostFocus(), and wmPaint().

00050 {       return (GetFlags() & F_HIDETREE) == 0;  }

void Ars::Window::RegisterChildWindow Window pWindow  )  [protected]
 

Register pWindow as a child

Parameters:
pWindow A pointer to the child window

Definition at line 158 of file arswindow.cpp.

Referenced by SetParent().

00159 {
00160         push_back( window );
00161 }

const bool Ars::Window::RelposInside const XPoint p  )  [protected]
 

Definition at line 323 of file arswindow.cpp.

References Ars::XRect::HitTest(), and Ars::XRect::RELPOS_INSIDE.

00324 {
00325         return HitTest( *pt ) == RELPOS_INSIDE;
00326 }

const bool Ars::Window::ResetChildren void   )  [virtual]
 

Remove all children from the list.

Definition at line 144 of file arswindow.cpp.

References parentWindow.

00145 {
00146         parentWindow = 0;
00147 
00148         MessageServer::Instance().DeregisterMessageClient( this );
00149         MessageServer::Instance().RegisterMessageClient( this , Message::SETUP_WINDOW );
00150 
00151         for_each( begin() , end() , mem_fun( &Window::ResetChildren ) );
00152         
00153         clear();
00154 
00155         return true;
00156 }

virtual void Ars::Window::RestoreColors void   )  [inline, virtual]
 

Reimplemented in Ars::XLabel.

Definition at line 114 of file arswindow.h.

Referenced by DrawProc().

00114 {};

const bool Ars::Window::SetParent Window pNewParent  )  [virtual]
 

Transfer the ownership of the window, so it has a new parent

Parameters:
pNewParent A pointer to a window that should be set as the parent

Reimplemented in Ars::XToolTip.

Definition at line 114 of file arswindow.cpp.

References DeregisterChildWindow(), Ars::HPaint::GetGDI(), GetRoot(), parentWindow, RegisterChildWindow(), and Ars::HPaint::SetGDI().

Referenced by Ars::Form::InitDialog(), Ars::XTextBox::SetupWindow(), Ars::XScrollBar::SetupWindow(), Ars::XListBox::SetupWindow(), Ars::XDropDown::SetupWindow(), and ~Window().

00115 {
00116 //      if( parentWindow )
00117 //              ArsPostMessage( CtrlMessage( Message::DEREG_CHILD , parentWindow , this ) );
00118 //              parentWindow->DeregisterChildWindow( this );
00119 
00120         if( pNewParent )
00121         {
00122                 if( parentWindow )
00123                         parentWindow->DeregisterChildWindow( this );
00124                 pNewParent->RegisterChildWindow( this );
00125                 SetGDI( pNewParent->GetRoot()->GetGDI() );
00126         }
00127         else
00128         {
00129                 MessageServer::Instance().DeregisterMessageClient( this );
00130                 MessageServer::Instance().RegisterMessageClient( this , Message::SETUP_WINDOW );
00131                 for_each( begin() , end() , mem_fun( &Window::ResetChildren ) );
00132 
00133                 clear();
00134 
00135                 if( parentWindow )
00136                         parentWindow->DeregisterChildWindow( this );
00137         }
00138 
00139         parentWindow = pNewParent;
00140 
00141         return true;
00142 }

const bool Ars::Window::SetupWindow const Message msg  )  [virtual]
 

Deregister the setup_window message.

Reimplemented from Ars::MessageClient.

Reimplemented in Ars::XToolTip, Ars::View, Ars::XButton, Ars::XButtonImage, Ars::XCheckBox, Ars::XDropDown, Ars::XEditBox, Ars::XImage, Ars::XLabel, Ars::XListBox, Ars::XMPEG, Ars::XProgress, Ars::XScrollBar, and Ars::XTextBox.

Definition at line 45 of file arswindow.cpp.

References Ars::XToolTip::SetupWindow(), and toolTip.

00046 {
00047         Painter::SetupWindow( msg );
00048         MessageServer::Instance().DeregisterMessageClient( this , Message::SETUP_WINDOW );
00049         MessageServer::Instance().RegisterMessageClient(this, Message::APP_PAINT);
00050 
00051         if( toolTip )
00052                 toolTip->SetupWindow( msg );
00053 
00054         return true;
00055 }

virtual void Ars::Window::SetWindowRect const XRect WindowRect  )  [inline, virtual]
 

Giving a control a new WindowRect will move and resize the control

Parameters:
WindowRect A CRect that defines the outer limits of the control

Reimplemented from Ars::Thing.

Reimplemented in Ars::XListBox, Ars::XScrollBar, and Ars::XTextBox.

Definition at line 66 of file arswindow.h.

References clientRect, Ars::XRect::Height(), and Ars::XRect::Width().

Referenced by Ars::XScrollBar::Init(), Ars::XDropDown::Init(), Ars::XScrollBar::SetWindowRect(), and Ars::View::View().

00067         {       
00068                 Thing::SetWindowRect( WindowRect );
00069                 clientRect.w = Width(); 
00070                 clientRect.h = Height();
00071         }

virtual void Ars::Window::SetWndText const int  val  )  [inline, virtual]
 

Definition at line 87 of file arswindow.h.

References itoa(), and SetWndText().

00087 {       char    tmp[20];        SetWndText( itoa( val , tmp , 10 ) );   }

virtual void Ars::Window::SetWndText const std::string &  sText  )  [inline, virtual]
 

Set the WindowText of the control

Parameters:
sText The text to assign to the window

Reimplemented in Ars::XToolTip, Ars::View, Ars::XEditBox, Ars::XLabel, and Ars::XTextBox.

Definition at line 86 of file arswindow.h.

References Ars::Thing::SetDirty(), and text.

Referenced by Init(), and SetWndText().

00086 {       text = sText;   SetDirty();     }

const bool Ars::Window::ShowWindow void   )  [virtual]
 

Set the visibility of the control, and all of it's children.

Definition at line 76 of file arswindow.cpp.

References F_HIDETREE, and Ars::Thing::ResetFlags().

Referenced by Ars::XDropDown::ShowListBox(), and Ars::XToolTip::ShowTip().

00077 {
00078         ResetFlags( F_HIDETREE );
00079         for_each( begin() , end() , mem_fun( &Window::ShowWindow ) );
00080 
00081         return true;
00082 }

void Ars::Window::UpdateWindow const bool  aNow = false  )  [virtual]
 

sends or post a wm_paint message

Definition at line 175 of file arswindow.cpp.

References ArsPostMessage, ArsSendMessage, and paintAlreadySent.

Referenced by Ars::XImage::ChangeImage(), HandleMessage(), Ars::XDropDown::HideListBox(), Ars::XToolTip::HideTip(), Ars::XImage::SetImageId(), Ars::XScrollBar::SetPosition(), Ars::XProgress::SetProgress(), Ars::View::SetupWindow(), Ars::XLabel::SetWndText(), Ars::XDropDown::ShowListBox(), Ars::XToolTip::ShowTip(), and Ars::View::wmResize().

00176 {
00177         if( aNow )
00178                 ArsSendMessage( Message( Message::APP_PAINT  , this ) );
00179         else if( !paintAlreadySent )
00180         {
00181                 ArsPostMessage( Message( Message::APP_PAINT  , this ) );
00182                 paintAlreadySent = true;
00183         }
00184 }

const bool Ars::Window::wmPaint const Message msg  )  [virtual]
 

This calls DrawProc, then updates the relevant screen area.

Reimplemented from Ars::MessageClient.

Definition at line 234 of file arswindow.cpp.

References bkgnd, Ars::Message::Destination(), DrawProc(), Ars::HPaint::GetGDI(), IsVisible(), paintAlreadySent, and Ars::Thing::SetDirty().

00235 {
00236         if( IsVisible() )
00237         {
00238                 DrawProc();
00239                 SDL_UpdateRect( GetGDI() , x , y , w  , h );
00240                 paintAlreadySent = false;
00241         }
00242         else if( GetGDI() && bkgnd )
00243         {
00244                 XRect   r( 0 , 0 , bkgnd->w , bkgnd->h );
00245                 XRect   t( *this );
00246                 t.w += 1;
00247                 t.h += 1;
00248                 SDL_BlitSurface( bkgnd , &r , GetGDI() , &t );
00249                 SDL_UpdateRect( GetGDI() , x , y , w , h );
00250                 paintAlreadySent = false;
00251                 SDL_FreeSurface( bkgnd );
00252                 bkgnd = 0;
00253         }
00254 
00255         SetDirty( false );
00256 
00257         return (m.Destination() == this);
00258 }


Friends And Related Function Documentation

friend class View [friend]
 

Reimplemented from Ars::HPaint.

Definition at line 26 of file arswindow.h.

friend class XBox [friend]
 

Definition at line 27 of file arswindow.h.


Field Documentation

SDL_Surface* Ars::Window::bkgnd [private]
 

Definition at line 22 of file arswindow.h.

Referenced by DrawBG(), wmPaint(), and ~Window().

XRect Ars::Window::clientRect [protected]
 

Definition at line 29 of file arswindow.h.

Referenced by Ars::XImage::ChangeImage(), Ars::XButtonImage::ChangeImage(), GetClientRect(), Ars::XScrollBar::Init(), Ars::XButtonImage::SetImage(), Ars::XImage::SetImageId(), Ars::XImage::SetupWindow(), Ars::XButtonImage::SetupWindow(), Ars::XTextBox::SetWindowRect(), Ars::XScrollBar::SetWindowRect(), Ars::XListBox::SetWindowRect(), SetWindowRect(), Ars::XToolTip::SetWndText(), and Ars::View::wmResize().

unsigned int Ars::Window::m_MouseButton [protected]
 

The last mouse button to be pushed over the control, it's used internally.

Reimplemented in Ars::XButton.

Definition at line 31 of file arswindow.h.

Referenced by evMouseButtonDown(), and evMouseButtonUp().

bool Ars::Window::paintAlreadySent [private]
 

set to true when a wm_paint message is sent and the paint not yet done. avoid several paint to be sent

Definition at line 11 of file arswindow.h.

Referenced by UpdateWindow(), and wmPaint().

Window* Ars::Window::parentWindow [private]
 

Pointer to the parent window.

Definition at line 17 of file arswindow.h.

Referenced by GetParent(), GetRoot(), ResetChildren(), and SetParent().

icstring Ars::Window::soundName [private]
 

Definition at line 20 of file arswindow.h.

Referenced by evMouseButtonUp(), and Init().

std::string Ars::Window::text [private]
 

The Window Text (not directly used by Window).

Definition at line 14 of file arswindow.h.

Referenced by GetWindowText(), and SetWndText().

XToolTip* Ars::Window::toolTip [private]
 

Definition at line 18 of file arswindow.h.

Referenced by Init(), SetupWindow(), and ~Window().


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