- }
-#endif // wxUSE_TOOLTIPS
-
- return FALSE;
-}
-
-bool wxWindow::MSWTranslateMessage(WXMSG* pMsg)
-{
- if (m_acceleratorTable.Ok() &&
- ::TranslateAccelerator((HWND) GetHWND(), (HACCEL) m_acceleratorTable.GetHACCEL(), (MSG *)pMsg))
- return TRUE;
- else
- return FALSE;
-}
-
-long wxWindow::MSWOnMDIActivate(long WXUNUSED(flag), WXHWND WXUNUSED(activate), WXHWND WXUNUSED(deactivate))
-{
- return 1;
-}
-
-void wxWindow::MSWDetachWindowMenu()
-{
- if (m_hMenu)
- {
- int N = GetMenuItemCount((HMENU) m_hMenu);
- int i;
- for (i = 0; i < N; i++)
- {
- char buf[100];
- int chars = GetMenuString((HMENU) m_hMenu, i, buf, 100, MF_BYPOSITION);
- if ((chars > 0) && (strcmp(buf, "&Window") == 0))
- {
- RemoveMenu((HMENU) m_hMenu, i, MF_BYPOSITION);
- break;
- }
- }
- }
-}
-
-bool wxWindow::MSWOnPaint()
-{
-#ifdef __WIN32__
- HRGN hRegion = ::CreateRectRgn(0, 0, 0, 0); // Dummy call to get a handle
- ::GetUpdateRgn((HWND) GetHWND(), hRegion, FALSE);
-
- m_updateRegion = wxRegion((WXHRGN) hRegion);
-#else
- RECT updateRect;
- ::GetUpdateRect((HWND) GetHWND(), & updateRect, FALSE);
-
- m_updateRegion = wxRegion(updateRect.left, updateRect.top,
- updateRect.right - updateRect.left, updateRect.bottom - updateRect.top);
-#endif
-
- wxPaintEvent event(m_windowId);
- event.SetEventObject(this);
- if (!GetEventHandler()->ProcessEvent(event))
- Default();
- return TRUE;
-}
-
-void wxWindow::MSWOnSize(int w, int h, WXUINT WXUNUSED(flag))
-{
- if (m_inOnSize)
- return;
-
- if (!m_hWnd)
- return;
-
- m_inOnSize = TRUE;
-
- wxSizeEvent event(wxSize(w, h), m_windowId);
- event.SetEventObject(this);
- if (!GetEventHandler()->ProcessEvent(event))
- Default();
-
- m_inOnSize = FALSE;
-}
-
-void wxWindow::MSWOnWindowPosChanging(void *WXUNUSED(lpPos))
-{
- Default();
-}
-
-// Deal with child commands from buttons etc.
-bool wxWindow::MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control)
-{
- if (wxCurrentPopupMenu)
- {
- wxMenu *popupMenu = wxCurrentPopupMenu;
- wxCurrentPopupMenu = NULL;
- bool succ = popupMenu->MSWCommand(cmd, id);
- return succ;
- }
-
- wxWindow *item = FindItem(id);
- if (item)
- {
- bool value = item->MSWCommand(cmd, id);
- return value;
- }
- else
- {
- wxWindow *win = wxFindWinFromHandle(control);
- if (win)
- return win->MSWCommand(cmd, id);
- }
- return FALSE;
-}
-
-long wxWindow::MSWOnSysCommand(WXWPARAM wParam, WXLPARAM lParam)
-{
- switch (wParam & 0xFFFFFFF0)
- {
- case SC_MAXIMIZE:
- {
- wxMaximizeEvent event(m_windowId);
- event.SetEventObject(this);
- if (!GetEventHandler()->ProcessEvent(event))
- return Default();
- else
- return 0;
- break;
- }
- case SC_MINIMIZE:
- {
- wxIconizeEvent event(m_windowId);
- event.SetEventObject(this);
- if (!GetEventHandler()->ProcessEvent(event))
- return Default();
- else
- return 0;
- break;
- }
- default:
- return Default();
- }
- return 0;
-}
-
-void wxWindow::MSWOnLButtonDown(int x, int y, WXUINT flags)
-{
- wxMouseEvent event(wxEVT_LEFT_DOWN);
-
- event.m_x = x; event.m_y = y;
- event.m_shiftDown = ((flags & MK_SHIFT) != 0);
- event.m_controlDown = ((flags & MK_CONTROL) != 0);
- event.m_leftDown = ((flags & MK_LBUTTON) != 0);
- event.m_middleDown = ((flags & MK_MBUTTON) != 0);
- event.m_rightDown = ((flags & MK_RBUTTON) != 0);
- event.SetTimestamp(wxApp::sm_lastMessageTime);
- event.m_eventObject = this;
-
- m_lastXPos = event.m_x; m_lastYPos = event.m_y; m_lastEvent = wxEVT_LEFT_DOWN;
-
- if (!GetEventHandler()->ProcessEvent(event))
- Default();
-}
-
-void wxWindow::MSWOnLButtonUp(int x, int y, WXUINT flags)
-{
- wxMouseEvent event(wxEVT_LEFT_UP);
-
- event.m_x = x; event.m_y = y;
- event.m_shiftDown = ((flags & MK_SHIFT) != 0);
- event.m_controlDown = ((flags & MK_CONTROL) != 0);
- event.m_leftDown = ((flags & MK_LBUTTON) != 0);
- event.m_middleDown = ((flags & MK_MBUTTON) != 0);
- event.m_rightDown = ((flags & MK_RBUTTON) != 0);
- event.SetTimestamp(wxApp::sm_lastMessageTime);
- event.m_eventObject = this;
-
- m_lastXPos = event.m_x; m_lastYPos = event.m_y; m_lastEvent = wxEVT_LEFT_UP;
-
- if (!GetEventHandler()->ProcessEvent(event))
- Default();
-}
-
-void wxWindow::MSWOnLButtonDClick(int x, int y, WXUINT flags)
-{
- wxMouseEvent event(wxEVT_LEFT_DCLICK);
-
- event.m_x = x; event.m_y = y;
- event.m_shiftDown = ((flags & MK_SHIFT) != 0);
- event.m_controlDown = ((flags & MK_CONTROL) != 0);
- event.m_leftDown = ((flags & MK_LBUTTON) != 0);
- event.m_middleDown = ((flags & MK_MBUTTON) != 0);
- event.m_rightDown = ((flags & MK_RBUTTON) != 0);
- event.SetTimestamp(wxApp::sm_lastMessageTime);
- event.m_eventObject = this;
-
- m_lastXPos = event.m_x; m_lastYPos = event.m_y; m_lastEvent = wxEVT_LEFT_DCLICK;
-
- if (!GetEventHandler()->ProcessEvent(event))
- Default();
-}
-
-void wxWindow::MSWOnMButtonDown(int x, int y, WXUINT flags)
-{
- wxMouseEvent event(wxEVT_MIDDLE_DOWN);
-
- event.m_x = x; event.m_y = y;
- event.m_shiftDown = ((flags & MK_SHIFT) != 0);
- event.m_controlDown = ((flags & MK_CONTROL) != 0);
- event.m_leftDown = ((flags & MK_LBUTTON) != 0);
- event.m_middleDown = ((flags & MK_MBUTTON) != 0);
- event.m_rightDown = ((flags & MK_RBUTTON) != 0);
- event.SetTimestamp(wxApp::sm_lastMessageTime);
- event.m_eventObject = this;
-
- m_lastXPos = event.m_x; m_lastYPos = event.m_y; m_lastEvent = wxEVT_MIDDLE_DOWN;
-
- if (!GetEventHandler()->ProcessEvent(event))
- Default();
-}
-
-void wxWindow::MSWOnMButtonUp(int x, int y, WXUINT flags)
-{
- wxMouseEvent event(wxEVT_MIDDLE_UP);
-
- event.m_x = x; event.m_y = y;
- event.m_shiftDown = ((flags & MK_SHIFT) != 0);
- event.m_controlDown = ((flags & MK_CONTROL) != 0);
- event.m_leftDown = ((flags & MK_LBUTTON) != 0);
- event.m_middleDown = ((flags & MK_MBUTTON) != 0);
- event.m_rightDown = ((flags & MK_RBUTTON) != 0);
- event.SetTimestamp(wxApp::sm_lastMessageTime);
- event.m_eventObject = this;
-
- m_lastXPos = event.m_x; m_lastYPos = event.m_y; m_lastEvent = wxEVT_MIDDLE_UP;