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