]> git.saurik.com Git - wxWidgets.git/commitdiff
Win64 compilation fixes
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 10 Feb 2004 13:02:51 +0000 (13:02 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 10 Feb 2004 13:02:51 +0000 (13:02 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25704 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

12 files changed:
include/wx/selstore.h
include/wx/thread.h
src/msw/colordlg.cpp
src/msw/combobox.cpp
src/msw/dialup.cpp
src/msw/fdrepdlg.cpp
src/msw/radiobox.cpp
src/msw/spinctrl.cpp
src/msw/textctrl.cpp
src/msw/thread.cpp
src/msw/tooltip.cpp
src/msw/window.cpp

index 8ddb73be184eb7238eab1f7c3fb32d2ba513d00c..5c7ffd18638745fddeda08578308906eeaf84b03 100644 (file)
 // wxSelectedIndices is just a sorted array of indices
 // ----------------------------------------------------------------------------
 
-inline int CMPFUNC_CONV wxSizeTCmpFn(size_t n1, size_t n2) { return n1 - n2; }
+inline int CMPFUNC_CONV wxSizeTCmpFn(size_t n1, size_t n2)
+{
+    return (int)(n1 - n2);
+}
 
-WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_LONG(size_t,
-                                         wxSizeTCmpFn,
-                                         wxSelectedIndices);
+WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_SIZE_T(size_t,
+                                           wxSizeTCmpFn,
+                                           wxSelectedIndices);
 
 // ----------------------------------------------------------------------------
 // wxSelectionStore is used to store the selected items in the virtual
index fb33bde0f89d20c9b1fb240e3027f4bc7eb37603..1e7d9f215e3ed2e4694bea563d368ae652b7ddbc 100644 (file)
@@ -249,7 +249,11 @@ private:
     // finally, we need this typedef instead of declaring m_buffer directly
     // because otherwise the assert mentioned above wouldn't compile with some
     // compilers (notably CodeWarrior 8)
+#ifdef __WIN64__
+    typedef char wxCritSectBuffer[40];
+#else // __WIN32__
     typedef char wxCritSectBuffer[24];
+#endif
     union
     {
         unsigned long m_dummy1;
index 66af5ffcf7438bd9435e34244aff00ff6785c1a3..467b05a3cde72232cdbfdeb7614d068a6dc57030 100644 (file)
@@ -70,10 +70,11 @@ IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog)
 // colour dialog hook proc
 // ----------------------------------------------------------------------------
 
-UINT CALLBACK wxColourDialogHookProc(HWND hwnd,
-                                     UINT uiMsg,
-                                     WPARAM WXUNUSED(wParam),
-                                     LPARAM lParam)
+UINT_PTR CALLBACK
+wxColourDialogHookProc(HWND hwnd,
+                       UINT uiMsg,
+                       WPARAM WXUNUSED(wParam),
+                       LPARAM lParam)
 {
     if ( uiMsg == WM_INITDIALOG )
     {
index 2e6715a7e0c1e7d33f06671eb77c9ea4fbda8a12..3b7515c645eaae0cdab79fa97b165e978debde21 100644 (file)
@@ -127,7 +127,7 @@ LRESULT APIENTRY _EXPORT wxComboEditWndProc(HWND hWnd,
 // ---------------------------------------------------------------------------
 
 // the pointer to standard radio button wnd proc
-static WXFARPROC gs_wndprocEdit = (WXFARPROC)NULL;
+static WNDPROC gs_wndprocEdit = (WNDPROC)NULL;
 
 // ============================================================================
 // implementation
@@ -409,12 +409,8 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
     // edit control, we must subclass it as well
     if ( !(style & wxCB_READONLY) )
     {
-        gs_wndprocEdit = (WXFARPROC)::SetWindowLong
-                                      (
-                                        (HWND)GetEditHWND(),
-                                        GWL_WNDPROC,
-                                        (LPARAM)wxComboEditWndProc
-                                      );
+        gs_wndprocEdit = wxSetWindowProc((HWND)GetEditHWND(),
+                                         wxComboEditWndProc);
     }
 
     // and finally, show the control
index 3ccfba7a7fa5f5c79df8b8b89d5fdd3c808d7a73..70035cfc7a6c5ccc897e5e8b0dddbfb839f3fcad 100644 (file)
@@ -1073,13 +1073,7 @@ bool wxDialUpManagerMSW::EnableAutoCheckOnlineStatus(size_t nSeconds)
         }
 
         // and subclass it
-        FARPROC windowProc = MakeProcInstance
-                             (
-                              (FARPROC)wxRasStatusWindowProc,
-                              wxGetInstance()
-                             );
-
-        ::SetWindowLong(ms_hwndRas, GWL_WNDPROC, (LONG) windowProc);
+        wxSetWindowProc(ms_hwndRas, wxRasStatusWindowProc);
     }
 
     m_data.hWnd = ms_hwndRas;
index 7c533fb4a321284b31e0632f233b070ff9074df8..871a4c7b0a48550c33bbd00d06d301c9d7deef56 100644 (file)
 LRESULT APIENTRY wxFindReplaceWindowProc(HWND hwnd, WXUINT nMsg,
                                        WPARAM wParam, LPARAM lParam);
 
-UINT CALLBACK wxFindReplaceDialogHookProc(HWND hwnd,
-                                          UINT uiMsg,
-                                          WPARAM wParam,
-                                          LPARAM lParam);
+UINT_PTR CALLBACK wxFindReplaceDialogHookProc(HWND hwnd,
+                                              UINT uiMsg,
+                                              WPARAM wParam,
+                                              LPARAM lParam);
 
 // ----------------------------------------------------------------------------
 // wxWin macros
@@ -201,14 +201,11 @@ void wxFindReplaceDialogImpl::SubclassDialog(HWND hwnd)
     // as then we'd have infinite recursion in wxFindReplaceWindowProc
     if ( !wxCheckWindowWndProc((WXHWND)hwnd, (WXFARPROC)wxFindReplaceWindowProc) )
     {
-        WNDPROC oldParentWndProc = (WNDPROC)::GetWindowLong(hwnd, GWL_WNDPROC);
-        // save old wnd proc elsewhere to access it from
-        // wxFindReplaceWindowProc
-        m_oldParentWndProc = oldParentWndProc;
-        (void)::SetWindowLong(hwnd, GWL_USERDATA, (LONG)oldParentWndProc);
-
-        // and set the new one
-        (void)::SetWindowLong(hwnd, GWL_WNDPROC, (LONG)wxFindReplaceWindowProc);
+        // set the new one and save the old as user data to allow access to it
+        // from wxFindReplaceWindowProc
+        m_oldParentWndProc = wxSetWindowProc(hwnd, wxFindReplaceWindowProc);
+
+        wxSetWindowUserData(hwnd, m_oldParentWndProc);
     }
 }
 
@@ -219,7 +216,8 @@ wxFindReplaceDialogImpl::~wxFindReplaceDialogImpl()
 
     if ( m_hwndOwner )
     {
-        ::SetWindowLong(m_hwndOwner, GWL_WNDPROC, (LONG)m_oldParentWndProc);
+        // undo subclassing
+        wxSetWindowProc(m_hwndOwner, m_oldParentWndProc);
     }
 }
 
@@ -327,7 +325,7 @@ LRESULT APIENTRY wxFindReplaceWindowProc(HWND hwnd, WXUINT nMsg,
         s_lastMsgFlags = 0;
 #endif // wxUSE_UNICODE_MSLU
 
-    WNDPROC wndProc = (WNDPROC)::GetWindowLong(hwnd, GWL_USERDATA);
+    WNDPROC wndProc = (WNDPROC)wxGetWindowUserData(hwnd);
 
     // sanity check
     wxASSERT_MSG( wndProc != wxFindReplaceWindowProc,
@@ -340,10 +338,11 @@ LRESULT APIENTRY wxFindReplaceWindowProc(HWND hwnd, WXUINT nMsg,
 // Find/replace dialog hook proc
 // ----------------------------------------------------------------------------
 
-UINT CALLBACK wxFindReplaceDialogHookProc(HWND hwnd,
-                                          UINT uiMsg,
-                                          WPARAM WXUNUSED(wParam),
-                                          LPARAM lParam)
+UINT_PTR CALLBACK
+wxFindReplaceDialogHookProc(HWND hwnd,
+                            UINT uiMsg,
+                            WPARAM WXUNUSED(wParam),
+                            LPARAM lParam)
 {
     if ( uiMsg == WM_INITDIALOG )
     {
index bb1b247614aac745fdf1f2c11c37583e518a1c0d..0434f16e2ebefa91b85a0823e8d7e11a1a675216 100644 (file)
@@ -782,10 +782,10 @@ void wxRadioBox::SubclassRadioButton(WXHWND hWndBtn)
     HWND hwndBtn = (HWND)hWndBtn;
 
     if ( !s_wndprocRadioBtn )
-        s_wndprocRadioBtn = (WXFARPROC)::GetWindowLong(hwndBtn, GWL_WNDPROC);
+        s_wndprocRadioBtn = (WXFARPROC)wxGetWindowProc(hwndBtn);
 
-    ::SetWindowLong(hwndBtn, GWL_WNDPROC, (long)wxRadioBtnWndProc);
-    ::SetWindowLong(hwndBtn, GWL_USERDATA, (long)this);
+    wxSetWindowProc(hwndBtn, wxRadioBtnWndProc);
+    wxSetWindowUserData(hwndBtn, this);
 }
 
 void wxRadioBox::SendNotificationEvent()
@@ -933,8 +933,8 @@ LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hwnd,
                 NMHDR* hdr = (NMHDR *)lParam;
                 if ( hdr->code == TTN_NEEDTEXT )
                 {
-                    wxRadioBox *radiobox = (wxRadioBox *)
-                        ::GetWindowLong(hwnd, GWL_USERDATA);
+                    wxRadioBox *
+                        radiobox = (wxRadioBox *)wxGetWindowUserData(hwnd);
 
                     wxCHECK_MSG( radiobox, 0,
                                  wxT("radio button without radio box?") );
@@ -955,8 +955,7 @@ LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hwnd,
 
         case WM_KEYDOWN:
             {
-                wxRadioBox *radiobox = (wxRadioBox *)
-                    ::GetWindowLong(hwnd, GWL_USERDATA);
+                wxRadioBox *radiobox = (wxRadioBox *)wxGetWindowUserData(hwnd);
 
                 wxCHECK_MSG( radiobox, 0, wxT("radio button without radio box?") );
 
@@ -1015,8 +1014,7 @@ LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hwnd,
         case WM_SETFOCUS:
         case WM_KILLFOCUS:
             {
-                wxRadioBox *radiobox = (wxRadioBox *)
-                    ::GetWindowLong(hwnd, GWL_USERDATA);
+                wxRadioBox *radiobox = (wxRadioBox *)wxGetWindowUserData(hwnd);
 
                 wxCHECK_MSG( radiobox, 0, wxT("radio button without radio box?") );
 
@@ -1034,8 +1032,7 @@ LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hwnd,
 #ifdef __WIN32__
         case WM_HELP:
             {
-                wxRadioBox *radiobox = (wxRadioBox *)
-                        ::GetWindowLong(hwnd, GWL_USERDATA);
+                wxRadioBox *radiobox = (wxRadioBox *)wxGetWindowUserData(hwnd);
 
                 wxCHECK_MSG( radiobox, 0, wxT("radio button without radio box?") );
 
index b28679f7fa523b7e918f8e23afc8ed1fc76fa585..88a9e2ec1c844367c0f0c76ee8782e10cdaf9e62 100644 (file)
@@ -149,7 +149,7 @@ LRESULT APIENTRY _EXPORT wxBuddyTextWndProc(HWND hwnd,
                                             WPARAM wParam,
                                             LPARAM lParam)
 {
-    wxSpinCtrl *spin = (wxSpinCtrl *)::GetWindowLong(hwnd, GWL_USERDATA);
+    wxSpinCtrl *spin = (wxSpinCtrl *)wxGetWindowUserData(hwnd);
 
     // forward some messages (the key and focus ones only so far) to
     // the spin ctrl
@@ -170,7 +170,7 @@ LRESULT APIENTRY _EXPORT wxBuddyTextWndProc(HWND hwnd,
             spin->MSWWindowProc(message, wParam, lParam);
 
             // The control may have been deleted at this point, so check.
-            if (!(::IsWindow(hwnd) && ((wxSpinCtrl *)::GetWindowLong(hwnd, GWL_USERDATA)) == spin))
+            if ( !::IsWindow(hwnd) || wxGetWindowUserData(hwnd) != spin )
                 return 0;
             break;
 
@@ -186,8 +186,7 @@ LRESULT APIENTRY _EXPORT wxBuddyTextWndProc(HWND hwnd,
 /* static */
 wxSpinCtrl *wxSpinCtrl::GetSpinForTextCtrl(WXHWND hwndBuddy)
 {
-    wxSpinCtrl *spin = (wxSpinCtrl *)::GetWindowLong((HWND)hwndBuddy,
-                                                     GWL_USERDATA);
+    wxSpinCtrl *spin = (wxSpinCtrl *)wxGetWindowUserData((HWND)hwndBuddy);
 
     int i = ms_allSpins.Index(spin);
 
@@ -363,9 +362,9 @@ bool wxSpinCtrl::Create(wxWindow *parent,
     SetValue(initial);
 
     // subclass the text ctrl to be able to intercept some events
-    m_wndProcBuddy = (WXFARPROC)::GetWindowLong(GetBuddyHwnd(), GWL_WNDPROC);
-    ::SetWindowLong(GetBuddyHwnd(), GWL_USERDATA, (LONG)this);
-    ::SetWindowLong(GetBuddyHwnd(), GWL_WNDPROC, (LONG)wxBuddyTextWndProc);
+    wxSetWindowUserData(GetBuddyHwnd(), this);
+    m_wndProcBuddy = (WXFARPROC)wxSetWindowProc(GetBuddyHwnd(),
+                                                wxBuddyTextWndProc);
 
     // should have the same font as the other controls
     SetFont(GetParent()->GetFont());
index 79040fcb2c9bc97b2834cb63fd224a315cf7b725..966fff942b759bcfb8f15cd53f8d19d35919ac9c 100644 (file)
@@ -688,7 +688,7 @@ struct wxStreamOutData
 };
 
 DWORD CALLBACK
-wxRichEditStreamOut(DWORD dwCookie, BYTE *buf, LONG cb, LONG *pcb)
+wxRichEditStreamOut(DWORD_PTR dwCookie, BYTE *buf, LONG cb, LONG *pcb)
 {
     *pcb = 0;
 
index e179d3683f46fbc1e85199991421a16f80a14278..469ced786b44ebabbe4ea8866e854061e55e4e0c 100644 (file)
@@ -902,7 +902,7 @@ bool wxThread::SetConcurrency(size_t level)
 
     // get system affinity mask first
     HANDLE hProcess = ::GetCurrentProcess();
-    DWORD dwProcMask, dwSysMask;
+    DWORD_PTR dwProcMask, dwSysMask;
     if ( ::GetProcessAffinityMask(hProcess, &dwProcMask, &dwSysMask) == 0 )
     {
         wxLogLastError(_T("GetProcessAffinityMask"));
@@ -983,7 +983,8 @@ bool wxThread::SetConcurrency(size_t level)
 
         return false;
     }
-#endif
+#endif // !__WXWINCE__
+
     return true;
 }
 
index 29b03ade78ca98c44d7f64d4e0edaa8a6d201b79..0ab90686a80205ccd8b484149c0e7c9d5d05b688 100644 (file)
@@ -217,8 +217,7 @@ WXHWND wxToolTip::GetToolTipCtrl()
 
 #if wxUSE_TTM_WINDOWFROMPOINT
            // subclass the newly created control
-           gs_wndprocToolTip = (WNDPROC)::GetWindowLong(hwnd, GWL_WNDPROC);
-           ::SetWindowLong(hwnd, GWL_WNDPROC, (long)wxToolTipWndProc);
+           gs_wndprocToolTip = wxSetWindowProc(hwnd, wxToolTipWndProc);
 #endif // wxUSE_TTM_WINDOWFROMPOINT
        }
     }
index 94f3430ce18e66359fc19715fdc937707c177358..814064fb754a1081dad379baa7e563209e482367 100644 (file)
@@ -974,13 +974,13 @@ void wxWindowMSW::SubclassWin(WXHWND hWnd)
 
     wxAssociateWinWithHandle(hwnd, this);
 
-    m_oldWndProc = (WXFARPROC)::GetWindowLong((HWND)hWnd, GWL_WNDPROC);
+    m_oldWndProc = (WXFARPROC)wxGetWindowProc((HWND)hWnd);
 
     // we don't need to subclass the window of our own class (in the Windows
     // sense of the word)
        if ( !wxCheckWindowWndProc(hWnd, (WXFARPROC)wxWndProc) )
     {
-        ::SetWindowLong(hwnd, GWL_WNDPROC, (LONG) wxWndProc);
+        wxSetWindowProc(hwnd, wxWndProc);
     }
     else
     {
@@ -1008,7 +1008,7 @@ void wxWindowMSW::UnsubclassWin()
         {
             if ( !wxCheckWindowWndProc((WXHWND)hwnd, m_oldWndProc) )
             {
-                ::SetWindowLong(hwnd, GWL_WNDPROC, (LONG) m_oldWndProc);
+                wxSetWindowProc(hwnd, (WNDPROC)m_oldWndProc);
             }
 
             m_oldWndProc = NULL;
@@ -3678,8 +3678,13 @@ wxWindowMSW::MSWOnMeasureItem(int WXUNUSED_UNLESS_ODRAWN(id),
 
         wxCHECK( pMenuItem->IsKindOf(CLASSINFO(wxMenuItem)), FALSE );
 
-        return pMenuItem->OnMeasureItem(&pMeasureStruct->itemWidth,
-                                        &pMeasureStruct->itemHeight);
+        size_t w, h;
+        bool rc = pMenuItem->OnMeasureItem(&w, &h);
+
+        pMeasureStruct->itemWidth = w;
+        pMeasureStruct->itemHeight = h;
+
+        return rc;
     }
 
     wxControl *item = wxDynamicCast(FindItem(id), wxControl);
@@ -5103,7 +5108,7 @@ extern wxWindow *wxGetWindowFromHWND(WXHWND hWnd)
             // do it as well, win would be already non NULL
             if ( ::SendMessage(hwnd, WM_GETDLGCODE, 0, 0) & DLGC_RADIOBUTTON )
             {
-                win = (wxWindow *)::GetWindowLong(hwnd, GWL_USERDATA);
+                win = (wxWindow *)wxGetWindowUserData(hwnd);
             }
             //else: it's a wxRadioButton, not a radiobutton from wxRadioBox
 #endif // wxUSE_RADIOBOX