コード例 #1
0
ファイル: DefaultBorder.cs プロジェクト: lol-github/TizenFX
 /// Determines the behavior of pinch gesture.
 private void OnPinchGestureDetected(object source, PinchGestureDetector.DetectedEventArgs e)
 {
     if (e == null)
     {
         return;
     }
     if (e.PinchGesture.State == Gesture.StateType.Started)
     {
         preScale = e.PinchGesture.Scale;
     }
     else if (e.PinchGesture.State == Gesture.StateType.Finished || e.PinchGesture.State == Gesture.StateType.Cancelled)
     {
         if (preScale > e.PinchGesture.Scale)
         {
             if (BorderWindow.IsMaximized())
             {
                 BorderWindow.Maximize(false);
             }
             else
             {
                 BorderWindow.Minimize(true);
             }
         }
         else
         {
             BorderWindow.Maximize(true);
         }
     }
 }
コード例 #2
0
ファイル: DefaultBorder.cs プロジェクト: lol-github/TizenFX
        // Window moves through pan gestures.
        private void OnWinPanGestureDetected(object source, PanGestureDetector.DetectedEventArgs e)
        {
            if (currentGesture <= CurrentGesture.PanGesture /*&& panGesture.NumberOfTouches == 1*/)
            {
                PanGesture panGesture = e.PanGesture;

                if (panGesture.State == Gesture.StateType.Started)
                {
                    currentGesture = CurrentGesture.PanGesture;
                    if (BorderWindow.IsMaximized() == true)
                    {
                        BorderWindow.Maximize(false);
                    }
                    else
                    {
                        BorderWindow.RequestMoveToServer();
                    }
                }
                else if (panGesture.State == Gesture.StateType.Finished || panGesture.State == Gesture.StateType.Cancelled)
                {
                    currentGesture = CurrentGesture.None;
                    ClearWindowGesture();
                }
            }
        }
コード例 #3
0
ファイル: DefaultBorder.cs プロジェクト: wonrst/TizenFX
 public virtual bool OverlayBorderShow(uint time = 3000)
 {
     if (BorderWindow != null && BorderWindow.IsMaximized())
     {
         if (overlayTimer == null)
         {
             overlayTimer       = new Timer(time);
             overlayTimer.Tick += (s, e) =>
             {
                 BorderWindow.GetBorderWindowBottomLayer().LowerToBottom();
                 borderView?.Hide();
                 overlayTimer?.Stop();
                 overlayTimer?.Dispose();
                 overlayTimer = null;
                 return(false);
             };
             overlayTimer.Start();
             BorderWindow.GetBorderWindowBottomLayer().RaiseToTop();
             borderView?.Show();
         }
         else
         {
             overlayTimer.Start();
         }
         return(true);
     }
     return(false);
 }
コード例 #4
0
ファイル: DefaultBorder.cs プロジェクト: lol-github/TizenFX
 private void UpdateIcons()
 {
     if (BorderWindow != null && rootView != null)
     {
         if (BorderWindow.IsMaximized() == true)
         {
             if (maximalizeIcon != null)
             {
                 maximalizeIcon.ResourceUrl = DarkPreviousIcon;
             }
             if (minimalizeIcon != null)
             {
                 minimalizeIcon.ResourceUrl = DarkMinimalizeIcon;
             }
             if (closeIcon != null)
             {
                 closeIcon.ResourceUrl = DarkCloseIcon;
             }
             if (leftCornerIcon != null)
             {
                 leftCornerIcon.ResourceUrl = DarkLeftCornerIcon;
             }
             if (rightCornerIcon != null)
             {
                 rightCornerIcon.ResourceUrl = DarkRightCornerIcon;
             }
             rootView.CornerRadius       = new Vector4(0, 0, 0, 0);
             rootView.CornerRadiusPolicy = VisualTransformPolicyType.Relative;
             BorderWindow.SetTransparency(false);
         }
         else
         {
             if (maximalizeIcon != null)
             {
                 maximalizeIcon.ResourceUrl = MaximalizeIcon;
             }
             if (minimalizeIcon != null)
             {
                 minimalizeIcon.ResourceUrl = MinimalizeIcon;
             }
             if (closeIcon != null)
             {
                 closeIcon.ResourceUrl = CloseIcon;
             }
             if (leftCornerIcon != null)
             {
                 leftCornerIcon.ResourceUrl = LeftCornerIcon;
             }
             if (rightCornerIcon != null)
             {
                 rightCornerIcon.ResourceUrl = RightCornerIcon;
             }
             rootView.CornerRadius       = new Vector4(0.03f, 0.03f, 0.03f, 0.03f);
             rootView.CornerRadiusPolicy = VisualTransformPolicyType.Relative;
             BorderWindow.SetTransparency(true);
         }
     }
 }
