libt3window
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups
window.h
1 /* Copyright (C) 2011 G.P. Halkes
2  This program is free software: you can redistribute it and/or modify
3  it under the terms of the GNU General Public License version 3, as
4  published by the Free Software Foundation.
5 
6  This program is distributed in the hope that it will be useful,
7  but WITHOUT ANY WARRANTY; without even the implied warranty of
8  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9  GNU General Public License for more details.
10 
11  You should have received a copy of the GNU General Public License
12  along with this program. If not, see <http://www.gnu.org/licenses/>.
13 */
14 #ifndef T3_WINDOW_H
15 #define T3_WINDOW_H
16 
19 #include <stdlib.h>
20 #include <t3window/terminal.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
27 #define T3_PARENT(_x) ((_x) << 4)
28 
29 #define T3_CHILD(_x) ((_x) << 8)
30 
31 #define T3_GETPARENT(_x) (((_x) >> 4) & 0xf)
32 
33 #define T3_GETCHILD(_x) (((_x) >> 8) & 0xf)
34 
44  T3_ANCHOR_TOPLEFT,
45  T3_ANCHOR_TOPRIGHT,
46  T3_ANCHOR_BOTTOMLEFT,
47  T3_ANCHOR_BOTTOMRIGHT,
48  T3_ANCHOR_CENTER,
49  T3_ANCHOR_TOPCENTER,
50  T3_ANCHOR_BOTTOMCENTER,
51  T3_ANCHOR_CENTERLEFT,
52  T3_ANCHOR_CENTERRIGHT
53 };
54 
58 typedef struct t3_window_t t3_window_t;
59 
60 T3_WINDOW_API t3_window_t *t3_win_new(t3_window_t *parent, int height, int width, int y, int x, int depth);
61 T3_WINDOW_API t3_window_t *t3_win_new_unbacked(t3_window_t *parent, int height, int width, int y, int x, int depth);
62 T3_WINDOW_API void t3_win_del(t3_window_t *win);
63 
64 T3_WINDOW_API t3_bool t3_win_set_parent(t3_window_t *win, t3_window_t *parent);
65 T3_WINDOW_API t3_bool t3_win_set_anchor(t3_window_t *win, t3_window_t *anchor, int relation);
66 T3_WINDOW_API void t3_win_set_depth(t3_window_t *win, int depth);
67 T3_WINDOW_API void t3_win_set_default_attrs(t3_window_t *win, t3_attr_t attr);
68 T3_WINDOW_API t3_bool t3_win_set_restrict(t3_window_t *win, t3_window_t *restrict);
69 
70 T3_WINDOW_API t3_bool t3_win_resize(t3_window_t *win, int height, int width);
71 T3_WINDOW_API void t3_win_move(t3_window_t *win, int y, int x);
72 T3_WINDOW_API int t3_win_get_width(t3_window_t *win);
73 T3_WINDOW_API int t3_win_get_height(t3_window_t *win);
74 T3_WINDOW_API int t3_win_get_x(t3_window_t *win);
75 T3_WINDOW_API int t3_win_get_y(t3_window_t *win);
76 T3_WINDOW_API int t3_win_get_abs_x(t3_window_t *win);
77 T3_WINDOW_API int t3_win_get_abs_y(t3_window_t *win);
78 T3_WINDOW_API int t3_win_get_depth(t3_window_t *win);
79 T3_WINDOW_API int t3_win_get_relation(t3_window_t *win, t3_window_t **anchor);
80 T3_WINDOW_API t3_window_t *t3_win_get_parent(t3_window_t *win);
81 T3_WINDOW_API void t3_win_set_cursor(t3_window_t *win, int y, int x);
82 T3_WINDOW_API void t3_win_set_paint(t3_window_t *win, int y, int x);
83 T3_WINDOW_API void t3_win_show(t3_window_t *win);
84 T3_WINDOW_API void t3_win_hide(t3_window_t *win);
85 
86 T3_WINDOW_API int t3_win_addnstr(t3_window_t *win, const char *str, size_t n, t3_attr_t attr);
87 T3_WINDOW_API int t3_win_addstr(t3_window_t *win, const char *str, t3_attr_t attr);
88 T3_WINDOW_API int t3_win_addch(t3_window_t *win, char c, t3_attr_t attr);
89 
90 T3_WINDOW_API int t3_win_addnstrrep(t3_window_t *win, const char *str, size_t n, t3_attr_t attr, int rep);
91 T3_WINDOW_API int t3_win_addstrrep(t3_window_t *win, const char *str, t3_attr_t attr, int rep);
92 T3_WINDOW_API int t3_win_addchrep(t3_window_t *win, char c, t3_attr_t attr, int rep);
93 
94 T3_WINDOW_API int t3_win_box(t3_window_t *win, int y, int x, int height, int width, t3_attr_t attr);
95 
96 T3_WINDOW_API void t3_win_clrtoeol(t3_window_t *win);
97 T3_WINDOW_API void t3_win_clrtobot(t3_window_t *win);
98 
99 T3_WINDOW_API t3_window_t *t3_win_at_location(int search_y, int search_x);
100 #ifdef __cplusplus
101 } /* extern "C" */
102 #endif
103 
104 #endif