Example #1
0
 /// <summary> Try focuse control </summary>
 public void Focus()
 {
     if (OwnerFrame != null)
     {
         OwnerFrame.FocusControl(this);
     }
 }
Example #2
0
        /// <summary>
        /// This method refreshes caption of the Visual Studio editor.
        /// Used during initialization and after object is saved.
        /// </summary>
        protected void RefreshCaption()
        {
            Debug.Assert(OwnerFrame != null, "Frame is not initialized!");
            if (OwnerFrame == null)
            {
                return;
            }

            // Extract current caption first
            object result;

            // Extract owner caption
            result = null;
            OwnerFrame.GetProperty((int)__VSFPROPID.VSFPROPID_OwnerCaption, out result);
            string ownerCaption = result is string?result as string : String.Empty;

            // Extract editor caption
            result = null;
            OwnerFrame.GetProperty((int)__VSFPROPID.VSFPROPID_EditorCaption, out result);
            string editorCaption = result is string?result as string : String.Empty;

            // Change frame caption if should be changed
            if (!StringComparer.CurrentCulture.Equals(ownerCaption, OwnerCaption))
            {
                OwnerFrame.SetProperty((int)__VSFPROPID.VSFPROPID_OwnerCaption, OwnerCaption);
            }
            if (!StringComparer.CurrentCulture.Equals(editorCaption, EditorCaption))
            {
                OwnerFrame.SetProperty((int)__VSFPROPID.VSFPROPID_EditorCaption, EditorCaption);
            }
        }
Example #3
0
 /// <summary>
 /// MouseDownEvent
 /// </summary>
 /// <param name="args">args</param>
 protected override void MouseDownEvent(MouseClickEventArgs args)
 {
     if (args.Button == MouseButton.Left)
     {
         Frame of = OwnerFrame;
         if (of != null)
         {
             _IsMouseDown    = OwnerFrame.RegisterPrecedenceEvent(this);
             _StartSelection = _EndSelection = args.MousePosition;
             _DeltaSelection = Vector2.zero;
             _Shift          = args.Shift;
             _KeepKeysSelected.Clear();
             if (!_Shift)
             {
                 _Selection.Clear();
             }
             else
             {
                 foreach (var ki in _Selection)
                 {
                     _KeepKeysSelected.Add(ki);
                 }
             }
             args.Handled = true;
         }
     }
     base.MouseDownEvent(args);
 }
Example #4
0
 /// <summary> Try focuse control </summary>
 public void Focus()
 {
     if (_IsFocusable && OwnerFrame != null)
     {
         OwnerFrame.FocusControl(this);
     }
 }
Example #5
0
 /// <summary>
 /// HandleEvent event
 /// </summary>
 /// <param name="e">event to handle</param>
 public override void HandleEvent(Event e)
 {
     if (IsInScrollView && !IsHandlingEventInternal)
     {
         return;
     }
     if (e != null && e.type != EventType.Used)
     {
         for (int i = Controls.Count - 1; i >= 0; i--)
         {
             var c = Controls[i];
             if (c != null)
             {
                 if (OwnerFrame != null && OwnerFrame.IsPrecedenceEvent(c))
                 {
                     continue;
                 }
                 if (c.Visibility == UI.Visibility.Visible)
                 {
                     c.HandleEvent(e);
                 }
                 if (e.type == EventType.Used)
                 {
                     break;
                 }
             }
         }
         BaseHandleEvent(e);
     }
 }
Example #6
0
        /// <summary>
        /// Occurs when mouse button was pressed.(if WantsMouseEvents = true)
        /// </summary>
        /// <param name="args"> MouseClickEventArgs </param>
        protected override void MouseDownEvent(MouseClickEventArgs args)
        {
            if (args.Button == MouseButton.Left)
            {
                _IsMouseDown = OwnerFrame.RegisterPrecedenceEvent(this);
                args.Handled = true;
            }

            base.MouseDownEvent(args);
        }
