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.
67 * @return A public handle to the newly allocated ControlWrapper.
69 static Dali::Toolkit::ControlWrapper New( ControlWrapper* controlWrapper );
71 public: // From CustomActorImpl
73 // Size negotiation helpers
76 * @copydoc Dali::CustomActorImpl::RelayoutRequest()
78 void RelayoutRequest();
81 * @copydoc Dali::CustomActorImpl::GetHeightForWidthBase()
83 float GetHeightForWidthBase( float width );
86 * @copydoc Dali::CustomActorImpl::GetWidthForHeightBase()
88 float GetWidthForHeightBase( float height );
91 * @copydoc Dali::CustomActorImpl::CalculateChildSizeBase()
93 float CalculateChildSizeBase( const Dali::Actor& child, Dimension::Type dimension );
96 * @copydoc Dali::CustomActorImpl::RelayoutDependentOnChildrenBase()
98 bool RelayoutDependentOnChildrenBase( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
100 public: // From Control
103 * @copydoc Dali::Toolkit::Internal::Control::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual )
105 void RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual );
108 * @copydoc Dali::Toolkit::Internal::Control::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, bool enabled )
110 void RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, bool enabled );
113 * @copydoc Dali::Toolkit::Internal::Control::UnregisterVisual()
115 void UnregisterVisual( Property::Index index );
118 * @copydoc Dali::Toolkit::Internal::Control::GetVisual()
120 Toolkit::Visual::Base GetVisual( Property::Index index ) const;
123 * @copydoc Dali::Toolkit::Internal::Control::EnableVisual()
125 void EnableVisual( Property::Index index, bool enable );
128 * @copydoc Dali::Toolkit::Internal::Control::IsVisualEnabled()
130 bool IsVisualEnabled( Property::Index index ) const;
133 * @copydoc Dali::Toolkit::Internal::Control::CreateTransition()
135 Dali::Animation CreateTransition( const Toolkit::TransitionData& transitionData );
138 * @copydoc Dali::Toolkit::Internal::Control::EmitKeyInputFocusSignal()
140 void EmitKeyInputFocusSignal( bool focusGained );
143 * @brief Apply the current style
145 * This method is called after the Control has been initialized.
148 void ApplyThemeStyle();
153 * Protected Destructor
154 * A reference counted object may only be deleted by calling Unreference()
156 virtual ~ControlWrapper();
162 DALI_INTERNAL ControlWrapper( const ControlWrapper& );
165 DALI_INTERNAL ControlWrapper& operator=( const ControlWrapper& rhs );
169 } // namespace Internal
171 // Helpers for public-api forwarding methods
173 inline Toolkit::Internal::ControlWrapper& GetControlWrapperImpl( Toolkit::ControlWrapper& publicObject )
175 DALI_ASSERT_ALWAYS( publicObject );
177 Dali::RefObject& handle = publicObject.GetImplementation();
179 return static_cast<Toolkit::Internal::ControlWrapper&>( handle );
182 inline const Toolkit::Internal::ControlWrapper& GetControlWrapperImpl( const Toolkit::ControlWrapper& publicObject )
184 DALI_ASSERT_ALWAYS( publicObject );
186 const Dali::RefObject& handle = publicObject.GetImplementation();
188 return static_cast<const Toolkit::Internal::ControlWrapper&>( handle );
191 } // namespace Toolkit
195 #endif // DALI_TOOLKIT_INTERNAL_CONTROL_WRAPPER_H