1 #ifndef DALI_DEMO_INTERNAL_IMAGE_CHANNEL_CONTROL_IMPL_H
2 #define DALI_DEMO_INTERNAL_IMAGE_CHANNEL_CONTROL_IMPL_H
5 * Copyright (c) 2020 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.
20 #include <dali-toolkit/devel-api/visual-factory/transition-data.h>
21 #include <dali-toolkit/devel-api/visual-factory/visual-base.h>
22 #include <dali-toolkit/public-api/controls/control-impl.h>
23 #include <dali/public-api/animation/animation.h>
24 #include "image-channel-control.h"
28 namespace Internal // To use TypeRegistry, handle and body classes need the same name
30 class ImageChannelControl : public Dali::Toolkit::Internal::Control
34 * Instantiate a new ImageChannelControl object
36 static Demo::ImageChannelControl New();
37 ImageChannelControl();
38 ~ImageChannelControl();
42 * @copydoc ImageChannelControl::SetImage
44 void SetImage(const std::string& url);
47 * @copydoc ImageChannelControl::SetVisibility
49 void SetVisibility(bool visibility);
53 * Called when a property of an object of this type is set.
54 * @param[in] object The object whose property is set.
55 * @param[in] index The property index.
56 * @param[in] value The new property value.
58 static void SetProperty(Dali::BaseObject* object, Dali::Property::Index index, const Dali::Property::Value& value);
61 * Called to retrieve a property of an object of this type.
62 * @param[in] object The object whose property is to be retrieved.
63 * @param[in] index The property index.
64 * @return The current value of the property.
66 static Dali::Property::Value GetProperty(Dali::BaseObject* object, Dali::Property::Index propertyIndex);
68 private: // From Control
70 * @copydoc Toolkit::Control::OnInitialize()
72 virtual void OnInitialize();
75 * @copydoc Toolkit::Control::OnSceneConnection()
77 virtual void OnSceneConnection(int depth);
80 * @copydoc Toolkit::Control::OnSceneDisconnection()
82 virtual void OnSceneDisconnection();
85 * @copydoc Toolkit::Control::OnSizeSet()
87 virtual void OnSizeSet(const Dali::Vector3& targetSize);
90 * @copydoc Toolkit::Control::GetNaturalSize
92 virtual Dali::Vector3 GetNaturalSize();
95 * @copydoc Toolkit::Control::OnStyleChange
97 virtual void OnStyleChange(Dali::Toolkit::StyleManager styleManager, Dali::StyleChange::Type change);
100 void OnStateChangeAnimationFinished(Dali::Animation& handle);
104 ImageChannelControl(const ImageChannelControl&);
105 ImageChannelControl& operator=(const ImageChannelControl&);
108 // Implementation details
110 Dali::Toolkit::Visual::Base mVisual;
111 Dali::Vector3 mChannels;
112 Dali::Toolkit::TransitionData mEnableVisibilityTransition;
113 Dali::Toolkit::TransitionData mDisableVisibilityTransition;
114 Dali::Animation mAnimation;
115 Dali::Property::Index mChannelIndex;
116 bool mVisibility : 1;
117 bool mTargetVisibility : 1;
120 } // namespace Internal
122 inline Internal::ImageChannelControl& GetImpl(Demo::ImageChannelControl& handle)
124 DALI_ASSERT_ALWAYS(handle);
125 Dali::RefObject& object = handle.GetImplementation();
126 return static_cast<Internal::ImageChannelControl&>(object);
129 inline const Internal::ImageChannelControl& GetImpl(const Demo::ImageChannelControl& handle)
131 DALI_ASSERT_ALWAYS(handle);
132 const Dali::RefObject& object = handle.GetImplementation();
133 return static_cast<const Internal::ImageChannelControl&>(object);
138 #endif // DALI_DEMO_IMAGE_CHANNEL_CONTROL_IMPL_H