summaryrefslogtreecommitdiff
path: root/src/lib/ecore_cocoa/Ecore_Cocoa.h
blob: caae2d07412e6e8b056d34f0e83d56f218df161f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
#ifndef __ECORE_COCOA_H__
#define __ECORE_COCOA_H__

/*
 * DO NOT USE THIS HEADER. IT IS WORK IN PROGRESS. IT IS NOT FINAL AND
 * THE API MAY CHANGE.
 */

#ifndef ECORE_COCOA_WIP_GNSIDNQI
# warning "You are using a work in progress API. This API is not stable"
# warning "and is subject to change. You use this at your own risk."
#endif

#ifdef EAPI
# undef EAPI
#endif

#ifdef __GNUC__
# if __GNUC__ >= 4
#  define EAPI __attribute__ ((visibility("default")))
# else
#  define EAPI
# endif
#else
# define EAPI
#endif

#include <Eina.h>
#include "Ecore_Cocoa_Cursor.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct _Ecore_Cocoa_Window Ecore_Cocoa_Window;
typedef struct _Ecore_Cocoa_Screen Ecore_Cocoa_Screen;

EAPI extern int ECORE_COCOA_EVENT_GOT_FOCUS;
EAPI extern int ECORE_COCOA_EVENT_LOST_FOCUS;
EAPI extern int ECORE_COCOA_EVENT_RESIZE;
EAPI extern int ECORE_COCOA_EVENT_EXPOSE;
EAPI extern int ECORE_COCOA_EVENT_WINDOW_DESTROY;
EAPI extern int ECORE_COCOA_EVENT_DATA_SOURCE_SEND;
EAPI extern int ECORE_COCOA_EVENT_SELECTION_DATA_READY;

typedef void * Ecore_Cocoa_Window_Id;
typedef struct _Ecore_Cocoa_Event_Video_Resize Ecore_Cocoa_Event_Video_Resize;
struct _Ecore_Cocoa_Event_Video_Resize
{
   int             w;
   int             h;
   Ecore_Cocoa_Window_Id wid;
};

typedef struct _Ecore_Cocoa_Event_Window Ecore_Cocoa_Event_Window;
struct _Ecore_Cocoa_Event_Window
{
   Ecore_Cocoa_Window_Id wid;
};

struct _Ecore_Cocoa_Screen
{
  int dummy;
};

typedef enum
{
   ECORE_COCOA_CNP_TYPE_UNKNOWN = 0,
   ECORE_COCOA_CNP_TYPE_STRING  = (1 << 0),
   ECORE_COCOA_CNP_TYPE_MARKUP  = (1 << 1),
   ECORE_COCOA_CNP_TYPE_IMAGE   = (1 << 2),
   ECORE_COCOA_CNP_TYPE_HTML    = (1 << 3)
} Ecore_Cocoa_Cnp_Type;

/* Core */

EAPI int  ecore_cocoa_init(void);
EAPI int  ecore_cocoa_shutdown(void);
EAPI Eina_Bool ecore_cocoa_feed_events(void *anEvent);

/* Screen */

EAPI void ecore_cocoa_screen_size_get(Ecore_Cocoa_Screen *screen, int *w, int *h);

/* Window */

EAPI Ecore_Cocoa_Window *ecore_cocoa_window_new(int x,
                                                int y,
                                                int width,
                                                int height);

EAPI void ecore_cocoa_window_free(Ecore_Cocoa_Window *window);

EAPI void *ecore_cocoa_window_hwnd_get(Ecore_Cocoa_Window *window);

EAPI void ecore_cocoa_window_move(Ecore_Cocoa_Window *window,
                                  int                 x,
                                  int                 y);

EAPI void ecore_cocoa_window_resize(Ecore_Cocoa_Window *window,
                                    int                 width,
                                    int                 height);

EAPI void ecore_cocoa_window_move_resize(Ecore_Cocoa_Window *window,
                                         int                 x,
                                         int                 y,
                                         int                 width,
                                         int                 height);

