コード例 #1
0
 public NoteView(IGuiContext guiContext)
 {
     InitializeComponent();
     _guiContext = guiContext;
 }
コード例 #2
0
 public override bool Contains(IGuiContext context, Point point)
 {
     return(base.Contains(context, point) || IsOpen && GetContentRectangle(context).Contains(point));
 }
コード例 #3
0
 protected abstract void Layout(IGuiContext context, Rectangle rectangle);
コード例 #4
0
 public Size2 GetDesiredSize(IGuiContext context, Size2 availableSize)
 {
     return(new Size2(Width, Height));
 }
コード例 #5
0
 public override bool OnPointerDown(IGuiContext context, GuiPointerEventArgs args)
 {
     IsOpen = !IsOpen;
     return(base.OnPointerDown(context, args));
 }
コード例 #6
0
 public virtual bool Contains(IGuiContext context, Point point)
 {
     return(BoundingRectangle.Contains(point));
 }
コード例 #7
0
        public override bool OnKeyPressed(IGuiContext context, KeyboardEventArgs args)
        {
            switch (args.Key)
            {
            case Keys.Tab:
            case Keys.Enter:
                return(true);

            case Keys.Back:
                if (Text.Length > 0)
                {
                    if (SelectionStart > 0)     // && _selectionIndexes.Count <= 1)
                    {
                        SelectionStart--;
                        Text = Text.Remove(SelectionStart, 1);
                    }
                    //else
                    //{
                    //    var start = MathHelper.Min(_selectionIndexes.Last(), _selectionIndexes.Peek());
                    //    var end = MathHelper.Max(_selectionIndexes.Last(), _selectionIndexes.Peek());
                    //    Text = Text.Remove(start, end - start);

                    //    _selectionIndexes.Clear();
                    //}
                }

                break;

            case Keys.Delete:
                if (SelectionStart < Text.Length)     // && _selectionIndexes.Count <= 1)
                {
                    Text = Text.Remove(SelectionStart, 1);
                }
                //else if (_selectionIndexes.Count > 1)
                //{
                //    var start = MathHelper.Min(_selectionIndexes.Last(), _selectionIndexes.Peek());
                //    var end = MathHelper.Max(_selectionIndexes.Last(), _selectionIndexes.Peek());
                //    Text = Text.Remove(start, end - start);
                //    SelectionStart = 0; // yeah, nah.

                //    _selectionIndexes.Clear();
                //}
                break;

            case Keys.Left:
                if (SelectionStart > 0)
                {
                    //if (_selectionIndexes.Count > 1)
                    //{
                    //    if (_selectionIndexes.Last() < SelectionStart) SelectionStart = _selectionIndexes.Last();
                    //    _selectionIndexes.Clear();
                    //}
                    //else
                    {
                        SelectionStart--;
                    }
                }

                break;

            case Keys.Right:
                if (SelectionStart < Text.Length)
                {
                    //if (_selectionIndexes.Count > 1)
                    //{
                    //    if (_selectionIndexes.Last() > SelectionStart) SelectionStart = _selectionIndexes.Last();
                    //    _selectionIndexes.Clear();
                    //}
                    //else
                    {
                        SelectionStart++;
                    }
                }

                break;

            case Keys.Home:
                SelectionStart = 0;
                //_selectionIndexes.Clear();
                break;

            case Keys.End:
                SelectionStart = Text.Length;
                //_selectionIndexes.Clear();
                break;

            default:
                if (args.Character != null)
                {
                    //if (_selectionIndexes.Count > 1)
                    //{
                    //    var start = MathHelper.Min(_selectionIndexes.Last(), _selectionIndexes.Peek());
                    //    var end = MathHelper.Max(_selectionIndexes.Last(), _selectionIndexes.Peek());
                    //    Text = Text.Remove(start, end - start);

                    //    _selectionIndexes.Clear();
                    //}

                    Text = Text.Insert(SelectionStart, args.Character.ToString());
                    SelectionStart++;
                }

                break;
            }

            _isCaretVisible = true;
            return(base.OnKeyPressed(context, args));
        }
コード例 #8
0
 protected override Rectangle GetContentRectangle(IGuiContext context)
 {
     return(ClippingRectangle);
 }
