public bool ProcessEvent(IntPtr callref, IntPtr eventref, IntPtr handle, uint kind, ref MSG msg) { Hwnd hwnd; bool client; GetEventParameter(eventref, kEventParamDirectObject, typeControlRef, IntPtr.Zero, (uint)Marshal.SizeOf(typeof(IntPtr)), IntPtr.Zero, ref handle); hwnd = Hwnd.ObjectFromHandle(handle); if (hwnd == null) { return(false); } msg.hwnd = hwnd.Handle; client = (hwnd.ClientWindow == handle ? true : false); switch (kind) { case kEventControlDraw: { IntPtr rgn = IntPtr.Zero; HIRect bounds = new HIRect(); GetEventParameter(eventref, kEventParamRgnHandle, typeQDRgnHandle, IntPtr.Zero, (uint)Marshal.SizeOf(typeof(IntPtr)), IntPtr.Zero, ref rgn); if (rgn != IntPtr.Zero) { Rect rbounds = new Rect(); GetRegionBounds(rgn, ref rbounds); bounds.origin.x = rbounds.left; bounds.origin.y = rbounds.top; bounds.size.width = rbounds.right - rbounds.left; bounds.size.height = rbounds.bottom - rbounds.top; } else { HIViewGetBounds(handle, ref bounds); } if (!hwnd.visible) { if (client) { hwnd.expose_pending = false; } else { hwnd.nc_expose_pending = false; } return(false); } if (!client) { DrawBorders(hwnd); } Driver.AddExpose(hwnd, client, bounds); return(true); } case kEventControlVisibilityChanged: { if (client) { msg.message = Msg.WM_SHOWWINDOW; msg.lParam = (IntPtr)0; msg.wParam = (HIViewIsVisible(handle) ? (IntPtr)1 : (IntPtr)0); return(true); } return(false); } case kEventControlBoundsChanged: { HIRect view_frame = new HIRect(); HIViewGetFrame(handle, ref view_frame); if (!client) { hwnd.X = (int)view_frame.origin.x; hwnd.Y = (int)view_frame.origin.y; hwnd.Width = (int)view_frame.size.width; hwnd.Height = (int)view_frame.size.height; Driver.PerformNCCalc(hwnd); } msg.message = Msg.WM_WINDOWPOSCHANGED; msg.hwnd = hwnd.Handle; return(true); } case kEventControlGetFocusPart: { short pcode = 0; SetEventParameter(eventref, kEventParamControlPart, typeControlPartCode, (uint)Marshal.SizeOf(typeof(short)), ref pcode); return(false); } case kEventControlDragEnter: case kEventControlDragWithin: case kEventControlDragLeave: case kEventControlDragReceive: return(Dnd.HandleEvent(callref, eventref, handle, kind, ref msg)); } return(false); }