2015-10-13 09:14:13 -07:00
|
|
|
/**
|
|
|
|
* @file Ecore_Cocoa.h
|
|
|
|
*
|
|
|
|
* @brief Ecore_Cocoa Wrapper Library to interact with the Cocoa
|
|
|
|
* envirnement (Mac OS X) from the E environment
|
|
|
|
*
|
|
|
|
*/
|
2011-11-02 12:20:09 -07:00
|
|
|
#ifndef __ECORE_COCOA_H__
|
|
|
|
#define __ECORE_COCOA_H__
|
2010-03-27 11:28:50 -07:00
|
|
|
|
2010-09-23 22:30:51 -07:00
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
|
2016-01-05 14:29:35 -08:00
|
|
|
#include <Eina.h>
|
|
|
|
|
2010-03-27 11:28:50 -07:00
|
|
|
#ifdef EAPI
|
|
|
|
# undef EAPI
|
|
|
|
#endif
|
|
|
|
|
2010-09-23 22:30:51 -07:00
|
|
|
#ifdef __GNUC__
|
|
|
|
# if __GNUC__ >= 4
|
|
|
|
# define EAPI __attribute__ ((visibility("default")))
|
2010-03-27 11:28:50 -07:00
|
|
|
# else
|
|
|
|
# define EAPI
|
|
|
|
# endif
|
2010-09-23 22:30:51 -07:00
|
|
|
#else
|
|
|
|
# define EAPI
|
|
|
|
#endif
|
2010-03-27 11:28:50 -07:00
|
|
|
|
2015-10-08 02:58:46 -07:00
|
|
|
#include "Ecore_Cocoa_Cursor.h"
|
2014-09-03 11:34:52 -07:00
|
|
|
|
2010-03-27 11:28:50 -07:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2015-10-13 09:14:13 -07:00
|
|
|
/**
|
|
|
|
* @typedef Ecore_Cocoa_Window
|
|
|
|
* Opaque handler to manipulate a Cocoa Window through Ecore
|
|
|
|
*/
|
2015-10-14 00:08:38 -07:00
|
|
|
#ifndef _ECORE_COCOA_WINDOW_PREDEF
|
2010-03-27 11:28:50 -07:00
|
|
|
typedef struct _Ecore_Cocoa_Window Ecore_Cocoa_Window;
|
2015-10-14 00:08:38 -07:00
|
|
|
#endif /* ! _ECORE_COCOA_WINDOW_PREDEF */
|
2015-10-13 09:14:13 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @typedef Ecore_Cocoa_Screen
|
|
|
|
* Opaque handler to manipulate a Cocoa Screen through Ecore
|
|
|
|
*/
|
2014-06-08 12:50:42 -07:00
|
|
|
typedef struct _Ecore_Cocoa_Screen Ecore_Cocoa_Screen;
|
2010-03-27 11:28:50 -07:00
|
|
|
|
2015-10-13 09:14:13 -07:00
|
|
|
/**
|
|
|
|
* @typedef Ecore_Cocoa_Window_Id
|
|
|
|
* Opaque handler to reference the actual Cocoa window
|
|
|
|
*/
|
|
|
|
typedef void * Ecore_Cocoa_Window_Id;
|
|
|
|
|
2016-01-05 15:03:57 -08:00
|
|
|
/**
|
|
|
|
* @typedef Ecore_Cocoa_Object
|
|
|
|
* Opaque handler to refer to an objective-c object (aka id)
|
|
|
|
*/
|
|
|
|
typedef void Ecore_Cocoa_Object;
|
|
|
|
|
2015-10-13 09:14:13 -07:00
|
|
|
/**
|
|
|
|
* @typedef Ecore_Cocoa_Event_Video_Resize
|
|
|
|
* Type of event thrown when a window is resized
|
|
|
|
*/
|
|
|
|
typedef struct _Ecore_Cocoa_Event_Video_Resize Ecore_Cocoa_Event_Video_Resize;
|
|
|
|
|
|
|
|
/** Event triggered when a window receives focus */
|
2010-03-27 11:28:50 -07:00
|
|
|
EAPI extern int ECORE_COCOA_EVENT_GOT_FOCUS;
|
2015-10-13 09:14:13 -07:00
|
|
|
|
|
|
|
/** Event triggered when a window loses focus */
|
2010-03-27 11:28:50 -07:00
|
|
|
EAPI extern int ECORE_COCOA_EVENT_LOST_FOCUS;
|
2015-10-13 09:14:13 -07:00
|
|
|
|
|
|
|
/** Event triggered when a window is resized */
|
2010-03-27 11:28:50 -07:00
|
|
|
EAPI extern int ECORE_COCOA_EVENT_RESIZE;
|
2015-10-13 09:14:13 -07:00
|
|
|
|
2015-01-30 08:15:55 -08:00
|
|
|
EAPI extern int ECORE_COCOA_EVENT_WINDOW_DESTROY;
|
2010-03-27 11:28:50 -07:00
|
|
|
|
2015-10-13 09:14:13 -07:00
|
|
|
/**
|
|
|
|
* @struct _Ecore_Cocoa_Event_Video_Resize
|
|
|
|
* Data available when a window is resized
|
|
|
|
*/
|
2010-03-27 11:28:50 -07:00
|
|
|
struct _Ecore_Cocoa_Event_Video_Resize
|
|
|
|
{
|
2015-10-13 09:14:13 -07:00
|
|
|
int w; /**< Current width of the window */
|
|
|
|
int h; /**< Current height of the window */
|
|
|
|
Ecore_Cocoa_Window_Id wid; /**< Handler of the Cocoa window */
|
2015-01-15 07:45:32 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _Ecore_Cocoa_Event_Window Ecore_Cocoa_Event_Window;
|
|
|
|
struct _Ecore_Cocoa_Event_Window
|
|
|
|
{
|
|
|
|
Ecore_Cocoa_Window_Id wid;
|
2010-03-27 11:28:50 -07:00
|
|
|
};
|
|
|
|
|
2015-10-13 09:14:13 -07:00
|
|
|
/**
|
|
|
|
* @typedef Ecore_Cocoa_Cnp_Type
|
|
|
|
* Type used to interact with the Cocoa pasteboard.
|
|
|
|
* It hold types that can apply to a context.
|
|
|
|
*/
|
2015-10-09 08:18:03 -07:00
|
|
|
typedef enum
|
|
|
|
{
|
2015-10-13 09:14:13 -07:00
|
|
|
ECORE_COCOA_CNP_TYPE_UNKNOWN = 0, /**< Undefined type */
|
|
|
|
ECORE_COCOA_CNP_TYPE_STRING = (1 << 0), /**< String type (pure text) */
|
|
|
|
ECORE_COCOA_CNP_TYPE_MARKUP = (1 << 1), /**< Elementary markup */
|
|
|
|
ECORE_COCOA_CNP_TYPE_IMAGE = (1 << 2), /**< Image (all formats) */
|
|
|
|
ECORE_COCOA_CNP_TYPE_HTML = (1 << 3) /**< HTML */
|
2015-10-09 08:18:03 -07:00
|
|
|
} Ecore_Cocoa_Cnp_Type;
|
|
|
|
|
2010-03-27 11:28:50 -07:00
|
|
|
|
2015-10-13 09:14:13 -07:00
|
|
|
/*============================================================================*
|
|
|
|
* Core *
|
|
|
|
*============================================================================*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Inits the Ecore_Cocoa library
|
|
|
|
* @return How many times Ecore_Cocoa has been initted
|
|
|
|
*/
|
|
|
|
EAPI int ecore_cocoa_init(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Shuts the Ecore_Cocoa library down
|
|
|
|
* @return How many times Ecore_Cocoa has been initted
|
|
|
|
*/
|
|
|
|
EAPI int ecore_cocoa_shutdown(void);
|
|
|
|
|
2014-06-08 12:50:42 -07:00
|
|
|
|
2015-10-13 09:14:13 -07:00
|
|
|
/*============================================================================*
|
|
|
|
* Screen *
|
|
|
|
*============================================================================*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieves the size of a Cocoa screen
|
|
|
|
* @param screen The screen which size must be retrieved
|
|
|
|
* @param [out] w The width of the screen
|
|
|
|
* @param [out] h The height of the screen
|
|
|
|
*/
|
2014-06-08 12:50:42 -07:00
|
|
|
EAPI void ecore_cocoa_screen_size_get(Ecore_Cocoa_Screen *screen, int *w, int *h);
|
|
|
|
|
2010-03-27 11:28:50 -07:00
|
|
|
|
2015-10-13 09:14:13 -07:00
|
|
|
/*============================================================================*
|
|
|
|
* Window *
|
|
|
|
*============================================================================*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates a Cocoa window
|
|
|
|
* @param x The origin (X) where the window must be created
|
|
|
|
* @param y The origin (Y) where the window must be created
|
|
|
|
* @param width The width of the window
|
|
|
|
* @param height The height of the window
|
|
|
|
* @return A handler on the window. NULL on failure
|
|
|
|
*/
|
2010-03-27 11:28:50 -07:00
|
|
|
EAPI Ecore_Cocoa_Window *ecore_cocoa_window_new(int x,
|
|
|
|
int y,
|
|
|
|
int width,
|
|
|
|
int height);
|
|
|
|
|
2015-10-13 09:14:13 -07:00
|
|
|
/**
|
|
|
|
* Releases a Cocoa window
|
|
|
|
* @param window The window to be released
|
|
|
|
*/
|
2010-03-27 11:28:50 -07:00
|
|
|
EAPI void ecore_cocoa_window_free(Ecore_Cocoa_Window *window);
|
|
|
|
|
2015-10-13 09:14:13 -07:00
|
|
|
/**
|
|
|
|
* Moves a Cocoa window to a given point
|
|
|
|
* @param window The window to be moved
|
|
|
|
* @param x The new origin of the window (X)
|
|
|
|
* @param y The new origin of the window (Y)
|
|
|
|
*/
|
2010-03-27 11:28:50 -07:00
|
|
|
EAPI void ecore_cocoa_window_move(Ecore_Cocoa_Window *window,
|
|
|
|
int x,
|
|
|
|
int y);
|
|
|
|
|
2015-10-13 09:14:13 -07:00
|
|
|
/**
|
|
|
|
* Resizes a Cocoa window to a given size
|
|
|
|
* @param window The window to be moved
|
|
|
|
* @param width The new width of the window
|
|
|
|
* @param height The new height of the window
|
|
|
|
*/
|
2010-03-27 11:28:50 -07:00
|
|
|
EAPI void ecore_cocoa_window_resize(Ecore_Cocoa_Window *window,
|
|
|
|
int width,
|
|
|
|
int height);
|
|
|
|
|
2015-10-13 09:14:13 -07:00
|
|
|
/**
|
|
|
|
* Moves and resizes a Cocoa window to a given point and size
|
|
|
|
* @param window The window to be moved
|
|
|
|
* @param x The new origin of the window (X)
|
|
|
|
* @param y The new origin of the window (Y)
|
|
|
|
* @param width The new width of the window
|
|
|
|
* @param height The new height of the window
|
|
|
|
* @see ecore_cocoa_window_resize()
|
|
|
|
* @see ecore_cocoa_window_move()
|
|
|
|
*/
|
2010-03-27 11:28:50 -07:00
|
|
|
EAPI void ecore_cocoa_window_move_resize(Ecore_Cocoa_Window *window,
|
|
|
|
int x,
|
|
|
|
int y,
|
|
|
|
int width,
|
|
|
|
int height);
|
|
|
|
|
2016-01-05 14:45:50 -08:00
|
|
|
EAPI void ecore_cocoa_window_geometry_get(const Ecore_Cocoa_Window *window,
|
|
|
|
int *x,
|
|
|
|
int *y,
|
|
|
|
int *w,
|
|
|
|
int *h);
|
2010-03-27 11:28:50 -07:00
|
|
|
|
2016-01-05 14:47:30 -08:00
|
|
|
EAPI void ecore_cocoa_window_size_get(const Ecore_Cocoa_Window *window,
|
|
|
|
int *w,
|
|
|
|
int *h);
|
2010-03-27 11:28:50 -07:00
|
|
|
|
|
|
|
EAPI void ecore_cocoa_window_size_min_set(Ecore_Cocoa_Window *window,
|
|
|
|
unsigned int min_width,
|
|
|
|
unsigned int min_height);
|
|
|
|
|
2016-01-05 14:50:52 -08:00
|
|
|
EAPI void ecore_cocoa_window_size_min_get(const Ecore_Cocoa_Window *window,
|
|
|
|
unsigned int *min_width,
|
|
|
|
unsigned int *min_height);
|
2010-03-27 11:28:50 -07:00
|
|
|
|
|
|
|
EAPI void ecore_cocoa_window_size_max_set(Ecore_Cocoa_Window *window,
|
|
|
|
unsigned int max_width,
|
|
|
|
unsigned int max_height);
|
|
|
|
|
2016-01-05 14:54:57 -08:00
|
|
|
EAPI void ecore_cocoa_window_size_max_get(const Ecore_Cocoa_Window *window,
|
|
|
|
unsigned int *max_width,
|
|
|
|
unsigned int *max_height);
|
2010-03-27 11:28:50 -07:00
|
|
|
|
|
|
|
EAPI void ecore_cocoa_window_size_step_set(Ecore_Cocoa_Window *window,
|
|
|
|
unsigned int step_width,
|
|
|
|
unsigned int step_height);
|
|
|
|
|
2016-01-05 14:58:04 -08:00
|
|
|
EAPI void ecore_cocoa_window_size_step_get(const Ecore_Cocoa_Window *window,
|
|
|
|
unsigned int *step_width,
|
|
|
|
unsigned int *step_height);
|
2010-03-27 11:28:50 -07:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
2015-03-12 04:13:08 -07:00
|
|
|
EAPI void ecore_cocoa_window_activate(Ecore_Cocoa_Window *window);
|
|
|
|
|
2010-03-27 11:28:50 -07:00
|
|
|
EAPI void ecore_cocoa_window_title_set(Ecore_Cocoa_Window *window,
|
|
|
|
const char *title);
|
|
|
|
|
|
|
|
EAPI void ecore_cocoa_window_iconified_set(Ecore_Cocoa_Window *window,
|
2016-01-05 15:00:56 -08:00
|
|
|
Eina_Bool on);
|
2010-03-27 11:28:50 -07:00
|
|
|
|
|
|
|
EAPI void ecore_cocoa_window_borderless_set(Ecore_Cocoa_Window *window,
|
2016-01-05 15:00:56 -08:00
|
|
|
Eina_Bool on);
|
2010-03-27 11:28:50 -07:00
|
|
|
|
2011-11-02 12:20:09 -07:00
|
|
|
EAPI void ecore_cocoa_window_view_set(Ecore_Cocoa_Window *window,
|
2016-01-05 15:03:57 -08:00
|
|
|
Ecore_Cocoa_Object *view);
|
2011-11-02 12:20:09 -07:00
|
|
|
|
2014-07-10 11:04:24 -07:00
|
|
|
EAPI int ecore_cocoa_titlebar_height_get(void);
|
|
|
|
|
2015-10-13 01:59:13 -07:00
|
|
|
EAPI Ecore_Cocoa_Window_Id ecore_cocoa_window_get_window_id(const Ecore_Cocoa_Window *window);
|
2015-01-15 07:45:32 -08:00
|
|
|
|
2015-10-08 02:58:46 -07:00
|
|
|
|
2015-10-09 08:18:03 -07:00
|
|
|
EAPI Eina_Bool ecore_cocoa_selection_clipboard_set(const void *data, int size, Ecore_Cocoa_Cnp_Type type);
|
|
|
|
|
|
|
|
EAPI void *ecore_cocoa_selection_clipboard_get(int *size, Ecore_Cocoa_Cnp_Type type,
|
|
|
|
Ecore_Cocoa_Cnp_Type *retrieved_types);
|
|
|
|
|
|
|
|
EAPI void ecore_cocoa_selection_clipboard_clear(void);
|
|
|
|
|
2015-10-08 02:58:46 -07:00
|
|
|
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);
|
|
|
|
|
2010-03-27 11:28:50 -07:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-04-28 05:24:48 -07:00
|
|
|
#undef EAPI
|
|
|
|
#define EAPI
|
|
|
|
|
2010-03-27 11:28:50 -07:00
|
|
|
#endif
|