X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/22f3361e1cf25c52a2da8fdfc5cb081809e18fb9..6d3b231a02b761671d042c2f8989048ba49125e8:/src/msw/accel.cpp?ds=sidebyside diff --git a/src/msw/accel.cpp b/src/msw/accel.cpp index dd112f385a..a5feca7c4b 100644 --- a/src/msw/accel.cpp +++ b/src/msw/accel.cpp @@ -9,7 +9,7 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "accel.h" #endif @@ -26,6 +26,8 @@ #include "wx/accel.h" +#if wxUSE_ACCEL + #include "wx/msw/private.h" IMPLEMENT_DYNAMIC_CLASS(wxAcceleratorTable, wxObject) @@ -49,7 +51,7 @@ protected: wxAcceleratorRefData::wxAcceleratorRefData() { - m_ok = FALSE; + m_ok = false; m_hAccel = 0; } @@ -57,10 +59,7 @@ wxAcceleratorRefData::~wxAcceleratorRefData() { if (m_hAccel) { - // This function not available in WIN16 -#if !defined(__WIN16__) && !defined(__TWIN32__) DestroyAcceleratorTable((HACCEL) m_hAccel); -#endif } m_hAccel = 0 ; } @@ -80,7 +79,7 @@ wxAcceleratorTable::wxAcceleratorTable(const wxString& resource) m_refData = new wxAcceleratorRefData; HACCEL hAccel = -#if defined(__WIN32__) && !defined(__TWIN32__) +#if defined(__WIN32__) #ifdef UNICODE ::LoadAcceleratorsW(wxGetInstance(), (const wxChar *)resource); #else @@ -93,13 +92,11 @@ wxAcceleratorTable::wxAcceleratorTable(const wxString& resource) M_ACCELDATA->m_ok = (hAccel != 0); } -extern int wxCharCodeWXToMSW(int id, bool *isVirtual); +extern WXWORD wxCharCodeWXToMSW(int id, bool *isVirtual); // Create from an array -#if !defined(__WIN16__) && !defined(__TWIN32__) && !defined(__WXWINE__) wxAcceleratorTable::wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]) { - // Not available in WIN16 m_refData = new wxAcceleratorRefData; ACCEL* arr = new ACCEL[n]; @@ -123,7 +120,7 @@ wxAcceleratorTable::wxAcceleratorTable(int n, const wxAcceleratorEntry entries[] arr[i].fVirt = fVirt; arr[i].key = key; - arr[i].cmd = entries[i].GetCommand(); + arr[i].cmd = (WORD)entries[i].GetCommand(); } M_ACCELDATA->m_hAccel = ::CreateAcceleratorTable(arr, n); @@ -131,14 +128,6 @@ wxAcceleratorTable::wxAcceleratorTable(int n, const wxAcceleratorEntry entries[] M_ACCELDATA->m_ok = (M_ACCELDATA->m_hAccel != 0); } -#else // Win16 -wxAcceleratorTable::wxAcceleratorTable(int WXUNUSED(n), const wxAcceleratorEntry WXUNUSED(entries)[]) -{ - // No, we simply gracefully degrade; we don't expect the - // developer to pepper their code with #ifdefs just for this. - // wxFAIL_MSG("not implemented"); -} -#endif // Win32/16 bool wxAcceleratorTable::Ok() const { @@ -166,3 +155,4 @@ bool wxAcceleratorTable::Translate(wxWindow *window, WXMSG *wxmsg) const return Ok() && ::TranslateAccelerator(GetHwndOf(window), GetHaccel(), msg); } +#endif