From: Richard Huang Date: Fri, 19 Sep 2014 10:50:50 +0000 (+0100) Subject: Added default hover event handling in Control X-Git-Tag: dali_1.0.12~2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=69c760f194a0363e7b6b4996e2b4ba8ce01e985a Added default hover event handling in Control Change-Id: I091db23b835e856aabdc8e5c2273318812a0cacc --- diff --git a/base/dali-toolkit/public-api/controls/control-impl.cpp b/base/dali-toolkit/public-api/controls/control-impl.cpp index 74720d0..c7b03dc 100644 --- a/base/dali-toolkit/public-api/controls/control-impl.cpp +++ b/base/dali-toolkit/public-api/controls/control-impl.cpp @@ -556,7 +556,7 @@ public: Toolkit::Control::SizePolicy mWidthPolicy :3; ///< Stores the width policy. 3 bits covers 8 values Toolkit::Control::SizePolicy mHeightPolicy :3; ///< Stores the height policy. 3 bits covers 8 values - ControlBehaviour mFlags :4; ///< Flags passed in from constructor. Need to increase this size when new enums are added + ControlBehaviour mFlags :6; ///< Flags passed in from constructor. Need to increase this size when new enums are added bool mInsideRelayout:1; ///< Detect when were in Relayout bool mIsKeyboardNavigationSupported:1; ///< Stores whether keyboard navigation is supported by the control. bool mIsKeyboardFocusGroup:1; ///< Stores whether the control is a focus group. @@ -617,6 +617,9 @@ void Control::Initialize() GetImpl( styleManager ).ApplyThemeStyle( GetOwner() ); } + SetRequiresHoverEvents(mImpl->mFlags & REQUIRES_HOVER_EVENTS); + SetRequiresMouseWheelEvents(mImpl->mFlags & REQUIRES_MOUSE_WHEEL_EVENTS); + mImpl->mInitialized = true; } @@ -866,6 +869,11 @@ bool Control::OnTouchEvent(const TouchEvent& event) return false; // Do not consume } +bool Control::OnHoverEvent(const HoverEvent& event) +{ + return false; // Do not consume +} + bool Control::OnKeyEvent(const KeyEvent& event) { return false; // Do not consume diff --git a/base/dali-toolkit/public-api/controls/control-impl.h b/base/dali-toolkit/public-api/controls/control-impl.h index fdcc05f..d863a5d 100644 --- a/base/dali-toolkit/public-api/controls/control-impl.h +++ b/base/dali-toolkit/public-api/controls/control-impl.h @@ -507,6 +507,11 @@ private: // From CustomActorImpl, derived classes can override these. virtual bool OnTouchEvent(const TouchEvent& event); /** + * @copydoc Dali::CustomActorImpl::OnHoverEvent(const HoverEvent&) + */ + virtual bool OnHoverEvent(const HoverEvent& event); + + /** * @copydoc Dali::CustomActorImpl::OnKeyEvent(const KeyEvent&) */ virtual bool OnKeyEvent(const KeyEvent& event); @@ -549,7 +554,9 @@ protected: // Construction CONTROL_BEHAVIOUR_NONE = 0, REQUIRES_TOUCH_EVENTS = 1<<1, ///< True if the OnTouchEvent() callback is required. REQUIRES_STYLE_CHANGE_SIGNALS = 1<<2, ///< True if needs to monitor style change signals such as theme/font change - NO_SIZE_NEGOTIATION = 1<<3 ///< True if control does not need size negotiation, i.e. it can be skipped in the algorithm + NO_SIZE_NEGOTIATION = 1<<3, ///< True if control does not need size negotiation, i.e. it can be skipped in the algorithm + REQUIRES_HOVER_EVENTS = 1<<4, ///< True if the OnHoverEvent() callback is required. + REQUIRES_MOUSE_WHEEL_EVENTS = 1<<5 ///< True if the OnMouseWheelEvent() callback is required. }; /**