Beispiel #1
0
        internal static void ZoomWindowIdeal(IntPtr windowRef, WindowPartCode inPartCode, ref CarbonPoint toIdealSize)
        {
            CarbonPoint pt = toIdealSize;
            OSStatus    error;
            IntPtr      handle = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(CarbonPoint)));

            Marshal.StructureToPtr(toIdealSize, handle, false);
            error       = _ZoomWindowIdeal(windowRef, (short)inPartCode, handle);
            toIdealSize = (CarbonPoint)Marshal.PtrToStructure(handle, typeof(CarbonPoint));
            Marshal.FreeHGlobal(handle);
            if (error != OSStatus.NoError)
            {
                throw new MacOSException(error);
            }
        }
Beispiel #2
0
 private void SetCarbonWindowState()
 {
   switch (this.windowState)
   {
     case WindowState.Normal:
       if (this.WindowState == WindowState.Maximized)
       {
         CarbonPoint toIdealSize = new CarbonPoint();
         API.ZoomWindowIdeal(this.window.WindowRef, WindowPartCode.inZoomIn, ref toIdealSize);
         break;
       }
       else
         break;
     case WindowState.Minimized:
       API.CollapseWindow(this.window.WindowRef, true);
       break;
     case WindowState.Maximized:
       CarbonPoint toIdealSize1 = new CarbonPoint(9000, 9000);
       API.ZoomWindowIdeal(this.window.WindowRef, WindowPartCode.inZoomOut, ref toIdealSize1);
       break;
     case WindowState.Fullscreen:
       this.window.GoFullScreenHack = true;
       break;
   }
   this.WindowStateChanged((object) this, EventArgs.Empty);
   this.LoadSize();
   this.Resize((object) this, EventArgs.Empty);
 }
        private void SetCarbonWindowState()
        {
            CarbonPoint idealSize;
            OSStatus err;

            switch (windowState)
            {
                case WindowState.Fullscreen:
                    window.goFullScreenHack = true;
                    break;

                case WindowState.Maximized:
                    // hack because mac os has no concept of maximized. Instead windows are "zoomed"
                    // meaning they are maximized up to their reported ideal size.  So we report a
                    // large ideal size.
                    idealSize = new CarbonPoint(9000, 9000);
                    err = API.ZoomWindowIdeal(window.WindowRef, (short)WindowPartCode.inZoomOut, ref idealSize);
                    API.CheckReturn( err );
                    break;

                case WindowState.Normal:
                    if (WindowState == WindowState.Maximized)
                    {
                        idealSize = new CarbonPoint();
                        err = API.ZoomWindowIdeal(window.WindowRef, (short)WindowPartCode.inZoomIn, ref idealSize);
                        API.CheckReturn( err );
                    }
                    break;

                case WindowState.Minimized:
                    err = API.CollapseWindow(window.WindowRef, true);
                    API.CheckReturn( err );
                    break;
            }

            OnWindowStateChanged();
            OnResize();
        }
Beispiel #4
0
 internal static void ZoomWindowIdeal(IntPtr windowRef, WindowPartCode inPartCode, ref CarbonPoint toIdealSize)
 {
     IntPtr num = Marshal.AllocHGlobal(Marshal.SizeOf(typeof (CarbonPoint)));
       Marshal.StructureToPtr((object) toIdealSize, num, false);
       OSStatus errorCode = API._ZoomWindowIdeal(windowRef, (short) inPartCode, num);
       toIdealSize = (CarbonPoint) Marshal.PtrToStructure(num, typeof (CarbonPoint));
       Marshal.FreeHGlobal(num);
       if (errorCode != OSStatus.NoError)
     throw new MacOSException(errorCode);
 }
 public static unsafe extern OSStatus ZoomWindowIdeal(IntPtr windowRef, short inPartCode, ref CarbonPoint toIdealSize);
Beispiel #6
0
        internal static void ZoomWindowIdeal(IntPtr windowRef, WindowPartCode inPartCode, ref CarbonPoint toIdealSize)
        {
            CarbonPoint pt = toIdealSize;
            OSStatus error ;
            IntPtr handle = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(CarbonPoint)));
            Marshal.StructureToPtr(toIdealSize, handle, false);

            error = _ZoomWindowIdeal(windowRef, (short)inPartCode, handle);

            toIdealSize = (CarbonPoint)Marshal.PtrToStructure(handle,typeof(CarbonPoint));

            Marshal.FreeHGlobal(handle);

            if (error != OSStatus.NoError)
            {
                throw new MacOSException(error);
            }
        }
Beispiel #7
0
 public unsafe static extern OSStatus ZoomWindowIdeal(IntPtr windowRef, short inPartCode, ref CarbonPoint toIdealSize);
Beispiel #8
0
        internal static void ZoomWindowIdeal(IntPtr windowRef, WindowPartCode inPartCode, ref CarbonPoint toIdealSize)
        {
            IntPtr num = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(CarbonPoint)));

            Marshal.StructureToPtr((object)toIdealSize, num, false);
            OSStatus errorCode = API._ZoomWindowIdeal(windowRef, (short)inPartCode, num);

            toIdealSize = (CarbonPoint)Marshal.PtrToStructure(num, typeof(CarbonPoint));
            Marshal.FreeHGlobal(num);
            if (errorCode != OSStatus.NoError)
            {
                throw new MacOSException(errorCode);
            }
        }