// Authors:
// Peter Bartok pbartok@novell.com
//
-//
-// $Revision: 1.3 $
-// $Modtime: $
-// $Log: NativeWindow.cs,v $
-// Revision 1.3 2004/10/02 19:06:20 pbartok
-// - Changed access level for the window_collection hash table
-//
-// Revision 1.2 2004/08/11 22:20:59 pbartok
-// - Signature fixes
-//
-// Revision 1.1 2004/07/09 05:21:25 pbartok
-// - Initial check-in
-//
-//
+
// COMPLETE
+#undef ExternalExceptionHandler
+
using System.Runtime.Remoting;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
}
#endregion // Public Static Methods
+ #region Private and Internal Static Methods
+ internal static NativeWindow FindWindow(IntPtr handle) {
+ return (NativeWindow)window_collection[handle];
+
+ }
+ #endregion
+
#region Public Instance Methods
public void AssignHandle(IntPtr handle) {
if (window_handle != IntPtr.Zero) {
public virtual void CreateHandle(CreateParams create_params) {
if (create_params != null) {
- window_handle=XplatUI.CreateWindow(create_params);
+ Control control;
+
+ control = ((Control.ControlNativeWindow)this).Owner;
+
+ if ( !(control is Form) && !(control is Form.FormParentWindow)) {
+ window_handle=XplatUI.CreateWindow(create_params);
+ } else {
+ CreateParams cp;
+
+ if (control is Form.FormParentWindow) {
+ cp = ((Form.FormParentWindow)control).owner.CreateFormParams;
+ } else {
+ cp = ((Form)control).CreateClientAreaParams;
+ }
+ window_handle=XplatUI.CreateWindow(cp);
+ }
if (window_handle != IntPtr.Zero) {
window_collection.Add(window_handle, this);
}
protected virtual void WndProc(ref Message m) {
-#if debug
- Console.WriteLine("NativeWindow.cs: WndProc(ref Message m) called");
-#endif
DefWndProc(ref m);
}
internal static IntPtr WndProc(IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam) {
Message m = new Message();
NativeWindow window = null;
+
+ #if !ExternalExceptionHandler
try {
+ #endif
window = (NativeWindow)window_collection[hWnd];
m.HWnd=hWnd;
m.Msg=(int)msg;
} else {
m.Result=XplatUI.DefWndProc(ref m);
}
+ #if !ExternalExceptionHandler
}
catch(System.Exception ex) {
window.OnThreadException(ex);
}
}
+ #endif
-#if debug
- Console.WriteLine("NativeWindow.cs: Message {0}, result {1}", msg, m.Result);
-#endif
+ #if debug
+ Console.WriteLine("NativeWindow.cs: Message {0}, result {1}", msg, m.Result);
+ #endif
return m.Result;
}