[DEV] add mac basic event

This commit is contained in:
Edouard DUPIN 2013-05-29 07:21:40 +02:00
parent c2b7cedb8c
commit 2ac2b5057e
3 changed files with 59 additions and 1 deletions

View File

@ -25,9 +25,11 @@ int mm_main(int argc, const char *argv[])
#include "ewol/renderer/os/gui.MacOs.Interface.h"
#import <ewol/renderer/os/gui.MacOs.OpenglView.h>
#import <ewol/renderer/os/gui.MacOs.AppDelegate.h>
int mm_main(int argc, const char *argv[])
{
[NSAutoreleasePool new];
[NSApplication sharedApplication];
@ -63,12 +65,14 @@ int mm_main(int argc, const char *argv[])
// ---------------------------------------------------------------
// create a windows of size 800/600
id window = [ [ [NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 800, 600)
styleMask:NSTitledWindowMask backing:NSBackingStoreBuffered defer:NO]
styleMask:(NSTitledWindowMask|NSMiniaturizableWindowMask|NSClosableWindowMask) backing:NSBackingStoreBuffered defer:NO]
autorelease];
// set the windows at a specific position :
[window cascadeTopLeftFromPoint:NSMakePoint(50,50)];
// set the title
[window setTitle:appName];
[window setAcceptsMouseMovedEvents:YES];
// ???
[window makeKeyAndOrderFront:nil];
[NSApp activateIgnoringOtherApps:YES];

View File

@ -14,6 +14,18 @@
{
}
- (void) drawRect: (NSRect) bounds;
- (void)mouseDown: (NSEvent *) event;
- (void)mouseDragged: (NSEvent *) event;
- (void)mouseUp:(NSEvent *)event;
- (void)mouseMoved:(NSEvent *)event;
- (void)mouseEntered:(NSEvent *)event;
- (void)mouseExited:(NSEvent *)event;
- (void)rightMouseDown:(NSEvent *)event;
- (void)rightMouseDragged:(NSEvent *)event;
- (void)rightMouseUp:(NSEvent *)event;
- (void)otherMouseDown:(NSEvent *)event;
- (void)otherMouseDragged:(NSEvent *)event;
- (void)otherMouseUp:(NSEvent *)event;
@end

View File

@ -10,6 +10,7 @@
#import <ewol/renderer/os/gui.MacOs.OpenglView.h>
#include <OpenGL/gl.h>
#include <ewol/renderer/os/eSystem.h>
#include <ewol/debug.h>
static int32_t width=0, height=0;
@ -28,4 +29,45 @@ static int32_t width=0, height=0;
}
-(void)mouseDown:(NSEvent *)event {
NSPoint point = [event locationInWindow];
//float x = [event locationInWindow].x; //point.x;
EWOL_INFO("mouseDown" << (float)point.x << " " << (float)point.y);
EWOL_INFO("mouseDown");
}
-(void)mouseDragged:(NSEvent *)event {
EWOL_INFO("mouseDragged");
}
-(void)mouseUp:(NSEvent *)event {
EWOL_INFO("mouseUp");
}
-(void)mouseMoved:(NSEvent *)event {
EWOL_INFO("mouseMoved");
}
-(void)mouseEntered:(NSEvent *)event {
EWOL_INFO("mouseEntered");
}
-(void)mouseExited:(NSEvent *)event {
EWOL_INFO("mouseExited");
}
-(void)rightMouseDown:(NSEvent *)event {
EWOL_INFO("rightMouseDown");
}
-(void)rightMouseDragged:(NSEvent *)event {
EWOL_INFO("rightMouseDragged");
}
-(void)rightMouseUp:(NSEvent *)event {
EWOL_INFO("rightMouseUp");
}
-(void)otherMouseDown:(NSEvent *)event {
EWOL_INFO("otherMouseDown");
}
-(void)otherMouseDragged:(NSEvent *)event {
EWOL_INFO("otherMouseDragged");
}
-(void)otherMouseUp:(NSEvent *)event {
EWOL_INFO("otherMouseUp");
}
@end