1 #ifndef EL__TERMINAL_WINDOW_H
2 #define EL__TERMINAL_WINDOW_H
4 #include "util/lists.h"
13 * Used for things like dialogs. The default type when adding windows
14 * with add_window(). */
18 * Tabs are a separate session and has separate history, current
19 * document and action-in-progress .. basically a separate browsing
24 typedef void (window_handler_T
)(struct window
*, struct term_event
*);
26 /** A window in the terminal screen. This structure does not know the
27 * position and size of the window, and no functions are provided for
28 * drawing into a window. Instead, when window.handler draws the
29 * window, it should decide the position and size of the window, and
30 * then draw directly to the terminal, taking care not to draw outside
31 * the window. Windows generally do not have their own coordinate
32 * systems; they get mouse events in the coordinate system of the
35 LIST_HEAD(struct window
); /*!< terminal.windows is the sentinel. */
37 /** Whether this is a normal window or a tab window. */
38 enum window_type type
;
40 /** The window event handler */
41 window_handler_T
*handler
;
43 /** For tab windows the session is stored in @c data.
44 * For normal windows it can contain dialog data.
45 * It is free()'d by delete_window() */
48 /** The terminal (and screen) that hosts the window */
49 struct terminal
*term
;
51 /** For ::WINDOW_TAB, the position and size in the tab bar.
52 * Updated while the tab bar is being drawn, and read if the
53 * user clicks there with the mouse. */
56 /** The position of something that has focus in the window.
57 * Any popup menus are drawn near this position.
58 * In tab windows, during ::NAVIGATE_CURSOR_ROUTING, this is
59 * also the position of the cursor that the user can move;
60 * there is no separate cursor position for each frame.
61 * In dialog boxes, this is typically the top left corner of
62 * the focused widget, while the cursor is somewhere within
64 * @see set_window_ptr, get_parent_ptr, set_cursor */
67 /** For delayed tab resizing */
68 unsigned int resize
:1;
71 /** Which windows redraw_windows() should redraw. */
72 enum windows_to_redraw
{
73 /** Redraw the windows in front of the specified window,
74 * but not the specified window itself. */
75 REDRAW_IN_FRONT_OF_WINDOW
,
77 /** Redraw the specified window, and the windows in front of
79 REDRAW_WINDOW_AND_FRONT
,
81 /** Redraw the windows behind the specified window,
82 * but not the specified window itself.
83 * Do that even if terminal.redrawing is TREDRAW_BUSY. */
87 void redraw_windows(enum windows_to_redraw
, struct window
*);
88 void add_window(struct terminal
*, window_handler_T
, void *);
89 void delete_window(struct window
*);
90 void delete_window_ev(struct window
*, struct term_event
*ev
);
91 #define set_window_ptr(window, x_, y_) do { (window)->x = (x_); (window)->y = (y_); } while (0)
92 void set_dlg_window_ptr(struct dialog_data
*dlg_data
, struct window
*window
, int x
, int y
);
93 void get_parent_ptr(struct window
*, int *, int *);
95 void add_empty_window(struct terminal
*, void (*)(void *), void *);
98 void assert_window_stacking(struct terminal
*);
100 #define assert_window_stacking(t) ((void) (t))