diff options
author | jmarshallnz <jmarshallnz@svn> | 2010-03-25 02:02:06 +0000 |
---|---|---|
committer | jmarshallnz <jmarshallnz@svn> | 2010-03-25 02:02:06 +0000 |
commit | 44a3d70de84e60ed25c6c15258d01324cfe3377d (patch) | |
tree | 886ea6798d7009593f531208d746098488923a51 /guilib | |
parent | 002fb7812778df0dc924f5159236a19a052661cf (diff) |
changed: Make On/SendMouseEvent() return an enum rather than true/false.
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@28796 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
Diffstat (limited to 'guilib')
32 files changed, 112 insertions, 99 deletions
diff --git a/guilib/GUIBaseContainer.cpp b/guilib/GUIBaseContainer.cpp index 87d87113fc..6d36c77c89 100644 --- a/guilib/GUIBaseContainer.cpp +++ b/guilib/GUIBaseContainer.cpp @@ -542,27 +542,27 @@ bool CGUIBaseContainer::OnMouseOver(const CPoint &point) return CGUIControl::OnMouseOver(point); } -bool CGUIBaseContainer::OnMouseEvent(const CPoint &point, const CMouseEvent &event) +EVENT_RESULT CGUIBaseContainer::OnMouseEvent(const CPoint &point, const CMouseEvent &event) { if (event.m_id >= ACTION_MOUSE_LEFT_CLICK && event.m_id <= ACTION_MOUSE_DOUBLE_CLICK) { if (SelectItemFromPoint(point - CPoint(m_posX, m_posY))) { OnClick(event.m_id); - return true; + return EVENT_RESULT_HANDLED; } } else if (event.m_id == ACTION_MOUSE_WHEEL_UP) { Scroll(-1); - return true; + return EVENT_RESULT_HANDLED; } else if (event.m_id == ACTION_MOUSE_WHEEL_DOWN) { Scroll(1); - return true; + return EVENT_RESULT_HANDLED; } - return false; + return EVENT_RESULT_UNHANDLED; } bool CGUIBaseContainer::OnClick(int actionID) diff --git a/guilib/GUIBaseContainer.h b/guilib/GUIBaseContainer.h index 893d9b240d..99e757ac84 100644 --- a/guilib/GUIBaseContainer.h +++ b/guilib/GUIBaseContainer.h @@ -94,7 +94,7 @@ public: virtual void DumpTextureUse(); #endif protected: - virtual bool OnMouseEvent(const CPoint &point, const CMouseEvent &event); + virtual EVENT_RESULT OnMouseEvent(const CPoint &point, const CMouseEvent &event); bool OnClick(int actionID); virtual void Render(); virtual void RenderItem(float posX, float posY, CGUIListItem *item, bool focused); diff --git a/guilib/GUIButtonControl.cpp b/guilib/GUIButtonControl.cpp index 4c7690d061..8d6f74a72f 100644 --- a/guilib/GUIButtonControl.cpp +++ b/guilib/GUIButtonControl.cpp @@ -226,14 +226,14 @@ void CGUIButtonControl::UpdateColors() m_imgNoFocus.SetDiffuseColor(m_diffuseColor); } -bool CGUIButtonControl::OnMouseEvent(const CPoint &point, const CMouseEvent &event) +EVENT_RESULT CGUIButtonControl::OnMouseEvent(const CPoint &point, const CMouseEvent &event) { if (event.m_id == ACTION_MOUSE_LEFT_CLICK) { OnAction(CAction(ACTION_SELECT_ITEM)); - return true; + return EVENT_RESULT_HANDLED; } - return false; + return EVENT_RESULT_UNHANDLED; } CStdString CGUIButtonControl::GetDescription() const diff --git a/guilib/GUIButtonControl.h b/guilib/GUIButtonControl.h index 60844573e7..6f42b507c3 100644 --- a/guilib/GUIButtonControl.h +++ b/guilib/GUIButtonControl.h @@ -80,7 +80,7 @@ public: virtual void UpdateColors(); protected: friend class CGUISpinControlEx; - virtual bool OnMouseEvent(const CPoint &point, const CMouseEvent &event); + virtual EVENT_RESULT OnMouseEvent(const CPoint &point, const CMouseEvent &event); void OnFocus(); void OnUnFocus(); virtual void RenderText(); diff --git a/guilib/GUIButtonScroller.cpp b/guilib/GUIButtonScroller.cpp index 4091995201..3fd5380107 100644 --- a/guilib/GUIButtonScroller.cpp +++ b/guilib/GUIButtonScroller.cpp @@ -886,7 +886,7 @@ bool CGUIButtonScroller::OnMouseOver(const CPoint &point) return CGUIControl::OnMouseOver(point); } -bool CGUIButtonScroller::OnMouseEvent(const CPoint &point, const CMouseEvent &event) +EVENT_RESULT CGUIButtonScroller::OnMouseEvent(const CPoint &point, const CMouseEvent &event) { float fStartAlpha, fEndAlpha; GetScrollZone(fStartAlpha, fEndAlpha); @@ -900,22 +900,22 @@ bool CGUIButtonScroller::OnMouseEvent(const CPoint &point, const CMouseEvent &ev else m_iCurrentSlot = (int)((point.y - m_posY) / (m_imgFocus.GetHeight() + m_buttonGap)); OnAction(CAction(ACTION_SELECT_ITEM)); - return true; + return EVENT_RESULT_HANDLED; } else if (event.m_id == ACTION_MOUSE_WHEEL_UP) { m_bScrollDown = true; m_fScrollSpeed = SCROLL_SPEED; - return true; + return EVENT_RESULT_HANDLED; } else if (event.m_id == ACTION_MOUSE_WHEEL_DOWN) { m_bScrollUp = true; m_fScrollSpeed = SCROLL_SPEED; - return true; + return EVENT_RESULT_HANDLED; } } - return false; + return EVENT_RESULT_UNHANDLED; } CStdString CGUIButtonScroller::GetDescription() const diff --git a/guilib/GUIButtonScroller.h b/guilib/GUIButtonScroller.h index 39c4c279b7..1a405e253b 100644 --- a/guilib/GUIButtonScroller.h +++ b/guilib/GUIButtonScroller.h @@ -81,7 +81,7 @@ public: void LoadButtons(TiXmlNode *node); protected: - virtual bool OnMouseEvent(const CPoint &point, const CMouseEvent &event); + virtual EVENT_RESULT OnMouseEvent(const CPoint &point, const CMouseEvent &event); virtual void UpdateColors(); int GetNext(int iCurrent) const; int GetPrevious(int iCurrent); diff --git a/guilib/GUICheckMarkControl.cpp b/guilib/GUICheckMarkControl.cpp index 38aa74293f..17cc96d251 100644 --- a/guilib/GUICheckMarkControl.cpp +++ b/guilib/GUICheckMarkControl.cpp @@ -148,14 +148,14 @@ bool CGUICheckMarkControl::GetSelected() const return m_bSelected; } -bool CGUICheckMarkControl::OnMouseEvent(const CPoint &point, const CMouseEvent &event) +EVENT_RESULT CGUICheckMarkControl::OnMouseEvent(const CPoint &point, const CMouseEvent &event) { if (event.m_id == ACTION_MOUSE_LEFT_CLICK) { OnAction(CAction(ACTION_SELECT_ITEM)); - return true; + return EVENT_RESULT_HANDLED; } - return false; + return EVENT_RESULT_UNHANDLED; } void CGUICheckMarkControl::SetLabel(const string &label) diff --git a/guilib/GUICheckMarkControl.h b/guilib/GUICheckMarkControl.h index 62a5ab975a..3130dff42d 100644 --- a/guilib/GUICheckMarkControl.h +++ b/guilib/GUICheckMarkControl.h @@ -62,7 +62,7 @@ public: void PythonSetDisabledColor(color_t disabledColor); protected: - virtual bool OnMouseEvent(const CPoint &point, const CMouseEvent &event); + virtual EVENT_RESULT OnMouseEvent(const CPoint &point, const CMouseEvent &event); virtual void UpdateColors(); CGUILabel::COLOR GetTextColor() const; diff --git a/guilib/GUIControl.cpp b/guilib/GUIControl.cpp index 38f24acc8b..94b5755c27 100644 --- a/guilib/GUIControl.cpp +++ b/guilib/GUIControl.cpp @@ -510,17 +510,18 @@ bool CGUIControl::HitTest(const CPoint &point) const return m_hitRect.PtInRect(point); } -bool CGUIControl::SendMouseEvent(const CPoint &point, const CMouseEvent &event) +EVENT_RESULT CGUIControl::SendMouseEvent(const CPoint &point, const CMouseEvent &event) { CPoint childPoint(point); m_transform.InverseTransformPosition(childPoint.x, childPoint.y); if (!CanFocusFromPoint(childPoint)) - return false; + return EVENT_RESULT_UNHANDLED; bool handled = OnMouseOver(childPoint); - if (OnMouseEvent(childPoint, event)) - return true; - return handled && (event.m_id == ACTION_MOUSE_MOVE); + EVENT_RESULT ret = OnMouseEvent(childPoint, event); + if (ret) + return ret; + return (handled && (event.m_id == ACTION_MOUSE_MOVE)) ? EVENT_RESULT_HANDLED : EVENT_RESULT_UNHANDLED; } // override this function to implement custom mouse behaviour diff --git a/guilib/GUIControl.h b/guilib/GUIControl.h index ab98f5a7f9..ea4be50318 100644 --- a/guilib/GUIControl.h +++ b/guilib/GUIControl.h @@ -53,6 +53,13 @@ public: }; /*! + \brief Results of OnMouseEvent() + Any value not equal to EVENT_RESULT_UNHANDLED indicates that the event was handled. + */ +enum EVENT_RESULT { EVENT_RESULT_UNHANDLED = 0, + EVENT_RESULT_HANDLED }; + +/*! \ingroup controls \brief Base class for controls */ @@ -94,10 +101,10 @@ public: \param point the location in transformed skin coordinates from the upper left corner of the parent control. \param event the mouse event to perform - \return true if the control has handled this event, false otherwise - \sa HitTest, CanFocusFromPoint, CMouseEvent + \return EVENT_RESULT corresponding to whether the control handles this event + \sa HitTest, CanFocusFromPoint, CMouseEvent, EVENT_RESULT */ - virtual bool SendMouseEvent(const CPoint &point, const CMouseEvent &event); + virtual EVENT_RESULT SendMouseEvent(const CPoint &point, const CMouseEvent &event); /*! \brief Perform a mouse action @@ -106,10 +113,10 @@ public: \param point the location in transformed skin coordinates from the upper left corner of the parent control. \param event the mouse event to perform - \return true if the control has handled this event, false otherwise + \return EVENT_RESULT corresponding to whether the control handles this event \sa SendMouseEvent, HitTest, CanFocusFromPoint, CMouseEvent */ - virtual bool OnMouseEvent(const CPoint &point, const CMouseEvent &event) { return false; }; + virtual EVENT_RESULT OnMouseEvent(const CPoint &point, const CMouseEvent &event) { return EVENT_RESULT_UNHANDLED; }; /*! \brief Unfocus the control if the given point on screen is not within it's boundary \param point the location in transformed skin coordinates from the upper left corner of the parent control. diff --git a/guilib/GUIControlGroup.cpp b/guilib/GUIControlGroup.cpp index 9399c6d85a..4066b1b4cb 100644 --- a/guilib/GUIControlGroup.cpp +++ b/guilib/GUIControlGroup.cpp @@ -357,7 +357,7 @@ bool CGUIControlGroup::HasAnimation(ANIMATION_TYPE animType) return false; } -bool CGUIControlGroup::SendMouseEvent(const CPoint &point, const CMouseEvent &event) +EVENT_RESULT CGUIControlGroup::SendMouseEvent(const CPoint &point, const CMouseEvent &event) { // transform our position into child coordinates CPoint childPoint(point); @@ -370,17 +370,19 @@ bool CGUIControlGroup::SendMouseEvent(const CPoint &point, const CMouseEvent &ev for (rControls i = m_children.rbegin(); i != m_children.rend(); ++i) { CGUIControl *child = *i; - if (child->SendMouseEvent(childPoint - pos, event)) + EVENT_RESULT ret = child->SendMouseEvent(childPoint - pos, event); + if (ret) { // we've handled the action, and/or have focused an item - return true; + return ret; } } // none of our children want the event, but we may want it. - if (HitTest(childPoint) && OnMouseEvent(childPoint, event)) - return true; + EVENT_RESULT ret; + if (HitTest(childPoint) && (ret = OnMouseEvent(childPoint, event))) + return ret; } m_focusedControl = 0; - return false; + return EVENT_RESULT_UNHANDLED; } void CGUIControlGroup::UnfocusFromPoint(const CPoint &point) diff --git a/guilib/GUIControlGroup.h b/guilib/GUIControlGroup.h index d0f2f8f599..41a8826a68 100644 --- a/guilib/GUIControlGroup.h +++ b/guilib/GUIControlGroup.h @@ -51,7 +51,7 @@ public: virtual void DynamicResourceAlloc(bool bOnOff); virtual bool CanFocus() const; - virtual bool SendMouseEvent(const CPoint &point, const CMouseEvent &event); + virtual EVENT_RESULT SendMouseEvent(const CPoint &point, const CMouseEvent &event); virtual void UnfocusFromPoint(const CPoint &point); virtual void SetInitialVisibility(); diff --git a/guilib/GUIControlGroupList.cpp b/guilib/GUIControlGroupList.cpp index 6f5daff21f..0a370b880c 100644 --- a/guilib/GUIControlGroupList.cpp +++ b/guilib/GUIControlGroupList.cpp @@ -313,7 +313,7 @@ void CGUIControlGroupList::ScrollTo(float offset) m_scrollSpeed = (m_scrollOffset - m_offset) / m_scrollTime; } -bool CGUIControlGroupList::SendMouseEvent(const CPoint &point, const CMouseEvent &event) +EVENT_RESULT CGUIControlGroupList::SendMouseEvent(const CPoint &point, const CMouseEvent &event) { // transform our position into child coordinates CPoint childPoint(point); @@ -331,20 +331,22 @@ bool CGUIControlGroupList::SendMouseEvent(const CPoint &point, const CMouseEvent { // we're on screen float offsetX = m_orientation == VERTICAL ? m_posX : m_posX + alignOffset + pos - m_offset; float offsetY = m_orientation == VERTICAL ? m_posY + alignOffset + pos - m_offset : m_posY; - if (child->SendMouseEvent(childPoint - CPoint(offsetX, offsetY), event)) + EVENT_RESULT ret = child->SendMouseEvent(childPoint - CPoint(offsetX, offsetY), event); + if (ret) { // we've handled the action, and/or have focused an item - return true; + return ret; } } pos += Size(child) + m_itemGap; } } // none of our children want the event, but we may want it. - if (HitTest(childPoint) && OnMouseEvent(childPoint, event)) - return true; + EVENT_RESULT ret; + if (HitTest(childPoint) && (ret = OnMouseEvent(childPoint, event))) + return ret; } m_focusedControl = 0; - return false; + return EVENT_RESULT_UNHANDLED; } void CGUIControlGroupList::UnfocusFromPoint(const CPoint &point) @@ -420,7 +422,7 @@ float CGUIControlGroupList::GetAlignOffset() const return 0.0f; } -bool CGUIControlGroupList::OnMouseEvent(const CPoint &point, const CMouseEvent &event) +EVENT_RESULT CGUIControlGroupList::OnMouseEvent(const CPoint &point, const CMouseEvent &event) { if (event.m_id == ACTION_MOUSE_WHEEL_UP || event.m_id == ACTION_MOUSE_WHEEL_DOWN) { @@ -434,15 +436,15 @@ bool CGUIControlGroupList::OnMouseEvent(const CPoint &point, const CMouseEvent & if (event.m_id == ACTION_MOUSE_WHEEL_DOWN && nextOffset > m_offset) // past our current offset { ScrollTo(nextOffset); - return true; + return EVENT_RESULT_HANDLED; } else if (event.m_id == ACTION_MOUSE_WHEEL_UP && nextOffset >= m_offset) // at least at our current offset { ScrollTo(offset); - return true; + return EVENT_RESULT_HANDLED; } offset = nextOffset; } } - return false; + return EVENT_RESULT_UNHANDLED; } diff --git a/guilib/GUIControlGroupList.h b/guilib/GUIControlGroupList.h index ab26d08ccb..f05d5e3c13 100644 --- a/guilib/GUIControlGroupList.h +++ b/guilib/GUIControlGroupList.h @@ -42,7 +42,7 @@ public: virtual void Render(); virtual bool OnMessage(CGUIMessage& message); - virtual bool SendMouseEvent(const CPoint &point, const CMouseEvent &event); + virtual EVENT_RESULT SendMouseEvent(const CPoint &point, const CMouseEvent &event); virtual void UnfocusFromPoint(const CPoint &point); virtual void AddControl(CGUIControl *control, int position = -1); @@ -50,7 +50,7 @@ public: virtual bool GetCondition(int condition, int data) const; protected: - virtual bool OnMouseEvent(const CPoint &point, const CMouseEvent &event); + virtual EVENT_RESULT OnMouseEvent(const CPoint &point, const CMouseEvent &event); bool IsFirstFocusableControl(const CGUIControl *control) const; bool IsLastFocusableControl(const CGUIControl *control) const; void ValidateOffset(); diff --git a/guilib/GUIMoverControl.cpp b/guilib/GUIMoverControl.cpp index bdf7999878..b2b53e1fef 100644 --- a/guilib/GUIMoverControl.cpp +++ b/guilib/GUIMoverControl.cpp @@ -134,7 +134,7 @@ void CGUIMoverControl::OnRight() Move((int)m_fSpeed, 0); } -bool CGUIMoverControl::OnMouseEvent(const CPoint &point, const CMouseEvent &event) +EVENT_RESULT CGUIMoverControl::OnMouseEvent(const CPoint &point, const CMouseEvent &event) { if (event.m_id == ACTION_MOUSE_DRAG) { @@ -149,9 +149,9 @@ bool CGUIMoverControl::OnMouseEvent(const CPoint &point, const CMouseEvent &even SendWindowMessage(msg); } Move((int)event.m_offsetX, (int)event.m_offsetY); - return true; + return EVENT_RESULT_HANDLED; } - return false; + return EVENT_RESULT_UNHANDLED; } void CGUIMoverControl::UpdateSpeed(int nDirection) diff --git a/guilib/GUIMoverControl.h b/guilib/GUIMoverControl.h index 562304c236..b8424ad3a5 100644 --- a/guilib/GUIMoverControl.h +++ b/guilib/GUIMoverControl.h @@ -77,7 +77,7 @@ public: int GetYLocation() const { return m_iLocationY;}; protected: - virtual bool OnMouseEvent(const CPoint &point, const CMouseEvent &event); + virtual EVENT_RESULT OnMouseEvent(const CPoint &point, const CMouseEvent &event); virtual void UpdateColors(); void SetAlpha(unsigned char alpha); void UpdateSpeed(int nDirection); diff --git a/guilib/GUIMultiSelectText.cpp b/guilib/GUIMultiSelectText.cpp index 4cb80714f0..8c9592b480 100644 --- a/guilib/GUIMultiSelectText.cpp +++ b/guilib/GUIMultiSelectText.cpp @@ -246,15 +246,15 @@ bool CGUIMultiSelectTextControl::OnMouseOver(const CPoint &point) return CGUIControl::OnMouseOver(point); } -bool CGUIMultiSelectTextControl::OnMouseEvent(const CPoint &point, const CMouseEvent &event) +EVENT_RESULT CGUIMultiSelectTextControl::OnMouseEvent(const CPoint &point, const CMouseEvent &event) { if (event.m_id == ACTION_MOUSE_LEFT_CLICK) { m_selectedItem = GetItemFromPoint(point); OnAction(CAction(ACTION_SELECT_ITEM)); - return true; + return EVENT_RESULT_HANDLED; } - return false; + return EVENT_RESULT_UNHANDLED; } int CGUIMultiSelectTextControl::GetItemFromPoint(const CPoint &point) const diff --git a/guilib/GUIMultiSelectText.h b/guilib/GUIMultiSelectText.h index 6fc12e8bc6..18f5706436 100644 --- a/guilib/GUIMultiSelectText.h +++ b/guilib/GUIMultiSelectText.h @@ -61,7 +61,7 @@ public: virtual void SetAnimations(const std::vector<CAnimation> &animations); virtual void SetFocus(bool focus); protected: - virtual bool OnMouseEvent(const CPoint &point, const CMouseEvent &event); + virtual EVENT_RESULT OnMouseEvent(const CPoint &point, const CMouseEvent &event); virtual void UpdateColors(); void AddString(const CStdString &text, bool selectable, const CStdString &clickAction = ""); void PositionButtons(); diff --git a/guilib/GUIResizeControl.cpp b/guilib/GUIResizeControl.cpp index c71dd8b738..3b77268d51 100644 --- a/guilib/GUIResizeControl.cpp +++ b/guilib/GUIResizeControl.cpp @@ -123,7 +123,7 @@ void CGUIResizeControl::OnRight() Resize(m_fSpeed, 0); } -bool CGUIResizeControl::OnMouseEvent(const CPoint &point, const CMouseEvent &event) +EVENT_RESULT CGUIResizeControl::OnMouseEvent(const CPoint &point, const CMouseEvent &event) { if (event.m_id == ACTION_MOUSE_DRAG) { @@ -138,9 +138,9 @@ bool CGUIResizeControl::OnMouseEvent(const CPoint &point, const CMouseEvent &eve SendWindowMessage(msg); } Resize(event.m_offsetX, event.m_offsetY); - return true; + return EVENT_RESULT_HANDLED; } - return false; + return EVENT_RESULT_UNHANDLED; } void CGUIResizeControl::UpdateSpeed(int nDirection) diff --git a/guilib/GUIResizeControl.h b/guilib/GUIResizeControl.h index dfd78e5435..aaa9343756 100644 --- a/guilib/GUIResizeControl.h +++ b/guilib/GUIResizeControl.h @@ -66,7 +66,7 @@ public: void SetLimits(float x1, float y1, float x2, float y2); protected: - virtual bool OnMouseEvent(const CPoint &point, const CMouseEvent &event); + virtual EVENT_RESULT OnMouseEvent(const CPoint &point, const CMouseEvent &event); virtual void UpdateColors(); void SetAlpha(unsigned char alpha); void UpdateSpeed(int nDirection); diff --git a/guilib/GUIScrollBarControl.cpp b/guilib/GUIScrollBarControl.cpp index 3281674faf..3d661e522d 100644 --- a/guilib/GUIScrollBarControl.cpp +++ b/guilib/GUIScrollBarControl.cpp @@ -264,7 +264,7 @@ void CGUIScrollBar::SetFromPosition(const CPoint &point) SetInvalid(); } -bool CGUIScrollBar::OnMouseEvent(const CPoint &point, const CMouseEvent &event) +EVENT_RESULT CGUIScrollBar::OnMouseEvent(const CPoint &point, const CMouseEvent &event) { if (event.m_id == ACTION_MOUSE_DRAG) { @@ -279,23 +279,24 @@ bool CGUIScrollBar::OnMouseEvent(const CPoint &point, const CMouseEvent &event) SendWindowMessage(msg); } SetFromPosition(point); - return true; + return EVENT_RESULT_HANDLED; } else if (event.m_id == ACTION_MOUSE_LEFT_CLICK && m_guiBackground.HitTest(point)) { SetFromPosition(point); - return true; + return EVENT_RESULT_HANDLED; } else if (event.m_id == ACTION_MOUSE_WHEEL_UP) { Move(-1); + return EVENT_RESULT_HANDLED; } else if (event.m_id == ACTION_MOUSE_WHEEL_DOWN) { Move(1); - return true; + return EVENT_RESULT_HANDLED; } - return false; + return EVENT_RESULT_UNHANDLED; } CStdString CGUIScrollBar::GetDescription() const diff --git a/guilib/GUIScrollBarControl.h b/guilib/GUIScrollBarControl.h index 562006949e..688811da91 100644 --- a/guilib/GUIScrollBarControl.h +++ b/guilib/GUIScrollBarControl.h @@ -63,7 +63,7 @@ public: virtual bool IsVisible() const; protected: virtual bool HitTest(const CPoint &point) const; - virtual bool OnMouseEvent(const CPoint &point, const CMouseEvent &event); + virtual EVENT_RESULT OnMouseEvent(const CPoint &point, const CMouseEvent &event); virtual void UpdateColors(); void UpdateBarSize(); virtual void Move(int iNumSteps); diff --git a/guilib/GUISelectButtonControl.cpp b/guilib/GUISelectButtonControl.cpp index 8a287400a0..e614336a3c 100644 --- a/guilib/GUISelectButtonControl.cpp +++ b/guilib/GUISelectButtonControl.cpp @@ -358,7 +358,7 @@ bool CGUISelectButtonControl::OnMouseOver(const CPoint &point) return ret; } -bool CGUISelectButtonControl::OnMouseEvent(const CPoint &point, const CMouseEvent &event) +EVENT_RESULT CGUISelectButtonControl::OnMouseEvent(const CPoint &point, const CMouseEvent &event) { if (event.m_id == ACTION_MOUSE_LEFT_CLICK) { @@ -368,19 +368,19 @@ bool CGUISelectButtonControl::OnMouseEvent(const CPoint &point, const CMouseEven OnRight(); else // normal select CGUIButtonControl::OnMouseEvent(point, event); - return true; + return EVENT_RESULT_HANDLED; } else if (event.m_id == ACTION_MOUSE_WHEEL_UP) { OnLeft(); - return true; + return EVENT_RESULT_HANDLED; } else if (event.m_id == ACTION_MOUSE_WHEEL_DOWN) { OnRight(); - return true; + return EVENT_RESULT_HANDLED; } - return false; + return EVENT_RESULT_UNHANDLED; } void CGUISelectButtonControl::SetPosition(float posX, float posY) diff --git a/guilib/GUISelectButtonControl.h b/guilib/GUISelectButtonControl.h index 01abe147cc..76604c5877 100644 --- a/guilib/GUISelectButtonControl.h +++ b/guilib/GUISelectButtonControl.h @@ -113,7 +113,7 @@ public: virtual void SetPosition(float posX, float posY); protected: - virtual bool OnMouseEvent(const CPoint &point, const CMouseEvent &event); + virtual EVENT_RESULT OnMouseEvent(const CPoint &point, const CMouseEvent &event); virtual void UpdateColors(); bool m_bShowSelect; CGUITexture m_imgBackground; diff --git a/guilib/GUISliderControl.cpp b/guilib/GUISliderControl.cpp index 4c1ed9eb7a..47516e84b3 100644 --- a/guilib/GUISliderControl.cpp +++ b/guilib/GUISliderControl.cpp @@ -295,7 +295,7 @@ void CGUISliderControl::SetFromPosition(const CPoint &point) SEND_CLICK_MESSAGE(GetID(), GetParentID(), MathUtils::round_int(fPercent)); } -bool CGUISliderControl::OnMouseEvent(const CPoint &point, const CMouseEvent &event) +EVENT_RESULT CGUISliderControl::OnMouseEvent(const CPoint &point, const CMouseEvent &event) { if (event.m_id == ACTION_MOUSE_DRAG) { @@ -310,24 +310,24 @@ bool CGUISliderControl::OnMouseEvent(const CPoint &point, const CMouseEvent &eve SendWindowMessage(msg); } SetFromPosition(point); - return true; + return EVENT_RESULT_HANDLED; } else if (event.m_id == ACTION_MOUSE_LEFT_CLICK && m_guiBackground.HitTest(point)) { SetFromPosition(point); - return true; + return EVENT_RESULT_HANDLED; } else if (event.m_id == ACTION_MOUSE_WHEEL_UP) { Move(10); - return true; + return EVENT_RESULT_HANDLED; } else if (event.m_id == ACTION_MOUSE_WHEEL_DOWN) { Move(-10); - return true; + return EVENT_RESULT_HANDLED; } - return false; + return EVENT_RESULT_UNHANDLED; } void CGUISliderControl::SetInfo(int iInfo) diff --git a/guilib/GUISliderControl.h b/guilib/GUISliderControl.h index e15af23453..4a2d8dc978 100644 --- a/guilib/GUISliderControl.h +++ b/guilib/GUISliderControl.h @@ -70,7 +70,7 @@ public: void SetTextValue(const CStdString &textValue) { m_textValue = textValue; }; protected: virtual bool HitTest(const CPoint &point) const; - virtual bool OnMouseEvent(const CPoint &point, const CMouseEvent &event); + virtual EVENT_RESULT OnMouseEvent(const CPoint &point, const CMouseEvent &event); virtual void UpdateColors(); virtual void Move(int iNumSteps); virtual void SetFromPosition(const CPoint &point); diff --git a/guilib/GUISpinControl.cpp b/guilib/GUISpinControl.cpp index f2b98d30c0..f57ee9423d 100644 --- a/guilib/GUISpinControl.cpp +++ b/guilib/GUISpinControl.cpp @@ -866,7 +866,7 @@ bool CGUISpinControl::OnMouseOver(const CPoint &point) return CGUIControl::OnMouseOver(point); } -bool CGUISpinControl::OnMouseEvent(const CPoint &point, const CMouseEvent &event) +EVENT_RESULT CGUISpinControl::OnMouseEvent(const CPoint &point, const CMouseEvent &event) { if (event.m_id == ACTION_MOUSE_LEFT_CLICK) { @@ -874,19 +874,19 @@ bool CGUISpinControl::OnMouseEvent(const CPoint &point, const CMouseEvent &event MoveUp(); else if (m_imgspinDownFocus.HitTest(point)) MoveDown(); - return true; + return EVENT_RESULT_HANDLED; } else if (event.m_id == ACTION_MOUSE_WHEEL_UP) { MoveUp(); - return true; + return EVENT_RESULT_HANDLED; } else if (event.m_id == ACTION_MOUSE_WHEEL_DOWN) { MoveDown(); - return true; + return EVENT_RESULT_HANDLED; } - return false; + return EVENT_RESULT_UNHANDLED; } CStdString CGUISpinControl::GetDescription() const diff --git a/guilib/GUISpinControl.h b/guilib/GUISpinControl.h index ccdba3ef3c..27db78d7e5 100644 --- a/guilib/GUISpinControl.h +++ b/guilib/GUISpinControl.h @@ -88,7 +88,7 @@ public: virtual bool IsVisible() const; protected: - virtual bool OnMouseEvent(const CPoint &point, const CMouseEvent &event); + virtual EVENT_RESULT OnMouseEvent(const CPoint &point, const CMouseEvent &event); virtual void UpdateColors(); /*! \brief Render the spinner text \param posX position of the left edge of the text diff --git a/guilib/GUIVideoControl.cpp b/guilib/GUIVideoControl.cpp index dfb034631a..565e7e46ed 100644 --- a/guilib/GUIVideoControl.cpp +++ b/guilib/GUIVideoControl.cpp @@ -66,14 +66,14 @@ void CGUIVideoControl::Render() CGUIControl::Render(); } -bool CGUIVideoControl::OnMouseEvent(const CPoint &point, const CMouseEvent &event) +EVENT_RESULT CGUIVideoControl::OnMouseEvent(const CPoint &point, const CMouseEvent &event) { - if (!g_application.IsPlayingVideo()) return false; + if (!g_application.IsPlayingVideo()) return EVENT_RESULT_UNHANDLED; if (event.m_id == ACTION_MOUSE_LEFT_CLICK) { // switch to fullscreen CGUIMessage message(GUI_MSG_FULLSCREEN, GetID(), GetParentID()); g_windowManager.SendMessage(message); - return true; + return EVENT_RESULT_HANDLED; } else if (event.m_id == ACTION_MOUSE_RIGHT_CLICK) { // toggle the playlist window @@ -81,9 +81,9 @@ bool CGUIVideoControl::OnMouseEvent(const CPoint &point, const CMouseEvent &even g_windowManager.PreviousWindow(); else g_windowManager.ActivateWindow(WINDOW_VIDEO_PLAYLIST); - return true; + return EVENT_RESULT_HANDLED; } - return false; + return EVENT_RESULT_UNHANDLED; } bool CGUIVideoControl::CanFocus() const diff --git a/guilib/GUIVideoControl.h b/guilib/GUIVideoControl.h index bd4615ae80..3ed7089054 100644 --- a/guilib/GUIVideoControl.h +++ b/guilib/GUIVideoControl.h @@ -44,7 +44,7 @@ public: virtual CGUIVideoControl *Clone() const { return new CGUIVideoControl(*this); }; virtual void Render(); - virtual bool OnMouseEvent(const CPoint &point, const CMouseEvent &event); + virtual EVENT_RESULT OnMouseEvent(const CPoint &point, const CMouseEvent &event); virtual bool CanFocus() const; virtual bool CanFocusFromPoint(const CPoint &point) const; }; diff --git a/guilib/GUIWindow.cpp b/guilib/GUIWindow.cpp index 25920b28b9..2fc36b3105 100644 --- a/guilib/GUIWindow.cpp +++ b/guilib/GUIWindow.cpp @@ -336,7 +336,7 @@ void CGUIWindow::Close(bool forceClose) bool CGUIWindow::OnAction(const CAction &action) { if (action.IsMouse()) - return OnMouseAction(action); + return EVENT_RESULT_UNHANDLED != OnMouseAction(action); CGUIControl *focusedControl = GetFocusedControl(); if (focusedControl) @@ -363,7 +363,7 @@ CPoint CGUIWindow::GetPosition() const } // OnMouseAction - called by OnAction() -bool CGUIWindow::OnMouseAction(const CAction &action) +EVENT_RESULT CGUIWindow::OnMouseAction(const CAction &action) { g_graphicsContext.SetScalingResolution(m_coordsRes, m_needsScaling); CPoint mousePoint(action.GetAmount(0), action.GetAmount(1)); @@ -386,13 +386,13 @@ bool CGUIWindow::OnMouseAction(const CAction &action) return SendMouseEvent(mousePoint, event); } -bool CGUIWindow::OnMouseEvent(const CPoint &point, const CMouseEvent &event) +EVENT_RESULT CGUIWindow::OnMouseEvent(const CPoint &point, const CMouseEvent &event) { if (event.m_id == ACTION_MOUSE_RIGHT_CLICK) { // no control found to absorb this click - go to previous menu - return OnAction(CAction(ACTION_PREVIOUS_MENU)); + return OnAction(CAction(ACTION_PREVIOUS_MENU)) ? EVENT_RESULT_HANDLED : EVENT_RESULT_UNHANDLED; } - return false; + return EVENT_RESULT_UNHANDLED; } /// \brief Called on window open. diff --git a/guilib/GUIWindow.h b/guilib/GUIWindow.h index b2181670bc..dc3c3bfd84 100644 --- a/guilib/GUIWindow.h +++ b/guilib/GUIWindow.h @@ -203,7 +203,7 @@ public: bool HasSaveLastControl() const { return !m_defaultAlways; }; protected: - virtual bool OnMouseEvent(const CPoint &point, const CMouseEvent &event); + virtual EVENT_RESULT OnMouseEvent(const CPoint &point, const CMouseEvent &event); virtual bool LoadXML(const CStdString& strPath, const CStdString &strLowerPath); ///< Loads from the given file bool Load(TiXmlDocument &xmlDoc); ///< Loads from the given XML document virtual void LoadAdditionalTags(TiXmlElement *root) {}; ///< Load additional information from the XML document @@ -213,7 +213,7 @@ protected: virtual void OnWindowLoaded(); virtual void OnInitWindow(); virtual void OnDeinitWindow(int nextWindowID); - bool OnMouseAction(const CAction &action); + EVENT_RESULT OnMouseAction(const CAction &action); virtual bool RenderAnimation(unsigned int time); virtual bool CheckAnimation(ANIMATION_TYPE animType); |