コード例 #9
0
 public override bool OnPointerMove(IGuiContext context, PointerEventArgs args)
 {
     OnPointerMoveEvent?.Invoke(this, EventArgs.Empty);
     return(base.OnPointerMove(context, args));
 }
コード例 #10
0
 protected abstract Rectangle GetContentRectangle(IGuiContext context);
コード例 #11
0
 protected override void DrawForeground(IGuiContext context, IGuiRenderer renderer, float deltaSeconds, TextInfo textInfo)
 {
     ScrollIntoView(context);
     DrawItemList(context, renderer);
 }
コード例 #12
0
 public override void Draw(IGuiContext context, IGuiRenderer renderer, float deltaSeconds)
 {
     DrawBackground(context, renderer, deltaSeconds);
     DrawForeground(context, renderer, deltaSeconds, GetTextInfo(context, Text, BoundingRectangle, HorizontalTextAlignment, VerticalTextAlignment));
 }
コード例 #13
0
 public virtual void OnPointerUp(IGuiContext context, GuiPointerEventArgs args)
 {
 }
コード例 #14
0
 public virtual void OnKeyPressed(IGuiContext context, KeyboardEventArgs args)
 {
 }
コード例 #15
0
 public virtual bool OnUnfocus(IGuiContext context)
 {
     return(true);
 }
コード例 #16
0
 public MainForm(IGuiContext guiContext)
 {
     InitializeComponent();
     _guiContext = guiContext;
 }
コード例 #17
0
 public virtual bool OnPointerUp(IGuiContext context, GuiPointerEventArgs args)
 {
     return(true);
 }
コード例 #18
0
 protected virtual void OnItemClicked(IGuiContext context, PointerEventArgs args)
 {
 }
コード例 #19
0
 public override void Draw(IGuiContext context, IGuiRenderer renderer, float deltaSeconds)
 {
     DrawBackground(context, renderer, deltaSeconds);
     DrawForeground(context, renderer, deltaSeconds, GetTextInfo(context, CreateBoxText(Text, Font ?? context.DefaultFont, Width), BoundingRectangle, HorizontalTextAlignment, VerticalTextAlignment));
 }
コード例 #20
0
 protected abstract Rectangle GetListAreaRectangle(IGuiContext context);
コード例 #21
0
 public override void Draw(IGuiContext context, IGuiRenderer renderer, float deltaSeconds)
 {
     renderer.FillRectangle(BoundingRectangle, Color.Magenta);
 }
コード例 #22
0
        public override bool OnPointerUp(IGuiContext context, GuiPointerEventArgs args)
        {
            _startSelectionBox = false;

            return(base.OnPointerUp(context, args));
        }
コード例 #23
0
 /// <summary>
 /// Returns content size of the view
 /// </summary>
 /// <param name="context">gui context</param>
 /// <returns>content size</returns>
 public override Size GetContentSize(IGuiContext context)
 {
     return(new Size(this.Width, this.Height));
 }
コード例 #24
0
        protected override Size2 CalculateDesiredSize(IGuiContext context, Size2 availableSize)
        {
            var font = Font ?? context.DefaultFont;

            return(new Size2(Width + Padding.Left + Padding.Right, (Height <= 0.0f ? font.LineHeight + 2 : Height) + Padding.Top + Padding.Bottom));
        }
コード例 #25
0
 protected override Rectangle GetContentRectangle(IGuiContext context)
 {
     return(GetDropDownRectangle(context));
 }
コード例 #26
0
 protected virtual Size2 CalculateDesiredSize(IGuiContext context, Size2 availableSize)
 {
     return(Size2.Empty);
 }
コード例 #27
0
 public override Size GetContentSize(IGuiContext context)
 {
     return(new Size());
 }
コード例 #28
0
 public virtual bool OnKeyPressed(IGuiContext context, KeyboardEventArgs args)
 {
     return(true);
 }
コード例 #29
0
 protected static void PlaceControl(IGuiContext context, Control control, float x, float y, float width, float height)
 {
     LayoutHelper.PlaceControl(context, control, x, y, width, height);
 }
コード例 #30
0
 public abstract void Draw(IGuiContext context, IGuiRenderer renderer, float deltaSeconds);