2 * Copyright(c) 2022 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 using System.ComponentModel;
20 using Tizen.NUI.BaseComponents;
22 using Tizen.NUI.Binding;
27 /// This class creates a border UI.
29 [EditorBrowsable(EditorBrowsableState.Never)]
30 public class DefaultBorder : BindableObject, IDisposable, IBorderInterface
32 static DefaultBorder()
34 if(NUIApplication.IsUsingXaml)
36 BorderLineThicknessProperty = BindableProperty.Create(nameof(BorderLineThickness), typeof(uint), typeof(DefaultBorder), default(uint), propertyChanged: SetInternalBorderLineThicknessProperty, defaultValueCreator: GetInternalBorderLineThicknessProperty);
38 MinSizeProperty = BindableProperty.Create(nameof(MinSize), typeof(Size2D), typeof(DefaultBorder), default(Size2D), propertyChanged: SetInternalMinSizeProperty, defaultValueCreator: GetInternalMinSizeProperty);
40 MaxSizeProperty = BindableProperty.Create(nameof(MaxSize), typeof(Size2D), typeof(DefaultBorder), default(Size2D), propertyChanged: SetInternalMaxSizeProperty, defaultValueCreator: GetInternalMaxSizeProperty);
42 ResizePolicyProperty = BindableProperty.Create(nameof(ResizePolicy), typeof(Window.BorderResizePolicyType), typeof(DefaultBorder), default(Window.BorderResizePolicyType), propertyChanged: SetInternalResizePolicyProperty, defaultValueCreator: GetInternalResizePolicyProperty);
45 #region Constant Fields
46 private static readonly string ResourcePath = FrameworkInformation.ResourcePath;
47 private static readonly string MinimalizeIcon = ResourcePath + "minimalize.png";
48 private static readonly string MaximalizeIcon = ResourcePath + "maximalize.png";
49 private static readonly string CloseIcon = ResourcePath + "close.png";
50 private static readonly string LeftCornerIcon = ResourcePath + "leftCorner.png";
51 private static readonly string RightCornerIcon = ResourcePath + "rightCorner.png";
53 private static readonly string DarkMinimalizeIcon = ResourcePath + "dark_minimalize.png";
54 private static readonly string DarkPreviousIcon = ResourcePath + "dark_smallwindow.png";
55 private static readonly string DarkCloseIcon = ResourcePath + "dark_close.png";
56 private static readonly string DarkLeftCornerIcon = ResourcePath + "dark_leftCorner.png";
57 private static readonly string DarkRightCornerIcon = ResourcePath + "dark_rightCorner.png";
60 private const float DefaultHeight = 50;
61 private const uint DefaultLineThickness = 5;
62 private const uint DefaultTouchThickness = 0;
63 private static readonly Color DefaultBackgroundColor = new Color(0.7f, 0.7f, 0.7f, 0.6f);
64 private static readonly Color DefaultClickedBackgroundColor = new Color(0.7f, 0.7f, 0.7f, 0.7f);
65 private static readonly Size2D DefaultMinSize = new Size2D(100, 0);
66 #endregion //Constant Fields
70 private bool disposed = false;
71 private Color backgroundColor;
72 private View borderView;
74 private ImageView minimalizeIcon;
75 private ImageView maximalizeIcon;
76 private ImageView closeIcon;
77 private ImageView leftCornerIcon;
78 private ImageView rightCornerIcon;
80 private Window.BorderDirection direction = Window.BorderDirection.None;
81 private float preScale = 0;
83 private View windowView = null;
84 private Timer overlayTimer;
86 private uint borderLineThickness;
87 private Size2D minSize;
88 private Size2D maxSize;
89 private Window.BorderResizePolicyType resizePolicy;
94 private PanGestureDetector borderPanGestureDetector;
102 [EditorBrowsable(EditorBrowsableState.Never)]
103 public static readonly BindableProperty BorderLineThicknessProperty = null;
105 internal static void SetInternalBorderLineThicknessProperty(BindableObject bindable, object oldValue, object newValue)
107 var instance = (DefaultBorder)bindable;
108 if (newValue != null)
110 instance.borderLineThickness = (uint)newValue;
111 instance.UpdateProperty();
115 internal static object GetInternalBorderLineThicknessProperty(BindableObject bindable)
117 var instance = (DefaultBorder)bindable;
118 return instance.borderLineThickness;
121 [EditorBrowsable(EditorBrowsableState.Never)]
122 public static readonly BindableProperty MinSizeProperty = null;
124 internal static void SetInternalMinSizeProperty(BindableObject bindable, object oldValue, object newValue)
126 var instance = (DefaultBorder)bindable;
127 if (newValue != null)
129 instance.minSize = (Size2D)newValue;
130 instance.UpdateProperty();
134 internal static object GetInternalMinSizeProperty(BindableObject bindable)
136 var instance = (DefaultBorder)bindable;
137 return instance.minSize;
140 [EditorBrowsable(EditorBrowsableState.Never)]
141 public static readonly BindableProperty MaxSizeProperty = null;
143 internal static void SetInternalMaxSizeProperty(BindableObject bindable, object oldValue, object newValue)
145 var instance = (DefaultBorder)bindable;
146 if (newValue != null)
148 instance.maxSize = (Size2D)newValue;
149 instance.UpdateProperty();
153 internal static object GetInternalMaxSizeProperty(BindableObject bindable)
155 var instance = (DefaultBorder)bindable;
156 return instance.maxSize;
159 [EditorBrowsable(EditorBrowsableState.Never)]
160 public static readonly BindableProperty ResizePolicyProperty = null;
162 internal static void SetInternalResizePolicyProperty(BindableObject bindable, object oldValue, object newValue)
164 var instance = (DefaultBorder)bindable;
165 if (newValue != null)
167 instance.resizePolicy = (Window.BorderResizePolicyType)newValue;
168 instance.UpdateProperty();
172 internal static object GetInternalResizePolicyProperty(BindableObject bindable)
174 var instance = (DefaultBorder)bindable;
175 return instance.resizePolicy;
180 /// The thickness of the border.
182 [EditorBrowsable(EditorBrowsableState.Never)]
183 public uint BorderLineThickness
187 if (NUIApplication.IsUsingXaml)
189 return (uint)GetValue(BorderLineThicknessProperty);
193 return (uint)GetInternalBorderLineThicknessProperty(this);
198 if (NUIApplication.IsUsingXaml)
200 SetValue(BorderLineThicknessProperty, value);
204 SetInternalBorderLineThicknessProperty(this, null, value);
210 /// The thickness of the border's touch area.
212 [EditorBrowsable(EditorBrowsableState.Never)]
213 public uint TouchThickness {get; set;}
216 /// The height of the border.
217 /// This value is the initial value used when creating borders.
219 [EditorBrowsable(EditorBrowsableState.Never)]
220 public float BorderHeight {get; set;}
223 /// The minimum size by which the window will small.
225 [EditorBrowsable(EditorBrowsableState.Never)]
226 public Size2D MinSize
230 if (NUIApplication.IsUsingXaml)
232 return (Size2D)GetValue(MinSizeProperty);
236 return (Size2D)GetInternalMinSizeProperty(this);
241 if (NUIApplication.IsUsingXaml)
243 SetValue(MinSizeProperty, value);
247 SetInternalMinSizeProperty(this, null, value);
253 /// The maximum size by which the window will big.
255 [EditorBrowsable(EditorBrowsableState.Never)]
256 public Size2D MaxSize
260 if (NUIApplication.IsUsingXaml)
262 return (Size2D)GetValue(MaxSizeProperty);
266 return (Size2D)GetInternalMaxSizeProperty(this);
271 if (NUIApplication.IsUsingXaml)
273 SetValue(MaxSizeProperty, value);
277 SetInternalMaxSizeProperty(this, null, value);
283 /// The window with borders added.
285 [EditorBrowsable(EditorBrowsableState.Never)]
286 public Window BorderWindow {get; set;}
289 /// Whether overlay mode.
290 /// If overlay mode is true, the border area is hidden when the window is maximized.
291 /// And if you touched at screen, the border area is shown on the screen.
292 /// Default value is false;
294 [EditorBrowsable(EditorBrowsableState.Never)]
295 public bool OverlayMode {get; set;}
298 /// Set the window resizing policy.
299 /// Default value is BorderResizePolicyType.Free;
301 [EditorBrowsable(EditorBrowsableState.Never)]
302 public Window.BorderResizePolicyType ResizePolicy
306 if (NUIApplication.IsUsingXaml)
308 return (Window.BorderResizePolicyType)GetValue(ResizePolicyProperty);
312 return (Window.BorderResizePolicyType)GetInternalResizePolicyProperty(this);
317 if (NUIApplication.IsUsingXaml)
319 SetValue(ResizePolicyProperty, value);
323 SetInternalResizePolicyProperty(this, null, value);
329 /// Update properties
331 [EditorBrowsable(EditorBrowsableState.Never)]
332 public void UpdateProperty()
334 BorderWindow?.UpdateProperty();
338 /// Creates a default border
340 [EditorBrowsable(EditorBrowsableState.Never)]
341 public DefaultBorder() : base()
343 BorderLineThickness = DefaultLineThickness;
344 TouchThickness = DefaultTouchThickness;
345 BorderHeight = DefaultHeight;
346 MinSize = DefaultMinSize;
348 ResizePolicy = Window.BorderResizePolicyType.Free;
352 /// Create top border UI. User can override this method to draw top border UI.
354 /// <param name="topView">The top view on which the border.</param>
355 [EditorBrowsable(EditorBrowsableState.Never)]
356 public virtual bool CreateTopBorderView(View topView)
362 /// Create bottom border UI. User can override this method to draw bottom border UI.
364 /// <param name="bottomView">The bottom view on which the border.</param>
365 [EditorBrowsable(EditorBrowsableState.Never)]
366 public virtual bool CreateBottomBorderView(View bottomView)
368 if (bottomView == null)
372 bottomView.Layout = new RelativeLayout();
374 minimalizeIcon = new ImageView()
377 ResourceUrl = MinimalizeIcon,
378 AccessibilityHighlightable = true,
381 maximalizeIcon = new ImageView()
384 ResourceUrl = MaximalizeIcon,
385 AccessibilityHighlightable = true,
388 closeIcon = new ImageView()
391 ResourceUrl = CloseIcon,
392 AccessibilityHighlightable = true,
395 leftCornerIcon = new ImageView()
398 ResourceUrl = LeftCornerIcon,
399 AccessibilityHighlightable = true,
402 rightCornerIcon = new ImageView()
405 ResourceUrl = RightCornerIcon,
406 AccessibilityHighlightable = true,
409 RelativeLayout.SetRightTarget(minimalizeIcon, maximalizeIcon);
410 RelativeLayout.SetRightRelativeOffset(minimalizeIcon, 0.0f);
411 RelativeLayout.SetHorizontalAlignment(minimalizeIcon, RelativeLayout.Alignment.End);
412 RelativeLayout.SetRightTarget(maximalizeIcon, closeIcon);
413 RelativeLayout.SetRightRelativeOffset(maximalizeIcon, 0.0f);
414 RelativeLayout.SetHorizontalAlignment(maximalizeIcon, RelativeLayout.Alignment.End);
415 RelativeLayout.SetRightTarget(closeIcon, rightCornerIcon);
416 RelativeLayout.SetRightRelativeOffset(closeIcon, 0.0f);
417 RelativeLayout.SetHorizontalAlignment(closeIcon, RelativeLayout.Alignment.End);
418 RelativeLayout.SetRightRelativeOffset(rightCornerIcon, 1.0f);
419 RelativeLayout.SetHorizontalAlignment(rightCornerIcon, RelativeLayout.Alignment.End);
420 bottomView.Add(leftCornerIcon);
421 bottomView.Add(minimalizeIcon);
422 bottomView.Add(maximalizeIcon);
423 bottomView.Add(closeIcon);
424 bottomView.Add(rightCornerIcon);
427 minimalizeIcon.TouchEvent += OnMinimizeIconTouched;
428 maximalizeIcon.TouchEvent += OnMaximizeIconTouched;
429 closeIcon.TouchEvent += OnCloseIconTouched;
430 leftCornerIcon.TouchEvent += OnLeftBottomCornerIconTouched;
431 rightCornerIcon.TouchEvent += OnRightBottomCornerIconTouched;
433 minimalizeIcon.AccessibilityActivated += (s, e) =>
435 MinimizeBorderWindow();
437 maximalizeIcon.AccessibilityActivated += (s, e) =>
439 MaximizeBorderWindow();
441 closeIcon.AccessibilityActivated += (s, e) =>
446 minimalizeIcon.AccessibilityNameRequested += (s, e) =>
450 maximalizeIcon.AccessibilityNameRequested += (s, e) =>
454 closeIcon.AccessibilityNameRequested += (s, e) =>
458 leftCornerIcon.AccessibilityNameRequested += (s, e) =>
462 rightCornerIcon.AccessibilityNameRequested += (s, e) =>
467 minimalizeIcon.SetAccessibilityReadingInfoTypes(Tizen.NUI.BaseComponents.AccessibilityReadingInfoTypes.Name);
468 maximalizeIcon.SetAccessibilityReadingInfoTypes(Tizen.NUI.BaseComponents.AccessibilityReadingInfoTypes.Name);
469 closeIcon.SetAccessibilityReadingInfoTypes(Tizen.NUI.BaseComponents.AccessibilityReadingInfoTypes.Name);
470 leftCornerIcon.SetAccessibilityReadingInfoTypes(Tizen.NUI.BaseComponents.AccessibilityReadingInfoTypes.Name);
471 rightCornerIcon.SetAccessibilityReadingInfoTypes(Tizen.NUI.BaseComponents.AccessibilityReadingInfoTypes.Name);
478 /// Create border UI. User can override this method to draw border UI.
479 /// A top border and a bottom border are added to this view.
481 /// <param name="borderView">The root view on which the border.</param>
482 [EditorBrowsable(EditorBrowsableState.Never)]
483 public virtual void CreateBorderView(View borderView)
485 if (borderView == null)
490 if (string.IsNullOrEmpty(borderView.BackgroundImage))
492 borderView.BackgroundColor = DefaultBackgroundColor;
494 borderView.BorderlineColor = new Color(0.5f, 0.5f, 0.5f, 0.3f);
495 borderView.BorderlineWidth = 1.0f;
496 borderView.BorderlineOffset = -1f;
497 borderView.CornerRadius = new Vector4(0.03f, 0.03f, 0.03f, 0.03f);
498 borderView.CornerRadiusPolicy = VisualTransformPolicyType.Relative;
500 // Register touch event for effect when border is touched.
501 borderView.LeaveRequired = true;
502 borderView.TouchEvent += OnBorderViewTouched;
503 this.borderView = borderView;
506 private bool OnBorderViewTouched(object sender, View.TouchEventArgs e)
508 if (string.IsNullOrEmpty(borderView.BackgroundImage))
510 if (e.Touch.GetState(0) == PointStateType.Started)
512 backgroundColor = new Color(borderView.BackgroundColor);
513 borderView.BackgroundColor = DefaultClickedBackgroundColor;
515 else if (e.Touch.GetState(0) == PointStateType.Finished ||
516 e.Touch.GetState(0) == PointStateType.Leave ||
517 e.Touch.GetState(0) == PointStateType.Interrupted)
519 borderView.BackgroundColor = backgroundColor;
525 /// Determines the behavior of pinch gesture.
526 private void OnPinchGestureDetected(object source, PinchGestureDetector.DetectedEventArgs e)
532 if (e.PinchGesture.State == Gesture.StateType.Started)
534 preScale = e.PinchGesture.Scale;
536 else if (e.PinchGesture.State == Gesture.StateType.Finished || e.PinchGesture.State == Gesture.StateType.Cancelled)
538 if (preScale > e.PinchGesture.Scale)
540 if (BorderWindow.IsMaximized())
542 BorderWindow.Maximize(false);
546 BorderWindow.Minimize(true);
552 BorderWindow.Maximize(true);
557 /// Determines the behavior of borders.
558 private void OnPanGestureDetected(object source, PanGestureDetector.DetectedEventArgs e)
564 PanGesture panGesture = e.PanGesture;
566 if (panGesture.State == Gesture.StateType.Started && panGesture.Position != null)
568 direction = BorderWindow.GetDirection(panGesture.Position.X, panGesture.Position.Y);
570 if (direction == Window.BorderDirection.Move)
572 if (BorderWindow.IsMaximized() == true)
574 BorderWindow.Maximize(false);
579 BorderWindow.RequestMoveToServer();
582 else if (direction != Window.BorderDirection.None && ResizePolicy != Window.BorderResizePolicyType.Fixed)
585 BorderWindow.RequestResizeToServer((Window.ResizeDirection)direction);
588 else if (panGesture.State == Gesture.StateType.Finished || panGesture.State == Gesture.StateType.Cancelled)
590 direction = Window.BorderDirection.None;
595 /// This is an event callback when the left top corner icon is touched.
597 [EditorBrowsable(EditorBrowsableState.Never)]
598 public virtual bool OnLeftTopCornerIconTouched(object sender, View.TouchEventArgs e)
600 SetDispatchParentGestureEvents(sender as View, false);
601 if (e != null && e.Touch.GetState(0) == PointStateType.Down)
603 if (ResizePolicy != Window.BorderResizePolicyType.Fixed)
606 BorderWindow.RequestResizeToServer(Window.ResizeDirection.TopLeft);
613 ///This is an event callback when the right bottom corner icon is touched.
615 [EditorBrowsable(EditorBrowsableState.Never)]
616 public virtual bool OnRightTopCornerIconTouched(object sender, View.TouchEventArgs e)
618 SetDispatchParentGestureEvents(sender as View, false);
619 if (e != null && e.Touch.GetState(0) == PointStateType.Down)
621 if (ResizePolicy != Window.BorderResizePolicyType.Fixed)
624 BorderWindow.RequestResizeToServer(Window.ResizeDirection.TopRight);
632 /// This is an event callback when the left bottom corner icon is touched.
634 [EditorBrowsable(EditorBrowsableState.Never)]
635 public virtual bool OnLeftBottomCornerIconTouched(object sender, View.TouchEventArgs e)
637 SetDispatchParentGestureEvents(sender as View, false);
638 if (e != null && e.Touch.GetState(0) == PointStateType.Down)
640 if (ResizePolicy != Window.BorderResizePolicyType.Fixed)
643 BorderWindow.RequestResizeToServer(Window.ResizeDirection.BottomLeft);
650 ///This is an event callback when the right bottom corner icon is touched.
652 [EditorBrowsable(EditorBrowsableState.Never)]
653 public virtual bool OnRightBottomCornerIconTouched(object sender, View.TouchEventArgs e)
655 SetDispatchParentGestureEvents(sender as View, false);
656 if (e != null && e.Touch.GetState(0) == PointStateType.Down)
658 if (ResizePolicy != Window.BorderResizePolicyType.Fixed)
661 BorderWindow.RequestResizeToServer(Window.ResizeDirection.BottomRight);
669 /// Minimize border window.
671 [EditorBrowsable(EditorBrowsableState.Never)]
672 protected void MinimizeBorderWindow()
674 BorderWindow.Minimize(true);
679 /// This is an event callback when the minimize icon is touched.
681 [EditorBrowsable(EditorBrowsableState.Never)]
682 public virtual bool OnMinimizeIconTouched(object sender, View.TouchEventArgs e)
684 SetDispatchParentGestureEvents(sender as View, false);
685 if (e != null && e.Touch.GetState(0) == PointStateType.Up)
687 MinimizeBorderWindow();
693 /// Maximize border window.
695 [EditorBrowsable(EditorBrowsableState.Never)]
696 protected void MaximizeBorderWindow()
698 if (BorderWindow.IsMaximized())
700 BorderWindow.Maximize(false);
704 BorderWindow.Maximize(true);
709 /// This is an event callback when the maximum icon is touched.
711 [EditorBrowsable(EditorBrowsableState.Never)]
712 public virtual bool OnMaximizeIconTouched(object sender, View.TouchEventArgs e)
714 SetDispatchParentGestureEvents(sender as View, false);
715 if (e != null && e.Touch.GetState(0) == PointStateType.Up)
717 MaximizeBorderWindow();
723 /// Close border window.
725 [EditorBrowsable(EditorBrowsableState.Never)]
726 protected void CloseBorderWindow()
728 BorderWindow.BorderDestroy();
732 /// This is an event callback when the close icon is touched.
734 [EditorBrowsable(EditorBrowsableState.Never)]
735 public virtual bool OnCloseIconTouched(object sender, View.TouchEventArgs e)
737 SetDispatchParentGestureEvents(sender as View, false);
738 if (e != null && e.Touch.GetState(0) == PointStateType.Up)
745 private void SetDispatchParentGestureEvents(View view, bool dispatch)
749 // If this is set, my parents will not receive gesture events.
750 // This is to prevent the move action by PanGesture when the icon is touched.
751 view.DispatchParentGestureEvents = dispatch;
756 private void UpdateIcons()
758 if (BorderWindow != null && borderView != null)
760 if (BorderWindow.IsMaximized() == true)
762 if (maximalizeIcon != null)
764 maximalizeIcon.ResourceUrl = DarkPreviousIcon;
766 if (minimalizeIcon != null)
768 minimalizeIcon.ResourceUrl = DarkMinimalizeIcon;
770 if (closeIcon != null)
772 closeIcon.ResourceUrl = DarkCloseIcon;
774 if (leftCornerIcon != null)
776 leftCornerIcon.ResourceUrl = DarkLeftCornerIcon;
778 if (rightCornerIcon != null)
780 rightCornerIcon.ResourceUrl = DarkRightCornerIcon;
782 borderView.CornerRadius = new Vector4(0, 0, 0, 0);
783 borderView.CornerRadiusPolicy = VisualTransformPolicyType.Relative;
787 if (maximalizeIcon != null)
789 maximalizeIcon.ResourceUrl = MaximalizeIcon;
791 if (minimalizeIcon != null)
793 minimalizeIcon.ResourceUrl = MinimalizeIcon;
795 if (closeIcon != null)
797 closeIcon.ResourceUrl = CloseIcon;
799 if (leftCornerIcon != null)
801 leftCornerIcon.ResourceUrl = LeftCornerIcon;
803 if (rightCornerIcon != null)
805 rightCornerIcon.ResourceUrl = RightCornerIcon;
807 borderView.CornerRadius = new Vector4(0.03f, 0.03f, 0.03f, 0.03f);
808 borderView.CornerRadiusPolicy = VisualTransformPolicyType.Relative;
814 /// Called after the border UI is created.
816 /// <param name="borderView">The border view on which the border.</param>
817 [EditorBrowsable(EditorBrowsableState.Never)]
818 public virtual void OnCreated(View borderView)
820 if (borderView == null)
824 this.borderView = borderView;
826 BorderWindow.BackgroundColor = Color.Transparent;
828 // Register to resize and move through pan gestures.
829 borderPanGestureDetector = new PanGestureDetector();
830 borderPanGestureDetector.Attach(borderView);
831 borderPanGestureDetector.Detected += OnPanGestureDetected;
837 /// Called when requesting a resize
839 [EditorBrowsable(EditorBrowsableState.Never)]
840 public virtual void OnRequestResize() {}
843 /// Called when the window is resized.
845 /// <param name="width">The width of the resized window</param>
846 /// <param name="height">The height of the resized window</param>
847 [EditorBrowsable(EditorBrowsableState.Never)]
848 public virtual void OnResized(int width, int height)
850 if (overlayTimer != null)
853 overlayTimer.Dispose();
860 /// Called when requesting a move
862 [EditorBrowsable(EditorBrowsableState.Never)]
863 public virtual void OnRequestMove() {}
866 /// Called when the window is moved.
868 /// <param name="x">The x of the moved window</param>
869 /// <param name="y">The y of the moved window</param>
870 [EditorBrowsable(EditorBrowsableState.Never)]
871 public virtual void OnMoved(int x, int y) {}
874 /// Called when window has been moved the display server.
876 /// <param name="x">The x of the has been moved window</param>
877 /// <param name="y">The y of the has been moved window</param>
878 [EditorBrowsable(EditorBrowsableState.Never)]
879 public virtual void OnMoveCompleted(int x, int y) {}
882 /// Called when window has been resized the display server.
884 /// <param name="width">The width of the resized window</param>
885 /// <param name="height">The height of the resized window</param>
886 [EditorBrowsable(EditorBrowsableState.Never)]
887 public virtual void OnResizeCompleted(int width, int height) {}
890 /// Called when the window is maximized.
892 /// <param name="isMaximized">If window is maximized or unmaximized.</param>
893 [EditorBrowsable(EditorBrowsableState.Never)]
894 public virtual void OnMaximize(bool isMaximized)
896 Tizen.Log.Info("NUI", $"OnMaximize {isMaximized}\n");
897 if (BorderWindow.IsMaximized() == true)
899 BorderWindow.SetTransparency(false);
903 BorderWindow.SetTransparency(true);
909 /// Called when the window is minimized.
911 /// <param name="isMinimized">If window is mnimized or unminimized.</param>
912 [EditorBrowsable(EditorBrowsableState.Never)]
913 public virtual void OnMinimize(bool isMinimized)
919 /// Called when there is a change in overlay mode.
921 /// <param name="enabled">If true, borderView has entered overlayMode.</param>
922 [EditorBrowsable(EditorBrowsableState.Never)]
923 public virtual void OnOverlayMode(bool enabled)
925 if (borderView != null && OverlayMode == true)
927 Tizen.Log.Info("NUI", $"OnOverlayMode {enabled}\n");
930 backgroundColor = new Color(borderView.BackgroundColor);
931 if (string.IsNullOrEmpty(borderView.BackgroundImage))
933 borderView.BackgroundColor = Color.Transparent;
939 if (string.IsNullOrEmpty(borderView.BackgroundImage))
941 borderView.BackgroundColor = backgroundColor;
949 /// Show the border when OverlayMode is true and the window is now Maximize.
951 /// <param name="time">Time(ms) for borders to disappear again</param>
952 /// <returns>True if border became show, false otherwise</returns>
953 [EditorBrowsable(EditorBrowsableState.Never)]
954 public virtual bool OverlayBorderShow(uint time = 3000)
956 if (BorderWindow != null && BorderWindow.IsMaximized())
958 if (overlayTimer == null)
960 overlayTimer = new Timer(time);
961 overlayTimer.Tick += (s, e) =>
964 overlayTimer?.Stop();
965 overlayTimer?.Dispose();
969 overlayTimer.Start();
974 overlayTimer.Start();
982 /// Hide the border when OverlayMode is true and the window is now Maximize.
984 /// <returns>True if border became hide, false otherwise</returns>
985 [EditorBrowsable(EditorBrowsableState.Never)]
986 public virtual bool OverlayBorderHide()
988 if (BorderWindow != null && BorderWindow.IsMaximized())
991 overlayTimer?.Stop();
992 overlayTimer?.Dispose();
999 [EditorBrowsable(EditorBrowsableState.Never)]
1000 public void Dispose()
1003 global::System.GC.SuppressFinalize(this);
1006 protected virtual void Dispose(bool disposing)
1015 borderView?.Dispose();
1016 windowView?.Dispose();
1017 borderPanGestureDetector?.Dispose();
1018 backgroundColor?.Dispose();
1019 minimalizeIcon?.Dispose();
1020 maximalizeIcon?.Dispose();
1021 closeIcon?.Dispose();
1022 leftCornerIcon?.Dispose();
1023 rightCornerIcon?.Dispose();
1024 overlayTimer?.Dispose();
1029 #endregion //Methods