[DEV] update for Mac port
Conflicts: sources/lutin_ewol.py
This commit is contained in:
parent
80f623bb72
commit
622ef88fea
@ -11,5 +11,6 @@
|
||||
@interface MacOsAppDelegate : NSObject <NSApplicationDelegate>
|
||||
|
||||
@property (assign) IBOutlet NSWindow *window;
|
||||
|
||||
- (void)sendEvent:(NSEvent *)event;
|
||||
- (void)applicationWillResignActive:(MacOsAppDelegate *)application;
|
||||
@end
|
||||
|
@ -20,6 +20,7 @@
|
||||
// Override point for customization after application launch.
|
||||
[self.window addSubview:view];
|
||||
[self.window makeKeyAndVisible];
|
||||
EWOL_INFO("lkjlkjlkj");
|
||||
return YES;
|
||||
}
|
||||
|
||||
@ -28,6 +29,7 @@
|
||||
Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
|
||||
Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
|
||||
*/
|
||||
EWOL_INFO("move windows in applicationWillResignActive");
|
||||
}
|
||||
|
||||
- (void)applicationDidEnterBackground:(MacOsAppDelegate *)application {
|
||||
@ -35,18 +37,21 @@
|
||||
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
|
||||
If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
|
||||
*/
|
||||
EWOL_INFO("move windows in applicationDidEnterBackground");
|
||||
}
|
||||
|
||||
- (void)applicationWillEnterForeground:(MacOsAppDelegate *)application {
|
||||
/*
|
||||
Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
|
||||
*/
|
||||
EWOL_INFO("move windows in applicationWillEnterForeground");
|
||||
}
|
||||
|
||||
- (void)applicationDidBecomeActive:(MacOsAppDelegate *)application {
|
||||
/*
|
||||
Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
||||
*/
|
||||
EWOL_INFO("move windows in applicationDidBecomeActive");
|
||||
}
|
||||
|
||||
- (void)applicationWillTerminate:(MacOsAppDelegate *)application {
|
||||
@ -55,6 +60,7 @@
|
||||
Save data if appropriate.
|
||||
See also applicationDidEnterBackground:.
|
||||
*/
|
||||
EWOL_INFO("move windows in applicationWillTerminate");
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
@ -62,6 +68,12 @@
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
- (void)sendEvent:(NSEvent *)event {
|
||||
EWOL_WARNING(" EVENT ... ");
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include <ewol/key/key.h>
|
||||
#include <ewol/context/commandLine.h>
|
||||
#include <etk/types.h>
|
||||
#include <etk/unicode.h>
|
||||
#include <etk/os/FSNode.h>
|
||||
#include <ewol/widget/Manager.h>
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "ewol/context/MacOs/Interface.h"
|
||||
|
||||
#import <ewol/context/MacOs/OpenglView.h>
|
||||
#import <ewol/context/MacOs/Windows.h>
|
||||
#import <ewol/context/MacOs/AppDelegate.h>
|
||||
|
||||
int mm_main(int argc, const char *argv[]) {
|
||||
@ -47,10 +48,14 @@ int mm_main(int argc, const char *argv[]) {
|
||||
// -- basic windows creation :
|
||||
// ---------------------------------------------------------------
|
||||
// create a windows of size 800/600
|
||||
id window = [ [ [NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 800, 600)
|
||||
styleMask:(NSTitledWindowMask|NSMiniaturizableWindowMask|NSClosableWindowMask) backing:NSBackingStoreBuffered defer:NO]
|
||||
autorelease];
|
||||
// set the windows at a specific position :
|
||||
#if 1
|
||||
id window = [ [ [EwolMainWindows alloc] initWithContentRect:NSMakeRect(0, 0, 800, 600)
|
||||
styleMask:(NSTitledWindowMask|NSMiniaturizableWindowMask|NSClosableWindowMask) backing:NSBackingStoreBuffered defer:NO]
|
||||
autorelease];
|
||||
|
||||
//id window = [ [MacOsAppDelegate alloc] autorelease];
|
||||
|
||||
// set the windows at a specific position :
|
||||
[window cascadeTopLeftFromPoint:NSMakePoint(50,50)];
|
||||
// set the windows resizable
|
||||
[window setStyleMask:[window styleMask] | NSResizableWindowMask];
|
||||
@ -75,6 +80,19 @@ int mm_main(int argc, const char *argv[]) {
|
||||
//[window makeKeyAndVisible];
|
||||
|
||||
[window setDelegate:view];
|
||||
#else
|
||||
@autoreleasepool
|
||||
{
|
||||
const ProcessSerialNumber psn = { 0, kCurrentProcess };
|
||||
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
|
||||
SetFrontProcess(&psn);
|
||||
|
||||
[MyApplication sharedApplication];
|
||||
[NSApp setDelegate: NSApp];
|
||||
|
||||
[NSApp run];
|
||||
}
|
||||
#endif
|
||||
// return no error
|
||||
return 0;
|
||||
}
|
||||
|
22
sources/ewol/context/MacOs/Windows.h
Normal file
22
sources/ewol/context/MacOs/Windows.h
Normal file
@ -0,0 +1,22 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD v3 (see license file)
|
||||
*/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface EwolMainWindows : NSWindow
|
||||
+ (id)alloc;
|
||||
- (id)init;
|
||||
+ (void)dealloc;
|
||||
@end
|
||||
|
||||
|
||||
@interface MyApplication : NSApplication
|
||||
|
||||
@property (strong, nonatomic) NSWindow *window;
|
||||
|
||||
@end
|
101
sources/ewol/context/MacOs/Windows.mm
Normal file
101
sources/ewol/context/MacOs/Windows.mm
Normal file
@ -0,0 +1,101 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD v3 (see license file)
|
||||
*/
|
||||
|
||||
|
||||
#import <ewol/context/MacOs/Windows.h>
|
||||
#import <ewol/context/MacOs/OpenglView.h>
|
||||
|
||||
#include <ewol/debug.h>
|
||||
|
||||
@implementation EwolMainWindows
|
||||
|
||||
+ (id)alloc {
|
||||
id windowsID = [super alloc];
|
||||
EWOL_DEBUG("ALLOCATE ...");
|
||||
return windowsID;
|
||||
}
|
||||
|
||||
- (id)init {
|
||||
id windowsID = [super init];
|
||||
EWOL_DEBUG("INIT ...");
|
||||
// set the windows at a specific position :
|
||||
[windowsID cascadeTopLeftFromPoint:NSMakePoint(50,50)];
|
||||
EWOL_DEBUG("ALLOCATE ...");
|
||||
// set the windows resizable
|
||||
[windowsID setStyleMask:[windowsID styleMask] | NSResizableWindowMask];
|
||||
EWOL_DEBUG("ALLOCATE ...");
|
||||
// oposite : [window setStyleMask:[window styleMask] & ~NSResizableWindowMask];
|
||||
// set the title
|
||||
id appName = [[NSProcessInfo processInfo] processName];
|
||||
EWOL_DEBUG("ALLOCATE ...");
|
||||
[windowsID setTitle:appName];
|
||||
EWOL_DEBUG("ALLOCATE ...");
|
||||
|
||||
[windowsID setAcceptsMouseMovedEvents:YES];
|
||||
EWOL_DEBUG("ALLOCATE ...");
|
||||
// ???
|
||||
[windowsID makeKeyAndOrderFront:nil];
|
||||
EWOL_DEBUG("ALLOCATE ...");
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
EWOL_DEBUG("ALLOCATE ...");
|
||||
|
||||
NSRect window_frame = [windowsID frame];
|
||||
EWOL_DEBUG("ALLOCATE ...");
|
||||
|
||||
OpenGLView* view=[[OpenGLView alloc]initWithFrame:window_frame]; //NSMakeRect(0, 0, 800, 600)];
|
||||
EWOL_DEBUG("ALLOCATE ...");
|
||||
[windowsID setContentView:view];
|
||||
EWOL_DEBUG("ALLOCATE ...");
|
||||
[view setAutoresizesSubviews:YES];
|
||||
EWOL_DEBUG("ALLOCATE ...");
|
||||
|
||||
// Override point for customization after application launch.
|
||||
//[window addSubview:view];
|
||||
//[window addChildWindow:view];
|
||||
//[window makeKeyAndVisible];
|
||||
|
||||
[windowsID setDelegate:view];
|
||||
EWOL_DEBUG("ALLOCATE ...");
|
||||
return windowsID;
|
||||
}
|
||||
|
||||
|
||||
+ (void)dealloc {
|
||||
EWOL_DEBUG("FREE ...");
|
||||
//[_window release];
|
||||
[super dealloc];
|
||||
}
|
||||
/*
|
||||
|
||||
- (void)sendEvent:(NSEvent *)event {
|
||||
EWOL_WARNING(" EVENT ... ");
|
||||
}
|
||||
*/
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
|
||||
@implementation MyApplication
|
||||
|
||||
- (void) applicationDidFinishLaunching: (NSNotification *) note
|
||||
{
|
||||
NSWindow *window = [[NSWindow alloc] initWithContentRect:NSMakeRect(100, 100, 100, 100)
|
||||
styleMask:NSTitledWindowMask backing:NSBackingStoreBuffered defer:YES];
|
||||
|
||||
self.window = window;
|
||||
|
||||
[window close];
|
||||
|
||||
[super stop: self];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
@ -47,16 +47,17 @@ def create(target):
|
||||
])
|
||||
if target.name=="Linux":
|
||||
myModule.add_src_file('ewol/context/X11/Context.cpp')
|
||||
elif target.name=="Android":
|
||||
myModule.add_src_file("ewol/context/Android/Context.cpp")
|
||||
elif target.name=="Windows":
|
||||
myModule.add_src_file("ewol/context/Windows/Context.cpp")
|
||||
myModule.add_src_file('ewol/context/Windows/Context.cpp')
|
||||
elif target.name=="Android":
|
||||
myModule.add_src_file('ewol/context/Android/Context.cpp')
|
||||
elif target.name=="MacOs":
|
||||
myModule.add_src_file([
|
||||
"ewol/context/MacOs/Context.cpp",
|
||||
"ewol/context/MacOs/Interface.mm",
|
||||
"ewol/context/MacOs/AppDelegate.mm",
|
||||
"ewol/context/MacOs/OpenglView.mm"])
|
||||
'ewol/context/MacOs/Context.cpp',
|
||||
'ewol/context/MacOs/Interface.mm',
|
||||
'ewol/context/MacOs/Windows.mm',
|
||||
'ewol/context/MacOs/OpenglView.mm',
|
||||
'ewol/context/MacOs/AppDelegate.mm'])
|
||||
else:
|
||||
debug.error("unknow mode...")
|
||||
|
||||
@ -163,7 +164,7 @@ def create(target):
|
||||
myModule.add_module_depend(['etk', 'freetype', 'exml', 'ejson', 'egami', 'date'])
|
||||
|
||||
myModule.add_export_path(tools.get_current_path(__file__))
|
||||
|
||||
|
||||
tagFile = tools.get_current_path(__file__) + "/tag"
|
||||
ewolVersionID = tools.file_read_data(tagFile)
|
||||
myModule.compile_flags_CC([
|
||||
|
Loading…
x
Reference in New Issue
Block a user