1 /* Haiku window system support
2    Copyright (C) 2021 Free Software Foundation, Inc.
3 
4 This file is part of GNU Emacs.
5 
6 GNU Emacs is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or (at
9 your option) any later version.
10 
11 GNU Emacs is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.  */
18 
19 #ifndef _HAIKU_GUI_H_
20 #define _HAIKU_GUI_H_
21 
22 #ifdef _cplusplus
23 extern "C"
24 {
25 #endif
26 
27 typedef struct haiku_char_struct
28 {
29   int rbearing;
30   int lbearing;
31   int width;
32   int ascent;
33   int descent;
34 } XCharStruct;
35 
36 struct haiku_rect
37 {
38   int x, y;
39   int width, height;
40 };
41 
42 typedef void *haiku;
43 
44 typedef haiku Emacs_Pixmap;
45 typedef haiku Emacs_Window;
46 typedef haiku Emacs_Cursor;
47 typedef haiku Drawable;
48 
49 #define NativeRectangle struct haiku_rect
50 #define CONVERT_TO_EMACS_RECT(xr, nr)	\
51   ((xr).x     = (nr).x,			\
52    (xr).y     = (nr).y,			\
53    (xr).width = (nr).width,		\
54    (xr).height = (nr).height)
55 
56 #define CONVERT_FROM_EMACS_RECT(xr, nr)	\
57   ((nr).x    = (xr).x,			\
58    (nr).y    = (xr).y,			\
59    (nr).width  = (xr).width,		\
60    (nr).height = (xr).height)
61 
62 #define STORE_NATIVE_RECT(nr, px, py, pwidth, pheight)	\
63   ((nr).x    = (px),					\
64    (nr).y    = (py),					\
65    (nr).width  = (pwidth),				\
66    (nr).height = (pheight))
67 
68 #define ForgetGravity		0
69 #define NorthWestGravity	1
70 #define NorthGravity		2
71 #define NorthEastGravity	3
72 #define WestGravity		4
73 #define CenterGravity		5
74 #define EastGravity		6
75 #define SouthWestGravity	7
76 #define SouthGravity		8
77 #define SouthEastGravity	9
78 #define StaticGravity		10
79 
80 #define NoValue		0x0000
81 #define XValue  	0x0001
82 #define YValue		0x0002
83 #define WidthValue  	0x0004
84 #define HeightValue  	0x0008
85 #define AllValues 	0x000F
86 #define XNegative 	0x0010
87 #define YNegative 	0x0020
88 
89 #define USPosition	(1L << 0) /* user specified x, y */
90 #define USSize		(1L << 1) /* user specified width, height */
91 #define PPosition	(1L << 2) /* program specified position */
92 #define PSize		(1L << 3) /* program specified size */
93 #define PMinSize	(1L << 4) /* program specified minimum size */
94 #define PMaxSize	(1L << 5) /* program specified maximum size */
95 #define PResizeInc	(1L << 6) /* program specified resize increments */
96 #define PAspect		(1L << 7) /* program specified min, max aspect ratios */
97 #define PBaseSize	(1L << 8) /* program specified base for incrementing */
98 #define PWinGravity	(1L << 9) /* program specified window gravity */
99 
100 typedef haiku Window;
101 typedef int Display;
102 
103 #ifdef _cplusplus
104 };
105 #endif
106 #endif /* _HAIKU_GUI_H_ */
107