[ACR-564] deprecate unused API
[platform/core/csapi/tizenfx.git] / src / ElmSharp / ElmSharp / ColorSelector.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 using System;
18
19 namespace ElmSharp
20 {
21     /// <summary>
22     /// Enumeration for the modes of ColorSelector.
23     /// </summary>
24     /// <since_tizen> preview </since_tizen>
25     [Obsolete("This has been deprecated in API12")]
26     public enum ColorSelectorMode
27     {
28         /// <summary>
29         /// Only the color palette is displayed, by default.
30         /// </summary>
31         Palette,
32         /// <summary>
33         /// Only the color selector is displayed.
34         /// </summary>
35         [Obsolete("Components is obsolete as of version 1.2.3 and is no longer supported.")]
36         Components,
37         /// <summary>
38         /// Both the palette and the selector is displayed.
39         /// </summary>
40         [Obsolete("Both is obsolete as of version 1.2.3 and is no longer supported.")]
41         Both,
42         /// <summary>
43         /// Only the color picker is displayed.
44         /// </summary>
45         [Obsolete("Picker is obsolete as of version 1.2.3 and is no longer supported.")]
46         Picker,
47         /// <summary>
48         /// This mode is not supported. If you use this, nothing will be shown.
49         /// </summary>
50         [Obsolete("Plane is obsolete as of version 1.2.3 and is no longer supported.")]
51         Plane,
52         /// <summary>
53         /// This mode is not supported. If you use this, it will be shown same with the Palette mode.
54         /// </summary>
55         [Obsolete("PallettePlane is obsolete as of version 1.2.3 and is no longer supported.")]
56         PallettePlane,
57         /// <summary>
58         /// This mode is not supported. If you use this, it will be shown same with the Palette mode.
59         /// </summary>
60         [Obsolete("All is obsolete as of version 1.2.3 and is no longer supported.")]
61         All
62     }
63
64     /// <summary>
65     /// The ColorSelector is a widget to set a series of colors.
66     /// It also allows to load/save colors from/to the configuration with a unique identifier.
67     /// </summary>
68     /// <remarks>
69     /// By default, the colors are loaded/saved from/to configuration using the "default" identifier.
70     /// The colors can be picked by the user from the color set by clicking on individual
71     /// color items on the palette, or by selecting it from the selector.
72     /// </remarks>
73     /// <since_tizen> preview </since_tizen>
74     [Obsolete("This has been deprecated in API12")]
75     public class ColorSelector : Layout
76     {
77         private readonly SmartEvent<ColorChangedEventArgs> _changed;
78         private Color _currentColor;
79
80         /// <summary>
81         /// Creates and initializes a new instance of the ColorSelector class.
82         /// </summary>
83         /// <param name="parent"></param>
84         /// <since_tizen> preview </since_tizen>
85         [Obsolete("This has been deprecated in API12")]
86         public ColorSelector(EvasObject parent) : base(parent)
87         {
88             _changed = new SmartEvent<ColorChangedEventArgs>(this, "changed", (data, obj, info) =>
89             {
90                 return new ColorChangedEventArgs(_currentColor, SelectedColor);
91             });
92         }
93
94         /// <summary>
95         /// ColorChanged will be triggered when the SelectedColor is changed.
96         /// </summary>
97         /// <since_tizen> preview </since_tizen>
98         [Obsolete("This has been deprecated in API12")]
99         public event EventHandler<ColorChangedEventArgs> ColorChanged
100         {
101             add { _changed.On += value; }
102             remove { _changed.On -= value; }
103         }
104
105         /// <summary>
106         /// Gets or sets the color of colorselector.
107         /// </summary>
108         /// <since_tizen> preview </since_tizen>
109         [Obsolete("This has been deprecated in API12")]
110         public Color SelectedColor
111         {
112             get
113             {
114                 int r, g, b, a;
115                 Interop.Elementary.elm_colorselector_color_get(Handle, out r, out g, out b, out a);
116                 _currentColor = new Color(r, g, b, a);
117                 return _currentColor;
118             }
119             set
120             {
121                 Interop.Elementary.elm_colorselector_color_set(Handle, value.R, value.G, value.B, value.A);
122                 _currentColor = new Color(value.R, value.G, value.B, value.A);
123             }
124         }
125
126         /// <summary>
127         /// Gets the Alpha of a default Color class (value is -1).
128         /// </summary>
129         /// <since_tizen> preview </since_tizen>
130         [Obsolete("This has been deprecated in API12")]
131         public override int Opacity
132         {
133             get
134             {
135                 return Color.Default.A;
136             }
137             set
138             {
139                 Console.WriteLine("ColorSelector instance doesn't support to set Opacity.");
140             }
141         }
142
143         /// <summary>
144         /// Gets or sets the Colorselector's mode.
145         /// </summary>
146         /// <since_tizen> preview </since_tizen>
147         [Obsolete("This has been deprecated in API12")]
148         public ColorSelectorMode Mode
149         {
150             get
151             {
152                 return (ColorSelectorMode)Interop.Elementary.elm_colorselector_mode_get(Handle);
153             }
154             set
155             {
156                 if (ColorSelectorMode.Palette == value)
157                 {
158                     Interop.Elementary.elm_colorselector_mode_set(Handle, (Interop.Elementary.Elm_Colorselector_Mode)value);
159                 }
160             }
161         }
162
163         /// <summary>
164         /// Gets or sets the current palette's name.
165         /// </summary>
166         /// <since_tizen> preview </since_tizen>
167         [Obsolete("This has been deprecated in API12")]
168         public string PaletteName
169         {
170             get
171             {
172                 return Interop.Elementary.elm_colorselector_palette_name_get(Handle);
173             }
174             set
175             {
176                 Interop.Elementary.elm_colorselector_palette_name_set(Handle, value);
177             }
178         }
179
180         /// <summary>
181         /// Adds a new color item to the palette.
182         /// </summary>
183         /// <param name="color">The color item to add.</param>
184         /// <returns>A new color palette Item.</returns>
185         /// <since_tizen> preview </since_tizen>
186         [Obsolete("This has been deprecated in API12")]
187         public ColorSelectorItem AddPaletteColor(Color color)
188         {
189             ColorSelectorItem item = new ColorSelectorItem(this);
190             item.Handle = Interop.Elementary.elm_colorselector_palette_color_add(Handle, color.R, color.G, color.B, color.A);
191             return item;
192         }
193
194         /// <summary>
195         /// Clears the palette items.
196         /// </summary>
197         /// <since_tizen> preview </since_tizen>
198         [Obsolete("This has been deprecated in API12")]
199         public void ClearPalette()
200         {
201             Interop.Elementary.elm_colorselector_palette_clear(Handle);
202         }
203
204         /// <summary>
205         /// Creates a widget handle.
206         /// </summary>
207         /// <param name="parent">Parent EvasObject.</param>
208         /// <returns>Handle IntPtr.</returns>
209         /// <since_tizen> preview </since_tizen>
210         [Obsolete("This has been deprecated in API12")]
211         protected override IntPtr CreateHandle(EvasObject parent)
212         {
213             return Interop.Elementary.elm_colorselector_add(parent.Handle);
214         }
215     }
216 }