private Layer borderWindowBottomLayer = null;
private bool isBorderWindow = false;
- private Color overlayBackgroundColor;
-
// for border area
private View rootView = null;
- private View borderView = null;
+ private BorderView borderView = null;
private View topView = null;
private View contentsView = null;
private View bottomView = null;
// Add a view to the border layer.
GetBorderWindowBottomLayer().Add(rootView);
- InterceptTouchEvent += (s, e) =>
- {
- if (e.Touch.GetState(0) == PointStateType.Down && IsMaximized() == false)
- {
- Raise();
- }
- return false;
- };
+ FocusChanged += OnWindowFocusChanged;
return true;
}
}
}
+ private void OnWindowFocusChanged(object sender, Window.FocusChangedEventArgs e)
+ {
+ if (e.FocusGained == true && IsMaximized() == false)
+ {
+ // Raises the window when the window is focused.
+ Raise();
+ }
+ }
+
/// Create the border UI.
private bool CreateBorder()
{
};
ushort padding = (ushort) borderInterface.BorderLineThickness;
- borderView = new View()
+ borderView = new BorderView()
{
GrabTouchAfterLeave = true,
WidthResizePolicy = ResizePolicyType.FillToParent,
return direction;
}
- private void OverlayMode(bool enable)
+ private void DoOverlayMode(bool enable)
{
if (borderInterface.OverlayMode == true)
{
+ borderInterface.OnOverlayMode(enable);
+ borderView?.OverlayMode(enable);
if (enable == true)
{
- if (borderView != null)
- {
- overlayBackgroundColor = new Color(borderView.BackgroundColor);
- borderView.BackgroundColor = Color.Transparent;
- borderView.Hide();
- }
+ GetBorderWindowBottomLayer().RaiseToTop();
}
else
{
GetBorderWindowBottomLayer().LowerToBottom();
- if (borderView != null)
- {
- borderView.BackgroundColor = overlayBackgroundColor;
- borderView.Show();
- }
}
}
}
{
contentsView.SizeHeight = resizeHeight - borderHeight - borderInterface.BorderLineThickness * 2;
}
- OverlayMode(true);
+ DoOverlayMode(true);
}
else
{
{
contentsView.SizeHeight = resizeHeight;
}
- OverlayMode(false);
+ DoOverlayMode(false);
}
if (NDalicPINVOKE.SWIGPendingException.Pending) { throw NDalicPINVOKE.SWIGPendingException.Retrieve(); }
internal void DisposeBorder()
{
Resized -= OnBorderWindowResized;
- if (borderInterface.OverlayMode == true)
- {
- OverlayMode(false);
- }
borderInterface.Dispose();
GetBorderWindowBottomLayer().Dispose();
}
#endregion //Structs
#region Classes
+ // View class for border view.
+ private class BorderView : View
+ {
+ private bool overlayEnabled = false;
+
+ /// <summary>
+ /// Set whether or not it is in overlay mode.
+ /// The borderView's OverlayMode means that it is displayed at the top of the screen.
+ /// In this case, the borderView should pass the event so that lower layers can receive the event.
+ /// </summary>
+ /// <param name="enabled">The true if borderView is Overlay mode. false otherwise.</param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void OverlayMode(bool enabled)
+ {
+ overlayEnabled = enabled;
+ }
+
+ protected override bool HitTest(Touch touch)
+ {
+ // If borderView is in overlay mode, pass the hittest.
+ if (overlayEnabled == true)
+ {
+ return false;
+ }
+ return true;
+ }
+ }
#endregion //Classes
}
-
-
-
}
private const float DefaultHeight = 50;
private const uint DefaultLineThickness = 5;
- private const uint DefaultTouchThickness = 20;
+ private const uint DefaultTouchThickness = 0;
private static readonly Color DefaultBackgroundColor = new Color(1, 1, 1, 0.3f);
private static readonly Color DefaultClickedBackgroundColor = new Color(1, 1, 1, 0.4f);
private static readonly Size2D DefaultMinSize = new Size2D(100, 0);
{
return;
}
- this.borderView = borderView;
borderView.BackgroundColor = DefaultBackgroundColor;
+ borderView.BorderlineColor = new Color(0.5f, 0.5f, 0.5f, 0.3f);
+ borderView.BorderlineWidth = 1.0f;
+ borderView.BorderlineOffset = -1f;
borderView.CornerRadius = new Vector4(0.03f, 0.03f, 0.03f, 0.03f);
borderView.CornerRadiusPolicy = VisualTransformPolicyType.Relative;
+
+ // Register touch event for effect when border is touched.
+ borderView.LeaveRequired = true;
+ borderView.TouchEvent += OnBorderViewTouched;
+ this.borderView = borderView;
+ }
+
+ private bool OnBorderViewTouched(object sender, View.TouchEventArgs e)
+ {
+ if (e.Touch.GetState(0) == PointStateType.Started)
+ {
+ backgroundColor = new Color(borderView.BackgroundColor);
+ borderView.BackgroundColor = DefaultClickedBackgroundColor;
+ }
+ else if (e.Touch.GetState(0) == PointStateType.Finished ||
+ e.Touch.GetState(0) == PointStateType.Leave ||
+ e.Touch.GetState(0) == PointStateType.Interrupted)
+ {
+ borderView.BackgroundColor = backgroundColor;
+ }
+ return true;
}
/// Determines the behavior of pinch gesture.
}
}
-
/// <summary>
/// Called after the border UI is created.
/// </summary>
borderPanGestureDetector.Attach(borderView);
borderPanGestureDetector.Detected += OnPanGestureDetected;
- // Register touch event for effect when border is touched.
- borderView.LeaveRequired = true;
- borderView.TouchEvent += (s, e) =>
- {
- if (e.Touch.GetState(0) == PointStateType.Started)
- {
- if (BorderWindow.IsMaximized() == false)
- {
- BorderWindow.Raise();
- }
- backgroundColor = new Color(borderView.BackgroundColor);
- borderView.BackgroundColor = DefaultClickedBackgroundColor;
- }
- else if (e.Touch.GetState(0) == PointStateType.Finished ||
- e.Touch.GetState(0) == PointStateType.Leave ||
- e.Touch.GetState(0) == PointStateType.Interrupted)
- {
- borderView.BackgroundColor = backgroundColor;
- }
- return true;
- };
-
borderPinchGestureDetector = new PinchGestureDetector();
borderPinchGestureDetector.Attach(borderView);
borderPinchGestureDetector.Detected += OnPinchGestureDetected;
overlayTimer.Stop();
overlayTimer.Dispose();
overlayTimer = null;
- BorderWindow?.GetBorderWindowBottomLayer().LowerToBottom();
- borderView?.Show();
}
UpdateIcons();
}
}
/// <summary>
+ /// Called when there is a change in overlay mode.
+ /// </summary>
+ /// <param name="enabled">If true, borderView has entered overlayMode.</param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual void OnOverlayMode(bool enabled)
+ {
+ if (borderView != null && OverlayMode == true)
+ {
+ if (enabled == true)
+ {
+ backgroundColor = new Color(borderView.BackgroundColor);
+ borderView.BackgroundColor = Color.Transparent;
+ borderView.Hide();
+ }
+ else
+ {
+ borderView.BackgroundColor = backgroundColor;
+ borderView.Show();
+ }
+ }
+ }
+
+ /// <summary>
/// Show the border when OverlayMode is true and the window is now Maximize.
/// </summary>
/// <param name="time">Time(ms) for borders to disappear again</param>
overlayTimer = new Timer(time);
overlayTimer.Tick += (s, e) =>
{
- BorderWindow.GetBorderWindowBottomLayer().LowerToBottom();
borderView?.Hide();
overlayTimer?.Stop();
overlayTimer?.Dispose();
return false;
};
overlayTimer.Start();
- BorderWindow.GetBorderWindowBottomLayer().RaiseToTop();
borderView?.Show();
}
else