Changed: #947 mouse wheel, resizable flag

This commit is contained in:
rti 2010-06-11 16:21:27 +02:00
parent db99233b0f
commit 265650262d

View file

@ -78,20 +78,23 @@ bool init(uint windowIcon, emptyProc exitFunc)
bool setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool resizeable) bool setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool resizeable)
{ {
/* /*
TODO use show and resizable flags TODO use show
*/ */
/* /*
TODO add menu, on quit send EventDestroyWindowId TODO add menu, on quit send EventDestroyWindowId
*/ */
unsigned int styleMask = NSTitledWindowMask | NSClosableWindowMask |
NSMiniaturizableWindowMask;
if(resizeable)
styleMask |= NSResizableWindowMask;
// create a cocoa window with the size provided by the mode parameter // create a cocoa window with the size provided by the mode parameter
g_window = [[CocoaWindow alloc] g_window = [[CocoaWindow alloc]
initWithContentRect:NSMakeRect(0, 0, mode.Width, mode.Height) initWithContentRect:NSMakeRect(0, 0, mode.Width, mode.Height)
styleMask:NSTitledWindowMask | NSResizableWindowMask | styleMask:styleMask backing:NSBackingStoreBuffered defer:NO];
NSClosableWindowMask | NSMiniaturizableWindowMask
backing:NSBackingStoreBuffered
defer:NO];
if(!g_window) if(!g_window)
nlerror("cannot create window"); nlerror("cannot create window");
@ -813,7 +816,16 @@ void submitEvents(NLMISC::CEventServer& server,
case NSApplicationDefined:break; case NSApplicationDefined:break;
case NSPeriodic:break; case NSPeriodic:break;
case NSCursorUpdate:break; case NSCursorUpdate:break;
case NSScrollWheel:break; case NSScrollWheel:
{
/*
TODO modifiers with mouse events
*/
server.postEvent(new NLMISC::CEventMouseWheel(
mouseX, mouseY, (NLMISC::TMouseButton)0 /* modifiers */,
(event.deltaY > 0), eventEmitter));
break;
}
case NSTabletPoint:break; case NSTabletPoint:break;
case NSTabletProximity:break; case NSTabletProximity:break;
case NSOtherMouseDown:break; case NSOtherMouseDown:break;