elinks-0.11.4rc1
[elinks/elinks-j605.git] / src / terminal / window.h
blobf3a3c6a745be9424092d2c738aaf1ba5500238a5
1 #ifndef EL__TERMINAL_WINDOW_H
2 #define EL__TERMINAL_WINDOW_H
4 #include "util/lists.h"
6 struct term_event;
7 struct terminal;
8 struct window;
10 enum window_type {
11 /* Normal windows: */
12 /* Used for things like dialogs. The default type when adding windows
13 * with add_window(). */
14 WINDOW_NORMAL,
16 /* Tab windows: */
17 /* Tabs are a separate session and has separate history, current
18 * document and action-in-progress .. basically a separate browsing
19 * state. */
20 WINDOW_TAB,
23 typedef void (window_handler_T)(struct window *, struct term_event *);
25 struct window {
26 LIST_HEAD(struct window);
28 enum window_type type;
30 /* The window event handler */
31 window_handler_T *handler;
33 /* For tab windows the session is stored in @data. For normal windows
34 * it can contain dialog data. */
35 /* It is free()'d by delete_window() */
36 void *data;
38 /* The terminal (and screen) that hosts the window */
39 struct terminal *term;
41 /* Used for tabs focus detection. */
42 int xpos, width;
43 int x, y;
45 /* For delayed tab resizing */
46 unsigned int resize:1;
49 void redraw_from_window(struct window *);
50 void redraw_below_window(struct window *);
51 void add_window(struct terminal *, window_handler_T, void *);
52 void delete_window(struct window *);
53 void delete_window_ev(struct window *, struct term_event *ev);
54 #define set_window_ptr(window, x_, y_) do { (window)->x = (x_); (window)->y = (y_); } while (0)
55 void get_parent_ptr(struct window *, int *, int *);
57 void add_empty_window(struct terminal *, void (*)(void *), void *);
59 #endif