tty.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /** \file tty.h
  2. * \brief Header: %interface to the terminal controlling library
  3. *
  4. * This file is the %interface to the terminal controlling library:
  5. * slang or ncurses. It provides an additional layer of abstraction
  6. * above the "real" libraries to keep the number of ifdefs in the other
  7. * files small.
  8. */
  9. #ifndef MC_TTY_H
  10. #define MC_TTY_H
  11. #include "lib/global.h" /* include <glib.h> */
  12. #ifdef HAVE_SLANG
  13. # include "tty-slang.h"
  14. #else
  15. # include "tty-ncurses.h"
  16. #endif
  17. /* {{{ Input }}} */
  18. extern int reset_hp_softkeys;
  19. extern void tty_init (gboolean slow, gboolean ugly_lines);
  20. extern void tty_shutdown (void);
  21. extern gboolean tty_is_slow (void);
  22. extern void tty_start_interrupt_key (void);
  23. extern void tty_enable_interrupt_key (void);
  24. extern void tty_disable_interrupt_key (void);
  25. extern gboolean tty_got_interrupt (void);
  26. extern void tty_reset_prog_mode (void);
  27. extern void tty_reset_shell_mode (void);
  28. extern void tty_raw_mode (void);
  29. extern void tty_noraw_mode (void);
  30. extern void tty_noecho (void);
  31. extern int tty_flush_input (void);
  32. extern void tty_keypad (gboolean set);
  33. extern void tty_nodelay (gboolean set);
  34. extern int tty_baudrate (void);
  35. extern int tty_lowlevel_getch (void);
  36. /* {{{ Output }}} */
  37. /*
  38. The output functions do not check themselves for screen overflows,
  39. so make sure that you never write more than what fits on the screen.
  40. While SLang provides such a feature, ncurses does not.
  41. */
  42. extern int tty_reset_screen (void);
  43. extern void tty_touch_screen (void);
  44. extern void tty_gotoyx (int y, int x);
  45. extern void tty_getyx (int *py, int *px);
  46. extern void tty_set_alt_charset (gboolean alt_charset);
  47. extern void tty_display_8bit (gboolean what);
  48. extern void tty_print_char (int c);
  49. extern void tty_print_alt_char (int c);
  50. extern void tty_print_anychar (int c);
  51. extern void tty_print_string (const char *s);
  52. extern void tty_printf (const char *s, ...);
  53. extern void tty_print_one_vline (void);
  54. extern void tty_print_one_hline (void);
  55. extern void tty_draw_hline (int y, int x, int ch, int len);
  56. extern void tty_draw_vline (int y, int x, int ch, int len);
  57. extern void tty_draw_box (int y, int x, int rows, int cols);
  58. extern void tty_fill_region (int y, int x, int rows, int cols, unsigned char ch);
  59. extern int mc_tty_ugly_frm[];
  60. typedef enum {
  61. MC_TTY_FRM_thinvert,
  62. MC_TTY_FRM_thinhoriz,
  63. MC_TTY_FRM_vert,
  64. MC_TTY_FRM_horiz,
  65. MC_TTY_FRM_lefttop,
  66. MC_TTY_FRM_righttop,
  67. MC_TTY_FRM_leftbottom,
  68. MC_TTY_FRM_rightbottom,
  69. MC_TTY_FRM_centertop,
  70. MC_TTY_FRM_centerbottom,
  71. MC_TTY_FRM_leftmiddle,
  72. MC_TTY_FRM_rightmiddle,
  73. MC_TTY_FRM_centermiddle,
  74. MC_TTY_FRM_MAX
  75. } mc_tty_frm_t;
  76. extern char *tty_tgetstr (const char *name);
  77. extern void tty_beep (void);
  78. #define KEY_KP_ADD 4001
  79. #define KEY_KP_SUBTRACT 4002
  80. #define KEY_KP_MULTIPLY 4003
  81. extern void tty_refresh (void);
  82. extern void tty_setup_sigwinch (void (*handler) (int));
  83. extern int mc_tty_normalize_lines_char (const char *);
  84. #endif /* MC_TTY_H */