You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

editbox.h 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #ifndef _GPXE_EDITBOX_H
  2. #define _GPXE_EDITBOX_H
  3. /** @file
  4. *
  5. * Editable text box widget
  6. *
  7. */
  8. #include <curses.h>
  9. #include <gpxe/editstring.h>
  10. /** An editable text box widget */
  11. struct edit_box {
  12. /** Editable string */
  13. struct edit_string string;
  14. /** Containing window */
  15. WINDOW *win;
  16. /** Row */
  17. unsigned int row;
  18. /** Starting column */
  19. unsigned int col;
  20. /** Width */
  21. unsigned int width;
  22. /** First displayed character */
  23. unsigned int first;
  24. /** Flags */
  25. unsigned int flags;
  26. };
  27. /** Editable text box widget flags */
  28. enum edit_box_flags {
  29. /** Show stars instead of contents (for password widgets) */
  30. EDITBOX_STARS = 0x0001,
  31. };
  32. extern void init_editbox ( struct edit_box *box, char *buf, size_t len,
  33. WINDOW *win, unsigned int row, unsigned int col,
  34. unsigned int width, unsigned int flags )
  35. __attribute__ (( nonnull (1, 2) ));
  36. extern void draw_editbox ( struct edit_box *box ) __nonnull;
  37. static inline int edit_editbox ( struct edit_box *box, int key ) __nonnull;
  38. /**
  39. * Edit text box widget
  40. *
  41. * @v box Editable text box widget
  42. * @v key Key pressed by user
  43. * @ret key Key returned to application, or zero
  44. *
  45. * You must call draw_editbox() to update the display after calling
  46. * edit_editbox().
  47. *
  48. */
  49. static inline int edit_editbox ( struct edit_box *box, int key ) {
  50. return edit_string ( &box->string, key );
  51. }
  52. #endif /* _GPXE_EDITBOX_H */