+
+ if (m_oleInPlaceObject.Ok())
+ m_oleInPlaceObject->SetObjectRects(&posRect, &posRect);
+}
+
+void wxActiveX::OnPaint(wxPaintEvent& event)
+{
+// wxLogTrace(wxT("repainting activex win"));
+ wxPaintDC dc(this);
+ dc.BeginDrawing();
+ int w, h;
+ GetSize(&w, &h);
+ RECT posRect;
+ posRect.left = 0;
+ posRect.top = 0;
+ posRect.right = w;
+ posRect.bottom = h;
+
+ // Draw only when control is windowless or deactivated
+ if (m_viewObject)
+ {
+ ::RedrawWindow(m_oleObjectHWND, NULL, NULL, RDW_INTERNALPAINT);
+ {
+ RECTL *prcBounds = (RECTL *) &posRect;
+ m_viewObject->Draw(DVASPECT_CONTENT, -1, NULL, NULL, NULL,
+ (HDC)dc.GetHDC(), prcBounds, NULL, NULL, 0);
+ }
+ }
+ else
+ {
+ dc.SetBrush(*wxRED_BRUSH);
+ dc.DrawRectangle(0, 0, w, h);
+ dc.SetBrush(wxNullBrush);
+ }
+ dc.EndDrawing();
+}
+
+
+void wxActiveX::OnMouse(wxMouseEvent& event)
+{
+ if (m_oleObjectHWND == NULL)
+ {
+// wxLogTrace(wxT("no oleInPlaceObject"));
+ event.Skip();
+ return;
+ }
+
+// wxLogTrace(wxT("mouse event"));
+ UINT msg = 0;
+ WPARAM wParam = 0;
+ LPARAM lParam = 0;
+ LRESULT lResult = 0;
+
+ if (event.m_metaDown)
+ wParam |= MK_CONTROL;
+ if (event.m_shiftDown)
+ wParam |= MK_SHIFT;
+ if (event.m_leftDown)
+ wParam |= MK_LBUTTON;
+ if (event.m_middleDown)
+ wParam |= MK_MBUTTON;
+ if (event.m_rightDown)
+ wParam |= MK_RBUTTON;
+ lParam = event.m_x << 16;
+ lParam |= event.m_y;
+
+ if (event.LeftDown())
+ msg = WM_LBUTTONDOWN;
+ else if (event.LeftDClick())
+ msg = WM_LBUTTONDBLCLK;
+ else if (event.LeftUp())
+ msg = WM_LBUTTONUP;
+ else if (event.MiddleDown())
+ msg = WM_MBUTTONDOWN;
+ else if (event.MiddleDClick())
+ msg = WM_MBUTTONDBLCLK;
+ else if (event.MiddleUp())
+ msg = WM_MBUTTONUP;
+ else if (event.RightDown())
+ msg = WM_RBUTTONDOWN;
+ else if (event.RightDClick())
+ msg = WM_RBUTTONDBLCLK;
+ else if (event.RightUp())
+ msg = WM_RBUTTONUP;
+ else if (event.Moving() || event.Dragging())
+ msg = WM_MOUSEMOVE;
+
+ wxString log;
+ if (msg == 0)
+ {
+// wxLogTrace(wxT("no message"));
+ event.Skip(); return;
+ };
+
+ if (!::SendMessage(m_oleObjectHWND, msg, wParam, lParam))
+ {
+// wxLogTrace(wxT("msg not delivered"));
+ event.Skip();
+ return;
+ };
+
+// wxLogTrace(wxT("msg sent"));