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