00001
00002
00003
00004
00005
00006
00007
00008
00009
00021 #ifndef __VTCORE_H__
00022 #define __VTCORE_H__
00023 #include <stdio.h>
00024 #include <wchar.h>
00025 #include "io.h"
00026 #include "screen.h"
00027
00028 enum {
00029 VTM_SHIFT = 0x0004,
00030 VTM_META = 0x0008,
00031 VTM_CONTROL = 0x0010,
00032 VTK_LEFT = 0xFF51,
00033 VTK_UP = 0xFF52,
00034 VTK_RIGHT = 0xFF53,
00035 VTK_DOWN = 0xFF54,
00037 VTK_CR = 0xFF0D,
00039 VTK_KP_0 = 0xFF00,
00040 VTK_KP_1 = 0xFF01,
00041 VTK_KP_2 = 0xFF02,
00042 VTK_KP_3 = 0xFF03,
00043 VTK_KP_4 = 0xFF04,
00044 VTK_KP_5 = 0xFF05,
00045 VTK_KP_6 = 0xFF06,
00046 VTK_KP_7 = 0xFF07,
00047 VTK_KP_8 = 0xFF08,
00048 VTK_KP_9 = 0xFF09,
00050 VTK_KP_DASH = 0xFF0A,
00051 VTK_KP_COMMA = 0xFF0B,
00052 VTK_KP_PERIOD = 0xFF0C,
00053 VTK_KP_ENTER = 0xFF0D,
00055 VTK_KP_PF1 = 0xFF0E,
00056 VTK_KP_PF2 = 0xFF0F,
00057 VTK_KP_PF3 = 0xFF10,
00058 VTK_KP_PF4 = 0xFF11,
00060 VTK_F1 = 0x1000,
00061 VTK_F2 = 0x1001,
00062 VTK_F3 = 0x1002,
00063 VTK_F4 = 0x1003,
00064 VTK_F5 = 0x1004,
00065 VTK_F6 = 0x1005,
00066 VTK_F7 = 0x1006,
00067 VTK_F8 = 0x1007,
00068 VTK_F9 = 0x1008,
00069 VTK_F10 = 0x1009,
00070 VTK_F11 = 0x1010,
00071 VTK_F12 = 0x1011,
00072 VTK_F13 = 0x1012,
00073 VTK_F14 = 0x1013,
00074 VTK_F15 = 0x1014,
00075 VTK_F16 = 0x1015,
00076 VTK_F17 = 0x1016,
00077 VTK_F18 = 0x1017
00078 };
00079
00080
00081 struct _VTScreen;
00082 struct _VT100;
00089 typedef struct _VTCore
00090 {
00091 struct _VTScreen *screen;
00093 TerminalIO *host_io;
00095 struct _VT100 *vt100;
00098 unsigned char buffer[BUFSIZ];
00101 int remain;
00104 mbstate_t ps;
00107 char **cursor;
00109 void (*exit_callback)(VTScreenView *view);
00112 } VTCore ;
00115 VTCore *VTCore_new(TerminalIO *io, int num_cols, int num_rows,
00116 int num_history);
00117
00118 void VTCore_destroy(VTCore *core);
00119 int VTCore_write(struct _VTCore *core, char *mb, int length);
00120 int VTCore_send_key(VTCore *core, int type);
00121 void VTCore_redraw(VTCore *core, int scol, int srow,int ecol, int erow);
00122 void VTCore_set_screen_view(VTCore *core, VTScreenView *view);
00123 void VTCore_set_screen_size(VTCore *core, int width, int height);
00124 void VTCore_start_selection(VTCore *core, int scol, int srow, int type);
00125 void VTCore_extend_selection(VTCore *core, int scol, int srow);
00126 void VTCore_copy_buffer(VTCore *core, int scol, int srow,
00127 int ecol, int erow, char *dest, int dest_size);
00128 void VTCore_copy_selected_buffer(VTCore *core, char *dest, int dest_size);
00129 void VTCore_clear_selection(VTCore *core);
00130 void VTCore_scroll(VTCore *core, double top);
00131 void VTCore_set_exit_callback(VTCore *core, void (*proc)(VTScreenView *view));
00132 void VTCore_set_reverse_video(VTCore *core, int on);
00133 void VTCore_scroll_up(VTCore *core, int num_line);
00134 void VTCore_scroll_down(VTCore *core, int num_line);
00135 int VTCore_send_mouse_position(VTCore *core, int button, int modifiers,
00136 int pressed, int col, int row);
00137 void VTCore_dispatch(VTCore *core);
00138 #ifdef BIDI
00139 void VTCore_set_direction(VTCore *core, int dir);
00140 int VTCore_is_direction_LTR(VTCore *core);
00141 #endif
00142 #endif
00143