Example #7
0
        /// <summary>
        /// MouseDownEvent
        /// </summary>
        /// <param name="args">args</param>
        protected override void MouseDownEvent(MouseClickEventArgs args)
        {
            if (args.Button == MouseButton.Left)
            {
                if (Contains(args.MousePosition))
                {
                    if (OwnerFrame.RegisterPrecedenceEvent(this))
                    {
                        _MouseButton = MouseButton.Left;
                    }
                    TimeLine.TimePosition = GetTime(args.MousePosition.x);
                    args.Handled          = true;
                }
                else
                {
                    if (_MouseButton != MouseButton.None)
                    {
                        OwnerFrame.UnregisterPrecedenceEvent(this);
                    }
                    _MouseButton = MouseButton.None;
                }
            }
            else if (args.Button == MouseButton.Right)
            {
                if (Contains(args.MousePosition))
                {
                    double time = GetTime(args.MousePosition.x);
                    if (args.Shift && TimeLine.SelectionLenght > 0)
                    {
                        AddTime(time);
                    }
                    else
                    {
                        _StartSelectionTime = time;
                        TimeLine.SelectTime(time, time);
                    }
                    if (OwnerFrame.RegisterPrecedenceEvent(this))
                    {
                        _MouseButton = MouseButton.Right;
                    }
                    args.Handled = true;
                }
                else
                {
                    if (_MouseButton != MouseButton.None)
                    {
                        OwnerFrame.UnregisterPrecedenceEvent(this);
                    }
                    _MouseButton = MouseButton.None;
                }
            }

            base.MouseDownEvent(args);
        }
Example #8
0
 /// <summary>
 /// Occurs when mouse button was released.(if WantsMouseEvents = true)
 /// </summary>
 /// <param name="args"> MouseClickEventArgs </param>
 protected override void MouseUpEvent(MouseClickEventArgs args)
 {
     if (args.Button == MouseButton.Left)
     {
         if (_IsMouseDown)
         {
             OwnerFrame.UnregisterPrecedenceEvent(this);
         }
         _IsMouseDown = false;
         args.Handled = true;
     }
     base.MouseUpEvent(args);
 }
Example #9
0
 /// <summary>
 /// Occurs when mouse button was released.(if WantsMouseEvents = true)
 /// </summary>
 /// <param name="args"> MouseClickEventArgs </param>
 protected override void MouseUpEvent(MouseClickEventArgs args)
 {
     if (args.Button == _MouseButton)
     {
         if (_MouseButton != MouseButton.None)
         {
             OwnerFrame.UnregisterPrecedenceEvent(this);
         }
         _MouseButton = MouseButton.None;
         args.Handled = true;
     }
     base.MouseUpEvent(args);
 }
Example #10
0
 /// <summary>
 /// MouseDownEvent
 /// </summary>
 /// <param name="args">args</param>
 protected override void MouseDownEvent(MouseClickEventArgs args)
 {
     if (_MouseButton == -1 && Parent != null && (args.Button == MouseButton.Middle || (args.Button == MouseButton.Right && args.Alt)))
     {
         Frame of = OwnerFrame;
         if (of != null)
         {
             _IsMouseDown = OwnerFrame.RegisterPrecedenceEvent(this);
             args.Handled = true;
         }
         _MouseButton = args.Button == MouseButton.Right ? 1 : 2;
     }
     base.MouseDownEvent(args);
 }
Example #11
0
 protected override void MouseDownEvent(MouseClickEventArgs args)
 {
     if (Parent != null && args.Button == MouseButton.Left)
     {
         Frame of = OwnerFrame;
         if (of != null)
         {
             _IsMouseDown   = OwnerFrame.RegisterPrecedenceEvent(this);
             _StartPosition = _EndPosition = args.MousePosition;
             _DeltaDrag     = Vector2.zero;
             args.Handled   = true;
         }
     }
     base.MouseDownEvent(args);
 }
