public MyToolButtonViewInfo(MyToolButton button) { this.button = button; imageBounds = Rectangle.Empty; captionBounds = Rectangle.Empty; bounds = Rectangle.Empty; }
public virtual void HitTest(Point pt) { if (focusedButton != null) { if (focusedButton.ViewInfo.Bounds.Contains(pt)) { return; } focusedButton.ViewInfo.UnderCursor = false; InvalidateButton(focusedButton); focusedButton = null; } MyToolButton btn; for (int i = 0; i < Buttons.Count; i++) { btn = Buttons[i]; if (btn.ViewInfo.Bounds.Contains(pt)) { btn.ViewInfo.UnderCursor = true; focusedButton = btn; InvalidateButton(focusedButton); break; } } }
public void Remove(MyToolButton btn) { if (btn == null) { return; } buttonList.Remove(btn); }
public void Add(MyToolButton btn) { if (btn == null || buttonList.Contains(btn)) { return; } buttonList.Add(btn); }
protected virtual void UpdateButtons() { focusedButton = null; Buttons.Clear(); if (!IsPosted) { Buttons.Add(new MyToolButton(MyButtonType.Cancel)); Buttons.Add(new MyToolButton(MyButtonType.Commit)); } else { Buttons.Add(new MyToolButton(MyButtonType.Link)); } }
protected virtual void InvalidateButton(MyToolButton btn) { TreeList.Invalidate(btn.ViewInfo.Bounds); }