aboutsummaryrefslogtreecommitdiffstats
path: root/src/gui/curses/headless/ncurses-fake.h
blob: 1c14bcfaf9d9cdf3cbb519ef92fae686e04924b0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/*
 * Copyright (C) 2014-2024 Sébastien Helleu <flashcode@flashtux.org>
 *
 * This file is part of WeeChat, the extensible chat client.
 *
 * WeeChat is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * WeeChat is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with WeeChat.  If not, see <https://www.gnu.org/licenses/>.
 */

#ifndef WEECHAT_NCURSES_FAKE_H
#define WEECHAT_NCURSES_FAKE_H

#include <stddef.h>

#define ERR (-1)
#define OK  (0)

#define TRUE 1
#define FALSE 0

#define COLS 80
#define LINES 25
#define COLORS 256
#define COLOR_PAIRS 256

#define COLOR_PAIR(x) x

#define COLOR_BLACK	0
#define COLOR_RED	1
#define COLOR_GREEN	2
#define COLOR_YELLOW	3
#define COLOR_BLUE	4
#define COLOR_MAGENTA	5
#define COLOR_CYAN	6
#define COLOR_WHITE	7

#define A_NORMAL 0
#define A_BLINK (1 << (11 + 8))
#define A_DIM (1 << (12 + 8))
#define A_BOLD (1 << (13 + 8))
#define A_UNDERLINE (1 << (9 + 8))
#define A_REVERSE (1 << (10 + 8))
#define A_ITALIC (1 << (23 + 8))

#define ACS_HLINE '-'
#define ACS_VLINE '|'

#define getyx(win, x, y)                        \
    x = 0;                                      \
    y = 0;

#define getmaxyx(win, x, y)                     \
    x = 0;                                      \
    y = 0;

struct _window
{
    int _cury, _curx;
    int _maxy, _maxx;
    int _begy, _begx;
};
typedef struct _window WINDOW;

typedef unsigned char bool;
typedef int attr_t;
typedef unsigned chtype;

struct _cchar_t
{
};
typedef struct _cchar_t cchar_t;

extern WINDOW *stdscr;
extern chtype acs_map[];

extern WINDOW *initscr ();
extern int endwin ();
extern WINDOW *newwin (int nlines, int ncols, int begin_y, int begin_x);
extern int delwin (WINDOW *win);
extern int move (int y, int x);
extern int wmove (WINDOW *win, int y, int x);
extern int wattr_on (WINDOW *win, attr_t attrs, void *opts);
extern int wattr_off (WINDOW *win, attr_t attrs, void *opts);
extern int wattr_get (WINDOW *win, attr_t *attrs, short *pair, void *opts);
extern int wattr_set (WINDOW *win, attr_t attrs, short pair, void *opts);
extern int wattron (WINDOW *win, int attrs);
extern int wattroff (WINDOW *win, int attrs);
extern int waddstr (WINDOW *win, const char *str);
extern int waddnstr (WINDOW *win, const char *str, int n);
extern int mvaddstr (int y, int x, const char *str);
extern int mvwaddstr (WINDOW *win, int y, int x, const char *str);
extern int wclrtobot (WINDOW *win);
extern int refresh ();
extern int wrefresh (WINDOW *win);
extern int wnoutrefresh (WINDOW *win);
extern int wclrtoeol (WINDOW *win);
extern int mvwprintw (WINDOW *win, int y, int x, const char *fmt, ...);
extern int init_pair (short pair, short f, short b);
extern bool has_colors ();
extern int cbreak ();
extern int start_color ();
extern int noecho ();
extern int clear ();
extern int wclear (WINDOW *win);
extern bool can_change_color ();
extern int curs_set (int visibility);
extern int nodelay (WINDOW *win, bool bf);
extern int werase (WINDOW *win);
extern int wbkgdset (WINDOW *win, chtype ch);
extern void wbkgrndset (WINDOW *win, const cchar_t *wcval);
extern int setcchar (cchar_t *wcval, const wchar_t *wch, attr_t attrs, short pair, const void *opts);
extern void wchgat (WINDOW *win, int n, attr_t attr, short color,
                    const void *opts);
extern int mvwchgat (WINDOW *win, int y, int x, int n, attr_t attr, short pair,
                     const void *opts);
extern void whline (WINDOW *win, chtype ch, int n);
extern void wvline (WINDOW *win, chtype ch, int n);
extern int mvwhline (WINDOW *win, int y, int x, chtype ch, int n);
extern int mvwvline (WINDOW *win, int y, int x, chtype ch, int n);
extern int raw ();
extern int wcolor_set (WINDOW *win, short pair, void *opts);
extern void cur_term ();
extern int use_default_colors ();
extern int resizeterm ();
extern int getch ();
extern int wgetch (WINDOW *win);

#endif /* WEECHAT_NCURSES_FAKE_H */