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