libt3window
|
00001 /* Copyright (C) 2011 G.P. Halkes 00002 This program is free software: you can redistribute it and/or modify 00003 it under the terms of the GNU General Public License version 3, as 00004 published by the Free Software Foundation. 00005 00006 This program is distributed in the hope that it will be useful, 00007 but WITHOUT ANY WARRANTY; without even the implied warranty of 00008 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00009 GNU General Public License for more details. 00010 00011 You should have received a copy of the GNU General Public License 00012 along with this program. If not, see <http://www.gnu.org/licenses/>. 00013 */ 00014 #ifndef T3_WINDOW_H 00015 #define T3_WINDOW_H 00016 00019 #include <stdlib.h> 00020 #include <t3window/terminal.h> 00021 00022 #ifdef __cplusplus 00023 extern "C" { 00024 #endif 00025 00027 #define T3_PARENT(_x) ((_x) << 4) 00028 00029 #define T3_CHILD(_x) ((_x) << 8) 00030 00031 #define T3_GETPARENT(_x) (((_x) >> 4) & 0xf) 00032 00033 #define T3_GETCHILD(_x) (((_x) >> 8) & 0xf) 00034 00043 enum t3_win_anchor_t { 00044 T3_ANCHOR_TOPLEFT, 00045 T3_ANCHOR_TOPRIGHT, 00046 T3_ANCHOR_BOTTOMLEFT, 00047 T3_ANCHOR_BOTTOMRIGHT, 00048 T3_ANCHOR_CENTER, 00049 T3_ANCHOR_TOPCENTER, 00050 T3_ANCHOR_BOTTOMCENTER, 00051 T3_ANCHOR_CENTERLEFT, 00052 T3_ANCHOR_CENTERRIGHT 00053 }; 00054 00058 typedef struct t3_window_t t3_window_t; 00059 00060 T3_WINDOW_API t3_window_t *t3_win_new(t3_window_t *parent, int height, int width, int y, int x, int depth); 00061 T3_WINDOW_API t3_window_t *t3_win_new_unbacked(t3_window_t *parent, int height, int width, int y, int x, int depth); 00062 T3_WINDOW_API void t3_win_del(t3_window_t *win); 00063 00064 T3_WINDOW_API t3_bool t3_win_set_parent(t3_window_t *win, t3_window_t *parent); 00065 T3_WINDOW_API t3_bool t3_win_set_anchor(t3_window_t *win, t3_window_t *anchor, int relation); 00066 T3_WINDOW_API void t3_win_set_depth(t3_window_t *win, int depth); 00067 T3_WINDOW_API void t3_win_set_default_attrs(t3_window_t *win, t3_attr_t attr); 00068 T3_WINDOW_API t3_bool t3_win_set_restrict(t3_window_t *win, t3_window_t *restrict); 00069 00070 T3_WINDOW_API t3_bool t3_win_resize(t3_window_t *win, int height, int width); 00071 T3_WINDOW_API void t3_win_move(t3_window_t *win, int y, int x); 00072 T3_WINDOW_API int t3_win_get_width(t3_window_t *win); 00073 T3_WINDOW_API int t3_win_get_height(t3_window_t *win); 00074 T3_WINDOW_API int t3_win_get_x(t3_window_t *win); 00075 T3_WINDOW_API int t3_win_get_y(t3_window_t *win); 00076 T3_WINDOW_API int t3_win_get_abs_x(t3_window_t *win); 00077 T3_WINDOW_API int t3_win_get_abs_y(t3_window_t *win); 00078 T3_WINDOW_API int t3_win_get_depth(t3_window_t *win); 00079 T3_WINDOW_API int t3_win_get_relation(t3_window_t *win, t3_window_t **anchor); 00080 T3_WINDOW_API t3_window_t *t3_win_get_parent(t3_window_t *win); 00081 T3_WINDOW_API void t3_win_set_cursor(t3_window_t *win, int y, int x); 00082 T3_WINDOW_API void t3_win_set_paint(t3_window_t *win, int y, int x); 00083 T3_WINDOW_API void t3_win_show(t3_window_t *win); 00084 T3_WINDOW_API void t3_win_hide(t3_window_t *win); 00085 00086 T3_WINDOW_API int t3_win_addnstr(t3_window_t *win, const char *str, size_t n, t3_attr_t attr); 00087 T3_WINDOW_API int t3_win_addstr(t3_window_t *win, const char *str, t3_attr_t attr); 00088 T3_WINDOW_API int t3_win_addch(t3_window_t *win, char c, t3_attr_t attr); 00089 00090 T3_WINDOW_API int t3_win_addnstrrep(t3_window_t *win, const char *str, size_t n, t3_attr_t attr, int rep); 00091 T3_WINDOW_API int t3_win_addstrrep(t3_window_t *win, const char *str, t3_attr_t attr, int rep); 00092 T3_WINDOW_API int t3_win_addchrep(t3_window_t *win, char c, t3_attr_t attr, int rep); 00093 00094 T3_WINDOW_API int t3_win_box(t3_window_t *win, int y, int x, int height, int width, t3_attr_t attr); 00095 00096 T3_WINDOW_API void t3_win_clrtoeol(t3_window_t *win); 00097 T3_WINDOW_API void t3_win_clrtobot(t3_window_t *win); 00098 00099 T3_WINDOW_API t3_window_t *t3_win_at_location(int search_y, int search_x); 00100 #ifdef __cplusplus 00101 } /* extern "C" */ 00102 #endif 00103 00104 #endif