1 #ifndef DALI_DEMO_INTERNAL_IMAGE_CHANNEL_CONTROL_IMPL_H
2 #define DALI_DEMO_INTERNAL_IMAGE_CHANNEL_CONTROL_IMPL_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.
20 #include "image-channel-control.h"
21 #include <dali/public-api/animation/animation.h>
22 #include <dali-toolkit/public-api/controls/control-impl.h>
23 #include <dali-toolkit/devel-api/visual-factory/visual-base.h>
24 #include <dali-toolkit/devel-api/visual-factory/transition-data.h>
29 namespace Internal // To use TypeRegistry, handle and body classes need the same name
32 class ImageChannelControl : public Dali::Toolkit::Internal::Control
36 * Instantiate a new ImageChannelControl object
38 static Demo::ImageChannelControl New();
39 ImageChannelControl();
40 ~ImageChannelControl();
44 * @copydoc ImageChannelControl::SetImage
46 void SetImage( const std::string& url );
49 * @copydoc ImageChannelControl::SetVisibility
51 void SetVisibility( bool visibility );
55 * Called when a property of an object of this type is set.
56 * @param[in] object The object whose property is set.
57 * @param[in] index The property index.
58 * @param[in] value The new property value.
60 static void SetProperty( Dali::BaseObject* object, Dali::Property::Index index, const Dali::Property::Value& value );
63 * Called to retrieve a property of an object of this type.
64 * @param[in] object The object whose property is to be retrieved.
65 * @param[in] index The property index.
66 * @return The current value of the property.
68 static Dali::Property::Value GetProperty( Dali::BaseObject* object, Dali::Property::Index propertyIndex );
70 private: // From Control
72 * @copydoc Toolkit::Control::OnInitialize()
74 virtual void OnInitialize();
77 * @copydoc Toolkit::Control::OnStageConnect()
79 virtual void OnStageConnection( int depth );
82 * @copydoc Toolkit::Control::OnStageDisconnection()
84 virtual void OnStageDisconnection();
87 * @copydoc Toolkit::Control::OnSizeSet()
89 virtual void OnSizeSet( const Dali::Vector3& targetSize );
92 * @copydoc Toolkit::Control::GetNaturalSize
94 virtual Dali::Vector3 GetNaturalSize();
97 * @copydoc Toolkit::Control::OnStyleChange
99 virtual void OnStyleChange( Dali::Toolkit::StyleManager styleManager, Dali::StyleChange::Type change );
102 void OnStateChangeAnimationFinished(Dali::Animation& handle);
106 ImageChannelControl( const ImageChannelControl& );
107 ImageChannelControl& operator=( const ImageChannelControl& );
110 // Implementation details
112 Dali::Toolkit::Visual::Base mVisual;
113 Dali::Vector3 mChannels;
114 Dali::Toolkit::TransitionData mEnableVisibilityTransition;
115 Dali::Toolkit::TransitionData mDisableVisibilityTransition;
116 Dali::Animation mAnimation;
117 Dali::Property::Index mChannelIndex;
119 bool mTargetVisibility:1;
124 inline Internal::ImageChannelControl& GetImpl( Demo::ImageChannelControl& handle )
126 DALI_ASSERT_ALWAYS( handle );
127 Dali::RefObject& object = handle.GetImplementation();
128 return static_cast<Internal::ImageChannelControl&>(object);
131 inline const Internal::ImageChannelControl& GetImpl( const Demo::ImageChannelControl& handle )
133 DALI_ASSERT_ALWAYS( handle );
134 const Dali::RefObject& object = handle.GetImplementation();
135 return static_cast<const Internal::ImageChannelControl&>(object);
140 #endif // DALI_DEMO_IMAGE_CHANNEL_CONTROL_IMPL_H