diff options
Diffstat (limited to 'xbmc/guilib/GUIControl.cpp')
-rw-r--r-- | xbmc/guilib/GUIControl.cpp | 51 |
1 files changed, 30 insertions, 21 deletions
diff --git a/xbmc/guilib/GUIControl.cpp b/xbmc/guilib/GUIControl.cpp index 7eed981092..9bad35c9d1 100644 --- a/xbmc/guilib/GUIControl.cpp +++ b/xbmc/guilib/GUIControl.cpp @@ -129,7 +129,7 @@ void CGUIControl::DoProcess(unsigned int currentTime, CDirtyRegionList &dirtyreg { CRect dirtyRegion = m_renderRegion; - bool changed = m_bInvalidated; + bool changed = m_bInvalidated && IsVisible(); changed |= Animate(currentTime); @@ -226,46 +226,50 @@ bool CGUIControl::OnAction(const CAction &action) return false; } +bool CGUIControl::Navigate(int direction) +{ + if (HasFocus()) + { + CGUIMessage msg(GUI_MSG_MOVE, GetParentID(), GetID(), direction); + return SendWindowMessage(msg); + } + return false; +} + // Movement controls (derived classes can override) void CGUIControl::OnUp() { - if (HasFocus()) - m_actionUp.Execute(GetID(), GetParentID(), ACTION_MOVE_UP); + Navigate(ACTION_MOVE_UP); } void CGUIControl::OnDown() { - if (HasFocus()) - m_actionDown.Execute(GetID(), GetParentID(), ACTION_MOVE_DOWN); + Navigate(ACTION_MOVE_DOWN); } void CGUIControl::OnLeft() { - if (HasFocus()) - m_actionLeft.Execute(GetID(), GetParentID(), ACTION_MOVE_LEFT); + Navigate(ACTION_MOVE_LEFT); } void CGUIControl::OnRight() { - if (HasFocus()) - m_actionRight.Execute(GetID(), GetParentID(), ACTION_MOVE_RIGHT); + Navigate(ACTION_MOVE_RIGHT); } bool CGUIControl::OnBack() { - return HasFocus() ? m_actionBack.Execute(GetID(), GetParentID(), ACTION_NAV_BACK) : false; + return Navigate(ACTION_NAV_BACK); } void CGUIControl::OnNextControl() { - if (HasFocus()) - m_actionNext.Execute(GetID(), GetParentID(), ACTION_NEXT_CONTROL); + Navigate(ACTION_NEXT_CONTROL); } void CGUIControl::OnPrevControl() { - if (HasFocus()) - m_actionPrev.Execute(GetID(), GetParentID(), ACTION_PREV_CONTROL); + Navigate(ACTION_PREV_CONTROL); } bool CGUIControl::SendWindowMessage(CGUIMessage &message) @@ -892,22 +896,27 @@ bool CGUIControl::IsAnimating(ANIMATION_TYPE animType) return false; } -int CGUIControl::GetNextControl(int direction) const +bool CGUIControl::GetNavigationAction(int direction, CGUIAction& action) const { switch (direction) { case ACTION_MOVE_UP: - return m_actionUp.GetNavigation(); + action = m_actionUp; + return true; case ACTION_MOVE_DOWN: - return m_actionDown.GetNavigation(); + action = m_actionDown; + return true; case ACTION_MOVE_LEFT: - return m_actionLeft.GetNavigation(); + action = m_actionLeft; + return true; case ACTION_MOVE_RIGHT: - return m_actionRight.GetNavigation(); + action = m_actionRight; + return true; case ACTION_NAV_BACK: - return m_actionBack.GetNavigation(); + action = m_actionBack; + return true; default: - return -1; + return false; } } |