64ae3b3a2c5730151fdd6023bd79cf1b83708670
[platform/core/csapi/tizenfx.git] / src / ElmSharp / ElmSharp / FloatingButton.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     /// The FloatingButton is a widget that to add floating area for buttons.
23     /// </summary>
24     /// <since_tizen> preview </since_tizen>
25     public class FloatingButton : Layout
26     {
27         /// <summary>
28         /// Creates and initializes a new instance of the FloatingButton class.
29         /// </summary>
30         /// <param name="parent">Created on this parent container..</param>
31         /// <since_tizen> preview </since_tizen>
32         public FloatingButton(EvasObject parent) : base(parent)
33         {
34         }
35
36         /// <summary>
37         /// Sets or gets floatingbutton mode.
38         /// </summary>
39         /// <since_tizen> preview </since_tizen>
40         public FloatingButtonMode Mode
41         {
42             get
43             {
44                 return (FloatingButtonMode)Interop.Eext.eext_floatingbutton_mode_get(Handle);
45             }
46             set
47             {
48                 Interop.Eext.eext_floatingbutton_mode_set(Handle, (int)value);
49             }
50         }
51
52         /// <summary>
53         /// Gets floatingbutton Position.
54         /// </summary>
55         /// <since_tizen> preview </since_tizen>
56         public FloatingButtonPosition Position
57         {
58             get
59             {
60                 return (FloatingButtonPosition)Interop.Eext.eext_floatingbutton_pos_get(Handle);
61             }
62         }
63
64         /// <summary>
65         /// Sets or gets movability for a given floatingbutton widget.
66         /// </summary>
67         /// <since_tizen> preview </since_tizen>
68         public bool MovementBlock
69         {
70             get
71             {
72                 return Interop.Eext.eext_floatingbutton_movement_block_get(Handle);
73             }
74             set
75             {
76                 Interop.Eext.eext_floatingbutton_movement_block_set(Handle, value);
77             }
78         }
79
80         /// <summary>
81         /// Get Opacity's value of the given FloatingButton.
82         /// </summary>
83         /// <since_tizen> preview </since_tizen>
84         public override int Opacity
85         {
86             get
87             {
88                 return Color.Default.A;
89             }
90
91             set
92             {
93                 Console.WriteLine("FloatingButton instance doesn't support to set Opacity.");
94             }
95         }
96
97         /// <summary>
98         /// Set the floatingbutton position with animation or not.
99         /// </summary>
100         /// <param name="position">Button position</param>
101         /// <param name="animated">Animat flag</param>
102         /// <since_tizen> preview </since_tizen>
103         public void SetPosition(FloatingButtonPosition position, bool animated)
104         {
105             if (animated)
106             {
107                 Interop.Eext.eext_floatingbutton_pos_bring_in(Handle, (int)position);
108             }
109             else
110             {
111                 Interop.Eext.eext_floatingbutton_pos_set(Handle, (int)position);
112             }
113         }
114
115         /// <summary>
116         /// Creates a widget handle.
117         /// </summary>
118         /// <param name="parent">Parent EvasObject</param>
119         /// <returns>Handle IntPtr</returns>
120         /// <since_tizen> preview </since_tizen>
121         protected override IntPtr CreateHandle(EvasObject parent)
122         {
123             return Interop.Eext.eext_floatingbutton_add(parent.Handle);
124         }
125     }
126
127     /// <summary>
128     /// Enumeration for FloatingButtonMode
129     /// </summary>
130     /// <since_tizen> preview </since_tizen>
131     public enum FloatingButtonMode
132     {
133         /// <summary>
134         /// Allows all positions
135         /// </summary>
136         All,
137
138         /// <summary>
139         /// Allows LEFT and RIGHT positions only
140         /// </summary>
141         LeftRightOnly,
142     }
143
144     /// <summary>
145     /// Enumeration for FloatingButtonPosition
146     /// </summary>
147     /// <since_tizen> preview </since_tizen>
148     public enum FloatingButtonPosition
149     {
150         /// <summary>
151         /// Hides in the left, but small handler will show only
152         /// </summary>
153         LeftOut,
154
155         /// <summary>
156         /// Shows all of buttons, but lies on the left
157         /// </summary>
158         Left,
159
160         /// <summary>
161         /// Shows all of buttons, but lies on the center
162         /// </summary>
163         Center,
164
165         /// <summary>
166         /// Shows all of buttons, but lies on the right
167         /// </summary>
168         Right,
169
170         /// <summary>
171         /// Hides in the right, but small handler will show only
172         /// </summary>
173         RightOut,
174     }
175 }