The SILC Project

source navigation ]
identifier search ]
freetext search ]
file search ]

silc/silc/screen.h

  1 /*
  2 
  3   screen.h
  4 
  5   Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
  6 
  7   Copyright (C) 1997 - 2000 Pekka Riikonen
  8 
  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.
 13   
 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.
 18 
 19 */
 20 
 21 #ifndef SCREEN_H
 22 #define SCREEN_H
 23 
 24 typedef struct {
 25   char *mode;
 26   char *nickname;
 27   char *connection;
 28   char *channel;
 29   char *channel_mode;
 30   char *umode;
 31   int away;
 32 } *SilcScreenBottomLine;
 33 
 34 typedef struct {
 35   /* Status line window top of the screen */
 36   WINDOW *upper_stat_line;
 37 
 38   /* Output windows */
 39   WINDOW **output_win;
 40   WINDOW **output_stat_line;
 41   SilcUInt32 output_win_count;
 42 
 43   /* Input window at the bottom of the screen */
 44   WINDOW *input_win;
 45   unsigned char *input_buffer;
 46   SilcUInt32 input_pos;
 47   SilcUInt32 input_end;
 48   SilcUInt32 cursor_pos;
 49   int virtual_window;
 50 
 51   /* Bottom line on screen */
 52   SilcScreenBottomLine bottom_line;
 53 
 54   /* On/off flag for insert */
 55   int insert;
 56 
 57   /* XXX */
 58   struct upper_status_line {
 59     const char *program_name;
 60     const char *program_version;
 61   } u_stat_line;
 62 
 63 } SilcScreenObject;
 64 
 65 typedef SilcScreenObject *SilcScreen;
 66 
 67 /* Size of the input window. User can type this many characters into
 68    the window. After that no more characters may be added into the 
 69    window. */
 70 #define SILC_SCREEN_INPUT_WIN_SIZE 1024
 71 
 72 /* Maximum length of nickaname that will be shown on the screen */
 73 #define SILC_SCREEN_MAX_NICK_LEN 16
 74 
 75 /* Maximum length of channel name that will be shown on the screen */
 76 #define SILC_SCREEN_MAX_CHANNEL_LEN 20
 77 
 78 /* Maximum length of connection name that will be shown on the screen */
 79 #define SILC_SCREEN_MAX_CONN_LEN 20
 80 
 81 /* Maximum length of user mode that will be shown on the screen */
 82 #define SILC_SCREEN_MAX_UMODE_LEN 20
 83 
 84 /* Macros */
 85 
 86 /* Macro used to insert typed character into the buffer. The character
 87    is not added at the end of the buffer but somewhere in between. */
 88 #define SILC_SCREEN_INPUT_INSERT(__x, __y, __ch, __end) \
 89 do {                                                    \
 90   unsigned char __tmp[SILC_SCREEN_INPUT_WIN_SIZE + 1];  \
 91   memcpy(__tmp, &(__x)[(__y)], (__end) - (__y));        \
 92   (__x)[(__y)] = __ch;                                  \
 93   memcpy(&(__x)[(__y) + 1], __tmp, (__end) - (__y));    \
 94 } while(0)
 95 
 96 /* Macro used to delete character from the buffer. The character
 97    is not removed from the end of the buffer but somewhere in between. */
 98 #define SILC_SCREEN_INPUT_DELETE(__x, __y, __end)       \
 99 do {                                                    \
100   unsigned char __tmp[SILC_SCREEN_INPUT_WIN_SIZE + 1];  \
101   memcpy(__tmp, &(__x)[(__y) + 1], (__end));            \
102   memset(&(__x)[(__y)], 0, (__end) - (__y) + 1);        \
103   memcpy(&(__x)[(__y)], __tmp, strlen(__tmp));          \
104 } while(0)
105 
106 /* Prototypes */
107 SilcScreen silc_screen_init();
108 WINDOW *silc_screen_create_output_window(SilcScreen screen);
109 WINDOW *silc_screen_add_output_window(SilcScreen screen);
110 void silc_screen_create_input_window(SilcScreen screen);
111 void silc_screen_init_upper_status_line(SilcScreen screen);
112 void silc_screen_print_upper_stat_line(SilcScreen screen);
113 void silc_screen_init_output_status_line(SilcScreen screen);
114 void silc_screen_print_clock(SilcScreen screen);
115 void silc_screen_print_coordinates(SilcScreen screen, int win_index);
116 void silc_screen_print_bottom_line(SilcScreen screen, int win_index);
117 void silc_screen_refresh_all(SilcScreen screen);
118 void silc_screen_refresh_win(WINDOW *win);
119 void silc_screen_input_reset(SilcScreen screen);
120 void silc_screen_input_backspace(SilcScreen screen);
121 void silc_screen_input_insert(SilcScreen screen);
122 void silc_screen_input_cursor_right(SilcScreen screen);
123 void silc_screen_input_cursor_left(SilcScreen screen);
124 void silc_screen_input_cursor_home(SilcScreen screen);
125 void silc_screen_input_cursor_end(SilcScreen screen);
126 void silc_screen_input_print(SilcScreen screen, unsigned char c);
127 void silc_screen_input_print_prompt(SilcScreen screen, char *prompt);
128 
129 #endif
130 

This page was automatically generated by the LXR engine.
Free-text search provided by Glimpse