コード例 #5
0
ファイル: DefaultBorder.cs プロジェクト: wonrst/TizenFX
 public virtual bool OverlayBorderHide()
 {
     if (BorderWindow != null && BorderWindow.IsMaximized())
     {
         borderView?.Hide();
         return(true);
     }
     return(false);
 }
コード例 #6
0
ファイル: DefaultBorder.cs プロジェクト: lol-github/TizenFX
        /// Determines the behavior of borders.
        private void OnPanGestureDetected(object source, PanGestureDetector.DetectedEventArgs e)
        {
            if (e == null)
            {
                return;
            }
            PanGesture panGesture = e.PanGesture;

            if (panGesture.State == Gesture.StateType.Started && panGesture.Position != null)
            {
                direction = BorderWindow.GetDirection(panGesture.Position.X, panGesture.Position.Y);
                if (direction == Window.BorderDirection.Move)
                {
                    if (BorderWindow.IsMaximized() == true)
                    {
                        BorderWindow.Maximize(false);
                    }
                    else
                    {
                        BorderWindow.RequestMoveToServer();
                    }
                }
                else if (direction != Window.BorderDirection.None)
                {
                    OnRequestResize();
                    BorderWindow.RequestResizeToServer((Window.ResizeDirection)direction);
                }
            }
            else if (panGesture.State == Gesture.StateType.Continuing)
            {
                if (direction == Window.BorderDirection.BottomLeft || direction == Window.BorderDirection.BottomRight || direction == Window.BorderDirection.TopLeft || direction == Window.BorderDirection.TopRight)
                {
                    BorderWindow.WindowSize += new Size2D((int)panGesture.ScreenDisplacement.X, (int)panGesture.ScreenDisplacement.Y);
                }
                else if (direction == Window.BorderDirection.Left || direction == Window.BorderDirection.Right)
                {
                    BorderWindow.WindowSize += new Size2D((int)panGesture.ScreenDisplacement.X, 0);
                }
                else if (direction == Window.BorderDirection.Bottom || direction == Window.BorderDirection.Top)
                {
                    BorderWindow.WindowSize += new Size2D(0, (int)panGesture.ScreenDisplacement.Y);
                }
                else if (direction == Window.BorderDirection.Move)
                {
                    BorderWindow.WindowPosition += new Position2D((int)panGesture.ScreenDisplacement.X, (int)panGesture.ScreenDisplacement.Y);
                }
            }
            else if (panGesture.State == Gesture.StateType.Finished || panGesture.State == Gesture.StateType.Cancelled)
            {
                direction = Window.BorderDirection.None;
                ClearWindowGesture();
            }
        }
コード例 #7
0
ファイル: BorderWindowTest.cs プロジェクト: wonrst/TizenFX
 public override bool OnMinimizeIconTouched(object sender, View.TouchEventArgs e)
 {
     if (e.Touch.GetState(0) == PointStateType.Up)
     {
         if (BorderWindow.IsMaximized() == true)
         {
             BorderWindow.Maximize(false);
         }
         preWinPositonSize = BorderWindow.WindowPositionSize;
         BorderWindow.WindowPositionSize = new Rectangle(preWinPositonSize.X, preWinPositonSize.Y, 500, 0);
     }
     return(true);
 }
