1 #ifndef DALI_TOOLKIT_INTERNAL_CONTROL_WRAPPER_H
2 #define DALI_TOOLKIT_INTERNAL_CONTROL_WRAPPER_H
5 * Copyright (c) 2017 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>
43 typedef IntrusivePtr< ControlWrapper > ControlWrapperPtr;
46 * @copydoc Toolkit::ControlWrapper
48 class DALI_IMPORT_API ControlWrapper : public Control
52 // Flags for the constructor
53 enum CustomControlBehaviour
55 CONTROL_BEHAVIOUR_DEFAULT = Control::CONTROL_BEHAVIOUR_DEFAULT,
56 DISABLE_SIZE_NEGOTIATION = CustomActorImpl::DISABLE_SIZE_NEGOTIATION,
57 REQUIRES_KEYBOARD_NAVIGATION_SUPPORT = Control::REQUIRES_KEYBOARD_NAVIGATION_SUPPORT,
58 DISABLE_STYLE_CHANGE_SIGNALS = Control::DISABLE_STYLE_CHANGE_SIGNALS,
60 LAST_CONTROL_BEHAVIOUR_FLAG
63 static const int CONTROL_BEHAVIOUR_FLAG_COUNT = Log< LAST_CONTROL_BEHAVIOUR_FLAG - 1 >::value + 1; ///< Total count of flags
66 * @brief Control constructor
68 * @param[in] behaviourFlags Behavioural flags from CustomControlBehaviour enum
70 ControlWrapper( CustomControlBehaviour behaviourFlags );
73 * Create a new ControlWrapper.
75 * @param[in] typeName The name of the type that is registered with this control
76 * @param[in] controlWrapper The implementation of this control
78 * @return A public handle to the newly allocated ControlWrapper.
80 static Dali::Toolkit::ControlWrapper New( const std::string& typeName, ControlWrapper* controlWrapper );
82 public: // From CustomActorImpl
84 // Size negotiation helpers
87 * @copydoc Dali::CustomActorImpl::RelayoutRequest()
89 void RelayoutRequest();
92 * @copydoc Dali::CustomActorImpl::GetHeightForWidthBase()
94 float GetHeightForWidthBase( float width );
97 * @copydoc Dali::CustomActorImpl::GetWidthForHeightBase()
99 float GetWidthForHeightBase( float height );
102 * @copydoc Dali::CustomActorImpl::CalculateChildSizeBase()
104 float CalculateChildSizeBase( const Dali::Actor& child, Dimension::Type dimension );
107 * @copydoc Dali::CustomActorImpl::RelayoutDependentOnChildrenBase()
109 bool RelayoutDependentOnChildrenBase( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
111 public: // From Control
114 * @ref Dali::Toolkit::DevelControl::RegisterVisual()
116 void RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual );
119 * @ref Dali::Toolkit::DevelControl::RegisterVisual()
121 void RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, bool enabled );
124 * @ref Dali::Toolkit::DevelControl::UnregisterVisual()
126 void UnregisterVisual( Property::Index index );
129 * @ref Dali::Toolkit::DevelControl::GetVisual()
131 Toolkit::Visual::Base GetVisual( Property::Index index ) const;
134 * @ref Dali::Toolkit::DevelControl::EnableVisual()
136 void EnableVisual( Property::Index index, bool enable );
139 * @ref Dali::Toolkit::DevelControl::IsVisualEnabled()
141 bool IsVisualEnabled( Property::Index index ) const;
144 * @ref Dali::Toolkit::DevelControl::CreateTransition()
146 Dali::Animation CreateTransition( const Toolkit::TransitionData& transitionData );
149 * @copydoc Dali::Toolkit::Internal::Control::EmitKeyInputFocusSignal()
151 void EmitKeyInputFocusSignal( bool focusGained );
154 * @brief Apply the current style
156 * This method is called after the Control has been initialized.
159 void ApplyThemeStyle();
164 * Protected Destructor
165 * A reference counted object may only be deleted by calling Unreference()
167 virtual ~ControlWrapper();
173 DALI_INTERNAL ControlWrapper( const ControlWrapper& );
176 DALI_INTERNAL ControlWrapper& operator=( const ControlWrapper& rhs );
180 } // namespace Internal
182 // Helpers for public-api forwarding methods
184 inline Toolkit::Internal::ControlWrapper& GetControlWrapperImpl( Toolkit::ControlWrapper& publicObject )
186 DALI_ASSERT_ALWAYS( publicObject );
188 Dali::RefObject& handle = publicObject.GetImplementation();
190 return static_cast<Toolkit::Internal::ControlWrapper&>( handle );
193 inline const Toolkit::Internal::ControlWrapper& GetControlWrapperImpl( const Toolkit::ControlWrapper& publicObject )
195 DALI_ASSERT_ALWAYS( publicObject );
197 const Dali::RefObject& handle = publicObject.GetImplementation();
199 return static_cast<const Toolkit::Internal::ControlWrapper&>( handle );
202 } // namespace Toolkit
206 #endif // DALI_TOOLKIT_INTERNAL_CONTROL_WRAPPER_H