internal override void SetWindowState(IntPtr handle, FormWindowState state) {
Hwnd hwnd = Hwnd.ObjectFromHandle (handle);
IntPtr window = HIViewGetWindow (handle);
switch (state) {
case FormWindowState.Minimized: {
CollapseWindow (window, true);
break;
}
case FormWindowState.Normal: {
ZoomWindow (window, 7, false);
break;
}
case FormWindowState.Maximized: {
Form form = Control.FromHandle (hwnd.Handle) as Form;
if (form != null && form.FormBorderStyle == FormBorderStyle.None) {
Carbon.Rect rect = new Carbon.Rect ();
Carbon.HIRect bounds = CGDisplayBounds (CGMainDisplayID ());
SetRect (ref rect, (short)0, (short)0, (short)bounds.size.width, (short)bounds.size.height);
SetWindowBounds ((IntPtr) WindowMapping [hwnd.Handle], 33, ref rect);
HIViewSetFrame (hwnd.whole_window, ref bounds);
} else {
ZoomWindow (window, 8, false);
}
break;
}
}
}