X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=base%2Fdali-toolkit%2Fpublic-api%2Fcontrols%2Fcontrol-impl.cpp;h=5ecacd787464d808f0ef738cdf93b70e67d078d0;hp=9347f6a27d88ed46f83e0bc1ed65c48bd819fb79;hb=f4d5b3ffc194fc1b1c14f4a79e3efa435a31bc32;hpb=00ef589046a32c53d20de1c61af7cc69524e51dc diff --git a/base/dali-toolkit/public-api/controls/control-impl.cpp b/base/dali-toolkit/public-api/controls/control-impl.cpp index 9347f6a..5ecacd7 100644 --- a/base/dali-toolkit/public-api/controls/control-impl.cpp +++ b/base/dali-toolkit/public-api/controls/control-impl.cpp @@ -16,18 +16,19 @@ #include -#include #include #include -#include "dali-toolkit/internal/controls/style-change-processor.h" #include "dali-toolkit/internal/controls/relayout-controller.h" #include "dali-toolkit/internal/controls/relayout-helper.h" #include "dali-toolkit/public-api/focus-manager/keyinput-focus-manager.h" #include "dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h" #include +#include +#include + namespace Dali { @@ -253,7 +254,8 @@ public: mIsKeyboardNavigationSupported(false), mIsKeyboardFocusGroup(false), mKeyEventSignalV2(), - mBackground( NULL ) + mBackground( NULL ), + mFlags( Control::CONTROL_BEHAVIOUR_NONE ) { } @@ -528,6 +530,8 @@ public: // Background Background* mBackground; ///< Only create the background if we use it + ControlBehaviour mFlags; ///< Flags passed in from constructor + // Properties - these need to be members of Internal::Control::Impl as they need to functions within this class. static PropertyRegistration PROPERTY_1; static PropertyRegistration PROPERTY_2; @@ -549,7 +553,7 @@ PropertyRegistration Control::Impl::PROPERTY_7( CONTROL_TYPE, "key-input-focus", Toolkit::Control Control::New() { // Create the implementation, temporarily owned on stack - IntrusivePtr controlImpl = new Control( false ); + IntrusivePtr controlImpl = new Control( CONTROL_BEHAVIOUR_NONE ); // Pass ownership to handle Toolkit::Control handle( *controlImpl ); @@ -563,22 +567,23 @@ Toolkit::Control Control::New() Control::~Control() { - if( mImpl->mInitialized ) - { - // Unregister only if control has been initialized. - Internal::StyleChangeProcessor::Unregister( this ); - } delete mImpl; } void Control::Initialize() { - // Register with the style change processor so we are informed when the default style changes - Internal::StyleChangeProcessor::Register( this ); // Calling deriving classes OnInitialize(); + if( mImpl->mFlags & REQUIRES_STYLE_CHANGE_SIGNALS ) + { + Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get(); + + // Register for style changes + styleManager.StyleChangeSignal().Connect( this, &ControlImpl::DoStyleChange ); + } + mImpl->mInitialized = true; } @@ -735,6 +740,11 @@ Actor Control::GetBackgroundActor() const return Actor(); } +void Control::OnThemeChange( Toolkit::StyleManager styleManager ) +{ + GetImpl( styleManager ).ApplyThemeStyle( GetOwner() ); +} + void Control::OnPinch(PinchGesture pinch) { if (pinch.state == Gesture::Started) @@ -847,6 +857,11 @@ bool Control::OnAccessibilityPan(PanGesture gesture) return false; // Accessibility pan gesture is not handled by default } +bool Control::OnAccessibilityTouch(const TouchEvent& touchEvent) +{ + return false; // Accessibility touch event is not handled by default +} + bool Control::OnAccessibilityValueChange(bool isIncrease) { return false; // Accessibility value change action is not handled by default @@ -893,6 +908,21 @@ void Control::DoActivatedAction(const PropertyValueContainer& attributes) OnActivated(); } +void Control::DoStyleChange( Toolkit::StyleManager styleManager, StyleChange change ) +{ + if( change.themeChange ) + { + OnThemeChange( styleManager ); + } + else if( change.defaultFontChange || change.defaultFontSizeChange ) + { + // This OnStyleChange(StyleChange change ) is deprecated, use OnFontChange instead + OnStyleChange( change ); + + OnFontChange( change.defaultFontChange, change.defaultFontSizeChange ); + } +} + Toolkit::Control::KeyEventSignalV2& Control::KeyEventSignal() { return mImpl->mKeyEventSignalV2; @@ -1218,6 +1248,13 @@ Control::Control( bool requiresTouchEvents ) { } +Control::Control( ControlBehaviour behaviourFlags ) +: CustomActorImpl( behaviourFlags & REQUIRES_TOUCH_EVENTS ), + mImpl(new Impl(*this)) +{ + mImpl->mFlags = behaviourFlags; +} + } // namespace Internal } // namespace Toolkit