Пример #1
0
 public void MouseMiddleUp(int x, int y)
 {
     _mouseMiddleDown?.MouseMiddleDrag(_mouseMiddleDown, DragEvent.End, x, y);
     _mouseMiddleDown = null;
     if (!IsAnyDown)
     {
         Active = null;
     }
 }
Пример #2
0
 public void MouseRightDown(int x, int y)
 {
     if (Active == null)
     {
         Active = Hover;
     }
     _mouseRightDown = Active.ParentPath.FirstOrDefault(r => r.RequireMouseRightCapture);
     _mouseRightDown?.MouseRightDrag(_mouseRightDown, DragEvent.Begin, x, y);
     //Console.WriteLine(nameof(MouseRightDown));
 }
Пример #3
0
 public void MouseLeftUp(int x, int y)
 {
     _mouseLeftDown?.MouseLeftClick(_mouseLeftDown);
     _mouseLeftDown?.MouseLeftDrag(_mouseLeftDown, DragEvent.End, x, y);
     _mouseLeftDown = null;
     if (!IsAnyDown)
     {
         Active = null;
     }
 }
Пример #4
0
        public void MouseMove(RectRegion root, int x, int y)
        {
            MouseX = x;
            MouseY = y;
            Hover  = root.MouseMove(MouseX, MouseY);

            _mouseLeftDown?.MouseLeftDrag(_mouseLeftDown, DragEvent.Drag, x, y);
            _mouseRightDown?.MouseRightDrag(_mouseRightDown, DragEvent.Drag, x, y);
            _mouseMiddleDown?.MouseMiddleDrag(_mouseMiddleDown, DragEvent.Drag, x, y);
        }
Пример #5
0
        private void Splitter_LeftDragged(RectRegion r, DragEvent dragEvent, int x, int y)
        {
            switch (dragEvent)
            {
            case DragEvent.Begin:
                break;

            case DragEvent.Drag:
                Splitter.Rect = new Rect(x, Splitter.Rect.Y,
                                         Splitter.Rect.Width, Splitter.Rect.Height);
                Layout();
                break;

            case DragEvent.End:
                break;
            }
        }
Пример #6
0
        private void D3DRegion_MouseRightDragged(RectRegion arg1, DragEvent arg2, int arg3, int arg4)
        {
            switch (arg2)
            {
            case DragEvent.Begin:
                break;

            case DragEvent.Drag:
            {
                var dx = arg3 - _rx;
                var dy = arg4 - _ry;
                _camera.YawPitch(dx, dy);
                Invalidate();
            }
            break;

            case DragEvent.End:
                break;
            }

            _rx = arg3;
            _ry = arg4;
        }
Пример #7
0
        private void D3DRegion_MouseMiddleDragged(RectRegion arg1, DragEvent arg2, int arg3, int arg4)
        {
            switch (arg2)
            {
            case DragEvent.Begin:
                break;

            case DragEvent.Drag:
            {
                var dx = arg3 - _mx;
                var dy = arg4 - _my;
                _camera.Shift(dx, dy);
                Invalidate();
            }
            break;

            case DragEvent.End:
                break;
            }

            _mx = arg3;
            _my = arg4;
        }
Пример #8
0
 public void Add(BoxItem boxItem, RectRegion child)
 {
     child.Parent = this;
     Children.Add(child);
     m_boxItems.Add(boxItem);
 }
Пример #9
0
 public void Add(RectRegion child)
 {
     child.Parent = this;
     Children.Add(child);
     m_boxItems.Add(BoxItem.Fixed);
 }
Пример #10
0
        public FileDialog(string openDir)
        {
            FileChanged += (obj) =>
            {
                var f = obj as FileInfo;
                if (f != null)
                {
                    m_context.SetResult(f);
                }
            };

            m_source = new DirSource(Path.GetDirectoryName(openDir));

            var list = new ListRegion <FileSystemInfo>(m_source);

            list.ItemLeftDoubleClicked += (i, obj) =>
            {
                Enter(obj);
            };

            var current = new TextRegion();

            m_source.Updated += () =>
            {
                current.Text = m_source.CurrentFullName;
            };

            UI = new VBoxRegion()
            {
                new HBoxRegion(new Rect(200, 40))
                {
                    new ButtonRegion
                    {
                        Label  = "Up",
                        Action = _ =>
                        {
                            m_source.GoUp();
                        },
                        Rect = new Rect(40, 40)
                    },

                    { BoxItem.Expand, current }
                },

                { BoxItem.Expand, list },

                new HBoxRegion(new Rect(200, 40))
                {
                    new ButtonRegion
                    {
                        Label  = "Open",
                        Action = _ => {
                            if (list.SelectedSourceIndex != null)
                            {
                                Enter(list.Selected);
                            }
                        },
                        Rect = new Rect(96, 24),
                    },

                    new ButtonRegion
                    {
                        Label  = "Cancel",
                        Action = _ => Canceled?.Invoke(),
                        Rect   = new Rect(96, 24),
                    }
                }
            };
        }
Пример #11
0
 public void Add(Anchor anchor, RectRegion child)
 {
     child.Parent = this;
     Children.Add(child);
     m_anchors.Add(anchor);
 }
Пример #12
0
 private void D3DRegion_OnWheel(RectRegion arg1, int arg2)
 {
     _camera.Dolly(arg2);
     Invalidate();
 }