2947c665455dd203ef7a80c97fc317aef4b0d542
[rodin/chimara.git] / src / window.h
1 #ifndef WINDOW_H
2 #define WINDOW_H
3
4 #include <gtk/gtk.h>
5 #include "glk.h"
6
7 #include "stream.h"
8 #include "error.h"
9 #include "callbacks.h"
10 #include "input.h"
11
12 enum InputRequestType
13 {
14         INPUT_REQUEST_NONE,
15         INPUT_REQUEST_CHARACTER,
16         INPUT_REQUEST_CHARACTER_UNICODE,
17         INPUT_REQUEST_LINE,
18         INPUT_REQUEST_LINE_UNICODE
19 };
20
21 struct glk_window_struct
22 {
23         glui32 rock;
24         /* Pointer to the node in the global tree that contains this window */
25         GNode *window_node;
26         /* Window parameters */
27         glui32 type;
28         /* "widget" is the actual widget with the window's functionality */
29         GtkWidget *widget;
30         /* "frame" is the widget that is the child of the ChimaraGlk container, such 
31         as a scroll window. It may be the same as "widget". */
32         GtkWidget *frame;
33         /* Width and height of the window's size units, in pixels */
34         int unit_width;
35         int unit_height;
36         /* Streams associated with the window */
37         strid_t window_stream;
38         strid_t echo_stream;
39         /* Width and height of the window, in characters (text grids only) */
40         glui32 width;
41         glui32 height;
42         /* Input request stuff */
43         enum InputRequestType input_request_type;
44         gchar *line_input_buffer;
45         glui32 *line_input_buffer_unicode;
46         glui32 line_input_buffer_max_len;
47         gboolean mouse_input_requested;
48         /* Line input field coordinates (text grids only) */
49         
50         /* Signal handlers */
51         gulong keypress_handler;
52         gulong insert_text_handler;
53 };
54
55 #endif