123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194 |
- #include "stdafx.h"
- #include "CWindow.h"
- CWindow::CWindow()
- {
- Top = 0;
- Left = 0;
- Width = 10000;
- Height = 10000;
- AnchorLeft = true;
- AnchorTop = true;
- AnchorRight = false;
- AnchorBottom = false;
- Visible = false;
- Updating = false;
-
- Parent = NULL;
- AddMoveEventHandler( *(MoveEventAbstractor< CWindow > *)this );
- AddResizeEventHandler( *(ResizeEventAbstractor< CWindow > *)this );
- AddMouseEventHandler( *(MouseEventsAbstractor< CWindow > *)this );
- AddKeyboardEventHandler( *(KeyboardEventsAbstractor< CWindow > *)this );
- AddRenderEventHandler( *(RenderEventAbstractor< CWindow > *)this );
- AddFocusEventHandler( *(FocusEventsAbstractor< CWindow > *)this );
- AddClipboardEventHandler( *(ClipboardEventsAbstractor< CWindow > *)this );
- return;
- }
- CWindow::~CWindow()
- {
- if (GetParent())
- GetParent()->RemoveChild(*this);
- return;
- }
- bool CWindow::AddMoveEventHandler( IMoveEvent &MoveEvents )
- {
- for( std::list< IMoveEvent * >::iterator I = MoveEventHandlers.begin(); I != MoveEventHandlers.end(); I++ )
- {
- if( *I == &MoveEvents )
- {
- return false;
- }
- }
- MoveEventHandlers.push_back( &MoveEvents );
- return true;
- }
- bool CWindow::AddResizeEventHandler( IResizeEvent &ResizeEvent )
- {
- for( std::list< IResizeEvent * >::iterator I = ResizeEventHandlers.begin(); I != ResizeEventHandlers.end(); I++ )
- {
- if( *I == &ResizeEvent )
- {
- return false;
- }
- }
- ResizeEventHandlers.push_back( &ResizeEvent );
- return true;
- }
- bool CWindow::AddMouseEventHandler( IMouseEvents &MouseEvents )
- {
- for( std::list< IMouseEvents * >::iterator I = MouseEventHandlers.begin(); I != MouseEventHandlers.end(); I++ )
- {
- if( *I == &MouseEvents )
- {
- return false;
- }
- }
- MouseEventHandlers.push_back( &MouseEvents );
- return true;
- }
- bool CWindow::AddKeyboardEventHandler( IKeyboardEvents &KeyboardEvents )
- {
- for( std::list< IKeyboardEvents * >::iterator I = KeyboardEventHandlers.begin(); I != KeyboardEventHandlers.end(); I++ )
- {
- if( *I == &KeyboardEvents )
- {
- return false;
- }
- }
- KeyboardEventHandlers.push_back( &KeyboardEvents );
- return true;
- }
- bool CWindow::AddRenderEventHandler( IRenderEvent &RenderEvent )
- {
- for( std::list< IRenderEvent * >::iterator I = RenderEventHandlers.begin(); I != RenderEventHandlers.end(); I++ )
- {
- if( *I == &RenderEvent )
- {
- return false;
- }
- }
- RenderEventHandlers.push_back( &RenderEvent );
- return true;
- }
- bool CWindow::AddFocusEventHandler( IFocusEvents &FocusEvents )
- {
- for( std::list< IFocusEvents * >::iterator I = FocusEventHandlers.begin(); I != FocusEventHandlers.end(); I++ )
- {
- if( *I == &FocusEvents )
- {
- return false;
- }
- }
- FocusEventHandlers.push_back( &FocusEvents );
- return true;
- }
- bool CWindow::AddClipboardEventHandler( IClipboardEvents &ClipboardEvents )
- {
- for( std::list< IClipboardEvents * >::iterator I = ClipboardEventHandlers.begin(); I != ClipboardEventHandlers.end(); I++ )
- {
- if( *I == &ClipboardEvents )
- {
- return false;
- }
- }
- ClipboardEventHandlers.push_back( &ClipboardEvents );
- return true;
- }
- bool CWindow::AddWindowEventHandler( IWindowEvents &WindowEvents )
- {
- for( std::list< IWindowEvents * >::iterator I = WindowEventHandlers.begin(); I != WindowEventHandlers.end(); I++ )
- {
- if( *I == &WindowEvents )
- {
- return false;
- }
- }
- WindowEventHandlers.push_back( &WindowEvents );
- return true;
- }
- bool CWindow::SetWidth( float NewWidth )
- {
- float LeftMargin = 0;
- float RightMargin = 0;
- bool AnchoredLeft = false;
- bool AnchoredRight = false;
- std::list< IWindow * >::iterator I;
- if( NewWidth < 0 )
- {
- return false;
- }
- if( FireResize( NewWidth, Height ) == true )
- {
- for( I = Children.begin(); I != Children.end(); I++ )
- {
- AnchoredLeft = (*I)->GetAnchorLeft();
- AnchoredRight = (*I)->GetAnchorRight();
- if( AnchoredLeft == true && AnchoredRight == false )
- {
- }
- else if( AnchoredLeft == false && AnchoredRight == true )
- {
- RightMargin = Width - (*I)->GetLeft() - (*I)->GetWidth();
- (*I)->SetLeft( NewWidth - RightMargin - (*I)->GetWidth() );
- }
- else if( AnchoredLeft == true && AnchoredRight == true )
- {
- LeftMargin = (*I)->GetLeft();
- RightMargin = Width - (*I)->GetLeft() - (*I)->GetWidth();
- if( NewWidth - LeftMargin - RightMargin > 0 )
- {
- (*I)->SetWidth( NewWidth - LeftMargin - RightMargin );
- }
- }
- else if( AnchoredLeft == false && AnchoredRight == false )
- {
- (*I)->SetLeft( (*I)->GetLeft() + ( NewWidth - Width ) / 2 );
- }
- }
- Width = NewWidth;
- FireResized();
- } else {
- return false;
- }
- return true;
- }
- bool CWindow::SetHeight( float NewHeight )
- {
- float TopMargin = 0;
- float BottomMargin = 0;
- bool AnchoredTop = false;
- bool AnchoredBottom = false;
- std::list< IWindow * >::iterator I;
- if( NewHeight < 0 )
- {
- return false;
- }
- if( FireResize( Width, NewHeight ) == true )
- {
- for( I = Children.begin(); I != Children.end(); I++ )
- {
- AnchoredTop = (*I)->GetAnchorTop();
- AnchoredBottom = (*I)->GetAnchorBottom();
- if( AnchoredTop == true && AnchoredBottom == false )
- {
- }
- else if( AnchoredTop == false && AnchoredBottom == true )
- {
- BottomMargin = Height - (*I)->GetTop() - (*I)->GetHeight();
- (*I)->SetTop( NewHeight - BottomMargin - (*I)->GetHeight() );
- }
- else if( AnchoredTop == true && AnchoredBottom == true )
- {
- TopMargin = (*I)->GetTop();
- BottomMargin = Height - (*I)->GetTop() - (*I)->GetHeight();
- if( NewHeight - TopMargin - BottomMargin > 0 )
- {
- (*I)->SetHeight( NewHeight - TopMargin - BottomMargin );
- }
- }
- else if( AnchoredTop == false && AnchoredBottom == false )
- {
- (*I)->SetTop( (*I)->GetTop() + ( NewHeight - Height ) / 2 );
- }
- }
- Height = NewHeight;
- FireResized();
- } else {
- return false;
- }
- return true;
- }
- bool CWindow::SetSize( float NewWidth, float NewHeight )
- {
- float LeftMargin = 0;
- float TopMargin = 0;
- float RightMargin = 0;
- float BottomMargin = 0;
-
- bool AnchoredLeft = false;
- bool AnchoredTop = false;
- bool AnchoredRight = false;
- bool AnchoredBottom = false;
-
- std::list< IWindow * >::iterator I;
-
- if( NewWidth < 0 || NewHeight < 0 )
- {
- return false;
- }
-
- if( FireResize( NewWidth, NewHeight ) == true )
- {
- for( I = Children.begin(); I != Children.end(); I++ )
- {
- AnchoredLeft = (*I)->GetAnchorLeft();
- AnchoredTop = (*I)->GetAnchorTop();
- AnchoredRight = (*I)->GetAnchorRight();
- AnchoredBottom = (*I)->GetAnchorBottom();
-
- //LEFT AND TOP ARE ANCHORED
- if( AnchoredLeft == true && AnchoredRight == false && AnchoredTop == true && AnchoredBottom == false )
- {
- }
- //LEFT, TOP, RIGHT AND BOTTOM ARE ANCHORED
- else if( AnchoredLeft == true && AnchoredRight == true && AnchoredTop == true && AnchoredBottom == true )
- {
- LeftMargin = (*I)->GetLeft();
- TopMargin = (*I)->GetTop();
- RightMargin = Width - (*I)->GetLeft() - (*I)->GetWidth();
- BottomMargin = Height - (*I)->GetTop() - (*I)->GetHeight();
- if( NewHeight - TopMargin - BottomMargin > 0 && NewWidth - LeftMargin - RightMargin > 0 )
- {
- (*I)->SetSize( NewWidth - LeftMargin - RightMargin, NewHeight - TopMargin - BottomMargin );
- }
- }
- //TOP AND RIGHT ARE ANCHORED
- else if( AnchoredLeft == false && AnchoredRight == true && AnchoredTop == true && AnchoredBottom == false )
- {
- RightMargin = Width - (*I)->GetLeft() - (*I)->GetWidth();
- (*I)->SetLeft( NewWidth - RightMargin - (*I)->GetWidth() );
- }
- //RIGHT AND BOTTOM ARE ANCHORED
- else if( AnchoredLeft == false && AnchoredRight == true && AnchoredTop == false && AnchoredBottom == true )
- {
- RightMargin = Width - (*I)->GetLeft() - (*I)->GetWidth();
- BottomMargin = Height - (*I)->GetTop() - (*I)->GetHeight();
- (*I)->SetPosition( NewWidth - RightMargin - (*I)->GetWidth(), NewHeight - BottomMargin - (*I)->GetHeight() );
- }
- //LEFT AND BOTTOM ARE ANCHORED
- else if( AnchoredLeft == true && AnchoredRight == false && AnchoredTop == false && AnchoredBottom == true )
- {
- BottomMargin = Height - (*I)->GetTop() - (*I)->GetHeight();
- (*I)->SetTop( NewHeight - BottomMargin - (*I)->GetHeight() );
- }
- //LEFT, TOP AND BOTTOM ARE ANCHORED
- else if( AnchoredLeft == true && AnchoredRight == false && AnchoredTop == true && AnchoredBottom == true )
- {
- TopMargin = (*I)->GetTop();
- BottomMargin = Height - (*I)->GetTop() - (*I)->GetHeight();
- if( NewHeight - TopMargin - BottomMargin > 0 )
- {
- (*I)->SetHeight( NewHeight - TopMargin - BottomMargin );
- }
- }
- //TOP, RIGHT AND BOTTOM ARE ANCHORED
- else if( AnchoredLeft == false && AnchoredRight == true && AnchoredTop == true && AnchoredBottom == true )
- {
- TopMargin = (*I)->GetTop();
- RightMargin = Width - (*I)->GetLeft() - (*I)->GetWidth();
- BottomMargin = Height - (*I)->GetTop() - (*I)->GetHeight();
- (*I)->SetLeft( NewWidth - RightMargin - (*I)->GetWidth() );
- if( NewHeight - TopMargin - BottomMargin > 0 )
- {
- (*I)->SetHeight( NewHeight - TopMargin - BottomMargin );
- }
- }
- //LEFT, TOP AND RIGHT ARE ANCHORED
- else if( AnchoredLeft == true && AnchoredRight == true && AnchoredTop == true && AnchoredBottom == false )
- {
- LeftMargin = (*I)->GetLeft();
- RightMargin = Width - (*I)->GetLeft() - (*I)->GetWidth();
- if( NewWidth - LeftMargin - RightMargin > 0 )
- {
- (*I)->SetWidth( NewWidth - LeftMargin - RightMargin );
- }
- }
- //LEFT, RIGHT AND BOTTOM ARE ANCHORED
- else if( AnchoredLeft == true && AnchoredRight == true && AnchoredTop == false && AnchoredBottom == true )
- {
- LeftMargin = (*I)->GetLeft();
- RightMargin = Width - (*I)->GetLeft() - (*I)->GetWidth();
- BottomMargin = Height - (*I)->GetTop() - (*I)->GetHeight();
- (*I)->SetTop( NewHeight - BottomMargin - (*I)->GetHeight() );
- if( NewWidth - LeftMargin - RightMargin > 0 )
- {
- (*I)->SetWidth( NewWidth - LeftMargin - RightMargin );
- }
- }
- //LEFT AND RIGHT ARE ANCHORED
- else if( AnchoredLeft == true && AnchoredRight == true && AnchoredTop == false && AnchoredBottom == false )
- {
- LeftMargin = (*I)->GetLeft();
- RightMargin = Width - (*I)->GetLeft() - (*I)->GetWidth();
-
- (*I)->SetTop( (*I)->GetTop() + ( NewHeight - Height ) / 2 );
- if( NewWidth - LeftMargin - RightMargin > 0 )
- {
- (*I)->SetWidth( NewWidth - LeftMargin - RightMargin );
- }
- }
- //TOP AND BOTTOM ARE ANCHORED
- else if( AnchoredLeft == false && AnchoredRight == false && AnchoredTop == true && AnchoredBottom == true )
- {
- TopMargin = (*I)->GetTop();
- BottomMargin = Height - (*I)->GetTop() - (*I)->GetHeight();
- (*I)->SetLeft( (*I)->GetLeft() + ( NewWidth - Width ) / 2 );
- if( NewHeight - TopMargin - BottomMargin > 0 )
- {
- (*I)->SetHeight( NewHeight - TopMargin - BottomMargin );
- }
- }
- //LEFT IS ANCHORED
- else if( AnchoredLeft == true && AnchoredRight == false && AnchoredTop == false && AnchoredBottom == false )
- {
- (*I)->SetTop( (*I)->GetTop() + ( NewHeight - Height ) / 2 );
- }
- //TOP IS ANCHORED
- else if( AnchoredLeft == false && AnchoredRight == false && AnchoredTop == true && AnchoredBottom == false )
- {
- (*I)->SetLeft( (*I)->GetLeft() + ( NewWidth - Width ) / 2 );
- }
- //RIGHT IS ANCHORED
- else if( AnchoredLeft == false && AnchoredRight == true && AnchoredTop == false && AnchoredBottom == false )
- {
- RightMargin = Width - (*I)->GetLeft() - (*I)->GetWidth();
- (*I)->SetPosition( NewWidth - RightMargin - (*I)->GetWidth(), (*I)->GetTop() + ( NewHeight - Height ) / 2 );
- }
- //BOTTOM IS ANCHORED
- else if( AnchoredLeft == false && AnchoredRight == false && AnchoredTop == false && AnchoredBottom == true )
- {
- BottomMargin = Height - (*I)->GetTop() - (*I)->GetHeight();
- (*I)->SetPosition( (*I)->GetLeft() + ( NewWidth - Width ) / 2, NewHeight - BottomMargin - (*I)->GetHeight() );
- }
- //NOTHING IS ANCHORED
- else if( AnchoredLeft == false && AnchoredRight == false && AnchoredTop == false && AnchoredBottom == false )
- {
- (*I)->SetPosition( (*I)->GetLeft() + ( NewWidth - Width ) / 2, (*I)->GetTop() + ( NewHeight - Height ) / 2 );
- }
- }
- Width = NewWidth;
- Height = NewHeight;
- FireResized();
- } else {
- return false;
- }
- return true;
- }
- bool CWindow::SetTop( float NewTop )
- {
- if( FireMove( Left, NewTop ) == true )
- {
- Top = NewTop;
- } else {
- return false;
- }
- return true;
- }
- bool CWindow::SetLeft( float NewLeft )
- {
- if( FireMove( NewLeft, Top ) == true )
- {
- Left = NewLeft;
- } else {
- return false;
- }
- return true;
- }
- bool CWindow::SetPosition( float NewLeft, float NewTop )
- {
- if( FireMove( NewLeft, NewTop ) == true )
- {
- Left = NewLeft;
- Top = NewTop;
- } else {
- return false;
- }
- return true;
- }
- float CWindow::GetLeft() const
- {
- return Left;
- }
- float CWindow::GetTop() const
- {
- return Top;
- }
- float CWindow::GetWidth() const
- {
- return Width;
- }
- float CWindow::GetHeight() const
- {
- return Height;
- }
- float CWindow::GetAbsoluteLeft() const
- {
- return Left + Parent->GetAbsoluteLeft();
- }
- float CWindow::GetAbsoluteTop() const
- {
- return Top + Parent->GetAbsoluteTop();
- }
- bool CWindow::SetAnchorTop( bool NewAnchorTop )
- {
- AnchorTop = NewAnchorTop;
- return true;
- }
- bool CWindow::SetAnchorLeft( bool NewAnchorLeft )
- {
- AnchorLeft = NewAnchorLeft;
-
- return true;
- }
- bool CWindow::SetAnchorBottom( bool NewAnchorBottom )
- {
- AnchorBottom = NewAnchorBottom;
-
- return true;
- }
- bool CWindow::SetAnchorRight( bool NewAnchorRight )
- {
- AnchorRight = NewAnchorRight;
- return true;
- }
- bool CWindow::GetAnchorTop() const
- {
- return AnchorTop;
- }
- bool CWindow::GetAnchorLeft() const
- {
- return AnchorLeft;
- }
- bool CWindow::GetAnchorBottom() const
- {
- return AnchorBottom;
- }
- bool CWindow::GetAnchorRight() const
- {
- return AnchorRight;
- }
- bool CWindow::SetVisible( bool NewVisible )
- {
- Visible = NewVisible;
- return true;
- }
- bool CWindow::GetVisible() const
- {
- return Visible;
- }
- bool CWindow::JumpToFront()
- {
- if( Parent == NULL )
- {
- return true;
- }
- try
- {
- IWindow *OldParent = Parent;
- Parent->RemoveChild( *this );
- OldParent->AddChild( *this, true );
- //Parent->GetChildren().remove( (IWindow *)this );
- //Parent->GetChildren().push_back( this );
- } catch( ... ) {
- return false;
- }
- return true;
- }
- bool CWindow::JumpToBack()
- {
- if( Parent == NULL )
- {
- return true;
- }
- try
- {
- IWindow *OldParent = Parent;
- Parent->RemoveChild( *this );
- OldParent->AddChild( *this );
- } catch( ... ) {
- return false;
- }
- return true;
- }
- bool CWindow::AddChild( IWindow &Child, bool AddToBack )
- {
- //THIS SHOULD BE CLEANED UP WHEN A CUSTOM LIST TAKES THE PLACE OF STD::LIST
- //ALSO, THIS UPDATING FLAG IS ASS, BUT I CAN'T THINK OF A BETTER FIX AT THE MOMENT
-
- if( &Child == this )
- {
- return false;
- }
- if( Updating == true )
- {
- return true;
- }
-
- Updating = true;
-
- if( Child.GetParent() != NULL )
- {
- Child.GetParent()->RemoveChild( Child );
- }
- try
- {
- if( AddToBack == false )
- {
- Children.push_front( &Child );
- }
- else
- {
- Children.push_back( &Child );
- }
- } catch( ... ) {
- Updating = false;
- return false;
- }
- Child.SetParent( this );
- Updating = false;
-
- return true;
- }
- bool CWindow::RemoveChild( IWindow &Child )
- {
- //THIS SHOULD BE CLEANED UP WHEN A CUSTOM LIST TAKES THE PLACE OF STD::LIST
- //ALSO, THIS UPDATING FLAG IS ASS, BUT I CAN'T THINK OF A BETTER FIX AT THE MOMENT
- if( Updating == true )
- {
- return true;
- }
- Updating = true;
- try
- {
- Children.remove( &Child );
- } catch( ... ) {
- Updating = false;
- return false;
- }
- Child.SetParent( NULL );
-
- Updating = false;
-
- return true;
- }
- bool CWindow::SetParent( IWindow *NewParent )
- {
- //THIS UPDATING FLAG IS ASS, BUT I CAN'T THINK OF A BETTER FIX AT THE MOMENT
- if( NewParent == this )
- {
- return false;
- }
- if( Updating == true )
- {
- return true;
- }
- Updating = true;
- if( Parent != NULL )
- {
- Parent->RemoveChild( *this );
- }
- Parent = NewParent;
- if( Parent != NULL )
- {
- Parent->AddChild( *this );
- }
- Updating = false;
- return true;
- }
- IWindow *CWindow::GetParent() const
- {
- return Parent;
- }
- const std::list< IWindow * > &CWindow::GetChildren() const
- {
- return Children;
- }
- bool CWindow::OnRender( IWindow & Window, double TimeSlice )
- {
- return false;
- }
- bool CWindow::OnResize( IWindow & Window, float NewWidth, float NewHeight )
- {
- return true;
- }
- bool CWindow::OnResized( IWindow & Window )
- {
- return false;
- }
- bool CWindow::OnMove( IWindow & Window, float NewLeft, float NewTop )
- {
- return true;
- }
- bool CWindow::OnClick( IWindow & Window, float X, float Y, unsigned long Button )
- {
- return false;
- }
- bool CWindow::OnDoubleClick( IWindow & Window, float X, float Y, unsigned long Button )
- {
- return false;
- }
- bool CWindow::OnMouseWheel( IWindow & Window, float X, float Y, unsigned long Button )
- {
- return false;
- }
- bool CWindow::OnMouseDown( IWindow & Window, float X, float Y, unsigned long Button )
- {
- return false;
- }
- bool CWindow::OnMouseUp( IWindow & Window, float X, float Y, unsigned long Button )
- {
- return false;
- }
- bool CWindow::OnMouseMove( IWindow & Window, float X, float Y, unsigned long Button )
- {
- return false;
- }
- bool CWindow::OnMouseEnter( IWindow & Window, float X, float Y, unsigned long Button )
- {
- return false;
- }
- bool CWindow::OnMouseExit( IWindow & Window, float X, float Y, unsigned long Button )
- {
- return false;
- }
- bool CWindow::OnKeyPress( IWindow & Window, unsigned long KeyCode )
- {
- return false;
- }
- bool CWindow::OnKeyDown( IWindow & Window, unsigned long KeyCode )
- {
- return false;
- }
- bool CWindow::OnKeyUp( IWindow & Window, unsigned long KeyCode )
- {
- return false;
- }
- bool CWindow::OnGotFocus( IWindow & Window, IWindow *FromWindow )
- {
- return false;
- }
- bool CWindow::OnLostFocus( IWindow & Window, IWindow *ToWindow )
- {
- return false;
- }
- bool CWindow::OnCut( IWindow & Window, IClipboard &Clipboard )
- {
- return false;
- }
- bool CWindow::OnCopy( IWindow & Window, IClipboard &Clipboard )
- {
- return false;
- }
- bool CWindow::OnPaste( IWindow & Window, const IClipboard &Clipboard )
- {
- return false;
- }
- bool CWindow::FireRender( double TimeSlice )
- {
- bool Temp = false;
- bool RetVal = false;
- for( std::list< IRenderEvent * >::iterator I = RenderEventHandlers.begin(); I != RenderEventHandlers.end(); I++ )
- {
- Temp = (*I)->OnRender( *this, TimeSlice );
- if( Temp == true )
- {
- RetVal = true;
- }
- }
- return RetVal;
- }
- bool CWindow::FireResize( float NewWidth, float NewHeight )
- {
- bool Temp = false;
- bool RetVal = false;
- for( std::list< IResizeEvent * >::iterator I = ResizeEventHandlers.begin(); I != ResizeEventHandlers.end(); I++ )
- {
- IResizeEvent * const foo = *I;
- Temp = (*I)->OnResize( *this, NewWidth, NewHeight );
- if( Temp == true )
- {
- RetVal = true;
- }
- }
- return RetVal;
- }
- bool CWindow::FireResized()
- {
- bool Temp = false;
- bool RetVal = false;
- for( std::list< IResizeEvent * >::iterator I = ResizeEventHandlers.begin(); I != ResizeEventHandlers.end(); I++ )
- {
- Temp = (*I)->OnResized( *this );
- if( Temp == true )
- {
- RetVal = true;
- }
- }
- return RetVal;
- }
- bool CWindow::FireMove( float NewLeft, float NewTop )
- {
- bool Temp = false;
- bool RetVal = false;
- for( std::list< IMoveEvent * >::iterator I = MoveEventHandlers.begin(); I != MoveEventHandlers.end(); I++ )
- {
- Temp = (*I)->OnMove( *this, NewLeft, NewTop );
- if( Temp == true )
- {
- RetVal = true;
- }
- }
- return RetVal;
- }
- bool CWindow::FireClick( float X, float Y, unsigned long Button )
- {
- bool Temp = false;
- bool RetVal = false;
- for( std::list< IMouseEvents * >::iterator I = MouseEventHandlers.begin(); I != MouseEventHandlers.end(); I++ )
- {
- Temp = (*I)->OnClick( *this, X, Y, Button );
- if( Temp == true )
- {
- RetVal = true;
- }
- }
- return RetVal;
- }
- bool CWindow::FireDoubleClick( float X, float Y, unsigned long Button )
- {
- bool Temp = false;
- bool RetVal = false;
- for( std::list< IMouseEvents * >::iterator I = MouseEventHandlers.begin(); I != MouseEventHandlers.end(); I++ )
- {
- Temp = (*I)->OnDoubleClick( *this, X, Y, Button );
- if( Temp == true )
- {
- RetVal = true;
- }
- }
- return RetVal;
- }
- bool CWindow::FireMouseWheel( float X, float Y, unsigned long Button )
- {
- bool Temp = false;
- bool RetVal = false;
- for( std::list< IMouseEvents * >::iterator I = MouseEventHandlers.begin(); I != MouseEventHandlers.end(); I++ )
- {
- Temp = (*I)->OnMouseWheel( *this, X, Y, Button );
- if( Temp == true )
- {
- RetVal = true;
- }
- }
- return RetVal;
- }
- bool CWindow::FireMouseDown( float X, float Y, unsigned long Button )
- {
- bool Temp = false;
- bool RetVal = false;
- for( std::list< IMouseEvents * >::iterator I = MouseEventHandlers.begin(); I != MouseEventHandlers.end(); I++ )
- {
- Temp = (*I)->OnMouseDown( *this, X, Y, Button );
- if( Temp == true )
- {
- RetVal = true;
- }
- }
- return RetVal;
- }
- bool CWindow::FireMouseUp( float X, float Y, unsigned long Button )
- {
- bool Temp = false;
- bool RetVal = false;
- for( std::list< IMouseEvents * >::iterator I = MouseEventHandlers.begin(); I != MouseEventHandlers.end(); I++ )
- {
- Temp = (*I)->OnMouseUp( *this, X, Y, Button );
- if( Temp == true )
- {
- RetVal = true;
- }
- }
- return RetVal;
- }
- bool CWindow::FireMouseMove( float X, float Y, unsigned long Button )
- {
- bool Temp = false;
- bool RetVal = false;
- for( std::list< IMouseEvents * >::iterator I = MouseEventHandlers.begin(); I != MouseEventHandlers.end(); I++ )
- {
- Temp = (*I)->OnMouseMove( *this, X, Y, Button );
- if( Temp == true )
- {
- RetVal = true;
- }
- }
- return RetVal;
- }
- bool CWindow::FireMouseEnter( float X, float Y, unsigned long Button )
- {
- bool Temp = false;
- bool RetVal = false;
- for( std::list< IMouseEvents * >::iterator I = MouseEventHandlers.begin(); I != MouseEventHandlers.end(); I++ )
- {
- Temp = (*I)->OnMouseEnter( *this, X, Y, Button );
- if( Temp == true )
- {
- RetVal = true;
- }
- }
- return RetVal;
- }
- bool CWindow::FireMouseExit( float X, float Y, unsigned long Button )
- {
- bool Temp = false;
- bool RetVal = false;
- for( std::list< IMouseEvents * >::iterator I = MouseEventHandlers.begin(); I != MouseEventHandlers.end(); I++ )
- {
- Temp = (*I)->OnMouseExit( *this, X, Y, Button );
- if( Temp == true )
- {
- RetVal = true;
- }
- }
- return RetVal;
- }
- bool CWindow::FireKeyPress( unsigned long KeyCode )
- {
- bool Temp = false;
- bool RetVal = false;
- for( std::list< IKeyboardEvents * >::iterator I = KeyboardEventHandlers.begin(); I != KeyboardEventHandlers.end(); I++ )
- {
- Temp = (*I)->OnKeyPress( *this, KeyCode );
- if( Temp == true )
- {
- RetVal = true;
- }
- }
- return RetVal;
- }
- bool CWindow::FireKeyDown( unsigned long KeyCode )
- {
- bool Temp = false;
- bool RetVal = false;
- for( std::list< IKeyboardEvents * >::iterator I = KeyboardEventHandlers.begin(); I != KeyboardEventHandlers.end(); I++ )
- {
- Temp = (*I)->OnKeyDown( *this, KeyCode );
- if( Temp == true )
- {
- RetVal = true;
- }
- }
- return RetVal;
- }
- bool CWindow::FireKeyUp( unsigned long KeyCode )
- {
- bool Temp = false;
- bool RetVal = false;
- for( std::list< IKeyboardEvents * >::iterator I = KeyboardEventHandlers.begin(); I != KeyboardEventHandlers.end(); I++ )
- {
- Temp = (*I)->OnKeyUp( *this, KeyCode );
- if( Temp == true )
- {
- RetVal = true;
- }
- }
- return RetVal;
- }
- bool CWindow::FireGotFocus( IWindow *FromWindow )
- {
- bool Temp = false;
- bool RetVal = false;
- for( std::list< IFocusEvents * >::iterator I = FocusEventHandlers.begin(); I != FocusEventHandlers.end(); I++ )
- {
- Temp = (*I)->OnGotFocus( *this, FromWindow );
- if( Temp == true )
- {
- RetVal = true;
- }
- }
- return RetVal;
- }
- bool CWindow::FireLostFocus( IWindow *ToWindow )
- {
- bool Temp = false;
- bool RetVal = false;
- for( std::list< IFocusEvents * >::iterator I = FocusEventHandlers.begin(); I != FocusEventHandlers.end(); I++ )
- {
- Temp = (*I)->OnLostFocus( *this, ToWindow );
- if( Temp == true )
- {
- RetVal = true;
- }
- }
- return RetVal;
- }
- bool CWindow::FireCut( IClipboard &Clipboard )
- {
- bool Temp = false;
- bool RetVal = false;
- for( std::list< IClipboardEvents * >::iterator I = ClipboardEventHandlers.begin(); I != ClipboardEventHandlers.end(); I++ )
- {
- Temp = (*I)->OnCut( *this, Clipboard );
- if( Temp == true )
- {
- RetVal = true;
- }
- }
- return RetVal;
- }
- bool CWindow::FireCopy( IClipboard &Clipboard )
- {
- bool Temp = false;
- bool RetVal = false;
- for( std::list< IClipboardEvents * >::iterator I = ClipboardEventHandlers.begin(); I != ClipboardEventHandlers.end(); I++ )
- {
- Temp = (*I)->OnCopy( *this, Clipboard );
- if( Temp == true )
- {
- RetVal = true;
- }
- }
- return RetVal;
- }
- bool CWindow::FirePaste( const IClipboard &Clipboard )
- {
- bool Temp = false;
- bool RetVal = false;
- for( std::list< IClipboardEvents * >::iterator I = ClipboardEventHandlers.begin(); I != ClipboardEventHandlers.end(); I++ )
- {
- Temp = (*I)->OnPaste( *this, Clipboard );
- if( Temp == true )
- {
- RetVal = true;
- }
- }
- return RetVal;
- }
|