2022-08-14 16:19:40 +00:00
|
|
|
/************************************************************//**
|
|
|
|
*
|
|
|
|
* @file: osx_app.h
|
|
|
|
* @author: Martin Fouilleul
|
|
|
|
* @date: 12/02/2021
|
|
|
|
* @revision:
|
|
|
|
*
|
|
|
|
*****************************************************************/
|
|
|
|
#ifndef __OSX_APP_H_
|
|
|
|
#define __OSX_APP_H_
|
|
|
|
|
|
|
|
#import<Cocoa/Cocoa.h>
|
|
|
|
#import<Carbon/Carbon.h>
|
|
|
|
#include"mp_app.h"
|
|
|
|
#include"graphics.h"
|
|
|
|
|
2022-08-19 17:46:31 +00:00
|
|
|
typedef struct mp_window_data
|
2022-08-14 16:19:40 +00:00
|
|
|
{
|
|
|
|
list_elt freeListElt;
|
|
|
|
u32 generation;
|
|
|
|
|
|
|
|
NSWindow* nsWindow;
|
|
|
|
NSView* nsView;
|
|
|
|
NSObject* nsWindowDelegate;
|
|
|
|
|
|
|
|
mp_rect contentRect;
|
|
|
|
mp_rect frameRect;
|
|
|
|
mp_window_style style;
|
|
|
|
|
|
|
|
bool shouldClose; //TODO could be in status flags
|
|
|
|
bool hidden;
|
|
|
|
|
|
|
|
mp_view mainView;
|
2022-08-19 17:46:31 +00:00
|
|
|
} mp_window_data;
|
2022-08-14 16:19:40 +00:00
|
|
|
|
2022-08-19 17:46:31 +00:00
|
|
|
typedef struct mp_view_data
|
2022-08-14 16:19:40 +00:00
|
|
|
{
|
|
|
|
list_elt freeListElt;
|
|
|
|
u32 generation;
|
|
|
|
|
|
|
|
mp_window window;
|
|
|
|
NSView* nsView;
|
|
|
|
mg_surface surface;
|
2022-08-19 17:46:31 +00:00
|
|
|
} mp_view_data;
|
2022-08-14 16:19:40 +00:00
|
|
|
|
|
|
|
@interface MPNativeWindow : NSWindow
|
|
|
|
{
|
|
|
|
mp_window_data* mpWindow;
|
|
|
|
}
|
|
|
|
- (id)initWithMPWindow:(mp_window_data*) window contentRect:(NSRect) rect styleMask:(uint32) style;
|
|
|
|
@end
|
|
|
|
|
|
|
|
mp_window_data* mp_window_ptr_from_handle(mp_window handle);
|
|
|
|
mp_view_data* mp_view_ptr_from_handle(mp_view handle);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif //__OSX_APP_H_
|