Convert the pager to a GtkOverlay
[projects/chimara/chimara.git] / libchimara / window.h
1 #ifndef WINDOW_H
2 #define WINDOW_H
3
4 #include <gtk/gtk.h>
5 #include "chimara-glk-private.h"
6 #include "glk.h"
7 #include "gi_dispa.h"
8 #include "stream.h"
9 #include "input.h"
10 #include "style.h"
11 #include "hyperlink.h"
12 #include "mouse.h"
13 #include "graphics.h"
14
15
16 enum InputRequestType
17 {
18         INPUT_REQUEST_NONE,
19         INPUT_REQUEST_CHARACTER,
20         INPUT_REQUEST_CHARACTER_UNICODE,
21         INPUT_REQUEST_LINE,
22         INPUT_REQUEST_LINE_UNICODE
23 };
24
25 /**
26  * glk_window_struct:
27  *
28  * This is an opaque structure (see <link linkend="chimara-Opaque-Structures">
29  * Opaque Structures</link> and should not be accessed directly.
30  */
31 struct glk_window_struct
32 {
33         /*< private >*/
34         glui32 magic, rock;
35         gidispatch_rock_t disprock;
36         /* Pointer to the node in the global tree that contains this window */
37         GNode *window_node;
38         /* Window parameters */
39         glui32 type;
40         /* "widget" is the actual widget with the window's functionality */
41         GtkWidget *widget;
42         /* "frame" is the widget that is the child of the ChimaraGlk container, such 
43         as a scroll window. It may be the same as "widget". */
44         GtkWidget *frame;
45         /* In text buffer windows, the scrolled window and the pager are extra
46         widgets that are neither "widget" nor "frame" */
47         GtkWidget *scrolledwindow;
48         GtkWidget *pager;
49         /* Width and height of the window's size units, in pixels */
50         int unit_width;
51         int unit_height;
52         /* Streams associated with the window */
53         strid_t window_stream;
54         strid_t echo_stream;
55         /* Width and height of the window, in characters (text grids only) */
56         glui32 width;
57         glui32 height;
58         /* Window split data (pair windows only) */
59         winid_t key_window;
60         glui32 split_method;
61         glui32 constraint_size;
62         /* Input request stuff */
63         enum InputRequestType input_request_type;
64         gchar *line_input_buffer;
65         glui32 *line_input_buffer_unicode;
66         glui32 line_input_buffer_max_len;
67         gidispatch_rock_t buffer_rock;
68         gboolean mouse_input_requested;
69         GList *history;
70         GList *history_pos;
71         GSList *extra_line_terminators;
72         GSList *current_extra_line_terminators;
73         /* Line input echoing (text buffers only) */
74         gboolean echo_line_input;
75         gboolean echo_current_line_input;
76         /* Line input field (text grids only) */
77         glui32 input_length;
78         GtkTextChildAnchor *input_anchor;
79         GtkWidget *input_entry;
80         gulong line_input_entry_changed;
81         /* Signal handlers */
82         gulong char_input_keypress_handler;
83         gulong line_input_keypress_handler;
84         gulong insert_text_handler;
85         gulong tag_event_handler;
86         gulong shutdown_keypress_handler;
87         gulong button_press_event_handler;
88         gulong size_allocate_handler;
89         gulong pager_keypress_handler;
90         gulong pager_adjustment_handler;
91         /* Window buffer */
92         GString *buffer;
93         GtkTextTag *zcolor;
94         GtkTextTag *zcolor_reversed;
95         /* Hyperlinks */
96         GHashTable *hyperlinks;
97         struct hyperlink *current_hyperlink;
98         gboolean hyperlink_event_requested;
99         /* Graphics */
100         glui32 background_color;
101         cairo_surface_t *backing_store;
102         /* Pager (textbuffer only) */
103         gboolean currently_paging;
104         PangoLayout *pager_layout;
105 };
106
107 #endif