Mercurial > hg > nnchat
view ui.h @ 718:1ab9b538c0bb default tip
Rename Makefile.gen to Makefile.common
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 03 Aug 2023 19:17:58 +0300 |
parents | 93d0e1547842 |
children |
line wrap: on
line source
/* * NNChat - Custom chat client for NewbieNudes.com chatrooms * Written by Matti 'ccr' Hämäläinen * (C) Copyright 2008-2016 Tecnic Software productions (TNSP) */ #ifndef LIBNNUI_H #define LIBNNUI_H #ifdef __WIN32 #define SET_DELAY (0) // Undefine because both windows.h and curses.h #define it #undef MOUSE_MOVED #else #define SET_DELAY (5) #endif #ifdef HAVE_NCURSES_H #include <ncurses.h> #else #include <curses.h> #endif #include <time.h> #include "th_types.h" #include "th_string.h" #include "th_network.h" #define SET_MAX_WINDOWS (32) // Max chat buffer windows #define SET_BACKBUF_LEN (512) // Backbuffer size (in lines) typedef struct { int *buf; size_t len, bufsize; } nn_line_t; typedef struct { th_ringbuf_t *data; // "Backbuffer" data for this window int pos; // Current position in the window, 0 = real time bool dirty; int num; char *id; // Chatter ID, NULL = main window nn_line_t *line; // Logging char *logFilename; FILE *logFile; time_t logPrevMsgTime; } nn_window_t; typedef struct { time_t prevKeepAlive; bool insertMode, isError, update, mask, done; th_conn_t *conn; void (*debugMsg)(const char *fmt, ...); } nn_editstate_t; extern nn_window_t *currWin; extern bool appCursesInit, appQuitFlag; extern int scrHeight, scrWidth; bool nnwin_init(int delay); void nnwin_shutdown(); void nnwin_reset(void); void nnwin_update(bool force, bool mask, nn_editbuf_t *ebuf, const char *username, const unsigned int usercolor); nn_window_t * nnwin_main_window(); nn_window_t * nnwin_get(const int index); nn_window_t * nnwin_find(const char *id); void nnwin_set_current(nn_window_t *); bool nnwin_open(const char *name, bool curwin); void nnwin_close(nn_window_t *win); int nnwin_print(nn_window_t *win, const char *fmt); void nnwin_input_process(nn_editbuf_t *editBuf, nn_editstate_t *editState, bool (*callback)(int, nn_editbuf_t *, nn_editstate_t *)); char * nnwin_prompt_requester(bool allowEmpty, nn_editstate_t *, bool (*callback)(int, nn_editbuf_t *, nn_editstate_t *), void (*update)(nn_editbuf_t *, nn_editstate_t *)); bool nn_log_open(nn_window_t *win); void nn_log_close(nn_window_t *win); #endif