/// <summary> /// Is visible SubItem of specified type in current Style and State? /// </summary> /// <param name="itemType"></param> /// <returns></returns> protected bool IsVisibleChildItemType(ChildItemType itemType) { bool e = this.IsEnabledChildItemType(itemType); bool s = this.IsSelected; bool o = this.CanDragOnlySelected; bool v = (this.InteractiveState == GInteractiveState.MouseOver); bool d = (this.InteractiveState == GInteractiveState.LeftDown || this.InteractiveState == GInteractiveState.RightDown); bool g = (this.InteractiveState == GInteractiveState.LeftDrag || this.InteractiveState == GInteractiveState.RightDrag); bool m = (v || d || g); switch (itemType) { case ChildItemType.Area: return(true); case ChildItemType.Border: return(s || (!o && m)); // Border is visible: only when Selected, or (!DragOnlySelected and with mouse) case ChildItemType.TopLeft: case ChildItemType.Top: case ChildItemType.TopRight: case ChildItemType.Right: case ChildItemType.BottomRight: case ChildItemType.Bottom: case ChildItemType.BottomLeft: case ChildItemType.Left: return(e && ((s && m) || (!o && m))); // Grip: when enabled and ((selected and mouse) or (!DragOnlySelected and with mouse)) } return(false); }
/// <summary> /// Is enabled SubItem of specified type in current Style? /// </summary> /// <param name="itemType"></param> /// <returns></returns> protected bool IsEnabledChildItemType(ChildItemType itemType) { bool rx = this.CanItemResizeX; bool ry = this.CanItemResizeY; bool ra = this.CanItemResize; switch (itemType) { case ChildItemType.Area: return(true); case ChildItemType.Border: return(false); case ChildItemType.TopLeft: return(ra); case ChildItemType.Top: return(ry); case ChildItemType.TopRight: return(ra); case ChildItemType.Right: return(rx); case ChildItemType.BottomRight: return(ra); case ChildItemType.Bottom: return(ry); case ChildItemType.BottomLeft: return(ra); case ChildItemType.Left: return(rx); } return(false); }
/// <summary> /// Konstruktor /// </summary> /// <param name="owner"></param> /// <param name="itemType"></param> /// <param name="overCursorType"></param> /// <param name="dragCursorType"></param> /// <param name="activeOverhead"></param> public ChildItem(MovableItem owner, ChildItemType itemType, SysCursorType?overCursorType, SysCursorType?dragCursorType, int activeOverhead) { this.Parent = owner; this.ItemType = itemType; this.OverCursorType = overCursorType; this.DragCursorType = dragCursorType; this.InteractivePadding = new Padding(activeOverhead); this.Is.GetEnabled = this._GetEnabled; this.Is.GetVisible = this._GetVisible; }