internal class Hwnd : IDisposable {
#region Local Variables
private static Hashtable windows = new Hashtable(100, 0.5f);
- private const int menu_height = 14; // FIXME - Read this value from somewhere
+ //private const int menu_height = 14; // FIXME - Read this value from somewhere
private const int caption_height = 0; // FIXME - Read this value from somewhere
private const int tool_caption_height = 0; // FIXME - Read this value from somewhere
internal Graphics client_dc;
internal object user_data;
internal Rectangle client_rectangle;
+ internal ArrayList marshal_free_list;
#endregion // Local Variables
#region Constructors and destructors
edge_style = Border3DStyle.Raised;
client_rectangle = Rectangle.Empty;
erase_pending = true;
+ marshal_free_list = new ArrayList(2);
}
public void Dispose() {
windows[client_window] = null;
windows[whole_window] = null;
-Console.WriteLine("Disposing window {0:X} (whole: {1:X})", client_window.ToInt32(), whole_window.ToInt32());
+ for (int i = 0; i < marshal_free_list.Count; i++) {
+ Marshal.FreeHGlobal((IntPtr)marshal_free_list[i]);
+ }
+ marshal_free_list.Clear();
}
#endregion
rect = new Rectangle(client_rect.Location, client_rect.Size);
if (menu_handle != IntPtr.Zero) {
- rect.Y -= menu_height;
- rect.Height += menu_height;
+ MenuAPI.MENU menu = MenuAPI.GetMenuFromID (menu_handle);
+ if (menu != null) {
+ int menu_height = menu.Height;
+ rect.Y -= menu_height;
+ rect.Height += menu_height;
+ } else
+ Console.WriteLine("Hwnd.GetWindowRectangle: No MENU for menu_handle = {0}", menu_handle);
}
if (border_style == BorderStyle.Fixed3D) {
rect = new Rectangle(0, 0, width, height);
if (menu_handle != IntPtr.Zero) {
- rect.Y += menu_height;
- rect.Height -= menu_height;
+ MenuAPI.MENU menu = MenuAPI.GetMenuFromID (menu_handle);
+ if (menu != null) {
+ int menu_height = menu.Height;
+ rect.Y += menu_height;
+ rect.Height -= menu_height;
+ } else
+ Console.WriteLine("Hwnd.GetClientRectangle: No MENU for menu_handle = {0}", menu_handle);
}
if (border_style == BorderStyle.Fixed3D) {