static readonly IntPtr selNextEventMatchingMask = Selector.Get("nextEventMatchingMask:untilDate:inMode:dequeue:");
static readonly IntPtr selSendEvent = Selector.Get("sendEvent:");
//static readonly IntPtr selUpdateWindows = Selector.Get("updateWindows");
+ static readonly IntPtr selContentView = Selector.Get("contentView");
static readonly IntPtr selConvertRectFromScreen = Selector.Get("convertRectFromScreen:");
static readonly IntPtr selConvertRectToScreen = Selector.Get("convertRectToScreen:");
static readonly IntPtr selPerformClose = Selector.Get("performClose:");
GraphicsContext.CurrentContext.Update(windowInfo);
if (suppressResize == 0)
- Resize(this, EventArgs.Empty);
+ OnResize(EventArgs.Empty);
}
private void ApplicationQuit(object sender, CancelEventArgs e)
{
// Problem: Called only when you stop moving for a brief moment,
// not each frame as it is on PC.
- Move(this, EventArgs.Empty);
+ OnMove(EventArgs.Empty);
}
private void WindowDidBecomeKey(IntPtr self, IntPtr cmd, IntPtr notification)
{
- FocusedChanged(this, EventArgs.Empty);
+ OnFocusedChanged(EventArgs.Empty);
}
private void WindowDidResignKey(IntPtr self, IntPtr cmd, IntPtr notification)
{
- FocusedChanged(this, EventArgs.Empty);
+ OnFocusedChanged(EventArgs.Empty);
}
private void WindowWillMiniaturize(IntPtr self, IntPtr cmd, IntPtr notification)
private void WindowDidMiniaturize(IntPtr self, IntPtr cmd, IntPtr notification)
{
windowState = WindowState.Minimized;
- WindowStateChanged(this, EventArgs.Empty);
+ OnWindowStateChanged(EventArgs.Empty);
OnResize(false); // Don't set tracking area when we minimize
}
private void WindowDidDeminiaturize(IntPtr self, IntPtr cmd, IntPtr notification)
{
windowState = WindowState.Normal;
- WindowStateChanged(this, EventArgs.Empty);
+ OnWindowStateChanged(EventArgs.Empty);
OnResize(true);
}
InternalBounds = toFrame;
windowState = WindowState.Maximized;
- WindowStateChanged(this, EventArgs.Empty);
+ OnWindowStateChanged(EventArgs.Empty);
}
return false;
}
private bool WindowShouldClose(IntPtr self, IntPtr cmd, IntPtr sender)
{
var cancelArgs = new CancelEventArgs();
- Closing(this, cancelArgs);
+ OnClosing(cancelArgs);
if (!cancelArgs.Cancel)
{
- Closed(this, EventArgs.Empty);
+ OnClosed(EventArgs.Empty);
return true;
}
if (!isARepeat || InputDriver.Keyboard[0].KeyRepeat)
{
- KeyDown(this, keyArgs);
+ OnKeyDown(keyArgs);
}
var s = Cocoa.FromNSString(Cocoa.SendIntPtr(e, selCharactersIgnoringModifiers));
// For some reason, arrow keys (mapped 63232-63235) are seen as non-control characters, so get rid of those.
keyPressArgs.KeyChar = c;
- KeyPress(this, keyPressArgs);
+ OnKeyPress(keyPressArgs);
}
}
}
GetKey(keyCode, modifierFlags, keyArgs);
InputDriver.Keyboard[0].SetKey(keyArgs.Key, keyArgs.ScanCode, false);
- KeyUp(this, keyArgs);
+ OnKeyUp(keyArgs);
}
break;
//SetCursor(selectedCursor);
}
- cursorInsideWindow = true;
- MouseEnter(this, EventArgs.Empty);
+ OnMouseEnter(EventArgs.Empty);
}
}
break;
SetCursor(MouseCursor.Default);
}
- cursorInsideWindow = false;
- MouseLeave(this, EventArgs.Empty);
+ OnMouseLeave(EventArgs.Empty);
}
}
break;
var dy = Cocoa.SendFloat(e, selDeltaY);
p = new Point(
- MathHelper.Clamp((int)Math.Round(p.X + dx)),
- MathHelper.Clamp((int)Math.Round(p.Y - dy)));
+ MathHelper.Clamp((int)Math.Round(p.X + dx), 0, Width),
+ MathHelper.Clamp((int)Math.Round(p.Y - dy), 0, Height));
}
InputDriver.Mouse[0].Position = p;
IntPtr nsimg = Cocoa.ToNSImage(img);
Cocoa.SendVoid(NSApplication.Handle, selSetApplicationIconImage, nsimg);
}
- IconChanged(this, EventArgs.Empty);
+ OnIconChanged(EventArgs.Empty);
}
}
set
{
Cocoa.SendVoid(windowInfo.Handle, selSetIsVisible, value);
- VisibleChanged(this, EventArgs.Empty);
+ OnVisibleChanged(EventArgs.Empty);
}
}
InternalBounds = GetCurrentScreenFrame();
windowState = value;
- WindowStateChanged(this, EventArgs.Empty);
+ OnWindowStateChanged(EventArgs.Empty);
}
else if (value == WindowState.Maximized)
{
else if (value == WindowState.Normal)
{
windowState = value;
- WindowStateChanged(this, EventArgs.Empty);
- Resize(this, EventArgs.Empty);
+ OnWindowStateChanged(EventArgs.Empty);
+ OnResize(EventArgs.Empty);
}
}
}
return;
SetWindowBorder(value);
- WindowBorderChanged(this, EventArgs.Empty);
+ OnWindowBorderChanged(EventArgs.Empty);
}
}
{
var contentViewBounds = Cocoa.SendRect(windowInfo.ViewHandle, selBounds);
var bounds = Cocoa.SendRect(windowInfo.Handle, selConvertRectToBacking, contentViewBounds);
- return new Size(0, 0, (int)bounds.Width, (int)bounds.Height);
+ return new Size((int)bounds.Width, (int)bounds.Height);
}
set
{
Cocoa.SendVoid(windowInfo.Handle, Selector.Release);
}
- Disposed(this, EventArgs.Empty);
+ OnDisposed(EventArgs.Empty);
}
public static IntPtr GetView(IntPtr windowHandle)
Cocoa.SendIntPtr(windowInfo.Handle, selSetTitle, Cocoa.ToNSString(title));
if (callEvent)
{
- TitleChanged(this, EventArgs.Empty);
+ OnTitleChanged(EventArgs.Empty);
}
}