]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/window.cpp
Changed the event handling to use events, instead of just virtual functions.
[wxWidgets.git] / src / msw / window.cpp
index 2031e5cc8438e7de67fbb262bc6990dcb6565c2b..c3969cdf30f0f0541c99737315af1694f1b85e90 100644 (file)
@@ -82,7 +82,7 @@
 
 #ifdef  __WXDEBUG__
 const char *wxGetMessageName(int message);
-#endif  //WXDEBUG
+#endif  //__WXDEBUG__
 
 #define WINDOW_MARGIN 3 // This defines sensitivity of Leave events
 
@@ -618,19 +618,8 @@ void wxWindow::ScreenToClient(int *x, int *y) const
     POINT pt;
     pt.x = *x;
     pt.y = *y;
-    ::ScreenToClient(hWnd, &pt);
 
-    /*
-    // We may be faking the client origin.
-    // So a window that's really at (0, 30) may appear
-    // (to wxWin apps) to be at (0, 0).
-    if (GetParent())
-    {
-    wxPoint pt1(GetParent()->GetClientAreaOrigin());
-    pt.x -= pt1.x;
-    pt.y -= pt1.y;
-    }
-    */
+    ::ScreenToClient(hWnd, &pt);
 
     *x = pt.x;
     *y = pt.y;
@@ -643,18 +632,6 @@ void wxWindow::ClientToScreen(int *x, int *y) const
     pt.x = *x;
     pt.y = *y;
 
-    /*
-    // We may be faking the client origin.
-    // So a window that's really at (0, 30) may appear
-    // (to wxWin apps) to be at (0, 0).
-    if (GetParent())
-    {
-    wxPoint pt1(GetParent()->GetClientAreaOrigin());
-    pt.x += pt1.x;
-    pt.y += pt1.y;
-    }
-    */
-
     ::ClientToScreen(hWnd, &pt);
 
     *x = pt.x;
@@ -918,9 +895,8 @@ LRESULT APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA
         wxWndHook = NULL;
         wnd->m_hWnd = (WXHWND) hWnd;
     }
