5 Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
7 Copyright (C) 1997 - 2000 Pekka Riikonen
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
30 } *SilcScreenBottomLine;
33 /* Status line window top of the screen */
34 WINDOW *upper_stat_line;
38 WINDOW **output_stat_line;
39 unsigned int output_win_count;
41 /* Input window at the bottom of the screen */
43 unsigned char *input_buffer;
44 unsigned int input_pos;
45 unsigned int input_end;
46 unsigned int cursor_pos;
49 /* Bottom line on screen */
50 SilcScreenBottomLine bottom_line;
52 /* On/off flag for insert */
56 struct upper_status_line {
58 char *program_version;
63 typedef SilcScreenObject *SilcScreen;
65 /* Size of the input window. User can type this many characters into
66 the window. After that no more characters may be added into the
68 #define SILC_SCREEN_INPUT_WIN_SIZE 1024
70 /* Maximum length of nickaname that will be shown on the screen */
71 #define SILC_SCREEN_MAX_NICK_LEN 16
73 /* Maximum length of channel name that will be shown on the screen */
74 #define SILC_SCREEN_MAX_CHANNEL_LEN 20
76 /* Maximum length of connection name that will be shown on the screen */
77 #define SILC_SCREEN_MAX_CONN_LEN 20
81 /* Macro used to insert typed character into the buffer. The character
82 is not added at the end of the buffer but somewhere in between. */
83 #define SILC_SCREEN_INPUT_INSERT(__x, __y, __ch, __end) \
85 unsigned char __tmp[SILC_SCREEN_INPUT_WIN_SIZE + 1]; \
86 memcpy(__tmp, &(__x)[(__y)], (__end) - (__y)); \
87 (__x)[(__y)] = __ch; \
88 memcpy(&(__x)[(__y) + 1], __tmp, (__end) - (__y)); \
91 /* Macro used to delete character from the buffer. The character
92 is not removed from the end of the buffer but somewhere in between. */
93 #define SILC_SCREEN_INPUT_DELETE(__x, __y, __end) \
95 unsigned char __tmp[SILC_SCREEN_INPUT_WIN_SIZE + 1]; \
96 memcpy(__tmp, &(__x)[(__y) + 1], (__end)); \
97 memset(&(__x)[(__y)], 0, (__end) - (__y) + 1); \
98 memcpy(&(__x)[(__y)], __tmp, strlen(__tmp)); \
102 SilcScreen silc_screen_init();
103 WINDOW *silc_screen_create_output_window(SilcScreen screen);
104 WINDOW *silc_screen_add_output_window(SilcScreen screen);
105 void silc_screen_create_input_window(SilcScreen screen);
106 void silc_screen_init_upper_status_line(SilcScreen screen);
107 void silc_screen_print_upper_stat_line(SilcScreen screen);
108 void silc_screen_init_output_status_line(SilcScreen screen);
109 void silc_screen_print_clock(SilcScreen screen);
110 void silc_screen_print_coordinates(SilcScreen screen, int win_index);
111 void silc_screen_print_bottom_line(SilcScreen screen, int win_index);
112 void silc_screen_refresh_all(SilcScreen screen);
113 void silc_screen_refresh_win(WINDOW *win);
114 void silc_screen_input_reset(SilcScreen screen);
115 void silc_screen_input_backspace(SilcScreen screen);
116 void silc_screen_input_insert(SilcScreen screen);
117 void silc_screen_input_cursor_right(SilcScreen screen);
118 void silc_screen_input_cursor_left(SilcScreen screen);
119 void silc_screen_input_cursor_home(SilcScreen screen);
120 void silc_screen_input_cursor_end(SilcScreen screen);
121 void silc_screen_input_print(SilcScreen screen, unsigned char c);
122 void silc_screen_input_print_prompt(SilcScreen screen, char *prompt);