public NoteView(IGuiContext guiContext) { InitializeComponent(); _guiContext = guiContext; }
public override bool Contains(IGuiContext context, Point point) { return(base.Contains(context, point) || IsOpen && GetContentRectangle(context).Contains(point)); }
protected abstract void Layout(IGuiContext context, Rectangle rectangle);
public Size2 GetDesiredSize(IGuiContext context, Size2 availableSize) { return(new Size2(Width, Height)); }
public override bool OnPointerDown(IGuiContext context, GuiPointerEventArgs args) { IsOpen = !IsOpen; return(base.OnPointerDown(context, args)); }
public virtual bool Contains(IGuiContext context, Point point) { return(BoundingRectangle.Contains(point)); }
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)); }
protected override Rectangle GetContentRectangle(IGuiContext context) { return(ClippingRectangle); }
public override bool OnPointerMove(IGuiContext context, PointerEventArgs args) { OnPointerMoveEvent?.Invoke(this, EventArgs.Empty); return(base.OnPointerMove(context, args)); }
protected abstract Rectangle GetContentRectangle(IGuiContext context);
protected override void DrawForeground(IGuiContext context, IGuiRenderer renderer, float deltaSeconds, TextInfo textInfo) { ScrollIntoView(context); DrawItemList(context, renderer); }
public override void Draw(IGuiContext context, IGuiRenderer renderer, float deltaSeconds) { DrawBackground(context, renderer, deltaSeconds); DrawForeground(context, renderer, deltaSeconds, GetTextInfo(context, Text, BoundingRectangle, HorizontalTextAlignment, VerticalTextAlignment)); }
public virtual void OnPointerUp(IGuiContext context, GuiPointerEventArgs args) { }
public virtual void OnKeyPressed(IGuiContext context, KeyboardEventArgs args) { }
public virtual bool OnUnfocus(IGuiContext context) { return(true); }
public MainForm(IGuiContext guiContext) { InitializeComponent(); _guiContext = guiContext; }
public virtual bool OnPointerUp(IGuiContext context, GuiPointerEventArgs args) { return(true); }
protected virtual void OnItemClicked(IGuiContext context, PointerEventArgs args) { }
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)); }
protected abstract Rectangle GetListAreaRectangle(IGuiContext context);
public override void Draw(IGuiContext context, IGuiRenderer renderer, float deltaSeconds) { renderer.FillRectangle(BoundingRectangle, Color.Magenta); }
public override bool OnPointerUp(IGuiContext context, GuiPointerEventArgs args) { _startSelectionBox = false; return(base.OnPointerUp(context, args)); }
/// <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)); }
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)); }
protected override Rectangle GetContentRectangle(IGuiContext context) { return(GetDropDownRectangle(context)); }
protected virtual Size2 CalculateDesiredSize(IGuiContext context, Size2 availableSize) { return(Size2.Empty); }
public override Size GetContentSize(IGuiContext context) { return(new Size()); }
public virtual bool OnKeyPressed(IGuiContext context, KeyboardEventArgs args) { return(true); }
protected static void PlaceControl(IGuiContext context, Control control, float x, float y, float width, float height) { LayoutHelper.PlaceControl(context, control, x, y, width, height); }
public abstract void Draw(IGuiContext context, IGuiRenderer renderer, float deltaSeconds);