-#if (WXDEBUG > 1)
-    wxDebugMsg("hWnd = %d, m_hWnd = %d, msg = %d\n", hWnd, m_hWnd, message);
-#endif
+    //    wxDebugMsg("hWnd = %d, m_hWnd = %d, msg = %d\n", hWnd, m_hWnd, message);
+
     // Stop right here if we don't have a valid handle
     // in our wxWnd object.
     if (wnd && !wnd->m_hWnd) {
@@ -959,7 +935,7 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
 #ifdef __WXDEBUG__
     wxLogTrace(wxTraceMessages, "Processing %s(%lx, %lx)",
         wxGetMessageName(message), wParam, lParam);
-#endif // WXDEBUG
+#endif // __WXDEBUG__
 
     HWND hWnd = (HWND)m_hWnd;
 
@@ -1580,10 +1556,6 @@ void wxWindow::MSWCreate(int id, wxWindow *parent, const char *wclass, wxWindow
 
     wxWndHook = NULL;
     wxWinHandleList->Append((long)m_hWnd, this);
-
-#if WXDEBUG > 1
-    wxDebugMsg("wxWindow::MSWCreate %d\n", m_hWnd);
-#endif
 }
 
 void wxWindow::MSWOnCreate(WXLPCREATESTRUCT WXUNUSED(cs))
@@ -1592,12 +1564,14 @@ void wxWindow::MSWOnCreate(WXLPCREATESTRUCT WXUNUSED(cs))
 
 bool wxWindow::MSWOnClose(void)
 {
-#if WXDEBUG > 1
-    wxDebugMsg("wxWindow::MSWOnClose %d\n", handle);
-#endif
     return FALSE;
 }
 
+// Some compilers don't define this
+#ifndef ENDSESSION_LOGOFF
+#define ENDSESSION_LOGOFF    0x80000000
+#endif
+
 // Return TRUE to end session, FALSE to veto end session.
 bool wxWindow::MSWOnQueryEndSession(long logOff)
 {
@@ -1632,9 +1606,6 @@ bool wxWindow::MSWOnEndSession(bool endSession, long logOff)
 
 bool wxWindow::MSWOnDestroy(void)
 {
-#if WXDEBUG > 1
-    wxDebugMsg("wxWindow::MSWOnDestroy %d\n", handle);
-#endif
     // delete our drop target if we've got one
 #if wxUSE_DRAG_AND_DROP
     if ( m_pDropTarget != NULL ) {
@@ -1693,9 +1664,6 @@ bool wxWindow::MSWOnNotify(WXWPARAM wParam, WXLPARAM lParam)
 
 void wxWindow::MSWOnMenuHighlight(WXWORD WXUNUSED(item), WXWORD WXUNUSED(flags), WXHMENU WXUNUSED(sysmenu))
 {
-#if WXDEBUG > 1
-    wxDebugMsg("wxWindow::MSWOnMenuHighlight %d\n", handle);
-#endif
 }
 
 void wxWindow::MSWOnInitMenuPopup(WXHMENU menu, int pos, bool isSystem)
@@ -1704,10 +1672,6 @@ void wxWindow::MSWOnInitMenuPopup(WXHMENU menu, int pos, bool isSystem)
 
 bool wxWindow::MSWOnActivate(int state, bool WXUNUSED(minimized), WXHWND WXUNUSED(activate))
 {
-#if WXDEBUG > 1
-    wxDebugMsg("wxWindow::MSWOnActivate %d\n", handle);
-#endif
-
     wxActivateEvent event(wxEVT_ACTIVATE, ((state == WA_ACTIVE) || (state == WA_CLICKACTIVE)),
         m_windowId);
     event.SetEventObject(this);
@@ -1717,9 +1681,6 @@ bool wxWindow::MSWOnActivate(int state, bool WXUNUSED(minimized), WXHWND WXUNUSE
 
 bool wxWindow::MSWOnSetFocus(WXHWND WXUNUSED(hwnd))
 {
-#if WXDEBUG > 1
-    wxDebugMsg("wxWindow::MSWOnSetFocus %d\n", m_hWnd);
-#endif
     // Deal with caret
     if (m_caretEnabled && (m_caretWidth > 0) && (m_caretHeight > 0))
     {
@@ -1737,9 +1698,6 @@ bool wxWindow::MSWOnSetFocus(WXHWND WXUNUSED(hwnd))
 
 bool wxWindow::MSWOnKillFocus(WXHWND WXUNUSED(hwnd))
 {
-#if WXDEBUG > 1
-    wxDebugMsg("wxWindow::MSWOnKillFocus %d\n", m_hWnd);
-#endif
     // Deal with caret
     if (m_caretEnabled)
     {
@@ -1755,9 +1713,6 @@ bool wxWindow::MSWOnKillFocus(WXHWND WXUNUSED(hwnd))
 
 void wxWindow::MSWOnDropFiles(WXWPARAM wParam)
 {
-#if WXDEBUG > 1
-    wxDebugMsg("wxWindow::MSWOnDropFiles %d\n", m_hWnd);
-#endif
 
     HDROP hFilesInfo = (HDROP) wParam;
     POINT dropPoint;
@@ -1848,9 +1803,6 @@ bool wxWindow::MSWOnMeasureItem(int id, WXMEASUREITEMSTRUCT *itemStruct)
 WXHBRUSH wxWindow::MSWOnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
                                  WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
 {
-#if WXDEBUG > 1
-    wxDebugMsg("wxWindow::MSWOnCtlColour %d\n", m_hWnd);
-#endif
     if (nCtlColor == CTLCOLOR_DLG)
     {
         return OnCtlColor(pDC, pWnd, nCtlColor, message, wParam, lParam);
@@ -1948,7 +1900,7 @@ long wxWindow::Default()
 #ifdef __WXDEBUG__
     wxLogTrace(wxTraceMessages, "Forwarding %s to DefWindowProc.",
         wxGetMessageName(m_lastMsg));
-#endif // WXDEBUG
+#endif // __WXDEBUG__
 
     return this->MSWDefWindowProc(m_lastMsg, m_lastWParam, m_lastLParam);
 }
@@ -2032,9 +1984,6 @@ bool wxWindow::MSWTranslateMessage(WXMSG* pMsg)
 
 long wxWindow::MSWOnMDIActivate(long WXUNUSED(flag), WXHWND WXUNUSED(activate), WXHWND WXUNUSED(deactivate))
 {
-#if WXDEBUG > 1
-    wxDebugMsg("wxWindow::MSWOnMDIActivate %d\n", m_hWnd);
-#endif
     return 1;
 }
 
@@ -2084,9 +2033,6 @@ void wxWindow::MSWOnSize(int w, int h, WXUINT WXUNUSED(flag))
     if (m_inOnSize)
         return;
 
-#if WXDEBUG > 1
-    wxDebugMsg("wxWindow::MSWOnSize %d\n", m_hWnd);
-#endif
     if (!m_hWnd)
         return;
 
@@ -2108,9 +2054,6 @@ void wxWindow::MSWOnWindowPosChanging(void *WXUNUSED(lpPos))
 // Deal with child commands from buttons etc.
 bool wxWindow::MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control)
 {
-#if WXDEBUG > 1
-    wxDebugMsg("wxWindow::MSWOnCommand\n");
-#endif
     if (wxCurrentPopupMenu)
     {
         wxMenu *popupMenu = wxCurrentPopupMenu;
@@ -2118,22 +2061,11 @@ bool wxWindow::MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control)
         bool succ = popupMenu->MSWCommand(cmd, id);
         return succ;
     }
-#if WXDEBUG > 1
-    char buf[80];
-    sprintf(buf, "Looking for item %d...\n", id);
-    wxDebugMsg(buf);
-#endif
 
     wxWindow *item = FindItem(id);
     if (item)
     {
         bool value = item->MSWCommand(cmd, id);
-#if WXDEBUG > 1
-        if (value)
-            wxDebugMsg("MSWCommand succeeded\n");
-        else
-            wxDebugMsg("MSWCommand failed\n");
-#endif
         return value;
     }
     else
@@ -2748,9 +2680,6 @@ void wxGetCharSize(WXHWND wnd, int *x, int *y,wxFont *the_font)
     HFONT was = 0;
     if (the_font)
     {
-#if WXDEBUG > 1
-        wxDebugMsg("wxGetCharSize: Selecting HFONT %X\n", fnt);
-#endif
         //    the_font->UseResource();
         //    the_font->RealizeResource();
         if ((fnt=(HFONT) the_font->GetResourceHandle()))
@@ -2759,9 +2688,6 @@ void wxGetCharSize(WXHWND wnd, int *x, int *y,wxFont *the_font)
     GetTextMetrics(dc, &tm);
     if (the_font && fnt && was)
     {
-#if WXDEBUG > 1
-        wxDebugMsg("wxGetCharSize: Selecting old HFONT %X\n", was);
-#endif
         SelectObject(dc,was) ;
     }
     ReleaseDC((HWND)wnd, dc);
@@ -4883,4 +4809,4 @@ const char *wxGetMessageName(int message)
         return s_szBuf;
   }
 }
-#endif //WXDEBUG
+#endif //__WXDEBUG__