Mercurial > hg > nnchat
comparison ui.h @ 466:796508f828f6
Refactor much of the "windowing" UI code into a new module, ui.[ch]
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 26 May 2012 06:56:18 +0300 |
parents | |
children | 607bd4491e79 |
comparison
equal
deleted
inserted
replaced
465:c3b3b6d89084 | 466:796508f828f6 |
---|---|
1 /* | |
2 * NNChat - Custom chat client for NewbieNudes.com chatrooms | |
3 * Written by Matti 'ccr' Hämäläinen | |
4 * (C) Copyright 2008-2012 Tecnic Software productions (TNSP) | |
5 */ | |
6 #ifndef LIBNNUI_H | |
7 #define LIBNNUI_H | |
8 | |
9 #include "th_types.h" | |
10 #include "th_string.h" | |
11 | |
12 #ifdef HAVE_NCURSES_H | |
13 #include <ncurses.h> | |
14 #else | |
15 #include <curses.h> | |
16 #endif | |
17 | |
18 | |
19 #define SET_MAX_WINDOWS (32) | |
20 #define NN_BACKBUF_LEN (512) // Backbuffer size (in lines) | |
21 | |
22 typedef struct | |
23 { | |
24 qringbuf_t *data; // "Backbuffer" data for this window | |
25 int pos; // Current position in the window, 0 = real time | |
26 BOOL dirty; | |
27 | |
28 char *id; // Chatter ID, NULL = main window | |
29 int num; // Window number | |
30 | |
31 char *buf; | |
32 size_t len, bufsize; | |
33 size_t chlen; | |
34 } nn_window_t; | |
35 | |
36 | |
37 extern nn_window_t *currWin; | |
38 extern BOOL cursesInit; | |
39 extern WINDOW *mainWin, *statusWin, *editWin; | |
40 | |
41 BOOL nnwin_init(int delay); | |
42 void nnwin_shutdown(); | |
43 | |
44 BOOL nnwin_init_windows(void); | |
45 void nnwin_close_windows(void); | |
46 | |
47 nn_window_t *nnwin_main_window(); | |
48 nn_window_t *nnwin_get(const int index); | |
49 nn_window_t *nnwin_find(const char *id); | |
50 | |
51 BOOL nnwin_open(const char *name, BOOL curwin); | |
52 void nnwin_close(nn_window_t *win); | |
53 | |
54 void nnwin_update_statusline(char *optUserName, int optUserColor); | |
55 void nnwin_update_editbuf(nn_editbuf_t *buf); | |
56 int nnwin_print(WINDOW *win, const char *fmt); | |
57 int nnwin_print_buf(nn_window_t *win, const char *fmt); | |
58 void nnwin_update_all(void); | |
59 char * nnwin_prompt_requester(WINDOW *win, const char *info, BOOL allowEmpty); | |
60 BOOL nnwin_update_main(BOOL force); | |
61 | |
62 | |
63 #endif |