tty.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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, gboolean single);
  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 (gboolean single);
  54. extern void tty_print_one_hline (gboolean single);
  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, gboolean single);
  58. extern void tty_fill_region (int y, int x, int rows, int cols, unsigned char ch);
  59. extern int mc_tty_frm[];
  60. typedef enum
  61. {
  62. /* single lines */
  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_TOPMIDDLE,
  70. MC_TTY_FRM_BOTTOMMIDDLE,
  71. MC_TTY_FRM_LEFTMIDDLE,
  72. MC_TTY_FRM_RIGHTMIDDLE,
  73. MC_TTY_FRM_CROSS,
  74. /* double lines */
  75. MC_TTY_FRM_DVERT,
  76. MC_TTY_FRM_DHORIZ,
  77. MC_TTY_FRM_DLEFTTOP,
  78. MC_TTY_FRM_DRIGHTTOP,
  79. MC_TTY_FRM_DLEFTBOTTOM,
  80. MC_TTY_FRM_DRIGHTBOTTOM,
  81. MC_TTY_FRM_DTOPMIDDLE,
  82. MC_TTY_FRM_DBOTTOMMIDDLE,
  83. MC_TTY_FRM_DLEFTMIDDLE,
  84. MC_TTY_FRM_DRIGHTMIDDLE,
  85. MC_TTY_FRM_MAX
  86. } mc_tty_frm_t;
  87. extern char *tty_tgetstr (const char *name);
  88. extern void tty_beep (void);
  89. #define KEY_KP_ADD 4001
  90. #define KEY_KP_SUBTRACT 4002
  91. #define KEY_KP_MULTIPLY 4003
  92. extern void tty_refresh (void);
  93. extern void tty_setup_sigwinch (void (*handler) (int));
  94. extern int mc_tty_normalize_lines_char (const char *);
  95. #endif /* MC_TTY_H */