Change I/O signals to pass a unique window ID
[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         char *librock; /* "library rock" - unique string identifier */
36         gidispatch_rock_t disprock;
37         /* Pointer to the node in the global tree that contains this window */
38         GNode *window_node;
39         /* Window parameters */
40         glui32 type;
41         /* "widget" is the actual widget with the window's functionality */
42         GtkWidget *widget;
43         /* "frame" is the widget that is the child of the ChimaraGlk container, such 
44         as a scroll window. It may be the same as "widget". */
45         GtkWidget *frame;
46         /* Width and height of the window's size units, in pixels */
47         int unit_width;
48         int unit_height;
49         /* Streams associated with the window */
50         strid_t window_stream;
51         strid_t echo_stream;
52         /* Width and height of the window, in characters (text grids only) */
53         glui32 width;
54         glui32 height;
55         /* Window split data (pair windows only) */
56         winid_t key_window;
57         glui32 split_method;
58         glui32 constraint_size;
59         /* Input request stuff */
60         enum InputRequestType input_request_type;
61         gchar *line_input_buffer;
62         glui32 *line_input_buffer_unicode;
63         glui32 line_input_buffer_max_len;
64         gidispatch_rock_t buffer_rock;
65         gboolean mouse_input_requested;
66         GList *history;
67         GList *history_pos;
68         GSList *extra_line_terminators;
69         GSList *current_extra_line_terminators;
70         /* Line input echoing (text buffers only) */
71         gboolean echo_line_input;
72         gboolean echo_current_line_input;
73         /* Line input field (text grids only) */
74         glui32 input_length;
75         GtkTextChildAnchor *input_anchor;
76         GtkWidget *input_entry;
77         gulong line_input_entry_changed;
78         /* Signal handlers */
79         gulong char_input_keypress_handler;
80         gulong line_input_keypress_handler;
81         gulong insert_text_handler;
82         gulong tag_event_handler;
83         gulong shutdown_keypress_handler;
84         gulong button_press_event_handler;
85         gulong size_allocate_handler;
86         gulong pager_expose_handler;
87         gulong pager_keypress_handler;
88         gulong pager_adjustment_handler;
89         /* Window buffer */
90         GString *buffer;
91         GtkTextTag *zcolor;
92         GtkTextTag *zcolor_reversed;
93         /* Hyperlinks */
94         GHashTable *hyperlinks;
95         struct hyperlink *current_hyperlink;
96         gboolean hyperlink_event_requested;
97         /* Graphics */
98         glui32 background_color;
99         cairo_surface_t *backing_store;
100         /* Pager (textbuffer only) */
101         gboolean currently_paging;
102         PangoLayout *pager_layout;
103 };
104
105 #endif