public override void KeyDown(NSEvent theEvent) { if (theEvent.Characters == " ") { var item = Cells [focusedCellIndex].Cell; PopupMenuForCell(item); return; } if (theEvent.Characters == "\t") { focusedCellIndex++; if (focusedCellIndex > VisibleCellIds.Length) { if (NextKeyView != null) { Window.MakeFirstResponder(NextKeyView); SetSelection(); focusedCellIndex = 0; focusedItem = null; return; } } } SetSelection(); base.KeyDown(theEvent); }
public override void KeyDown(NSEvent theEvent) { if (theEvent.Characters == " ") { var item = Cells [focusedCellIndex].Cell; PopupMenuForCell(item); return; } if (theEvent.Characters == "\t") { focusedCellIndex++; if (focusedCellIndex >= VisibleCellIds.Length) { if (NextKeyView != null) { SetSelection(); focusedCellIndex = 0; focusedItem = null; } } else { SetSelection(); return; } } base.KeyDown(theEvent); }
public override void KeyDown(NSEvent theEvent) { if (theEvent.KeyCode == (ushort)KeyCodes.Space) { var item = Cells [focusedCellIndex].Cell; PopupMenuForCell(item); return; } // 0x30 is Tab if (theEvent.KeyCode == (ushort)KeyCodes.Tab) { if ((theEvent.ModifierFlags & NSEventModifierMask.ShiftKeyMask) == NSEventModifierMask.ShiftKeyMask) { if (focusedCellIndex <= 0) { if (PreviousKeyView != null) { SetSelection(); focusedCellIndex = 0; focusedItem = null; } } else { if (UpdatePreviousCellForResponderChain(focusedCellIndex - 1)) { SetSelection(); return; } } } else { if (focusedCellIndex >= VisibleCellIds.Length - 1) { if (NextKeyView != null) { SetSelection(); focusedCellIndex = 0; focusedItem = null; } } else { if (UpdateNextCellForResponderChain(focusedCellIndex + 1)) { SetSelection(); return; } } } } base.KeyDown(theEvent); }
public override bool ResignFirstResponder() { focusedCellIndex = 0; if (focusedItem != null) { focusedItem.HasFocus = false; focusedItem = null; } return(base.ResignFirstResponder()); }
public override void KeyDown(NSEvent theEvent) { if (theEvent.KeyCode == KeyCodes.Space) { var item = Cells [focusedCellIndex].Cell; PopupMenuForCell(item); return; } // 0x30 is Tab if (theEvent.KeyCode == KeyCodes.Tab) { if ((theEvent.ModifierFlags & NSEventModifierMask.ShiftKeyMask) == NSEventModifierMask.ShiftKeyMask) { focusedCellIndex--; if (focusedCellIndex < 0) { if (PreviousKeyView != null) { SetSelection(); focusedCellIndex = 0; focusedItem = null; } } else { SetSelection(); return; } } else { focusedCellIndex++; if (focusedCellIndex >= VisibleCellIds.Length) { if (NextKeyView != null) { SetSelection(); focusedCellIndex = 0; focusedItem = null; } } else { SetSelection(); return; } } } base.KeyDown(theEvent); }
void SetSelection() { if (focusedItem != null) { focusedItem.HasFocus = false; } if (focusedCellIndex < Cells.Count()) { var item = Cells [focusedCellIndex]; focusedItem = item; item.HasFocus = true; } SetNeedsDisplay(); }
void SetSelection() { if (focusedItem != null) { focusedItem.HasFocus = false; } if (focusedCellIndex < Cells.Length) { var item = Cells [focusedCellIndex].Cell as NSPathComponentCellFocusable; focusedItem = item; if (item != null) { item.HasFocus = true; } } SetNeedsDisplay(); }
void SetSelection() { //ensures our cells are in the correct enabled state if (focusedCellIndex >= 0 && focusedCellIndex < Cells.Length) { focusedItem = Cells [focusedCellIndex].Cell as NSPathComponentCellFocusable; if (focusedItem != null) { focusedItem.HasFocus = true; } } //we want ensure our state is correct in other elements for (int i = 0; i < Cells.Length; i++) { if (i != focusedCellIndex && Cells [i].Cell is NSPathComponentCellFocusable focusable) { focusable.HasFocus = false; } } SetNeedsDisplay(); }