e0222b0215e47cccd8e9ab3432309453472d2771
[rodin/chimara.git] / libchimara / window.h
1 #ifndef WINDOW_H
2 #define WINDOW_H
3
4 #include <gtk/gtk.h>
5 #include "glk.h"
6 #include "gi_dispa.h"
7 #include "stream.h"
8 #include "input.h"
9 #include "style.h"
10 #include "hyperlink.h"
11
12
13 enum InputRequestType
14 {
15         INPUT_REQUEST_NONE,
16         INPUT_REQUEST_CHARACTER,
17         INPUT_REQUEST_CHARACTER_UNICODE,
18         INPUT_REQUEST_LINE,
19         INPUT_REQUEST_LINE_UNICODE
20 };
21
22 /**
23  * glk_window_struct:
24  *
25  * This is an opaque structure (see <link linkend="chimara-Opaque-Structures">
26  * Opaque Structures</link> and should not be accessed directly.
27  */
28 struct glk_window_struct
29 {
30         /*< private >*/
31         glui32 magic, rock;
32         gidispatch_rock_t disprock;
33         /* Pointer to the node in the global tree that contains this window */
34         GNode *window_node;
35         /* Window parameters */
36         glui32 type;
37         /* "widget" is the actual widget with the window's functionality */
38         GtkWidget *widget;
39         /* "frame" is the widget that is the child of the ChimaraGlk container, such 
40         as a scroll window. It may be the same as "widget". */
41         GtkWidget *frame;
42         /* Width and height of the window's size units, in pixels */
43         int unit_width;
44         int unit_height;
45         /* Streams associated with the window */
46         strid_t window_stream;
47         strid_t echo_stream;
48         /* Width and height of the window, in characters (text grids only) */
49         glui32 width;
50         glui32 height;
51         /* Window split data (pair windows only) */
52         winid_t key_window;
53         glui32 split_method;
54         glui32 constraint_size;
55         /* Input request stuff */
56         enum InputRequestType input_request_type;
57         gchar *line_input_buffer;
58         glui32 *line_input_buffer_unicode;
59         glui32 line_input_buffer_max_len;
60         gidispatch_rock_t buffer_rock;
61         gboolean mouse_input_requested;
62         GList *history;
63         GList *history_pos;
64         /* Line input field (text grids only) */
65         glui32 input_length;
66         GtkTextChildAnchor *input_anchor;
67         GtkWidget *input_entry;
68         gulong line_input_entry_changed;
69         /* Signal handlers */
70         gulong char_input_keypress_handler;
71         gulong line_input_keypress_handler;
72         gulong insert_text_handler;
73         gulong tag_event_handler;
74         /* Window buffer */
75         GString *buffer;
76         /* Hyperlinks */
77         GHashTable *hyperlinks;
78         struct hyperlink *current_hyperlink;
79 };
80
81 #endif