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