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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. extern void draw_editbox ( struct edit_box *box );
  29. /**
  30. * Edit text box widget
  31. *
  32. * @v box Editable text box widget
  33. * @v key Key pressed by user
  34. * @ret key Key returned to application, or zero
  35. *
  36. * You must call draw_editbox() to update the display after calling
  37. * edit_editbox().
  38. *
  39. */
  40. static inline int edit_editbox ( struct edit_box *box, int key ) {
  41. return edit_string ( &box->string, key );
  42. }
  43. #endif /* _GPXE_EDITBOX_H */