focusableControl.ts 995 B

1234567891011121314151617181920212223242526272829303132333435
  1. import { IKeyboardEvent } from "babylonjs/Events/deviceInputEvents";
  2. import { Nullable } from "babylonjs/types";
  3. import { Control } from "./control";
  4. /**
  5. * Interface used to define a control that can receive focus
  6. */
  7. export interface IFocusableControl {
  8. /**
  9. * Function called when the control receives the focus
  10. */
  11. onFocus(): void;
  12. /**
  13. * Function called when the control loses the focus
  14. */
  15. onBlur(): void;
  16. /**
  17. * Function called to let the control handle keyboard events
  18. * @param evt defines the current keyboard event
  19. */
  20. processKeyboard(evt: IKeyboardEvent): void;
  21. /**
  22. * Function called to get the list of controls that should not steal the focus from this control
  23. * @returns an array of controls
  24. */
  25. keepsFocusWith(): Nullable<Control[]>;
  26. /**
  27. * Function to focus the control programmatically
  28. */
  29. focus(): void;
  30. /**
  31. * Function to unfocus the control programmatically
  32. */
  33. blur(): void;
  34. }