root/lib/tty/tty.h

/* [previous][next][first][last][top][bottom][index][help]  */

INCLUDED FROM


   1 
   2 /** \file tty.h
   3  *  \brief Header: %interface to the terminal controlling library
   4  *
   5  *  This file is the %interface to the terminal controlling library:
   6  *  slang or ncurses. It provides an additional layer of abstraction
   7  *  above the "real" libraries to keep the number of ifdefs in the other
   8  *  files small.
   9  */
  10 
  11 #ifndef MC__TTY_H
  12 #define MC__TTY_H
  13 
  14 #include "lib/global.h"         /* include <glib.h> */
  15 
  16 #ifdef HAVE_SLANG
  17 #include "tty-slang.h"
  18 #else
  19 #include "tty-ncurses.h"
  20 #endif
  21 
  22 /*** typedefs(not structures) and defined constants **********************************************/
  23 
  24 #define KEY_KP_ADD      4001
  25 #define KEY_KP_SUBTRACT 4002
  26 #define KEY_KP_MULTIPLY 4003
  27 
  28 /*** enums ***************************************************************************************/
  29 
  30 typedef enum
  31 {
  32     /* single lines */
  33     MC_TTY_FRM_VERT,
  34     MC_TTY_FRM_HORIZ,
  35     MC_TTY_FRM_LEFTTOP,
  36     MC_TTY_FRM_RIGHTTOP,
  37     MC_TTY_FRM_LEFTBOTTOM,
  38     MC_TTY_FRM_RIGHTBOTTOM,
  39     MC_TTY_FRM_TOPMIDDLE,
  40     MC_TTY_FRM_BOTTOMMIDDLE,
  41     MC_TTY_FRM_LEFTMIDDLE,
  42     MC_TTY_FRM_RIGHTMIDDLE,
  43     MC_TTY_FRM_CROSS,
  44 
  45     /* double lines */
  46     MC_TTY_FRM_DVERT,
  47     MC_TTY_FRM_DHORIZ,
  48     MC_TTY_FRM_DLEFTTOP,
  49     MC_TTY_FRM_DRIGHTTOP,
  50     MC_TTY_FRM_DLEFTBOTTOM,
  51     MC_TTY_FRM_DRIGHTBOTTOM,
  52     MC_TTY_FRM_DTOPMIDDLE,
  53     MC_TTY_FRM_DBOTTOMMIDDLE,
  54     MC_TTY_FRM_DLEFTMIDDLE,
  55     MC_TTY_FRM_DRIGHTMIDDLE,
  56 
  57     MC_TTY_FRM_MAX
  58 } mc_tty_frm_t;
  59 
  60 /*** structures declarations (and typedefs of structures)*****************************************/
  61 
  62 /*** global variables defined in .c file *********************************************************/
  63 
  64 extern int mc_tty_frm[];
  65 
  66 extern char *tty_tgetstr (const char *name);
  67 
  68 /*** declarations of public functions ************************************************************/
  69 
  70 extern void tty_beep (void);
  71 
  72 /* {{{ Input }}} */
  73 
  74 extern gboolean tty_check_term (gboolean force_xterm);
  75 extern void tty_init (gboolean mouse_enable, gboolean is_xterm);
  76 extern void tty_shutdown (void);
  77 
  78 extern void tty_start_interrupt_key (void);
  79 extern void tty_enable_interrupt_key (void);
  80 extern void tty_disable_interrupt_key (void);
  81 extern gboolean tty_got_interrupt (void);
  82 
  83 extern gboolean tty_got_winch (void);
  84 extern void tty_flush_winch (void);
  85 
  86 extern void tty_reset_prog_mode (void);
  87 extern void tty_reset_shell_mode (void);
  88 
  89 extern void tty_raw_mode (void);
  90 extern void tty_noraw_mode (void);
  91 
  92 extern void tty_noecho (void);
  93 extern int tty_flush_input (void);
  94 
  95 extern void tty_keypad (gboolean set);
  96 extern void tty_nodelay (gboolean set);
  97 extern int tty_baudrate (void);
  98 
  99 /* {{{ Output }}} */
 100 
 101 /*
 102    The output functions do not check themselves for screen overflows,
 103    so make sure that you never write more than what fits on the screen.
 104    While SLang provides such a feature, ncurses does not.
 105  */
 106 
 107 extern int tty_reset_screen (void);
 108 extern void tty_touch_screen (void);
 109 
 110 extern void tty_gotoyx (int y, int x);
 111 extern void tty_getyx (int *py, int *px);
 112 
 113 extern void tty_set_alt_charset (gboolean alt_charset);
 114 
 115 extern void tty_display_8bit (gboolean what);
 116 extern void tty_print_char (int c);
 117 extern void tty_print_alt_char (int c, gboolean single);
 118 extern void tty_print_anychar (int c);
 119 extern void tty_print_string (const char *s);
 120 /* *INDENT-OFF* */
 121 extern void tty_printf (const char *s, ...) G_GNUC_PRINTF (1, 2);
 122 /* *INDENT-ON* */
 123 
 124 extern void tty_print_one_vline (gboolean single);
 125 extern void tty_print_one_hline (gboolean single);
 126 extern void tty_draw_hline (int y, int x, int ch, int len);
 127 extern void tty_draw_vline (int y, int x, int ch, int len);
 128 extern void tty_draw_box (int y, int x, int rows, int cols, gboolean single);
 129 extern void tty_draw_box_shadow (int y, int x, int rows, int cols, int shadow_color);
 130 extern void tty_fill_region (int y, int x, int rows, int cols, unsigned char ch);
 131 
 132 extern int tty_resize (int fd);
 133 extern void tty_refresh (void);
 134 extern void tty_change_screen_size (void);
 135 
 136 /* Clear screen */
 137 extern void tty_clear_screen (void);
 138 
 139 extern int mc_tty_normalize_lines_char (const char *str);
 140 
 141 extern void tty_enter_ca_mode (void);
 142 extern void tty_exit_ca_mode (void);
 143 
 144 /*** inline functions ****************************************************************************/
 145 
 146 #endif /* MC__TTY_H */

/* [previous][next][first][last][top][bottom][index][help]  */