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