6c147dded87d3f4a4ce46c8c504f3d6fc3b599df
[platform/core/csapi/tizenfx.git] / src / ElmSharp / ElmSharp / Window.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 using System.Collections.Generic;
19 using System.ComponentModel;
20
21 namespace ElmSharp
22 {
23     /// <summary>
24     /// Enumeration for the display rotation of window.
25     /// </summary>
26     /// <since_tizen> preview </since_tizen>
27     [Flags]
28     public enum DisplayRotation
29     {
30         /// <summary>
31         /// Rotation value of window is 0 degree
32         /// </summary>
33         Degree_0 = 1,
34
35         /// <summary>
36         /// Rotation value of window is 90 degree
37         /// </summary>
38         Degree_90 = 2,
39
40         /// <summary>
41         /// Rotation value of window is 180 degree
42         /// </summary>
43         Degree_180 = 4,
44
45         /// <summary>
46         /// Rotation value of window is 270 degree
47         /// </summary>
48         Degree_270 = 8
49     };
50
51     /// <summary>
52     /// Enumeration for the indicator opacity
53     /// </summary>
54     /// <since_tizen> preview </since_tizen>
55     public enum StatusBarMode
56     {
57         /// <summary>
58         /// Opacifies the status bar
59         /// </summary>
60         Opaque = 1,
61
62         /// <summary>
63         /// Be translucent the status bar
64         /// </summary>
65         /// <remarks>
66         /// Not supported.
67         /// </remarks>
68         Translucent = 2,
69
70         /// <summary>
71         /// Transparentizes the status bar
72         /// </summary>
73         Transparent = 3,
74     }
75
76     /// <summary>
77     /// Enumeration for the keygrab modes of window.
78     /// </summary>
79     /// <since_tizen> preview </since_tizen>
80     [EditorBrowsable(EditorBrowsableState.Never)]
81     public enum KeyGrabMode
82     {
83         /// <summary>
84         /// Unknown keygrab mode
85         /// </summary>
86         Shared = 256,
87
88         /// <summary>
89         /// Getting the grabbed-key together with the other client windows.
90         /// </summary>
91         Topmost = 512,
92
93         /// <summary>
94         /// Getting the grabbed-key only when window is top of the stack.
95         /// </summary>
96         Exclusive = 1024,
97
98         /// <summary>
99         /// Getting the grabbed-key exclusively regardless of window's position.
100         /// </summary>
101         OverrideExclusive = 2048,
102     }
103
104     /// <summary>
105     /// Enumeration for the indicator mode.
106     /// </summary>
107     /// <since_tizen> preview </since_tizen>
108     public enum IndicatorMode
109     {
110         /// <summary>
111         /// Unknown indicator state.
112         /// </summary>
113         Unknown = 0,
114
115         /// <summary>
116         /// Hides the indicator.
117         /// </summary>
118         Hide,
119
120         /// <summary>
121         /// Shows the indicator.
122         /// </summary>
123         Show,
124     };
125
126     /// <summary>
127     /// Enumeration for the keyboard mode
128     /// </summary>
129     /// <since_tizen> preview </since_tizen>
130     public enum KeyboardMode
131     {
132         /// <summary>
133         /// Unknown keyboard state
134         /// </summary>
135         Unknown,
136
137         /// <summary>
138         /// Request to deactivate the keyboard
139         /// </summary>
140         Off,
141
142         /// <summary>
143         /// Enable keyboard with default layout
144         /// </summary>
145         On,
146
147         /// <summary>
148         /// Alpha (a-z) keyboard layout
149         /// </summary>
150         Alpha,
151
152         /// <summary>
153         /// Numeric keyboard layout
154         /// </summary>
155         Numeric,
156
157         /// <summary>
158         /// PIN keyboard layout
159         /// </summary>
160         Pin,
161
162         /// <summary>
163         /// Phone keyboard layout
164         /// </summary>
165         PhoneNumber,
166
167         /// <summary>
168         /// Hexadecimal numeric keyboard layout
169         /// </summary>
170         Hex,
171
172         /// <summary>
173         /// Full (QWERTY) keyboard layout
174         /// </summary>
175         QWERTY,
176
177         /// <summary>
178         /// Password keyboard layout
179         /// </summary>
180         Password,
181
182         /// <summary>
183         /// IP keyboard layout
184         /// </summary>
185         IP,
186
187         /// <summary>
188         /// Host keyboard layout
189         /// </summary>
190         Host,
191
192         /// <summary>
193         /// File keyboard layout
194         /// </summary>
195         File,
196
197         /// <summary>
198         /// URL keyboard layout
199         /// </summary>
200         URL,
201
202         /// <summary>
203         /// Keypad layout
204         /// </summary>
205         Keypad,
206
207         /// <summary>
208         /// J2ME keyboard layout
209         /// </summary>
210         J2ME,
211     };
212
213     /// <summary>
214     /// Enumeration for the window type
215     /// </summary>
216     /// <since_tizen> preview </since_tizen>
217     public enum WindowType
218     {
219         /// <summary>
220         /// Unknown
221         /// </summary>
222         Unknown,
223
224         /// <summary>
225         /// A normal window. Indicates a normal, top-level window. Almost every window will be created with this type.
226         /// </summary>
227         Basic,
228
229         /// <summary>
230         /// Used for simple dialog windows.
231         /// </summary>
232         Dialog,
233
234         /// <summary>
235         /// For special desktop windows, like a background window holding desktop icons.
236         /// </summary>
237         Desktop,
238
239         /// <summary>
240         /// The window is used as a dock or panel. Usually would be kept on top of any other window by the Window Manager.
241         /// </summary>
242         Dock,
243
244         /// <summary>
245         /// The window is used to hold a floating toolbar, or similar.
246         /// </summary>
247         Toolbar,
248
249         /// <summary>
250         /// Similar to Toolbar.
251         /// </summary>
252         Menu,
253
254         /// <summary>
255         /// A persistent utility window, like a toolbox or palette.
256         /// </summary>
257         Utility,
258
259         /// <summary>
260         /// Splash window for a starting up application.
261         /// </summary>
262         Splash,
263
264         /// <summary>
265         /// The window is a dropdown menu, as when an entry in a menubar is clicked.
266         /// </summary>
267         DropdownMenu,
268
269         /// <summary>
270         /// Like DropdownMenu, but for the menu triggered by right-clicking an object.
271         /// </summary>
272         PopupMenu,
273
274         /// <summary>
275         /// The window is a tooltip. A short piece of explanatory text that typically appear after the mouse cursor hovers over an object for a while.
276         /// </summary>
277         Tooltip,
278
279         /// <summary>
280         /// A notification window, like a warning about battery life or a new E-Mail received.
281         /// </summary>
282         Notification,
283
284         /// <summary>
285         /// A window holding the contents of a combo box.
286         /// </summary>
287         Combo,
288
289         /// <summary>
290         /// Used to indicate the window is a representation of an object being dragged across different windows, or even applications.
291         /// </summary>
292         DragAndDrop,
293
294         /// <summary>
295         /// The window is rendered onto an image buffer. No actual window is created for this type, instead the window and all of its contents will be rendered to an image buffer.
296         /// This allows to have children window inside a parent one just like any other object would be, and do other things like applying Evas_Map effects to it.
297         /// </summary>
298         InlinedImage,
299
300         /// <summary>
301         /// The window is rendered onto an image buffer and can be shown other process's plug image object.
302         /// No actual window is created for this type, instead the window and all of its contents will be rendered to an image buffer and can be shown other process's plug image object.
303         /// </summary>
304         SocketImage,
305
306         /// <summary>
307         /// This window was created using a pre-existing canvas. The window widget can be deleted, but the canvas must be managed externally.
308         /// </summary>
309         Fake,
310     };
311
312     /// <summary>
313     /// The Window is container that contain the graphical user interface of a program.
314     /// </summary>
315     /// <since_tizen> preview </since_tizen>
316     public class Window : Widget
317     {
318         SmartEvent _deleteRequest;
319         SmartEvent _rotationChanged;
320         HashSet<EvasObject> _referenceHolder = new HashSet<EvasObject>();
321
322         /// <summary>
323         /// Creates and initializes a new instance of the Window class.
324         /// </summary>
325         /// <param name="name">Window name.</param>
326         /// <since_tizen> preview </since_tizen>
327         public Window(string name) : this(null, name)
328         {
329         }
330
331         /// <summary>
332         /// Creates and initializes a new instance of the Window class.
333         /// </summary>
334         /// <param name="parent">
335         /// Parent widget which this widow created on.
336         /// </param>
337         /// <param name="name">
338         /// Window name.
339         /// </param>
340         /// <remarks>
341         /// Window constructor.show window indicator,set callback
342         /// When closing the window in any way outside the program control,
343         /// and set callback when window rotation changed.
344         /// </remarks>
345         /// <since_tizen> preview </since_tizen>
346         public Window(Window parent, string name) : this(parent, name, WindowType.Basic)
347         {
348         }
349
350         /// <summary>
351         /// Creates and initializes a new instance of the Window class.
352         /// </summary>
353         /// <param name="parent">
354         /// Parent widget which this widow created on.
355         /// </param>
356         /// <param name="name">
357         /// Window name.
358         /// </param>
359         /// <param name="type">
360         /// Window type
361         /// </param>
362         /// <remarks>
363         /// Window constructor.show window indicator,set callback
364         /// When closing the window in any way outside the program control,
365         /// and set callback when window rotation changed.
366         /// </remarks>
367         /// <since_tizen> preview </since_tizen>
368         public Window(Window parent, string name, WindowType type)
369         {
370             Name = name;
371             Type = type;
372             Realize(parent);
373             IndicatorMode = IndicatorMode.Show;
374
375             _deleteRequest = new SmartEvent(this, "delete,request");
376             _rotationChanged = new SmartEvent(this, "wm,rotation,changed");
377             _deleteRequest.On += (s, e) => CloseRequested?.Invoke(this, EventArgs.Empty);
378             _rotationChanged.On += (s, e) => RotationChanged?.Invoke(this, EventArgs.Empty);
379         }
380
381         /// <summary>
382         /// Creates and initializes a new instance of the Window class.
383         /// </summary>
384         /// <since_tizen> preview </since_tizen>
385         protected Window()
386         {
387         }
388
389         /// <summary>
390         /// CloseRequested will be triggered when Window close.
391         /// </summary>
392         /// <since_tizen> preview </since_tizen>
393         public event EventHandler CloseRequested;
394
395         /// <summary>
396         /// RotationChanged will be triggered when Window do rotation.
397         /// </summary>
398         /// <since_tizen> preview </since_tizen>
399         public event EventHandler RotationChanged;
400
401         /// <summary>
402         /// Sets or gets Window name.
403         /// </summary>
404         /// <since_tizen> preview </since_tizen>
405         public string Name { get; set; }
406
407         /// <summary>
408         /// Gets the Window type.
409         /// </summary>
410         /// <since_tizen> preview </since_tizen>
411         public WindowType Type { get; } = WindowType.Basic;
412
413         /// <summary>
414         /// Gets Window size with Size value(w,h)
415         /// </summary>
416         /// <since_tizen> preview </since_tizen>
417         public Size ScreenSize
418         {
419             get
420             {
421                 int x, y, w, h;
422                 Interop.Elementary.elm_win_screen_size_get(Handle, out x, out y, out w, out h);
423                 return new Size(w, h);
424             }
425         }
426
427         /// <summary>
428         /// Gets the screen dpi for the screen that a Window is on.
429         /// </summary>
430         /// <since_tizen> preview </since_tizen>
431         public Point ScreenDpi
432         {
433             get
434             {
435                 Point point = default(Point);
436                 Interop.Elementary.elm_win_screen_dpi_get(Handle, out point.X, out point.Y);
437                 return point;
438             }
439         }
440
441         /// <summary>
442         /// Gets the rotation of the Window.The rotation of the window in degrees (0-360).
443         /// </summary>
444         /// <since_tizen> preview </since_tizen>
445         public int Rotation
446         {
447             get
448             {
449                 return Interop.Elementary.elm_win_rotation_get(Handle);
450             }
451         }
452
453         /// <summary>
454         /// Gets whether window manager supports window rotation or not.
455         /// </summary>
456         /// <since_tizen> preview </since_tizen>
457         public bool IsRotationSupported
458         {
459             get
460             {
461                 return Interop.Elementary.elm_win_wm_rotation_supported_get(Handle);
462             }
463         }
464
465         /// <summary>
466         /// Sets or gets available rotation degree.
467         /// </summary>
468         /// <since_tizen> preview </since_tizen>
469         [Obsolete("Sorry, it's error typo of AvailableRotations, please use AvailableRotations")]
470         public DisplayRotation AavailableRotations { get; set; }
471
472         /// <summary>
473         /// Sets or gets available rotation degree.
474         /// </summary>
475         /// <since_tizen> preview </since_tizen>
476         public DisplayRotation AvailableRotations
477         {
478             get
479             {
480                 int[] rotations;
481                 Interop.Elementary.elm_win_wm_rotation_available_rotations_get(Handle, out rotations);
482                 if (rotations == null)
483                 {
484                     return 0;
485                 }
486                 return ConvertToDisplayRotation(rotations);
487             }
488             set
489             {
490                 Interop.Elementary.elm_win_wm_rotation_available_rotations_set(Handle, ConvertDegreeArray(value));
491             }
492         }
493
494         /// <summary>
495         /// Sets or gets whether auto deletion function is enable.
496         /// </summary>
497         /// <remarks>
498         /// If you enable auto deletion, the window is automatically destroyed after the signal is emitted.
499         /// If auto deletion is disabled, the window is not destroyed and the program has to handle it.
500         /// </remarks>
501         /// <since_tizen> preview </since_tizen>
502         public bool AutoDeletion
503         {
504             get
505             {
506                 return Interop.Elementary.elm_win_autodel_get(Handle);
507             }
508             set
509             {
510                 Interop.Elementary.elm_win_autodel_set(Handle, value);
511             }
512         }
513
514         /// <summary>
515         /// Sets or gets the alpha channel state of a window.
516         /// </summary>
517         /// <remarks>
518         /// True if the window alpha channel is enabled, false otherwise.
519         /// If alpha is true, the alpha channel of the canvas will be enabled possibly making parts of the window completely or partially transparent.
520         /// </remarks>
521         /// <since_tizen> preview </since_tizen>
522         public bool Alpha
523         {
524             get
525             {
526                 return Interop.Elementary.elm_win_alpha_get(Handle);
527             }
528             set
529             {
530                 Interop.Elementary.elm_win_alpha_set(Handle, value);
531             }
532         }
533
534         /// <summary>
535         /// Sets or gets the role of the window.
536         /// </summary>
537         /// <remarks>
538         /// The Role will be invalid if a new role is set or if the window is destroyed.
539         /// </remarks>
540         /// <since_tizen> preview </since_tizen>
541         public string Role
542         {
543             get
544             {
545                 return Interop.Elementary.elm_win_role_get(Handle);
546             }
547             set
548             {
549                 Interop.Elementary.elm_win_role_set(Handle, value);
550             }
551         }
552
553         /// <summary>
554         /// Sets or gets the mode of status bar.
555         /// </summary>
556         /// <since_tizen> preview </since_tizen>
557         public StatusBarMode StatusBarMode
558         {
559             get
560             {
561                 return (StatusBarMode)Interop.Elementary.elm_win_indicator_opacity_get(Handle);
562             }
563             set
564             {
565                 Interop.Elementary.elm_win_indicator_opacity_set(Handle, (int)value);
566             }
567         }
568
569         /// <summary>
570         /// Sets or gets the iconified state of a window.
571         /// </summary>
572         /// <since_tizen> preview </since_tizen>
573         [EditorBrowsable(EditorBrowsableState.Never)]
574         public bool Iconified
575         {
576             get
577             {
578                 return Interop.Elementary.elm_win_iconified_get(RealHandle);
579             }
580             set
581             {
582                 Interop.Elementary.elm_win_iconified_set(RealHandle, value);
583             }
584         }
585
586         /// <summary>
587         /// Gets or sets the window's indicator mode.
588         /// </summary>
589         /// <value>The indicator mode.</value>
590         /// <since_tizen> preview </since_tizen>
591         public IndicatorMode IndicatorMode
592         {
593             get
594             {
595                 return Interop.Elementary.elm_win_indicator_mode_get(RealHandle);
596             }
597             set
598             {
599                 Interop.Elementary.elm_win_indicator_mode_set(RealHandle, value);
600             }
601         }
602
603         /// <summary>
604         /// Gets or sets the aspect ratio of a window.
605         /// </summary>
606         /// <since_tizen> preview </since_tizen>
607         public double Aspect
608         {
609             get
610             {
611                 return Interop.Elementary.elm_win_aspect_get(RealHandle);
612             }
613             set
614             {
615                 Interop.Elementary.elm_win_aspect_set(RealHandle, value);
616             }
617         }
618
619         /// <summary>
620         /// Window's autohide state.
621         /// </summary>
622         /// <since_tizen> preview </since_tizen>
623         public bool AutoHide
624         {
625             get
626             {
627                 return Interop.Elementary.elm_win_autohide_get(RealHandle);
628             }
629             set
630             {
631                 Interop.Elementary.elm_win_autohide_set(RealHandle, value);
632             }
633         }
634
635         /// <summary>
636         /// Get the borderless state of a window.
637         /// This function requests the Window Manager to not draw any decoration around the window.
638         /// </summary>
639         /// <since_tizen> preview </since_tizen>
640         public bool Borderless
641         {
642             get
643             {
644                 return Interop.Elementary.elm_win_borderless_get(RealHandle);
645             }
646             set
647             {
648                 Interop.Elementary.elm_win_borderless_set(RealHandle, value);
649             }
650         }
651
652         /// <summary>
653         /// Gets or sets the demand attention state of a window.
654         /// </summary>
655         /// <since_tizen> preview </since_tizen>
656         public bool DemandAttention
657         {
658             get
659             {
660                 return Interop.Elementary.elm_win_demand_attention_get(RealHandle);
661             }
662             set
663             {
664                 Interop.Elementary.elm_win_demand_attention_set(RealHandle, value);
665             }
666         }
667
668         /// <summary>
669         /// Gets or sets the floating mode of a window.
670         /// </summary>
671         /// <since_tizen> preview </since_tizen>
672         public bool FloatingMode
673         {
674             get
675             {
676                 return Interop.Elementary.elm_win_floating_mode_get(RealHandle);
677             }
678             set
679             {
680                 Interop.Elementary.elm_win_floating_mode_set(RealHandle, value);
681             }
682         }
683
684         /// <summary>
685         /// Gets or sets the animate status for the focus highlight for this window.
686         /// This function will enable or disable the animation of focus highlight only for the given window, regardless of the global setting for it.
687         /// </summary>
688         /// <since_tizen> preview </since_tizen>
689         public bool FocusHighlightAnimation
690         {
691             get
692             {
693                 return Interop.Elementary.elm_win_focus_highlight_animate_get(RealHandle);
694             }
695             set
696             {
697                 Interop.Elementary.elm_win_focus_highlight_animate_set(RealHandle, value);
698             }
699         }
700
701         /// <summary>
702         /// Gets or sets the enabled status for the focus highlight in a window.
703         /// This function will enable or disable the focus highlight only for the given window, regardless of the global setting for it.
704         /// </summary>
705         /// <since_tizen> preview </since_tizen>
706         public bool FocusHighlightEnabled
707         {
708             get
709             {
710                 return Interop.Elementary.elm_win_focus_highlight_enabled_get(RealHandle);
711             }
712             set
713             {
714                 Interop.Elementary.elm_win_focus_highlight_enabled_set(RealHandle, value);
715             }
716         }
717
718         /// <summary>
719         /// Gets or sets the style for the focus highlight on this window.
720         /// Sets the style to use for theming the highlight of focused objects on the given window.If style is NULL, the default will be used.
721         /// </summary>
722         /// <since_tizen> preview </since_tizen>
723         public string FocusHighlightStyle
724         {
725             get
726             {
727                 return Interop.Elementary.elm_win_focus_highlight_style_get(RealHandle);
728             }
729             set
730             {
731                 Interop.Elementary.elm_win_focus_highlight_style_set(RealHandle, value);
732             }
733         }
734
735         /// <summary>
736         /// Get the keyboard mode of the window.
737         /// </summary>
738         /// <since_tizen> preview </since_tizen>
739         public KeyboardMode KeyboardMode
740         {
741             get
742             {
743                 return (KeyboardMode)Interop.Elementary.elm_win_keyboard_mode_get(RealHandle);
744             }
745             set
746             {
747                 Interop.Elementary.elm_win_keyboard_mode_set(RealHandle, (int)value);
748             }
749         }
750
751         /// <summary>
752         /// Gets or sets the layer of the window.
753         /// What this means exactly will depend on the underlying engine used.
754         /// In the case of X11 backed engines, the value in layer has the following meanings
755         /// less than 3 means that the window will be placed below all others,
756         /// more than 5 means that the window will be placed above all others,
757         /// and anything else means that the window will be placed in the default layer.
758         /// </summary>
759         /// <since_tizen> preview </since_tizen>
760         public override int Layer
761         {
762             get
763             {
764                 return Interop.Elementary.elm_win_layer_get(RealHandle);
765             }
766             set
767             {
768                 Interop.Elementary.elm_win_layer_set(RealHandle, value);
769             }
770         }
771
772         /// <summary>
773         /// Gets or sets the modal state of a window.
774         /// </summary>
775         /// <since_tizen> preview </since_tizen>
776         public bool Modal
777         {
778             get
779             {
780                 return Interop.Elementary.elm_win_modal_get(RealHandle);
781             }
782             set
783             {
784                 Interop.Elementary.elm_win_modal_set(RealHandle, value);
785             }
786         }
787
788         /// <summary>
789         /// Gets or sets the noblank property of a window.
790         /// This is a way to request the display on which the windowis shown does not blank, screensave or otherwise hide or obscure the window.It is intended for uses such as media playback on a television where a user may not want to be interrupted by an idle screen.
791         /// The noblank property may have no effect if the window is iconified/minimized or hidden.
792         /// </summary>
793         /// <since_tizen> preview </since_tizen>
794         public bool NoBlank
795         {
796             get
797             {
798                 return Interop.Elementary.elm_win_noblank_get(RealHandle);
799             }
800             set
801             {
802                 Interop.Elementary.elm_win_noblank_set(RealHandle, value);
803             }
804         }
805
806         /// <summary>
807         /// Get the profile of a window.
808         /// </summary>
809         /// <since_tizen> preview </since_tizen>
810         public string Profile
811         {
812             get
813             {
814                 return Interop.Elementary.elm_win_profile_get(RealHandle);
815             }
816             set
817             {
818                 Interop.Elementary.elm_win_profile_set(RealHandle, value);
819             }
820         }
821
822         /// <summary>
823         /// Get the constraints on the maximum width and height of a window relative to the width and height of its screen.
824         /// When this function returns true, obj will never resize larger than the screen.
825         /// </summary>
826         /// <since_tizen> preview </since_tizen>
827         public bool ScreenConstrain
828         {
829             get
830             {
831                 return Interop.Elementary.elm_win_screen_constrain_get(RealHandle);
832             }
833             set
834             {
835                 Interop.Elementary.elm_win_screen_constrain_set(RealHandle, value);
836             }
837         }
838
839         /// <summary>
840         /// Gets or sets the base size of a window.
841         /// </summary>
842         /// <since_tizen> preview </since_tizen>
843         public Size BaseSize
844         {
845             get
846             {
847                 int w, h;
848                 Interop.Elementary.elm_win_size_base_get(RealHandle, out w, out h);
849                 return new Size(w, h);
850             }
851             set
852             {
853                 Interop.Elementary.elm_win_size_base_set(RealHandle, value.Width, value.Height);
854             }
855         }
856
857         /// <summary>
858         /// Gets or sets the step size of a window.
859         /// </summary>
860         /// <since_tizen> preview </since_tizen>
861         public Size StepSize
862         {
863             get
864             {
865                 int w, h;
866                 Interop.Elementary.elm_win_size_step_get(RealHandle, out w, out h);
867                 return new Size(w, h);
868             }
869             set
870             {
871                 Interop.Elementary.elm_win_size_step_set(RealHandle, value.Width, value.Height);
872             }
873         }
874
875         /// <summary>
876         /// Get the screen position X of a window.
877         /// </summary>
878         /// <since_tizen> preview </since_tizen>
879         public int ScreenPositionX
880         {
881             get
882             {
883                 int x, y;
884                 Interop.Elementary.elm_win_screen_position_get(Handle, out x, out y);
885                 return x;
886             }
887         }
888
889         /// <summary>
890         /// Get the screen position Y of a window.
891         /// </summary>
892         /// <since_tizen> preview </since_tizen>
893         public int ScreenPositionY
894         {
895             get
896             {
897                 int x, y;
898                 Interop.Elementary.elm_win_screen_position_get(Handle, out x, out y);
899                 return y;
900             }
901         }
902
903         /// <summary>
904         /// Gets or sets the title of the window.
905         /// </summary>
906         /// <since_tizen> preview </since_tizen>
907         public string Title
908         {
909             get
910             {
911                 return Interop.Elementary.elm_win_title_get(Handle);
912             }
913             set
914             {
915                 Interop.Elementary.elm_win_title_set(Handle, value);
916             }
917         }
918
919         /// <summary>
920         /// Gets or sets the urgent state of a window.
921         /// </summary>
922         /// <since_tizen> preview </since_tizen>
923         public bool Urgent
924         {
925             get
926             {
927                 return Interop.Elementary.elm_win_urgent_get(Handle);
928             }
929             set
930             {
931                 Interop.Elementary.elm_win_urgent_set(Handle, value);
932             }
933         }
934
935         /// <summary>
936         /// Gets or sets the withdrawn state of a window.
937         /// </summary>
938         /// <since_tizen> preview </since_tizen>
939         public bool Withdrawn
940         {
941             get
942             {
943                 return Interop.Elementary.elm_win_urgent_get(Handle);
944             }
945             set
946             {
947                 Interop.Elementary.elm_win_urgent_set(Handle, value);
948             }
949         }
950
951         /// <summary>
952         /// Create a socket to provide the service for Plug widget.
953         /// </summary>
954         /// <param name="name">A service name</param>
955         /// <param name="number">A number (any value, 0 being the common default) to differentiate multiple instances of services with the same name.</param>
956         /// <param name="systemWide">A boolean that if true, specifies to create a system-wide service all users can connect to, otherwise the service is private to the user id that created the service.</param>
957         /// <returns>If true, create successfull, otherwise false</returns>
958         /// <since_tizen> preview </since_tizen>
959         public bool CreateServiceSocket(string name, int number, bool systemWide)
960         {
961             return Interop.Elementary.elm_win_socket_listen(RealHandle, name, number, systemWide);
962         }
963
964         /// <summary>
965         /// Set the rotation of the window.
966         /// </summary>
967         /// <param name="degree">The rotation of the window, in degrees (0-360), counter-clockwise.</param>
968         /// <param name="resize">Resizes the window's contents so that they fit inside the current window geometry.</param>
969         /// <since_tizen> preview </since_tizen>
970         public void SetRotation(int degree, bool resize)
971         {
972             if (resize)
973                 Interop.Elementary.elm_win_rotation_with_resize_set(RealHandle, degree);
974             else
975                 Interop.Elementary.elm_win_rotation_set(RealHandle, degree);
976         }
977
978         /// <summary>
979         /// Set the window to be skipped by focus.
980         /// This sets the window to be skipped by normal input.
981         /// This means a window manager will be asked to not focus this window as well as omit it from things like the taskbar, pager etc.
982         /// Call this and enable it on a window BEFORE you show it for the first time, otherwise it may have no effect.
983         /// Use this for windows that have only output information or might only be interacted with by the mouse or fingers, and never for typing input.
984         /// Be careful that this may have side-effects like making the window non-accessible in some cases unless the window is specially handled. Use this with care.
985         /// </summary>
986         /// <since_tizen> preview </since_tizen>
987         public void FocusSkip(bool skip)
988         {
989             Interop.Elementary.elm_win_prop_focus_skip_set(Handle, skip);
990         }
991
992         /// <summary>
993         /// Pull up the window object.
994         /// Places the window pointed by obj at the top of the stack, so that it's not covered by any other window.
995         /// </summary>
996         /// <since_tizen> preview </since_tizen>
997         public void PullUp()
998         {
999             Interop.Elementary.elm_win_raise(Handle);
1000         }
1001
1002         /// <summary>
1003         /// Bring down the window object.
1004         /// Places the window pointed by obj at the bottom of the stack, so that no other window is covered by it.
1005         /// </summary>
1006         /// <since_tizen> preview </since_tizen>
1007         public void BringDown()
1008         {
1009             Interop.Elementary.elm_win_lower(Handle);
1010         }
1011
1012         /// <summary>
1013         /// This function sends a request to the Windows Manager to activate the Window.
1014         /// If honored by the WM, the window receives the keyboard focus.
1015         /// </summary>
1016         /// <remarks>
1017         /// This is just a request that a Window Manager may ignore, so calling this function does not ensure
1018         /// in any way that the window is going to be the active one after it.
1019         /// </remarks>
1020         /// <since_tizen> preview </since_tizen>
1021         public void Active()
1022         {
1023             Interop.Elementary.elm_win_activate(Handle);
1024         }
1025
1026         /// <summary>
1027         /// Delete subobj as a resize object of window obj.
1028         /// This function removes the object subobj from the resize objects of the window obj.
1029         /// It will not delete the object itself, which will be left unmanaged and should be deleted by the developer, manually handled or set as child of some other container.
1030         /// </summary>
1031         /// <param name="obj">Resize object.</param>
1032         /// <since_tizen> preview </since_tizen>
1033         public void DeleteResizeObject(EvasObject obj)
1034         {
1035             Interop.Elementary.elm_win_resize_object_del(Handle, obj);
1036         }
1037
1038         /// <summary>
1039         /// Adds obj as a resize object of the Window.
1040         /// </summary>
1041         /// <remarks>
1042         /// Setting an object as a resize object of the window means that the obj child's size and
1043         /// position is controlled by the window directly. That is, the obj is resized to match the window size
1044         /// and should never be moved or resized manually by the developer.In addition,
1045         /// resize objects of the window control the minimum size of it as well as whether it can or cannot be resized by the user.
1046         /// </remarks>
1047         /// <param name="obj">
1048         /// Resize object.
1049         /// </param>
1050         /// <since_tizen> preview </since_tizen>
1051         public void AddResizeObject(EvasObject obj)
1052         {
1053             Interop.Elementary.elm_win_resize_object_add(Handle, obj);
1054         }
1055
1056         /// <summary>
1057         /// Set keygrab value of the window.
1058         /// This function grabs the key of window using grab_mode.
1059         /// </summary>
1060         /// <param name="keyname">The keyname to grab.</param>
1061         /// <param name="mode">According to the grabmode, it can grab key differently</param>
1062         /// <since_tizen> preview </since_tizen>
1063         [EditorBrowsable(EditorBrowsableState.Never)]
1064         public void WinKeyGrab(string keyname, KeyGrabMode mode)
1065         {
1066             Interop.Elementary.elm_win_keygrab_set(RealHandle, keyname, 0, 0, 0, mode);
1067         }
1068
1069         /// <summary>
1070         /// Unset keygrab value of the window.
1071         /// This function unset keygrab value.Ungrab key of window.
1072         /// </summary>
1073         /// <param name="keyname">The keyname to grab.</param>
1074         /// <since_tizen> preview </since_tizen>
1075         [EditorBrowsable(EditorBrowsableState.Never)]
1076         public void WinKeyUngrab(string keyname)
1077         {
1078             Interop.Elementary.elm_win_keygrab_unset(RealHandle, keyname, 0, 0);
1079         }
1080
1081         /// <summary>
1082         /// Set the keygrab of the window.
1083         /// </summary>
1084         /// <param name="keyname">keyname string to set keygrab</param>
1085         /// <since_tizen> preview </since_tizen>
1086         public void KeyGrabEx(string keyname)
1087         {
1088             Interop.Elementary.eext_win_keygrab_set(RealHandle, keyname);
1089         }
1090
1091         /// <summary>
1092         /// Unset the keygrab of the window.
1093         /// </summary>
1094         /// <param name="keyname">keyname string to unset keygrab</param>
1095         /// <since_tizen> preview </since_tizen>
1096         public void KeyUngrabEx(string keyname)
1097         {
1098             Interop.Elementary.eext_win_keygrab_unset(RealHandle, keyname);
1099         }
1100
1101         /// <summary>
1102         /// Creates a widget handle.
1103         /// </summary>
1104         /// <param name="parent">Parent EvasObject</param>
1105         /// <returns>Handle IntPtr</returns>
1106         /// <since_tizen> preview </since_tizen>
1107         protected override IntPtr CreateHandle(EvasObject parent)
1108         {
1109             Interop.Elementary.elm_config_accel_preference_set("3d");
1110             return Interop.Elementary.elm_win_add(parent != null ? parent.Handle : IntPtr.Zero, Name, (int)Type);
1111         }
1112
1113         internal void AddChild(EvasObject obj)
1114         {
1115             _referenceHolder.Add(obj);
1116         }
1117
1118         internal void RemoveChild(EvasObject obj)
1119         {
1120             _referenceHolder.Remove(obj);
1121         }
1122
1123         static int[] ConvertDegreeArray(DisplayRotation value)
1124         {
1125             List<int> rotations = new List<int>();
1126             if (value.HasFlag(DisplayRotation.Degree_0))
1127                 rotations.Add(0);
1128             if (value.HasFlag(DisplayRotation.Degree_90))
1129                 rotations.Add(90);
1130             if (value.HasFlag(DisplayRotation.Degree_180))
1131                 rotations.Add(180);
1132             if (value.HasFlag(DisplayRotation.Degree_270))
1133                 rotations.Add(270);
1134             return rotations.ToArray();
1135         }
1136
1137         static DisplayRotation ConvertToDisplayRotation(int[] values)
1138         {
1139             int orientation = 0;
1140             foreach (int v in values)
1141             {
1142                 orientation |= (1 << (v / 90));
1143             }
1144             return (DisplayRotation)orientation;
1145         }
1146     }
1147 }