Release 4.0.0-preview1-00130
[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 modal state of a window.
710         /// </summary>
711         public bool Modal
712         {
713             get
714             {
715                 return Interop.Elementary.elm_win_modal_get(RealHandle);
716             }
717             set
718             {
719                 Interop.Elementary.elm_win_modal_set(RealHandle, value);
720             }
721         }
722
723         /// <summary>
724         /// Gets or sets the noblank property of a window.
725         /// 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.
726         /// The noblank property may have no effect if the window is iconified/minimized or hidden.
727         /// </summary>
728         public bool NoBlank
729         {
730             get
731             {
732                 return Interop.Elementary.elm_win_noblank_get(RealHandle);
733             }
734             set
735             {
736                 Interop.Elementary.elm_win_noblank_set(RealHandle, value);
737             }
738         }
739
740         /// <summary>
741         /// Get the profile of a window.
742         /// </summary>
743         public string Profile
744         {
745             get
746             {
747                 return Interop.Elementary.elm_win_profile_get(RealHandle);
748             }
749             set
750             {
751                 Interop.Elementary.elm_win_profile_set(RealHandle, value);
752             }
753         }
754
755         /// <summary>
756         /// Get the constraints on the maximum width and height of a window relative to the width and height of its screen.
757         /// When this function returns true, obj will never resize larger than the screen.
758         /// </summary>
759         public bool ScreenConstrain
760         {
761             get
762             {
763                 return Interop.Elementary.elm_win_screen_constrain_get(RealHandle);
764             }
765             set
766             {
767                 Interop.Elementary.elm_win_screen_constrain_set(RealHandle, value);
768             }
769         }
770
771         /// <summary>
772         /// Gets or sets the base size of a window.
773         /// </summary>
774         public Size BaseSize
775         {
776             get
777             {
778                 int w, h;
779                 Interop.Elementary.elm_win_size_base_get(RealHandle, out w, out h);
780                 return new Size(w, h);
781             }
782             set
783             {
784                 Interop.Elementary.elm_win_size_base_set(RealHandle, value.Width, value.Height);
785             }
786         }
787
788         /// <summary>
789         /// Gets or sets the step size of a window.
790         /// </summary>
791         public Size StepSize
792         {
793             get
794             {
795                 int w, h;
796                 Interop.Elementary.elm_win_size_step_get(RealHandle, out w, out h);
797                 return new Size(w, h);
798             }
799             set
800             {
801                 Interop.Elementary.elm_win_size_step_set(RealHandle, value.Width, value.Height);
802             }
803         }
804
805         /// <summary>
806         /// Get the screen position X of a window.
807         /// </summary>
808         public int ScreenPositionX
809         {
810             get
811             {
812                 int x, y;
813                 Interop.Elementary.elm_win_screen_position_get(Handle, out x, out y);
814                 return x;
815             }
816         }
817
818         /// <summary>
819         /// Get the screen position Y of a window.
820         /// </summary>
821         public int ScreenPositionY
822         {
823             get
824             {
825                 int x, y;
826                 Interop.Elementary.elm_win_screen_position_get(Handle, out x, out y);
827                 return y;
828             }
829         }
830
831         /// <summary>
832         /// Gets or sets the title of the window.
833         /// </summary>
834         public string Title
835         {
836             get
837             {
838                 return Interop.Elementary.elm_win_title_get(Handle);
839             }
840             set
841             {
842                 Interop.Elementary.elm_win_title_set(Handle, value);
843             }
844         }
845
846         /// <summary>
847         /// Gets or sets the urgent state of a window.
848         /// </summary>
849         public bool Urgent
850         {
851             get
852             {
853                 return Interop.Elementary.elm_win_urgent_get(Handle);
854             }
855             set
856             {
857                 Interop.Elementary.elm_win_urgent_set(Handle, value);
858             }
859         }
860
861         /// <summary>
862         /// Gets or sets the withdrawn state of a window.
863         /// </summary>
864         public bool Withdrawn
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         /// Create a socket to provide the service for Plug widget.
878         /// </summary>
879         /// <param name="name">A service name</param>
880         /// <param name="number">A number (any value, 0 being the common default) to differentiate multiple instances of services with the same name.</param>
881         /// <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>
882         /// <returns>If true, create successfull, otherwise false</returns>
883         public bool CreateServiceSocket(string name, int number, bool systemWide)
884         {
885             return Interop.Elementary.elm_win_socket_listen(RealHandle, name, number, systemWide);
886         }
887
888         /// <summary>
889         /// Set the rotation of the window.
890         /// </summary>
891         /// <param name="degree">The rotation of the window, in degrees (0-360), counter-clockwise.</param>
892         /// <param name="resize">Resizes the window's contents so that they fit inside the current window geometry.</param>
893         public void SetRotation(int degree, bool resize)
894         {
895             if (resize)
896                 Interop.Elementary.elm_win_rotation_with_resize_set(RealHandle, degree);
897             else
898                 Interop.Elementary.elm_win_rotation_set(RealHandle, degree);
899         }
900
901         /// <summary>
902         /// Set the window to be skipped by focus.
903         /// This sets the window to be skipped by normal input.
904         /// 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.
905         /// Call this and enable it on a window BEFORE you show it for the first time, otherwise it may have no effect.
906         /// 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.
907         /// 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.
908         /// </summary>
909         public void FocusSkip(bool skip)
910         {
911             Interop.Elementary.elm_win_prop_focus_skip_set(Handle, skip);
912         }
913
914         /// <summary>
915         /// Pull up the window object.
916         /// Places the window pointed by obj at the top of the stack, so that it's not covered by any other window.
917         /// </summary>
918         public void PullUp()
919         {
920             Interop.Elementary.elm_win_raise(Handle);
921         }
922
923         /// <summary>
924         /// Bring down the window object.
925         /// Places the window pointed by obj at the bottom of the stack, so that no other window is covered by it.
926         /// </summary>
927         public void BringDown()
928         {
929             Interop.Elementary.elm_win_lower(Handle);
930         }
931
932         /// <summary>
933         /// This function sends a request to the Windows Manager to activate the Window.
934         /// If honored by the WM, the window receives the keyboard focus.
935         /// </summary>
936         /// <remarks>
937         /// This is just a request that a Window Manager may ignore, so calling this function does not ensure
938         /// in any way that the window is going to be the active one after it.
939         /// </remarks>
940         public void Active()
941         {
942             Interop.Elementary.elm_win_activate(Handle);
943         }
944
945         /// <summary>
946         /// Delete subobj as a resize object of window obj.
947         /// This function removes the object subobj from the resize objects of the window obj.
948         /// 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.
949         /// </summary>
950         /// <param name="obj">Resize object.</param>
951         public void DeleteResizeObject(EvasObject obj)
952         {
953             Interop.Elementary.elm_win_resize_object_del(Handle, obj);
954         }
955
956         /// <summary>
957         /// Adds obj as a resize object of the Window.
958         /// </summary>
959         /// <remarks>
960         /// Setting an object as a resize object of the window means that the obj child's size and
961         /// position is controlled by the window directly. That is, the obj is resized to match the window size
962         /// and should never be moved or resized manually by the developer.In addition,
963         /// resize objects of the window control the minimum size of it as well as whether it can or cannot be resized by the user.
964         /// </remarks>
965         /// <param name="obj">
966         /// Resize object.
967         /// </param>
968         public void AddResizeObject(EvasObject obj)
969         {
970             Interop.Elementary.elm_win_resize_object_add(Handle, obj);
971         }
972
973         [EditorBrowsable(EditorBrowsableState.Never)]
974         public void WinKeyGrab(string keyname, KeyGrabMode mode)
975         {
976             Interop.Elementary.elm_win_keygrab_set(RealHandle, keyname, 0, 0, 0, mode);
977         }
978
979         [EditorBrowsable(EditorBrowsableState.Never)]
980         public void WinKeyUngrab(string keyname)
981         {
982             Interop.Elementary.elm_win_keygrab_unset(RealHandle, keyname, 0, 0);
983         }
984
985         /// <summary>
986         /// Set the keygrab of the window.
987         /// </summary>
988         /// <param name="keyname">keyname string to set keygrab</param>
989         public void KeyGrabEx(string keyname)
990         {
991             Interop.Elementary.eext_win_keygrab_set(RealHandle, keyname);
992         }
993
994         /// <summary>
995         /// Unset the keygrab of the window.
996         /// </summary>
997         /// <param name="keyname">keyname string to unset keygrab</param>
998         public void KeyUngrabEx(string keyname)
999         {
1000             Interop.Elementary.eext_win_keygrab_unset(RealHandle, keyname);
1001         }
1002
1003         protected override IntPtr CreateHandle(EvasObject parent)
1004         {
1005             Interop.Elementary.elm_config_accel_preference_set("3d");
1006             return Interop.Elementary.elm_win_add(parent != null ? parent.Handle : IntPtr.Zero, Name, (int)Type);
1007         }
1008
1009         internal void AddChild(EvasObject obj)
1010         {
1011             _referenceHolder.Add(obj);
1012         }
1013
1014         internal void RemoveChild(EvasObject obj)
1015         {
1016             _referenceHolder.Remove(obj);
1017         }
1018
1019         static int[] ConvertDegreeArray(DisplayRotation value)
1020         {
1021             List<int> rotations = new List<int>();
1022             if (value.HasFlag(DisplayRotation.Degree_0))
1023                 rotations.Add(0);
1024             if (value.HasFlag(DisplayRotation.Degree_90))
1025                 rotations.Add(90);
1026             if (value.HasFlag(DisplayRotation.Degree_180))
1027                 rotations.Add(180);
1028             if (value.HasFlag(DisplayRotation.Degree_270))
1029                 rotations.Add(270);
1030             return rotations.ToArray();
1031         }
1032
1033         static DisplayRotation ConvertToDisplayRotation(int[] values)
1034         {
1035             int orientation = 0;
1036             foreach (int v in values)
1037             {
1038                 orientation |= (1 << (v / 90));
1039             }
1040             return (DisplayRotation)orientation;
1041         }
1042     }
1043 }