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