tty.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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);
  58. extern void tty_draw_double_box (int y, int x, int rows, int cols);
  59. extern void tty_fill_region (int y, int x, int rows, int cols, unsigned char ch);
  60. extern int mc_tty_ugly_frm[];
  61. typedef enum {
  62. MC_TTY_FRM_thinvert,
  63. MC_TTY_FRM_thinhoriz,
  64. MC_TTY_FRM_vert,
  65. MC_TTY_FRM_horiz,
  66. MC_TTY_FRM_lefttop,
  67. MC_TTY_FRM_righttop,
  68. MC_TTY_FRM_leftbottom,
  69. MC_TTY_FRM_rightbottom,
  70. MC_TTY_FRM_centertop,
  71. MC_TTY_FRM_centerbottom,
  72. MC_TTY_FRM_leftmiddle,
  73. MC_TTY_FRM_rightmiddle,
  74. MC_TTY_FRM_centermiddle,
  75. MC_TTY_FRM_grpvert,
  76. MC_TTY_FRM_grphoriz,
  77. MC_TTY_FRM_grplefttop,
  78. MC_TTY_FRM_grprighttop,
  79. MC_TTY_FRM_grpleftbottom,
  80. MC_TTY_FRM_grprightbottom,
  81. MC_TTY_FRM_grpcentertop,
  82. MC_TTY_FRM_grpcenterbottom,
  83. MC_TTY_FRM_grpleftmiddle,
  84. MC_TTY_FRM_grprightmiddle,
  85. MC_TTY_FRM_grpcentermiddle,
  86. MC_TTY_FRM_MAX
  87. } mc_tty_frm_t;
  88. extern char *tty_tgetstr (const char *name);
  89. extern void tty_beep (void);
  90. #define KEY_KP_ADD 4001
  91. #define KEY_KP_SUBTRACT 4002
  92. #define KEY_KP_MULTIPLY 4003
  93. extern void tty_refresh (void);
  94. extern void tty_setup_sigwinch (void (*handler) (int));
  95. extern int mc_tty_normalize_lines_char (const char *);
  96. #endif /* MC_TTY_H */