Fix to adjust the position of the partial Frame
[platform/framework/native/uifw.git] / inc / FUiCtrlColorPicker.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://floralicense.org/license/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19 * @file                 FUiCtrlColorPicker.h
20 * @brief        This is the header file for the %ColorPicker class.
21 *
22 * This header file contains the declarations of the %ColorPicker class.
23 */
24 #ifndef _FUI_CTRL_COLOR_PICKER_H_
25 #define _FUI_CTRL_COLOR_PICKER_H_
26
27 #include <FUiControl.h>
28 #include <FUiIColorChangeEventListener.h>
29 #include <FUiIOrientationEventListener.h>
30
31 namespace Tizen { namespace Ui { namespace Controls
32 {
33
34 /**
35 * @class        ColorPicker
36 * @brief This class defines the common behavior of a %ColorPicker control.
37 *
38 * @since 2.0
39 *
40 * The %ColorPicker class displays a set of 3 sliders (hue, saturation, and luminance) with which the user can define a color.
41 *
42 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/ui/implementing_colorpicker.htm">ColorPicker</a>.
43 *
44 * The following example demonstrates how to use the %ColorPicker class.
45 *
46 * @code
47 // Sample code for ColorPickerSample.h
48 #include <FUi.h>
49 #include <FGraphics.h>
50
51 class ColorPickerSample
52         : public Tizen::Ui::Controls::Form
53     , public Tizen::Ui::IColorChangeEventListener
54 {
55 public:
56         ColorPickerSample(void)
57         : __pColorPicker(null){}
58
59         bool Initialize(void);
60         virtual result OnInitializing(void);
61
62         // IColorChangeEventListener
63         virtual void OnColorChanged(const Tizen::Ui::Control& source, const Tizen::Graphics::Color& color);
64
65 private:
66         Tizen::Ui::Controls::ColorPicker* __pColorPicker;
67 };
68
69  *      @endcode
70  *
71  *      @code
72
73 // Sample code for ColorPickerSample.cpp
74 #include "ColorPickerSample.h"
75
76 using namespace Tizen::Graphics;
77 using namespace Tizen::Ui::Controls;
78
79 bool
80 ColorPickerSample::Initialize(void)
81 {
82         Construct(FORM_STYLE_NORMAL);
83         return true;
84 }
85
86 result
87 ColorPickerSample::OnInitializing(void)
88 {
89         result r = E_SUCCESS;
90
91         // Creates an instance of ColorPicker
92         __pColorPicker = new ColorPicker();
93         __pColorPicker->Construct(Point(10,50));
94         __pColorPicker->AddColorChangeEventListener(*this);
95
96         // Adds the color picker to the form
97         AddControl(*__pColorPicker);
98
99         return r;
100 }
101
102 // IColorChangeEventListener implementation
103 void
104 ColorPickerSample::OnColorChanged(const Control& source, const Color& color)
105 {
106         // ....
107 }
108 * @endcode
109 */
110
111 class _OSP_EXPORT_ ColorPicker
112         : public Tizen::Ui::Control
113 {
114 public:
115         /**
116          * The object is not fully constructed after this constructor is called. For full construction, the Construct() method must be called right after calling this constructor.
117          *
118          * @since       2.0
119          */
120         ColorPicker(void);
121
122         /**
123          *      This polymorphic destructor should be overridden if required. This way, the destructors of the derived classes are called when the destructor of this interface is called.
124          *
125          * @since       2.0
126          */
127         virtual ~ColorPicker(void);
128
129         /**
130          * Initializes this instance of %ColorPicker with the specified parameter.
131          *
132          * @since                       2.0
133          *
134          * @return                      An error code
135          * @param[in]   point           The position of this %ColorPicker in the container
136          * @exception   E_SUCCESS       The method is successful.
137          * @exception   E_SYSTEM                A system error has occurred.
138          * @remarks             A control is fully usable only after it has been added to a container. Therefore, some methods may fail if the control is used earlier.
139          */
140         result Construct(const Tizen::Graphics::Point& point);
141
142         /**
143          * Initializes this instance of %ColorPicker with the specified parameter.
144          *
145          * @since                       2.1
146          *
147          * @return                      An error code
148          * @param[in]   point           The position of this %ColorPicker in the container
149          * @exception   E_SUCCESS       The method is successful.
150          * @exception   E_SYSTEM                A system error has occurred.
151          * @remarks             A control is fully usable only after it has been added to a container. Therefore, some methods may fail if the control is used earlier.
152          */
153         result Construct(const Tizen::Graphics::FloatPoint& point);
154
155         /**
156          * Gets the current color value of %ColorPicker.
157          *
158          * @since               2.0
159          *
160          * @return              The current color value
161          */
162         Tizen::Graphics::Color GetColor(void) const;
163
164         /**
165          * Gets the current hue value of %ColorPicker.
166          *
167          * @since               2.0
168          *
169          * @return              The current hue value
170          * @remarks             The return value is between @c 0 to @c 100.
171          */
172         int GetHue(void) const;
173
174         /**
175          * Gets the current saturation value of %ColorPicker.
176          *
177          * @since               2.0
178          *
179          * @return              The current saturation value
180          * @remarks             The return value is between @c 0 to @c 100.
181          */
182         int GetSaturation(void) const;
183
184         /**
185          * Gets the current luminance value of %ColorPicker.
186          *
187          * @since               2.0
188          *
189          * @return              The current luminance value
190          * @remarks             The return value is between @c 0 to @c 100.
191          */
192         int GetLuminance(void) const;
193
194         /**
195          * Sets the color value of %ColorPicker.
196          *
197          * @since                       2.0
198          *
199          * @param[in]   color   The color value
200          */
201         void SetColor(const Tizen::Graphics::Color& color);
202
203         /**
204          * Sets the hue value of %ColorPicker.
205          *
206          * @since                       2.0
207          *
208          * @param[in]   hue     The hue value of this object
209          * @remarks                     The value should be between @c 0 to @c 100.
210          *
211          */
212         void SetHue(int hue);
213
214         /**
215          * Sets the saturation value of %ColorPicker.
216          *
217          * @since                       2.0
218          *
219          * @param[in]   saturation      The saturation value of this object
220          * @remarks                     The value should be between @c 0 to @c 100.
221          *
222          */
223         void SetSaturation(int saturation);
224
225         /**
226          * Sets the luminance value of %ColorPicker.
227          *
228          * @since                       2.0
229          *
230          * @param[in]   luminance       The luminance value of this object
231          * @remarks                     The value should be between @c 0 to @c 100.
232          *
233          */
234         void SetLuminance(int luminance);
235
236         /**
237          * Adds a listener instance.
238          * The added listener can listen to events on the given event dispatcher's context when they are fired.
239          *
240          * @since                       2.0
241          *
242          * @param[in]   listener    The event listener to add
243          * @see                         RemoveColorChangeEventListener()
244          */
245         void AddColorChangeEventListener(Tizen::Ui::IColorChangeEventListener& listener);
246
247         /**
248          * Removes a listener instance.
249          * The removed listener cannot listen to events when they are fired.
250          *
251          * @since                       2.0
252          *
253          * @param[in]   listener    The event listener to remove
254          * @see                         AddColorChangeEventListener()
255          */
256         void RemoveColorChangeEventListener(Tizen::Ui::IColorChangeEventListener& listener);
257
258 private:
259         //
260         // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
261         //
262         ColorPicker(const ColorPicker& rhs);
263
264         //
265         // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
266         //
267         ColorPicker& operator =(const ColorPicker& rhs);
268
269         friend class _ColorPickerImpl;
270 };      // ColorPicker
271
272 }}}     // Tizen::Ui::Controls
273
274 #endif // _FUI_CTRL_COLOR_PICKER_H_