EAPI void ecore_cocoa_window_geometry_get(Ecore_Cocoa_Window *window,
                                          int                *x,
                                          int                *y,
                                          int                *width,
                                          int                *height);

EAPI void ecore_cocoa_window_size_get(Ecore_Cocoa_Window *window,
                                      int                *width,
                                      int                *height);

EAPI void ecore_cocoa_window_size_min_set(Ecore_Cocoa_Window *window,
                                          unsigned int        min_width,
                                          unsigned int        min_height);

EAPI void ecore_cocoa_window_size_min_get(Ecore_Cocoa_Window *window,
                                          unsigned int       *min_width,
                                          unsigned int       *min_height);

EAPI void ecore_cocoa_window_size_max_set(Ecore_Cocoa_Window *window,
                                          unsigned int        max_width,
                                          unsigned int        max_height);

EAPI void ecore_cocoa_window_size_max_get(Ecore_Cocoa_Window *window,
                                          unsigned int       *max_width,
                                          unsigned int       *max_height);

EAPI void ecore_cocoa_window_size_base_set(Ecore_Cocoa_Window *window,
                                           unsigned int        base_width,
                                           unsigned int        base_height);

EAPI void ecore_cocoa_window_size_base_get(Ecore_Cocoa_Window *window,
                                           unsigned int       *base_width,
                                           unsigned int       *base_height);

EAPI void ecore_cocoa_window_size_step_set(Ecore_Cocoa_Window *window,
                                           unsigned int        step_width,
                                           unsigned int        step_height);

EAPI void ecore_cocoa_window_size_step_get(Ecore_Cocoa_Window *window,
                                           unsigned int       *step_width,
                                           unsigned int       *step_height);

EAPI void ecore_cocoa_window_show(Ecore_Cocoa_Window *window);

EAPI void ecore_cocoa_window_hide(Ecore_Cocoa_Window *window);

EAPI void ecore_cocoa_window_raise(Ecore_Cocoa_Window *window);

EAPI void ecore_cocoa_window_lower(Ecore_Cocoa_Window *window);

EAPI void ecore_cocoa_window_activate(Ecore_Cocoa_Window *window);

EAPI void ecore_cocoa_window_title_set(Ecore_Cocoa_Window *window,
                                       const char         *title);

EAPI void ecore_cocoa_window_focus_set(Ecore_Cocoa_Window *window);

EAPI void ecore_cocoa_window_iconified_set(Ecore_Cocoa_Window *window,
                                           int                 on);

EAPI void ecore_cocoa_window_borderless_set(Ecore_Cocoa_Window *window,
                                            int                 on);

EAPI void ecore_cocoa_window_view_set(Ecore_Cocoa_Window *window,
                                      void *view);

EAPI int ecore_cocoa_titlebar_height_get(void);

EAPI Ecore_Cocoa_Window_Id ecore_cocoa_window_get_window_id(const Ecore_Cocoa_Window *window);



/**
 * @return false on error, true otherwise
 *
 * @ingroup Ecore_Cocoa_Cpn_Group
 */
EAPI Eina_Bool ecore_cocoa_selection_clipboard_set(const void *data, int size, Ecore_Cocoa_Cnp_Type type);

/**
 * @return false if type not found or on error, true otherwise
 *
 * @ingroup Ecore_Cocoa_Cnp_Group
 */
EAPI void *ecore_cocoa_selection_clipboard_get(int *size, Ecore_Cocoa_Cnp_Type type,
                                               Ecore_Cocoa_Cnp_Type *retrieved_types);

/**
 * @ingroup Ecore_Cocoa_Cnp_Group
 */
EAPI void ecore_cocoa_selection_clipboard_clear(void);

EAPI void ecore_cocoa_window_cursor_set(Ecore_Cocoa_Window *win, Ecore_Cocoa_Cursor c);
EAPI void ecore_cocoa_window_cursor_show(Ecore_Cocoa_Window *win, Eina_Bool show);

#ifdef __cplusplus
}
#endif

#undef EAPI
#define EAPI

#endif