bool MoveFocusToWidget(FocusWidget widget, DirectionType direction) { switch (widget) { case FocusWidget.BackButton: currentFocus = PreviousButton; return(PreviousButton.ChildFocus(direction)); case FocusWidget.NextButton: currentFocus = NextButton; return(NextButton.ChildFocus(direction)); case FocusWidget.MenuButton: currentFocus = DropDownButton; return(DropDownButton.ChildFocus(direction)); case FocusWidget.Tabs: case FocusWidget.TabCloseButton: GrabFocus(); currentFocus = null; QueueDraw(); return(true); case FocusWidget.None: break; } return(false); }
protected override bool OnFocused(DirectionType direction) { if (!FocusCurrentWidget(direction)) { FocusWidget focus = FocusWidget.None; if (currentFocus == PreviousButton) { focus = FocusWidget.BackButton; } else if (currentFocus == NextButton) { focus = FocusWidget.NextButton; } else if (currentFocus == DropDownButton) { focus = FocusWidget.MenuButton; } else if (IsFocus) { focus = currentFocusCloseButton ? FocusWidget.TabCloseButton : FocusWidget.Tabs; } while ((focus = GetNextWidgetToFocus(focus, direction)) != FocusWidget.None) { if (MoveFocusToWidget(focus, direction)) { return(true); } } currentFocus = null; currentFocusTab = -1; return(false); } return(base.OnFocused(direction)); }
protected override bool OnFocused(DirectionType direction) { if (!FocusCurrentWidget(direction)) { FocusWidget focus = FocusWidget.None; if (currentFocus == btnClose) { focus = FocusWidget.CloseButton; } else if (currentFocus == btnDock) { focus = FocusWidget.DockButton; } else if (IsFocus) { focus = FocusWidget.Widget; } while ((focus = GetNextWidgetToFocus(focus, direction)) != FocusWidget.None) { if (MoveFocusToWidget(focus, direction)) { return(true); } } // Clean up the icons because OnFocusOutEvent has already been called // so we need the icons to hide again mouseOver = false; UpdateBehavior(); currentFocus = null; return(false); } return(true); }
bool MoveFocusToWidget(FocusWidget widget, DirectionType direction) { switch (widget) { case FocusWidget.Widget: GrabFocus(); currentFocus = null; return(true); case FocusWidget.DockButton: currentFocus = btnDock; return(btnDock.ChildFocus(direction)); case FocusWidget.CloseButton: currentFocus = btnClose; return(btnClose.ChildFocus(direction)); case FocusWidget.None: break; } return(false); }
FocusWidget GetNextWidgetToFocus(FocusWidget widget, DirectionType direction) { switch (widget) { case FocusWidget.BackButton: switch (direction) { case DirectionType.TabForward: case DirectionType.Right: if (NextButton.Sensitive && NextButton.Visible) { return(FocusWidget.NextButton); } else if (notebook.Tabs.Count > 0) { currentFocusTab = 0; return(FocusWidget.Tabs); } else if (DropDownButton.Sensitive && DropDownButton.Visible) { return(FocusWidget.MenuButton); } else { return(FocusWidget.None); } case DirectionType.TabBackward: case DirectionType.Left: return(FocusWidget.None); } break; case FocusWidget.NextButton: switch (direction) { case DirectionType.TabForward: case DirectionType.Right: if (notebook.Tabs.Count > 0) { currentFocusTab = 0; return(FocusWidget.Tabs); } else if (DropDownButton.Sensitive && DropDownButton.Visible) { return(FocusWidget.MenuButton); } else { return(FocusWidget.None); } case DirectionType.TabBackward: case DirectionType.Left: if (PreviousButton.Sensitive && PreviousButton.Visible) { return(FocusWidget.BackButton); } else { return(FocusWidget.None); } } break; case FocusWidget.Tabs: switch (direction) { case DirectionType.TabForward: case DirectionType.Right: currentFocusCloseButton = true; return(FocusWidget.TabCloseButton); /* * if (currentFocusTab < notebook.Tabs.Count - 1) { * currentFocusTab++; * return FocusWidget.Tabs; * } else if (DropDownButton.Sensitive && DropDownButton.Visible) { * currentFocusTab = -1; * return FocusWidget.MenuButton; * } else { * return FocusWidget.None; * } */ case DirectionType.TabBackward: case DirectionType.Left: if (currentFocusTab > 0) { currentFocusTab--; currentFocusCloseButton = true; return(FocusWidget.TabCloseButton); } else if (NextButton.Sensitive && NextButton.Visible) { currentFocusTab = -1; return(FocusWidget.NextButton); } else if (PreviousButton.Sensitive && PreviousButton.Visible) { currentFocusTab = -1; return(FocusWidget.BackButton); } else { currentFocusTab = -1; return(FocusWidget.None); } } break; case FocusWidget.TabCloseButton: currentFocusCloseButton = false; switch (direction) { case DirectionType.TabForward: case DirectionType.Right: if (currentFocusTab < notebook.Tabs.Count - 1) { currentFocusTab++; return(FocusWidget.Tabs); } else if (DropDownButton.Sensitive && DropDownButton.Visible) { currentFocusTab = -1; return(FocusWidget.MenuButton); } else { return(FocusWidget.None); } case DirectionType.TabBackward: case DirectionType.Left: return(FocusWidget.Tabs); } break; case FocusWidget.MenuButton: switch (direction) { case DirectionType.TabForward: case DirectionType.Right: return(FocusWidget.None); case DirectionType.TabBackward: case DirectionType.Left: if (notebook.Tabs.Count > 0) { currentFocusTab = notebook.Tabs.Count - 1; currentFocusCloseButton = true; return(FocusWidget.TabCloseButton); } else if (NextButton.Sensitive && NextButton.Visible) { return(FocusWidget.NextButton); } else if (PreviousButton.Sensitive && PreviousButton.Visible) { return(FocusWidget.BackButton); } else { return(FocusWidget.None); } } break; case FocusWidget.None: switch (direction) { case DirectionType.TabForward: case DirectionType.Right: if (PreviousButton.Sensitive && PreviousButton.Visible) { return(FocusWidget.BackButton); } else if (NextButton.Sensitive && NextButton.Visible) { return(FocusWidget.NextButton); } else if (notebook.Tabs.Count > 0) { currentFocusTab = 0; return(FocusWidget.Tabs); } else if (DropDownButton.Sensitive && DropDownButton.Visible) { return(FocusWidget.MenuButton); } else { return(FocusWidget.None); } case DirectionType.TabBackward: case DirectionType.Left: if (DropDownButton.Sensitive && DropDownButton.Visible) { return(FocusWidget.MenuButton); } else if (notebook.Tabs.Count > 0) { currentFocusTab = notebook.Tabs.Count - 1; currentFocusCloseButton = true; return(FocusWidget.TabCloseButton); } else if (NextButton.Sensitive && NextButton.Visible) { return(FocusWidget.NextButton); } else if (PreviousButton.Sensitive && PreviousButton.Visible) { return(FocusWidget.BackButton); } else { return(FocusWidget.None); } } break; } return(FocusWidget.None); }
FocusWidget GetNextWidgetToFocus(FocusWidget widget, DirectionType direction) { FocusWidget nextSite; switch (widget) { case FocusWidget.CloseButton: switch (direction) { case DirectionType.TabForward: case DirectionType.Right: case DirectionType.Down: return(FocusWidget.None); case DirectionType.TabBackward: case DirectionType.Left: case DirectionType.Up: if (btnDock.Image != null) { nextSite = FocusWidget.DockButton; } else { nextSite = FocusWidget.Widget; } return(nextSite); } break; case FocusWidget.DockButton: switch (direction) { case DirectionType.TabForward: case DirectionType.Right: case DirectionType.Down: return(btnClose.Image == null ? FocusWidget.None : FocusWidget.CloseButton); case DirectionType.TabBackward: case DirectionType.Left: case DirectionType.Up: return(FocusWidget.Widget); } break; case FocusWidget.Widget: switch (direction) { case DirectionType.TabForward: case DirectionType.Right: case DirectionType.Down: if (btnDock.Image != null) { nextSite = FocusWidget.DockButton; } else if (btnClose.Image != null) { nextSite = FocusWidget.CloseButton; } else { nextSite = FocusWidget.None; } return(nextSite); case DirectionType.TabBackward: case DirectionType.Left: case DirectionType.Up: return(FocusWidget.None); } break; case FocusWidget.None: switch (direction) { case DirectionType.TabForward: case DirectionType.Right: case DirectionType.Down: return(FocusWidget.Widget); case DirectionType.TabBackward: case DirectionType.Left: case DirectionType.Up: if (btnClose.Image != null) { nextSite = FocusWidget.CloseButton; } else if (btnDock.Image != null) { nextSite = FocusWidget.DockButton; } else { nextSite = FocusWidget.Widget; } return(nextSite); } break; } return(FocusWidget.None); }