1 #ifndef WIDGET_H_INCLUDED 2 #define WIDGET_H_INCLUDED 3 4 #include <panel.h> 5 6 #define WIDGET_BORDER 0x1 7 #define WIDGET_SUBWINDOW 0x2 8 #define WIDGET_CURSOR_VISIBLE 0x4 9 10 #define SCREEN_CENTER -1 11 12 struct widget { 13 WINDOW *window; 14 WINDOW *subwindow; /* optional: contents without border */ 15 PANEL *panel; 16 int cursor_visibility; 17 18 void (*handle_key)(int key); 19 void (*window_size_changed)(void); 20 void (*close)(void); 21 }; 22 23 extern int screen_lines; 24 extern int screen_cols; 25 26 void widget_init(struct widget *widget, 27 int lines_, int cols, int y, int x, 28 chtype bkgd, unsigned int flags); 29 void widget_free(struct widget *widget); 30 const struct widget *get_active_widget(void); 31 void window_size_changed(void); 32 33 #endif 34