- WINDOW *handle; /* Window handle. */
- enum tui_win_type type; /* Type of window. */
- int width; /* Window width. */
- int height; /* Window height. */
- struct tui_point origin; /* Origin of window. */
- tui_win_content content; /* Content of window. */
- int content_size; /* Size of content (# of elements). */
- int content_in_use; /* Can it be used, or is it already used? */
- int viewport_height; /* Viewport height. */
- int last_visible_line; /* Index of last visible line. */
- int is_visible; /* Whether the window is visible or not. */
- char *title; /* Window title to display. */
+protected:
+
+ explicit tui_gen_win_info (enum tui_win_type t)
+ : type (t)
+ {
+ }
+
+ /* This is called after the window is resized, and should update the
+ window's contents. */
+ virtual void rerender ()
+ {
+ }
+
+ virtual void make_window ();
+
+public:
+ tui_gen_win_info (tui_gen_win_info &&) = default;
+
+ virtual ~tui_gen_win_info ();
+
+ /* Call to refresh this window. */
+ virtual void refresh_window ();
+
+ /* Make this window visible or invisible. */
+ virtual void make_visible (bool visible);
+
+ /* Return the name of this type of window. */
+ virtual const char *name () const
+ {
+ return "";
+ }
+
+ /* Resize this window. The parameters are used to set the window's
+ size and position. */
+ virtual void resize (int height, int width,
+ int origin_x, int origin_y);
+
+ /* Return true if this window is visible. */
+ bool is_visible () const
+ {
+ return handle != nullptr;
+ }
+
+ /* Window handle. */
+ WINDOW *handle = nullptr;
+ /* Type of window. */
+ enum tui_win_type type;
+ /* Window width. */
+ int width = 0;
+ /* Window height. */
+ int height = 0;
+ /* Origin of window. */
+ struct tui_point origin = {0, 0};
+ /* Viewport height. */
+ int viewport_height = 0;