e48c21dcf508f02428cd6341357c766616028827
[platform/core/uifw/dali-demo.git] / examples / styling / image-channel-control.h
1 #ifndef DALI_DEMO_IMAGE_CHANNEL_CONTROL_H
2 #define DALI_DEMO_IMAGE_CHANNEL_CONTROL_H
3
4 /*
5  * Copyright (c) 2016 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  */
19
20 #include <dali-toolkit/dali-toolkit.h>
21 #include <string>
22
23 namespace Demo
24 {
25
26 namespace Internal
27 {
28 // All type registered types need to have the same name for the body and the handle
29 class ImageChannelControl;
30 }
31
32 /**
33  * Control that allows the RGB channels of an image to be altered.
34  */
35 class ImageChannelControl : public Dali::Toolkit::Control
36 {
37 public:
38   /**
39    * The start and end property ranges for this control
40    */
41   enum PropertyRange
42   {
43     PROPERTY_START_INDEX = Dali::Toolkit::Control::CONTROL_PROPERTY_END_INDEX + 1,
44     PROPERTY_END_INDEX   = PROPERTY_START_INDEX + 1000,
45     ANIMATABLE_PROPERTY_START_INDEX = Dali::ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX,
46     ANIMATABLE_PROPERTY_END_INDEX = ANIMATABLE_PROPERTY_START_INDEX+1000
47   };
48
49   struct Property
50   {
51     enum
52     {
53       RESOURCE_URL = PROPERTY_START_INDEX,
54       RED_CHANNEL,
55       GREEN_CHANNEL,
56       BLUE_CHANNEL,
57       VISIBILITY,
58       ENABLE_VISIBILITY_TRANSITION,
59       DISABLE_VISIBILITY_TRANSITION,
60       IMAGE_VISUAL
61     };
62   };
63
64 public: // Construction / destruction
65
66   /**
67    * Create an uninitialized handle
68    */
69   ImageChannelControl();
70
71   /**
72    * Create a new image channel control without an image. Use
73    * SetImage to give this control an image
74    */
75   static ImageChannelControl New();
76
77   /**
78    * Create a new image channel control from a given URL
79    */
80   static ImageChannelControl New( const std::string& url );
81
82   /**
83    * Destructor. This is non-virtual since derived Handle types must not
84    * contain data or virtual methods
85    */
86   ~ImageChannelControl();
87
88   /**
89    * Copy Constructor
90    */
91   ImageChannelControl( const ImageChannelControl& imageChannelControl );
92
93   /**
94    * Assignment Operator
95    */
96   ImageChannelControl& operator=( const ImageChannelControl& imageChannelControl );
97
98   /**
99    * Downcast
100    */
101   static ImageChannelControl DownCast( BaseHandle handle );
102
103 public: // API
104
105   /**
106    * Set the image for this ImageChannelControl
107    * @param[in] url The url of the image resource
108    */
109   void SetImage( const std::string& url );
110
111   /**
112    * Set the visibility of this control
113    */
114   void SetVisibility( bool visibility );
115
116 public: // Not for public use
117   /**
118    * Create a handle from an implementation
119    */
120   ImageChannelControl( Internal::ImageChannelControl& implementation );
121
122   /**
123    * Allow the creation of an ImageChannelControl handle from an internal CustomActor pointer
124    */
125   ImageChannelControl( Dali::Internal::CustomActor* internal );
126 };
127
128 } // namespace Demo
129
130 #endif // DALI_DEMO_IMAGE_CHANNEL_CONTROL_H