コード例 #8
0
ファイル: DefaultBorder.cs プロジェクト: wonrst/TizenFX
 protected void MaximizeBorderWindow()
 {
     ClearWindowGesture();
     if (BorderWindow.IsMaximized())
     {
         BorderWindow.Maximize(false);
         OnMaximize(false);
     }
     else
     {
         BorderWindow.Maximize(true);
         OnMaximize(true);
     }
 }
コード例 #9
0
ファイル: DefaultBorder.cs プロジェクト: wonrst/TizenFX
        public virtual void OnCreated(View borderView)
        {
            if (borderView == null)
            {
                return;
            }
            this.borderView = borderView;
            // Register to resize and move through pan gestures.
            borderPanGestureDetector = new PanGestureDetector();
            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;

            AddInterceptGesture();

            UpdateIcons();
        }
コード例 #10
0
ファイル: BorderWindowTest.cs プロジェクト: wonrst/TizenFX
 private void UpdateIcons()
 {
     if (BorderWindow != null && borderView != null)
     {
         if (BorderWindow.IsMaximized() == true)
         {
             if (maximalizeIcon != null)
             {
                 maximalizeIcon.ResourceUrl = RestoreIcon;
             }
         }
         else
         {
             if (maximalizeIcon != null)
             {
                 maximalizeIcon.ResourceUrl = MaximalizeIcon;
             }
         }
     }
 }
コード例 #11
0
ファイル: DefaultBorder.cs プロジェクト: lol-github/TizenFX
 public virtual bool OnMaximizeIconTouched(object sender, View.TouchEventArgs e)
 {
     if (e == null)
     {
         return(false);
     }
     if (e.Touch.GetState(0) == PointStateType.Up)
     {
         ClearWindowGesture();
         if (BorderWindow.IsMaximized())
         {
             BorderWindow.Maximize(false);
         }
         else
         {
             BorderWindow.Maximize(true);
         }
     }
     return(true);
 }
コード例 #12
0
ファイル: DefaultBorder.cs プロジェクト: lol-github/TizenFX
 // Behavior when the window is tapped.
 private void OnWinTapGestureDetected(object source, TapGestureDetector.DetectedEventArgs e)
 {
     if (currentGesture <= CurrentGesture.TapGesture)
     {
         currentGesture = CurrentGesture.TapGesture;
         if (e.TapGesture.NumberOfTaps == 2)
         {
             if (BorderWindow.IsMaximized() == false)
             {
                 BorderWindow.Maximize(true);
             }
             else
             {
                 BorderWindow.Maximize(false);
             }
         }
         else
         {
             ClearWindowGesture();
         }
     }
 }
コード例 #13
0
ファイル: DefaultBorder.cs プロジェクト: wonrst/TizenFX
        /// Determines the behavior of borders.
        private void OnPanGestureDetected(object source, PanGestureDetector.DetectedEventArgs e)
        {
            if (e == null)
            {
                return;
            }
            PanGesture panGesture = e.PanGesture;

            if (panGesture.State == Gesture.StateType.Started && panGesture.Position != null)
            {
                direction = BorderWindow.GetDirection(panGesture.Position.X, panGesture.Position.Y);

                if (direction == Window.BorderDirection.Move)
                {
                    if (BorderWindow.IsMaximized() == true)
                    {
                        BorderWindow.Maximize(false);
                        OnMaximize(false);
                    }
                    else
                    {
                        BorderWindow.RequestMoveToServer();
                    }
                }
                else if (direction != Window.BorderDirection.None && ResizePolicy != Window.BorderResizePolicyType.Fixed)
                {
                    OnRequestResize();
                    BorderWindow.RequestResizeToServer((Window.ResizeDirection)direction);
                }
            }
            else if (panGesture.State == Gesture.StateType.Finished || panGesture.State == Gesture.StateType.Cancelled)
            {
                direction = Window.BorderDirection.None;
                ClearWindowGesture();
            }
        }