zori_console.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef zori_console_H_INCLUDED
  2. #define zori_console_H_INCLUDED
  3. typedef int (zori_console_command)(struct zori_widget *, const char * command, void * data);
  4. /* A console is a console for command-line interaction and error display. When it's active it captures all input (as long as it's active) */
  5. struct zori_console {
  6. struct zori_widget widget;
  7. USTRList text;
  8. int count;
  9. int max;
  10. int start;
  11. int charw;
  12. int cursor;
  13. char * buf;
  14. USTR * input;
  15. zori_console_command * command; // called when a command has been entered, if set.
  16. void * command_data; // command data.
  17. };
  18. struct zori_console *zori_widget_console(struct zori_widget *widget);
  19. int zori_console_docommand(struct zori_console *self, const char *text);
  20. int zori_console_addstr(struct zori_console *self, const char *str);
  21. int zori_console_addustr(struct zori_console *self, const ALLEGRO_USTR *ustr);
  22. int zori_console_puts(struct zori_console *self, const char *str);
  23. int zori_console_vprintf(struct zori_console *self, const char *format, va_list args);
  24. int zori_console_printf(struct zori_console *self, const char *format, ...);
  25. int zori_console_draw(union zori_event *zevent);
  26. void zori_console_active_(struct zori_console *self, int active);
  27. int zori_console_active(struct zori_console *self);
  28. int zori_console_scroll(struct zori_console *self, int direction);
  29. int zori_console_handle_keychar(union zori_event *zevent);
  30. int zori_console_handle_keydown(union zori_event *zevent);
  31. int zori_console_handle_mouseaxes(union zori_event *zevent);
  32. int zori_console_handle_ignore(union zori_event *zevent);
  33. int zori_console_handle(struct zori_widget *widget, zori_system_event *sevent);
  34. int zori_console_done(struct zori_widget *widget);
  35. int zori_console_free(struct zori_widget *widget);
  36. struct zori_console *zori_console_alloc(void);
  37. struct zori_console *zori_console_initall(struct zori_console *self, int id, zori_rebox *bounds, struct zori_style *style);
  38. struct zori_console *zori_console_new(int id, zori_rebox *bounds, struct zori_style *style);
  39. #endif