2 using System.Collections.Generic;
7 public enum DisplayRotation
15 public enum StatusBarMode
18 /// Opacifies the status bar
23 /// Be translucent the status bar
31 /// Transparentizes the status bar
36 public class Window : Widget
38 Interop.SmartEvent _deleteRequest;
39 Interop.SmartEvent _rotationChanged;
40 HashSet<EvasObject> _referenceHolder = new HashSet<EvasObject>();
42 public Window(string name) : this(null, name)
46 public Window(Window parent, string name)
50 Interop.Elementary.elm_win_indicator_mode_set(Handle, 2 /* ELM_WIN_INDICATOR_SHOW */);
52 _deleteRequest = new Interop.SmartEvent(this, Handle, "delete,request");
53 _rotationChanged = new Interop.SmartEvent(this, Handle, "wm,rotation,changed");
54 _deleteRequest.On += (s, e) => CloseRequested?.Invoke(this, EventArgs.Empty);
55 _rotationChanged.On += (s, e) => RotationChanged?.Invoke(this, EventArgs.Empty);
62 public event EventHandler CloseRequested;
63 public event EventHandler RotationChanged;
65 public string Name { get; set; }
67 public Size ScreenSize
72 Interop.Elementary.elm_win_screen_size_get(Handle, out x, out y, out w, out h);
73 return new Size(w, h);
81 return Interop.Elementary.elm_win_rotation_get(Handle);
85 public bool IsRotationSupported
89 return Interop.Elementary.elm_win_wm_rotation_supported_get(Handle);
93 [Obsolete("Sorry, it's error typo of AvailableRotations, please use AvailableRotations")]
94 public DisplayRotation AavailableRotations { get; set; }
96 public DisplayRotation AvailableRotations
101 Interop.Elementary.elm_win_wm_rotation_available_rotations_get(Handle, out rotations);
102 if (rotations == null)
106 return ConvertToDisplayRotation(rotations);
110 Interop.Elementary.elm_win_wm_rotation_available_rotations_set(Handle, ConvertDegreeArray(value));
114 public bool AutoDeletion
118 return Interop.Elementary.elm_win_autodel_get(Handle);
122 Interop.Elementary.elm_win_autodel_set(Handle, value);
126 public StatusBarMode StatusBarMode
130 return (StatusBarMode)Interop.Elementary.elm_win_indicator_opacity_get(Handle);
134 Interop.Elementary.elm_win_indicator_opacity_set(Handle, (int)value);
141 Interop.Elementary.elm_win_activate(Handle);
144 public void AddResizeObject(EvasObject obj)
146 Interop.Elementary.elm_win_resize_object_add(Handle, obj);
149 protected override IntPtr CreateHandle(EvasObject parent)
151 Interop.Elementary.elm_config_accel_preference_set("3d");
152 return Interop.Elementary.elm_win_add(parent != null ? parent.Handle : IntPtr.Zero, Name, 0);
155 internal void AddChild(EvasObject obj)
157 _referenceHolder.Add(obj);
160 internal void RemoveChild(EvasObject obj)
162 _referenceHolder.Remove(obj);
165 static int[] ConvertDegreeArray(DisplayRotation value)
167 List<int> rotations = new List<int>();
168 if (value.HasFlag(DisplayRotation.Degree_0))
170 if (value.HasFlag(DisplayRotation.Degree_90))
172 if (value.HasFlag(DisplayRotation.Degree_180))
174 if (value.HasFlag(DisplayRotation.Degree_270))
176 return rotations.ToArray();
179 static DisplayRotation ConvertToDisplayRotation(int[] values)
182 foreach (int v in values)
184 orientation |= (1 << (v / 90));
186 return (DisplayRotation)orientation;