No interaction with non-visible components"

This commit is contained in:
Simon Robertshaw 2012-04-19 14:38:15 +01:00
parent c13b05d272
commit e9fc64eed6

View File

@ -164,7 +164,7 @@ void Window::DoKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool a
//on key press //on key press
if(focusedComponent_ != NULL) if(focusedComponent_ != NULL)
{ {
if(!focusedComponent_->Locked) if(!focusedComponent_->Locked && focusedComponent_->Visible)
focusedComponent_->OnKeyPress(key, character, shift, ctrl, alt); focusedComponent_->OnKeyPress(key, character, shift, ctrl, alt);
} }
@ -178,7 +178,7 @@ void Window::DoKeyRelease(int key, Uint16 character, bool shift, bool ctrl, bool
//on key unpress //on key unpress
if(focusedComponent_ != NULL) if(focusedComponent_ != NULL)
{ {
if(!focusedComponent_->Locked) if(!focusedComponent_->Locked && focusedComponent_->Visible)
focusedComponent_->OnKeyRelease(key, character, shift, ctrl, alt); focusedComponent_->OnKeyRelease(key, character, shift, ctrl, alt);
} }
@ -195,7 +195,7 @@ void Window::DoMouseDown(int x_, int y_, unsigned button)
bool clickState = false; bool clickState = false;
for(int i = Components.size() - 1; i > -1 && !halt; --i) for(int i = Components.size() - 1; i > -1 && !halt; --i)
{ {
if(!Components[i]->Locked) if(!Components[i]->Locked && Components[i]->Visible)
{ {
if(x >= Components[i]->Position.X && y >= Components[i]->Position.Y && x < Components[i]->Position.X + Components[i]->Size.X && y < Components[i]->Position.Y + Components[i]->Size.Y) if(x >= Components[i]->Position.X && y >= Components[i]->Position.Y && x < Components[i]->Position.X + Components[i]->Size.X && y < Components[i]->Position.Y + Components[i]->Size.Y)
{ {
@ -213,7 +213,7 @@ void Window::DoMouseDown(int x_, int y_, unsigned button)
//on mouse down //on mouse down
for(int i = Components.size() - 1; i > -1 && !halt; --i) for(int i = Components.size() - 1; i > -1 && !halt; --i)
{ {
if(!Components[i]->Locked) if(!Components[i]->Locked && Components[i]->Visible)
Components[i]->OnMouseDown(x, y, button); Components[i]->OnMouseDown(x, y, button);
} }
@ -229,7 +229,7 @@ void Window::DoMouseMove(int x_, int y_, int dx, int dy)
int y = y_ - Position.Y; int y = y_ - Position.Y;
for(int i = Components.size() - 1; i > -1 && !halt; --i) for(int i = Components.size() - 1; i > -1 && !halt; --i)
{ {
if(!Components[i]->Locked) if(!Components[i]->Locked && Components[i]->Visible)
{ {
Point local (x - Components[i]->Position.X, y - Components[i]->Position.Y) Point local (x - Components[i]->Position.X, y - Components[i]->Position.Y)
, a (local.X - dx, local.Y - dy); , a (local.X - dx, local.Y - dy);
@ -280,7 +280,7 @@ void Window::DoMouseUp(int x_, int y_, unsigned button)
//on mouse unclick //on mouse unclick
for(int i = Components.size() - 1; i >= 0 && !halt; --i) for(int i = Components.size() - 1; i >= 0 && !halt; --i)
{ {
if(!Components[i]->Locked) if(!Components[i]->Locked && Components[i]->Visible)
{ {
if(x >= Components[i]->Position.X && y >= Components[i]->Position.Y && x < Components[i]->Position.X + Components[i]->Size.X && y < Components[i]->Position.Y + Components[i]->Size.Y) if(x >= Components[i]->Position.X && y >= Components[i]->Position.Y && x < Components[i]->Position.X + Components[i]->Size.X && y < Components[i]->Position.Y + Components[i]->Size.Y)
{ {
@ -293,7 +293,7 @@ void Window::DoMouseUp(int x_, int y_, unsigned button)
//on mouse up //on mouse up
for(int i = Components.size() - 1; i >= 0 && !halt; --i) for(int i = Components.size() - 1; i >= 0 && !halt; --i)
{ {
if(!Components[i]->Locked) if(!Components[i]->Locked && Components[i]->Visible)
Components[i]->OnMouseUp(x, y, button); Components[i]->OnMouseUp(x, y, button);
} }
@ -311,7 +311,7 @@ void Window::DoMouseWheel(int x_, int y_, int d)
{ {
if(x >= Components[i]->Position.X && y >= Components[i]->Position.Y && x < Components[i]->Position.X + Components[i]->Size.X && y < Components[i]->Position.Y + Components[i]->Size.Y) if(x >= Components[i]->Position.X && y >= Components[i]->Position.Y && x < Components[i]->Position.X + Components[i]->Size.X && y < Components[i]->Position.Y + Components[i]->Size.Y)
{ {
if(!Components[i]->Locked) if(!Components[i]->Locked && Components[i]->Visible)
Components[i]->OnMouseWheelInside(x - Components[i]->Position.X, y - Components[i]->Position.Y, d); Components[i]->OnMouseWheelInside(x - Components[i]->Position.X, y - Components[i]->Position.Y, d);
break; break;
} }
@ -320,7 +320,7 @@ void Window::DoMouseWheel(int x_, int y_, int d)
//on mouse wheel //on mouse wheel
for(int i = Components.size() - 1; i >= 0 && !halt; --i) for(int i = Components.size() - 1; i >= 0 && !halt; --i)
{ {
if(!Components[i]->Locked) if(!Components[i]->Locked && Components[i]->Visible)
Components[i]->OnMouseWheel(x - Components[i]->Position.X, y - Components[i]->Position.Y, d); Components[i]->OnMouseWheel(x - Components[i]->Position.X, y - Components[i]->Position.Y, d);
} }