1 #ifndef DALI_TOOLKIT_INTERNAL_CONTROL_WRAPPER_H
2 #define DALI_TOOLKIT_INTERNAL_CONTROL_WRAPPER_H
5 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali-toolkit/public-api/controls/control-impl.h>
23 #include <dali-toolkit/devel-api/controls/control-wrapper.h>
36 typedef IntrusivePtr< ControlWrapper > ControlWrapperPtr;
39 * @copydoc Toolkit::ControlWrapper
41 class DALI_IMPORT_API ControlWrapper : public Control
45 // Flags for the constructor
46 enum CustomControlBehaviour
48 CONTROL_BEHAVIOUR_DEFAULT = Control::CONTROL_BEHAVIOUR_DEFAULT,
49 DISABLE_SIZE_NEGOTIATION = CustomActorImpl::DISABLE_SIZE_NEGOTIATION,
50 REQUIRES_KEYBOARD_NAVIGATION_SUPPORT = Control::REQUIRES_KEYBOARD_NAVIGATION_SUPPORT,
51 DISABLE_STYLE_CHANGE_SIGNALS = Control::DISABLE_STYLE_CHANGE_SIGNALS,
53 LAST_CONTROL_BEHAVIOUR_FLAG
56 static const int CONTROL_BEHAVIOUR_FLAG_COUNT = Log< LAST_CONTROL_BEHAVIOUR_FLAG - 1 >::value + 1; ///< Total count of flags
59 * @brief Control constructor
61 * @param[in] behaviourFlags Behavioural flags from CustomControlBehaviour enum
63 ControlWrapper( CustomControlBehaviour behaviourFlags );
66 * Create a new ControlWrapper.
68 * @param[in] typeName The name of the type that is registered with this control
69 * @param[in] controlWrapper The implementation of this control
71 * @return A public handle to the newly allocated ControlWrapper.
73 static Dali::Toolkit::ControlWrapper New( const std::string& typeName, ControlWrapper* controlWrapper );
75 public: // From CustomActorImpl
77 // Size negotiation helpers
80 * @copydoc Dali::CustomActorImpl::RelayoutRequest()
82 void RelayoutRequest();
85 * @copydoc Dali::CustomActorImpl::GetHeightForWidthBase()
87 float GetHeightForWidthBase( float width );
90 * @copydoc Dali::CustomActorImpl::GetWidthForHeightBase()
92 float GetWidthForHeightBase( float height );
95 * @copydoc Dali::CustomActorImpl::CalculateChildSizeBase()
97 float CalculateChildSizeBase( const Dali::Actor& child, Dimension::Type dimension );
100 * @copydoc Dali::CustomActorImpl::RelayoutDependentOnChildrenBase()
102 bool RelayoutDependentOnChildrenBase( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
104 public: // From Control
107 * @copydoc Dali::Toolkit::Internal::Control::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual )
109 void RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual );
112 * @copydoc Dali::Toolkit::Internal::Control::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, bool enabled )
114 void RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, bool enabled );
117 * @copydoc Dali::Toolkit::Internal::Control::UnregisterVisual()
119 void UnregisterVisual( Property::Index index );
122 * @copydoc Dali::Toolkit::Internal::Control::GetVisual()
124 Toolkit::Visual::Base GetVisual( Property::Index index ) const;
127 * @copydoc Dali::Toolkit::Internal::Control::EnableVisual()
129 void EnableVisual( Property::Index index, bool enable );
132 * @copydoc Dali::Toolkit::Internal::Control::IsVisualEnabled()
134 bool IsVisualEnabled( Property::Index index ) const;
137 * @copydoc Dali::Toolkit::Internal::Control::CreateTransition()
139 Dali::Animation CreateTransition( const Toolkit::TransitionData& transitionData );
142 * @copydoc Dali::Toolkit::Internal::Control::EmitKeyInputFocusSignal()
144 void EmitKeyInputFocusSignal( bool focusGained );
147 * @brief Apply the current style
149 * This method is called after the Control has been initialized.
152 void ApplyThemeStyle();
157 * Protected Destructor
158 * A reference counted object may only be deleted by calling Unreference()
160 virtual ~ControlWrapper();
166 DALI_INTERNAL ControlWrapper( const ControlWrapper& );
169 DALI_INTERNAL ControlWrapper& operator=( const ControlWrapper& rhs );
173 } // namespace Internal
175 // Helpers for public-api forwarding methods
177 inline Toolkit::Internal::ControlWrapper& GetControlWrapperImpl( Toolkit::ControlWrapper& publicObject )
179 DALI_ASSERT_ALWAYS( publicObject );
181 Dali::RefObject& handle = publicObject.GetImplementation();
183 return static_cast<Toolkit::Internal::ControlWrapper&>( handle );
186 inline const Toolkit::Internal::ControlWrapper& GetControlWrapperImpl( const Toolkit::ControlWrapper& publicObject )
188 DALI_ASSERT_ALWAYS( publicObject );
190 const Dali::RefObject& handle = publicObject.GetImplementation();
192 return static_cast<const Toolkit::Internal::ControlWrapper&>( handle );
195 } // namespace Toolkit
199 #endif // DALI_TOOLKIT_INTERNAL_CONTROL_WRAPPER_H