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.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. };
  25. extern void init_editbox ( struct edit_box *box, char *buf, size_t len,
  26. WINDOW *win, unsigned int row, unsigned int col,
  27. unsigned int width )
  28. __attribute__ (( nonnull (1, 2) ));
  29. extern void draw_editbox ( struct edit_box *box ) __nonnull;
  30. static inline int __pure edit_editbox ( struct edit_box *box, int key ) __nonnull;
  31. /**
  32. * Edit text box widget
  33. *
  34. * @v box Editable text box widget
  35. * @v key Key pressed by user
  36. * @ret key Key returned to application, or zero
  37. *
  38. * You must call draw_editbox() to update the display after calling
  39. * edit_editbox().
  40. *
  41. */
  42. static inline int edit_editbox ( struct edit_box *box, int key ) {
  43. return edit_string ( &box->string, key );
  44. }
  45. #endif /* _GPXE_EDITBOX_H */