Example #12
0
 public override void HandleEvent(Event e)
 {
     if (e != null && e.type != EventType.Used)
     {
         if (_MouseButton != MouseButton.None)
         {
             EventType type = e.type;
             if (type == EventType.MouseDrag)
             {
                 MouseButton        mb   = ConvertButton(e.button);
                 MouseMoveEventArgs args = new MouseMoveEventArgs(e.mousePosition, e.modifiers, mb, e.delta);
                 MouseDragEvent(args);
                 if (args.Handled)
                 {
                     e.Use();
                 }
             }
             else if (type == EventType.mouseDown)
             {
                 if (!Contains(e.mousePosition))
                 {
                     OwnerFrame.UnregisterPrecedenceEvent(this);
                     _MouseButton = MouseButton.None;
                 }
             }
             else if (type == EventType.MouseUp || e.rawType == EventType.MouseUp)
             {
                 MouseButton         mb   = ConvertButton(e.button);
                 MouseClickEventArgs args = new MouseClickEventArgs(e.mousePosition, e.modifiers, mb, e.clickCount);
                 MouseUpEvent(args);
                 if (args.Handled)
                 {
                     e.Use();
                 }
             }
             else
             {
                 base.HandleEvent(e);
             }
         }
         else
         {
             base.HandleEvent(e);
         }
     }
 }
Example #13
0
 public bool BeginConnectionDetect(BaseControl startConnector)
 {
     if (InteractiveCreateConnection && !_IsDetecting)
     {
         Frame of = OwnerFrame;
         if (of != null)
         {
             _IsDetecting = OwnerFrame.RegisterPrecedenceEvent(this);
         }
         if (_IsDetecting)
         {
             _StartControl = startConnector;
             this._EndPreviewConnection = startConnector.RenderArea.center;
         }
         return(true);
     }
     return(false);
 }
Example #14
0
 internal bool BeginConnectionDetect(Connector startConnector)
 {
     if (InteractiveCreateConnection && !_IsDetecting)
     {
         Frame of = OwnerFrame;
         if (of != null)
         {
             _IsDetecting = OwnerFrame.RegisterPrecedenceEvent(this);
         }
         if (_IsDetecting)
         {
             _StartConnector           = startConnector;
             this._EndPreviewConnector = startConnector.ConnectionPoint;
         }
         return(true);
     }
     return(false);
 }
Example #15
0
 public override void HandleEvent(Event e)
 {
     if (!IsEnabled)
     {
         return;
     }
     if (e != null && e.type != EventType.Used)
     {
         if (_IsMouseDown)
         {
             EventType type = e.type;
             if (type == EventType.MouseDrag)
             {
                 MouseButton        mb   = ConvertButton(e.button);
                 MouseMoveEventArgs args = new MouseMoveEventArgs(e.mousePosition, e.modifiers, mb, e.delta);
                 MouseDragEvent(args);
                 if (args.Handled)
                 {
                     e.Use();
                 }
             }
             else if (type == EventType.mouseDown)
             {
                 if (!Contains(e.mousePosition))
                 {
                     if (_IsMouseDown)
                     {
                         OwnerFrame.UnregisterPrecedenceEvent(this);
                     }
                     _IsMouseDown = false;
                 }
             }
             else if (type == EventType.MouseUp || e.rawType == EventType.MouseUp)
             {
                 MouseButton         mb   = ConvertButton(e.button);
                 MouseClickEventArgs args = new MouseClickEventArgs(e.mousePosition, e.modifiers, mb, e.clickCount);
                 MouseUpEvent(args);
                 if (args.Handled)
                 {
                     e.Use();
                 }
             }
             else
             {
                 base.HandleEvent(e);
             }
         }
         else
         {
             if (WantsMouseEvents)
             {
                 if (e.isMouse)
                 {
                     EventType type       = e.type;
                     Vector2   localMouse = e.mousePosition;
                     if (_RenderAreaWidthOverFlow.Contains(localMouse))
                     {
                         if (type == EventType.MouseDown)
                         {
                             MouseButton mb = ConvertButton(e.button);
                             if (mb == MouseButton.Left)
                             {
                                 MouseClickEventArgs args = new MouseClickEventArgs(e.mousePosition, e.modifiers, mb, e.clickCount);
                                 MouseDownEvent(args);
                                 if (args.Handled)
                                 {
                                     e.Use();
                                 }
                             }
                         }
                     }
                 }
             }
             base.HandleEvent(e);
         }
     }
 }