1 | /*
|
---|
2 | * Copyright (c) 2012 Petr Koupy
|
---|
3 | * All rights reserved.
|
---|
4 | *
|
---|
5 | * Redistribution and use in source and binary forms, with or without
|
---|
6 | * modification, are permitted provided that the following conditions
|
---|
7 | * are met:
|
---|
8 | *
|
---|
9 | * - Redistributions of source code must retain the above copyright
|
---|
10 | * notice, this list of conditions and the following disclaimer.
|
---|
11 | * - Redistributions in binary form must reproduce the above copyright
|
---|
12 | * notice, this list of conditions and the following disclaimer in the
|
---|
13 | * documentation and/or other materials provided with the distribution.
|
---|
14 | * - The name of the author may not be used to endorse or promote products
|
---|
15 | * derived from this software without specific prior written permission.
|
---|
16 | *
|
---|
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
27 | */
|
---|
28 |
|
---|
29 | /** @addtogroup libc
|
---|
30 | * @{
|
---|
31 | */
|
---|
32 | /** @file
|
---|
33 | */
|
---|
34 |
|
---|
35 | #ifndef _LIBC_IO_WINDOW_H_
|
---|
36 | #define _LIBC_IO_WINDOW_H_
|
---|
37 |
|
---|
38 | #include <io/kbd_event.h>
|
---|
39 | #include <io/pos_event.h>
|
---|
40 | #include <types/common.h>
|
---|
41 |
|
---|
42 | typedef enum {
|
---|
43 | WINDOW_MAIN = 1,
|
---|
44 | WINDOW_DECORATED = 2,
|
---|
45 | WINDOW_RESIZEABLE = 4
|
---|
46 | } window_flags_t;
|
---|
47 |
|
---|
48 | typedef enum {
|
---|
49 | GF_EMPTY = 0,
|
---|
50 | GF_MOVE_X = 1,
|
---|
51 | GF_MOVE_Y = 2,
|
---|
52 | GF_RESIZE_X = 4,
|
---|
53 | GF_RESIZE_Y = 8,
|
---|
54 | GF_SCALE_X = 16,
|
---|
55 | GF_SCALE_Y = 32
|
---|
56 | } window_grab_flags_t;
|
---|
57 |
|
---|
58 | typedef enum {
|
---|
59 | WINDOW_PLACEMENT_ANY = 0,
|
---|
60 | WINDOW_PLACEMENT_CENTER_X = 1,
|
---|
61 | WINDOW_PLACEMENT_CENTER_Y = 2,
|
---|
62 | WINDOW_PLACEMENT_CENTER =
|
---|
63 | WINDOW_PLACEMENT_CENTER_X | WINDOW_PLACEMENT_CENTER_Y,
|
---|
64 | WINDOW_PLACEMENT_LEFT = 4,
|
---|
65 | WINDOW_PLACEMENT_RIGHT = 8,
|
---|
66 | WINDOW_PLACEMENT_TOP = 16,
|
---|
67 | WINDOW_PLACEMENT_BOTTOM = 32,
|
---|
68 | WINDOW_PLACEMENT_ABSOLUTE_X = 64,
|
---|
69 | WINDOW_PLACEMENT_ABSOLUTE_Y = 128,
|
---|
70 | WINDOW_PLACEMENT_ABSOLUTE =
|
---|
71 | WINDOW_PLACEMENT_ABSOLUTE_X | WINDOW_PLACEMENT_ABSOLUTE_Y
|
---|
72 | } window_placement_flags_t;
|
---|
73 |
|
---|
74 | typedef struct {
|
---|
75 | sysarg_t object;
|
---|
76 | sysarg_t slot;
|
---|
77 | sysarg_t argument;
|
---|
78 | } signal_event_t;
|
---|
79 |
|
---|
80 | typedef struct {
|
---|
81 | sysarg_t offset_x;
|
---|
82 | sysarg_t offset_y;
|
---|
83 | sysarg_t width;
|
---|
84 | sysarg_t height;
|
---|
85 | window_placement_flags_t placement_flags;
|
---|
86 | } resize_event_t;
|
---|
87 |
|
---|
88 | typedef enum {
|
---|
89 | ET_KEYBOARD_EVENT,
|
---|
90 | ET_POSITION_EVENT,
|
---|
91 | ET_SIGNAL_EVENT,
|
---|
92 | ET_WINDOW_FOCUS,
|
---|
93 | ET_WINDOW_UNFOCUS,
|
---|
94 | ET_WINDOW_RESIZE,
|
---|
95 | ET_WINDOW_REFRESH,
|
---|
96 | ET_WINDOW_DAMAGE,
|
---|
97 | ET_WINDOW_CLOSE
|
---|
98 | } window_event_type_t;
|
---|
99 |
|
---|
100 | typedef union {
|
---|
101 | kbd_event_t kbd;
|
---|
102 | pos_event_t pos;
|
---|
103 | signal_event_t signal;
|
---|
104 | resize_event_t resize;
|
---|
105 | } window_event_data_t;
|
---|
106 |
|
---|
107 | typedef struct {
|
---|
108 | link_t link;
|
---|
109 | window_event_type_t type;
|
---|
110 | window_event_data_t data;
|
---|
111 | } window_event_t;
|
---|
112 |
|
---|
113 | #endif
|
---|
114 |
|
---|
115 | /** @}
|
---|
116 | */
|
---|