00001 #region License
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #endregion
00027
00028 using System;
00029 using System.Collections.Generic;
00030 using System.Diagnostics;
00031 using System.Text;
00032
00033 namespace OpenTK.Platform.MacOS
00034 {
00039 sealed class CarbonWindowInfo : IWindowInfo
00040 {
00041 IntPtr windowRef;
00042 bool ownHandle = false;
00043 bool disposed = false;
00044 bool isControl = false;
00045 bool goFullScreenHack = false;
00046 bool goWindowedHack = false;
00047
00048 #region Constructors
00049
00056 public CarbonWindowInfo(IntPtr windowRef, bool ownHandle, bool isControl)
00057 {
00058 this.windowRef = windowRef;
00059 this.ownHandle = ownHandle;
00060 this.isControl = isControl;
00061 }
00062
00063 #endregion
00064
00065 #region Public Members
00066
00070 internal IntPtr WindowRef
00071 {
00072 get { return this.windowRef; }
00073 }
00074
00075 internal bool GoFullScreenHack
00076 {
00077 get { return goFullScreenHack; }
00078 set { goFullScreenHack = value; }
00079 }
00080 internal bool GoWindowedHack
00081 {
00082 get { return goWindowedHack; }
00083 set { goWindowedHack = value; }
00084 }
00085
00086
00090 public bool IsControl
00091 {
00092 get { return isControl; }
00093 }
00094
00097 public override string ToString()
00098 {
00099 return String.Format("MacOS.CarbonWindowInfo: Handle {0}",
00100 this.WindowRef);
00101 }
00102
00103 #endregion
00104
00105 #region IDisposable Members
00106
00107 public void Dispose()
00108 {
00109 Dispose(true);
00110 }
00111
00112 void Dispose(bool disposing)
00113 {
00114 if (disposed)
00115 return;
00116
00117 if (disposing)
00118 {
00119
00120 }
00121
00122 if (ownHandle)
00123 {
00124 Debug.Print("Disposing window {0}.", windowRef);
00125 Carbon.API.DisposeWindow(this.windowRef);
00126 windowRef = IntPtr.Zero;
00127 }
00128
00129 disposed = true;
00130 }
00131
00132 ~CarbonWindowInfo()
00133 {
00134 Dispose(false);
00135 }
00136
00137 #endregion
00138 }
00139 }