From c42404a58eac2c9eb0557565a471a794c387a715 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 14 Feb 2000 18:21:21 +0000 Subject: [PATCH] fixes for compilation with the old mingw32, wxUSE_NORLANDER_HEADERS is always defined (as 0 or 1) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6012 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/defs.h | 10 +- include/wx/msw/private.h | 3 +- include/wx/msw/registry.h | 2 +- include/wx/msw/window.h | 6 +- src/msw/app.cpp | 9 +- src/msw/checklst.cpp | 4 +- src/msw/control.cpp | 4 +- src/msw/curico.cpp | 6 +- src/msw/dc.cpp | 3 - src/msw/dib.cpp | 8 +- src/msw/dirdlg.cpp | 3 +- src/msw/gauge95.cpp | 4 +- src/msw/gsocket.c | 4 + src/msw/joystick.cpp | 90 +++++++++--------- src/msw/listbox.cpp | 6 +- src/msw/listctrl.cpp | 14 +-- src/msw/minifram.cpp | 10 +- src/msw/notebook.cpp | 12 +-- src/msw/registry.cpp | 2 +- src/msw/slider95.cpp | 6 +- src/msw/spinbutt.cpp | 2 +- src/msw/spinctrl.cpp | 2 +- src/msw/statbr95.cpp | 4 +- src/msw/tabctrl.cpp | 16 +--- src/msw/taskbar.cpp | 66 +++++++------ src/msw/textctrl.cpp | 2 +- src/msw/treectrl.cpp | 15 ++- src/msw/wave.cpp | 16 +--- src/msw/window.cpp | 194 +++++++++++++++++--------------------- 29 files changed, 237 insertions(+), 286 deletions(-) diff --git a/include/wx/defs.h b/include/wx/defs.h index 0b6b3cb00d..5a81d4ac0c 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -138,9 +138,13 @@ // we are setting this define because of the complex check // using NORLANDER as Cygwin may follow. (header author is Anders Norlander) #if defined(__MINGW32__) && ((__GNUC__>2) ||((__GNUC__==2) && (__GNUC_MINOR__>=95))) -#ifndef wxUSE_NORLANDER_HEADERS -# define wxUSE_NORLANDER_HEADERS 1 -#endif + #ifndef wxUSE_NORLANDER_HEADERS + #define wxUSE_NORLANDER_HEADERS 1 + #endif +#else + #ifndef wxUSE_NORLANDER_HEADERS + #define wxUSE_NORLANDER_HEADERS 0 + #endif #endif // "old" GNUWIN32 is the one without Norlander's headers: it lacks the standard diff --git a/include/wx/msw/private.h b/include/wx/msw/private.h index f932c659c0..c23c715266 100644 --- a/include/wx/msw/private.h +++ b/include/wx/msw/private.h @@ -67,7 +67,7 @@ WXDLLEXPORT_DATA(extern HFONT) wxSTATUS_LINE_FONT; // this defines a CASTWNDPROC macro which casts a pointer to the type of a // window proc -#if defined(__GNUWIN32__) && !defined(wxUSE_NORLANDER_HEADERS) +#ifdef __GNUWIN32_OLD__ # define CASTWNDPROC (long unsigned) #else # ifdef __BORLANDC__ @@ -79,7 +79,6 @@ WXDLLEXPORT_DATA(extern HFONT) wxSTATUS_LINE_FONT; typedef int (pascal * WndProcCast) (); #endif # define CASTWNDPROC (WndProcCast) -// # define CASTWNDPROC # else typedef int (pascal * WndProcCast) (); # define CASTWNDPROC (WndProcCast) diff --git a/include/wx/msw/registry.h b/include/wx/msw/registry.h index 958b78c878..c08a75110a 100644 --- a/include/wx/msw/registry.h +++ b/include/wx/msw/registry.h @@ -125,7 +125,7 @@ public: bool Exists() const; // get the info about key (any number of these pointers may be NULL) -#if defined( __GNUWIN32__) && !defined(wxUSE_NORLANDER_HEADERS) +#if defined( __GNUWIN32_OLD__ ) bool GetKeyInfo(size_t *pnSubKeys, // number of subkeys size_t *pnMaxKeyLen, // max len of subkey name size_t *pnValues, // number of values diff --git a/include/wx/msw/window.h b/include/wx/msw/window.h index fd873efbde..20f6cbb2aa 100644 --- a/include/wx/msw/window.h +++ b/include/wx/msw/window.h @@ -52,8 +52,6 @@ enum class WXDLLEXPORT wxWindow : public wxWindowBase { - DECLARE_DYNAMIC_CLASS(wxWindow); - public: wxWindow() { Init(); } @@ -425,6 +423,10 @@ private: bool HandleNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); #endif // __WIN95__ + // the helper functions used by HandleChar/KeyXXX methods + wxKeyEvent CreateKeyEvent(wxEventType evType, int id, WXLPARAM lp) const; + + DECLARE_DYNAMIC_CLASS(wxWindow); DECLARE_NO_COPY_CLASS(wxWindow); DECLARE_EVENT_TABLE() }; diff --git a/src/msw/app.cpp b/src/msw/app.cpp index 50df9a440d..cb05b27011 100644 --- a/src/msw/app.cpp +++ b/src/msw/app.cpp @@ -71,14 +71,13 @@ #include "wx/tooltip.h" #endif // wxUSE_TOOLTIPS -// OLE is used for drag-and-drop, clipboard, OLE Automation... -#ifndef wxUSE_NORLANDER_HEADERS -#if defined(__GNUWIN32__) || defined(__SC__) || defined(__SALFORDC__) +// OLE is used for drag-and-drop, clipboard, OLE Automation..., but some +// compilers don't support it (missing headers, libs, ...) +#if defined(__GNUWIN32_OLD__) || defined(__SC__) || defined(__SALFORDC__) #undef wxUSE_OLE #define wxUSE_OLE 0 #endif // broken compilers -#endif #if wxUSE_OLE #include @@ -87,7 +86,7 @@ #include #include -#if (defined(__WIN95__) && !defined(__GNUWIN32__)) || defined(__TWIN32__) || defined(wxUSE_NORLANDER_HEADERS) +#if defined(__WIN95__) && !(defined(__GNUWIN32_OLD__) || defined(__TWIN32__)) #include #endif diff --git a/src/msw/checklst.cpp b/src/msw/checklst.cpp index ea5b2a56f2..5747dc5e79 100644 --- a/src/msw/checklst.cpp +++ b/src/msw/checklst.cpp @@ -45,8 +45,8 @@ #include #include -#if defined(__GNUWIN32__) && !defined(wxUSE_NORLANDER_HEADERS) -#include "wx/msw/gnuwin32/extra.h" +#ifdef __GNUWIN32_OLD__ + #include "wx/msw/gnuwin32/extra.h" #endif // ---------------------------------------------------------------------------- diff --git a/src/msw/control.cpp b/src/msw/control.cpp index 89ddd5c546..ce7b2fca18 100644 --- a/src/msw/control.cpp +++ b/src/msw/control.cpp @@ -30,8 +30,8 @@ #include "wx/msw/private.h" -#if (defined(__WIN95__) && !defined(__GNUWIN32__)) || defined(__TWIN32__) || defined(wxUSE_NORLANDER_HEADERS) -#include +#if defined(__WIN95__) && !(defined(__GNUWIN32_OLD__) || defined(__TWIN32__)) + #include #endif IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow) diff --git a/src/msw/curico.cpp b/src/msw/curico.cpp index e3ee90176f..1629b21398 100644 --- a/src/msw/curico.cpp +++ b/src/msw/curico.cpp @@ -24,10 +24,8 @@ #include #endif -#ifndef __TWIN32__ -#if defined (__GNUWIN32__) && !defined(wxUSE_NORLANDER_HEADERS) -#include "wx/msw/gnuwin32/extra.h" -#endif +#ifdef __GNUWIN32_OLD__ + #include "wx/msw/gnuwin32/extra.h" #endif #include "wx/wxchar.h" diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index 8af1f9b506..5190c3b350 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -48,9 +48,6 @@ #include "wx/msw/private.h" // needs to be before #include #if wxUSE_COMMON_DIALOGS -#if wxUSE_NORLANDER_HEADERS - #include -#endif #include #endif diff --git a/src/msw/dib.cpp b/src/msw/dib.cpp index 47c855e766..5952c60152 100644 --- a/src/msw/dib.cpp +++ b/src/msw/dib.cpp @@ -48,12 +48,8 @@ #include "wx/msw/dib.h" -#ifndef __TWIN32__ -#ifndef wxUSE_NORLANDER_HEADERS -#ifdef __GNUWIN32__ -#include "wx/msw/gnuwin32/extra.h" -#endif -#endif +#ifdef __GNUWIN32_OLD__ + #include "wx/msw/gnuwin32/extra.h" #endif #ifndef SEEK_CUR diff --git a/src/msw/dirdlg.cpp b/src/msw/dirdlg.cpp index 460491c1f3..f8de559fa2 100644 --- a/src/msw/dirdlg.cpp +++ b/src/msw/dirdlg.cpp @@ -27,8 +27,7 @@ #pragma hdrstop #endif -#if defined(__WIN95__) && \ - (!defined(__GNUWIN32__) || defined(wxUSE_NORLANDER_HEADERS)) +#if defined(__WIN95__) && !defined(__GNUWIN32_OLD__) #ifndef WX_PRECOMP #include "wx/utils.h" diff --git a/src/msw/gauge95.cpp b/src/msw/gauge95.cpp index 74e1649158..c43b527cb6 100644 --- a/src/msw/gauge95.cpp +++ b/src/msw/gauge95.cpp @@ -29,8 +29,8 @@ #include "wx/msw/gauge95.h" #include "wx/msw/private.h" -#if (defined(__WIN95__) && !defined(__GNUWIN32__)) || defined(__TWIN32__) || defined(wxUSE_NORLANDER_HEADERS) -#include +#if defined(__WIN95__) && !(defined(__GNUWIN32_OLD__) || defined(__TWIN32__)) + #include #endif IMPLEMENT_DYNAMIC_CLASS(wxGauge95, wxControl) diff --git a/src/msw/gsocket.c b/src/msw/gsocket.c index dc1090f625..66dc5acfc6 100644 --- a/src/msw/gsocket.c +++ b/src/msw/gsocket.c @@ -46,7 +46,11 @@ #include #include +/* if we use configure for MSW SOCKLEN_T will be already defined */ +#ifndef SOCKLEN_T #define SOCKLEN_T int +#endif + #define CLASSNAME "_GSocket_Internal_Window_Class" #define WINDOWNAME "_GSocket_Internal_Window_Name" diff --git a/src/msw/joystick.cpp b/src/msw/joystick.cpp index cd636fba81..28c0752f05 100644 --- a/src/msw/joystick.cpp +++ b/src/msw/joystick.cpp @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -24,8 +24,8 @@ #include "wx/window.h" #include "wx/msw/private.h" -#if !defined( __GNUWIN32__ ) || defined(wxUSE_NORLANDER_HEADERS) -#include +#ifndef __GNUWIN32_OLD__ + #include #endif #if !defined(__WIN32__) && !defined(_MMRESULT_) @@ -33,12 +33,10 @@ typedef UINT MMRESULT; #endif #ifndef __TWIN32__ -#ifdef __GNUWIN32__ -#ifndef wxUSE_NORLANDER_HEADERS +#ifdef __GNUWIN32_OLD__ #include "wx/msw/gnuwin32/extra.h" #endif #endif -#endif // Why doesn't BC++ have joyGetPosEx? #if !defined(__WIN32__) || defined(__BORLANDC__) || defined(__TWIN32__) @@ -53,7 +51,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxJoystick, wxObject) // Attributes //////////////////////////////////////////////////////////////////////////// -wxPoint wxJoystick::GetPosition(void) const +wxPoint wxJoystick::GetPosition() const { JOYINFO joyInfo; MMRESULT res = joyGetPos(m_joystick, & joyInfo); @@ -63,7 +61,7 @@ wxPoint wxJoystick::GetPosition(void) const return wxPoint(0, 0); } -int wxJoystick::GetZPosition(void) const +int wxJoystick::GetZPosition() const { JOYINFO joyInfo; MMRESULT res = joyGetPos(m_joystick, & joyInfo); @@ -73,7 +71,7 @@ int wxJoystick::GetZPosition(void) const return 0; } -int wxJoystick::GetButtonState(void) const +int wxJoystick::GetButtonState() const { JOYINFO joyInfo; MMRESULT res = joyGetPos(m_joystick, & joyInfo); @@ -95,7 +93,7 @@ int wxJoystick::GetButtonState(void) const return 0; } -int wxJoystick::GetPOVPosition(void) const +int wxJoystick::GetPOVPosition() const { #ifndef NO_JOYGETPOSEX JOYINFOEX joyInfo; @@ -112,7 +110,7 @@ int wxJoystick::GetPOVPosition(void) const #endif } -int wxJoystick::GetPOVCTSPosition(void) const +int wxJoystick::GetPOVCTSPosition() const { #ifndef NO_JOYGETPOSEX JOYINFOEX joyInfo; @@ -129,7 +127,7 @@ int wxJoystick::GetPOVCTSPosition(void) const #endif } -int wxJoystick::GetRudderPosition(void) const +int wxJoystick::GetRudderPosition() const { #ifndef NO_JOYGETPOSEX JOYINFOEX joyInfo; @@ -146,7 +144,7 @@ int wxJoystick::GetRudderPosition(void) const #endif } -int wxJoystick::GetUPosition(void) const +int wxJoystick::GetUPosition() const { #ifndef NO_JOYGETPOSEX JOYINFOEX joyInfo; @@ -163,7 +161,7 @@ int wxJoystick::GetUPosition(void) const #endif } -int wxJoystick::GetVPosition(void) const +int wxJoystick::GetVPosition() const { #ifndef NO_JOYGETPOSEX JOYINFOEX joyInfo; @@ -180,7 +178,7 @@ int wxJoystick::GetVPosition(void) const #endif } -int wxJoystick::GetMovementThreshold(void) const +int wxJoystick::GetMovementThreshold() const { UINT thresh = 0; MMRESULT res = joyGetThreshold(m_joystick, & thresh); @@ -201,19 +199,19 @@ void wxJoystick::SetMovementThreshold(int threshold) // Capabilities //////////////////////////////////////////////////////////////////////////// -bool wxJoystick::IsOk(void) const +bool wxJoystick::IsOk() const { JOYINFO joyInfo; MMRESULT res = joyGetPos(m_joystick, & joyInfo); return ((joyGetNumDevs() > 0) || (res == JOYERR_NOERROR)); } -int wxJoystick::GetNumberJoysticks(void) const +int wxJoystick::GetNumberJoysticks() const { return joyGetNumDevs(); } -int wxJoystick::GetManufacturerId(void) const +int wxJoystick::GetManufacturerId() const { JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) @@ -222,7 +220,7 @@ int wxJoystick::GetManufacturerId(void) const return joyCaps.wMid; } -int wxJoystick::GetProductId(void) const +int wxJoystick::GetProductId() const { JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) @@ -231,7 +229,7 @@ int wxJoystick::GetProductId(void) const return joyCaps.wPid; } -wxString wxJoystick::GetProductName(void) const +wxString wxJoystick::GetProductName() const { JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) @@ -240,7 +238,7 @@ wxString wxJoystick::GetProductName(void) const return wxString(joyCaps.szPname); } -int wxJoystick::GetXMin(void) const +int wxJoystick::GetXMin() const { JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) @@ -249,7 +247,7 @@ int wxJoystick::GetXMin(void) const return joyCaps.wXmin; } -int wxJoystick::GetYMin(void) const +int wxJoystick::GetYMin() const { JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) @@ -258,7 +256,7 @@ int wxJoystick::GetYMin(void) const return joyCaps.wYmin; } -int wxJoystick::GetZMin(void) const +int wxJoystick::GetZMin() const { JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) @@ -267,7 +265,7 @@ int wxJoystick::GetZMin(void) const return joyCaps.wZmin; } -int wxJoystick::GetXMax(void) const +int wxJoystick::GetXMax() const { JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) @@ -276,7 +274,7 @@ int wxJoystick::GetXMax(void) const return joyCaps.wXmax; } -int wxJoystick::GetYMax(void) const +int wxJoystick::GetYMax() const { JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) @@ -285,7 +283,7 @@ int wxJoystick::GetYMax(void) const return joyCaps.wYmax; } -int wxJoystick::GetZMax(void) const +int wxJoystick::GetZMax() const { JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) @@ -294,7 +292,7 @@ int wxJoystick::GetZMax(void) const return joyCaps.wZmax; } -int wxJoystick::GetNumberButtons(void) const +int wxJoystick::GetNumberButtons() const { JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) @@ -303,7 +301,7 @@ int wxJoystick::GetNumberButtons(void) const return joyCaps.wNumButtons; } -int wxJoystick::GetNumberAxes(void) const +int wxJoystick::GetNumberAxes() const { #if defined(__WIN32__) && !defined(__TWIN32__) JOYCAPS joyCaps; @@ -316,7 +314,7 @@ int wxJoystick::GetNumberAxes(void) const #endif } -int wxJoystick::GetMaxButtons(void) const +int wxJoystick::GetMaxButtons() const { #if defined(__WIN32__) && !defined(__TWIN32__) JOYCAPS joyCaps; @@ -329,7 +327,7 @@ int wxJoystick::GetMaxButtons(void) const #endif } -int wxJoystick::GetMaxAxes(void) const +int wxJoystick::GetMaxAxes() const { #if defined(__WIN32__) && !defined(__TWIN32__) JOYCAPS joyCaps; @@ -342,7 +340,7 @@ int wxJoystick::GetMaxAxes(void) const #endif } -int wxJoystick::GetPollingMin(void) const +int wxJoystick::GetPollingMin() const { JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) @@ -351,7 +349,7 @@ int wxJoystick::GetPollingMin(void) const return joyCaps.wPeriodMin; } -int wxJoystick::GetPollingMax(void) const +int wxJoystick::GetPollingMax() const { JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) @@ -360,7 +358,7 @@ int wxJoystick::GetPollingMax(void) const return joyCaps.wPeriodMax; } -int wxJoystick::GetRudderMin(void) const +int wxJoystick::GetRudderMin() const { #if defined(__WIN32__) && !defined(__TWIN32__) JOYCAPS joyCaps; @@ -373,7 +371,7 @@ int wxJoystick::GetRudderMin(void) const #endif } -int wxJoystick::GetRudderMax(void) const +int wxJoystick::GetRudderMax() const { #if defined(__WIN32__) && !defined(__TWIN32__) JOYCAPS joyCaps; @@ -386,7 +384,7 @@ int wxJoystick::GetRudderMax(void) const #endif } -int wxJoystick::GetUMin(void) const +int wxJoystick::GetUMin() const { #if defined(__WIN32__) && !defined(__TWIN32__) JOYCAPS joyCaps; @@ -399,7 +397,7 @@ int wxJoystick::GetUMin(void) const #endif } -int wxJoystick::GetUMax(void) const +int wxJoystick::GetUMax() const { #if defined(__WIN32__) && !defined(__TWIN32__) JOYCAPS joyCaps; @@ -412,7 +410,7 @@ int wxJoystick::GetUMax(void) const #endif } -int wxJoystick::GetVMin(void) const +int wxJoystick::GetVMin() const { #if defined(__WIN32__) && !defined(__TWIN32__) JOYCAPS joyCaps; @@ -425,7 +423,7 @@ int wxJoystick::GetVMin(void) const #endif } -int wxJoystick::GetVMax(void) const +int wxJoystick::GetVMax() const { #if defined(__WIN32__) && !defined(__TWIN32__) JOYCAPS joyCaps; @@ -439,7 +437,7 @@ int wxJoystick::GetVMax(void) const } -bool wxJoystick::HasRudder(void) const +bool wxJoystick::HasRudder() const { #if defined(__WIN32__) && !defined(__TWIN32__) JOYCAPS joyCaps; @@ -452,7 +450,7 @@ bool wxJoystick::HasRudder(void) const #endif } -bool wxJoystick::HasZ(void) const +bool wxJoystick::HasZ() const { #if defined(__WIN32__) && !defined(__TWIN32__) JOYCAPS joyCaps; @@ -465,7 +463,7 @@ bool wxJoystick::HasZ(void) const #endif } -bool wxJoystick::HasU(void) const +bool wxJoystick::HasU() const { #if defined(__WIN32__) && !defined(__TWIN32__) JOYCAPS joyCaps; @@ -478,7 +476,7 @@ bool wxJoystick::HasU(void) const #endif } -bool wxJoystick::HasV(void) const +bool wxJoystick::HasV() const { #if defined(__WIN32__) && !defined(__TWIN32__) JOYCAPS joyCaps; @@ -491,7 +489,7 @@ bool wxJoystick::HasV(void) const #endif } -bool wxJoystick::HasPOV(void) const +bool wxJoystick::HasPOV() const { #if defined(__WIN32__) && !defined(__TWIN32__) JOYCAPS joyCaps; @@ -504,7 +502,7 @@ bool wxJoystick::HasPOV(void) const #endif } -bool wxJoystick::HasPOV4Dir(void) const +bool wxJoystick::HasPOV4Dir() const { #if defined(__WIN32__) && !defined(__TWIN32__) JOYCAPS joyCaps; @@ -517,7 +515,7 @@ bool wxJoystick::HasPOV4Dir(void) const #endif } -bool wxJoystick::HasPOVCTS(void) const +bool wxJoystick::HasPOVCTS() const { #if defined(__WIN32__) && !defined(__TWIN32__) JOYCAPS joyCaps; @@ -540,7 +538,7 @@ bool wxJoystick::SetCapture(wxWindow* win, int pollingFreq) return (res == JOYERR_NOERROR); } -bool wxJoystick::ReleaseCapture(void) +bool wxJoystick::ReleaseCapture() { MMRESULT res = joyReleaseCapture(m_joystick); return (res == JOYERR_NOERROR); diff --git a/src/msw/listbox.cpp b/src/msw/listbox.cpp index 128111853e..067fc11d90 100644 --- a/src/msw/listbox.cpp +++ b/src/msw/listbox.cpp @@ -48,10 +48,8 @@ #endif #ifndef __TWIN32__ - #if defined(__GNUWIN32__) - #ifndef wxUSE_NORLANDER_HEADERS - #include "wx/msw/gnuwin32/extra.h" - #endif + #ifdef __GNUWIN32_OLD__ + #include "wx/msw/gnuwin32/extra.h" #endif #endif diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index f38207bed6..f747968d69 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -40,7 +40,7 @@ #include "wx/msw/private.h" -#if defined(__GNUWIN32__) && !defined(wxUSE_NORLANDER_HEADERS) +#ifdef __GNUWIN32_OLD__ #include "wx/msw/gnuwin32/extra.h" #else #include @@ -554,13 +554,13 @@ bool wxListCtrl::SetColumnWidth(int col, int width) // visible area of the list control (list or report view) // or the total number of items in the list control (icon // or small icon view) -int wxListCtrl::GetCountPerPage(void) const +int wxListCtrl::GetCountPerPage() const { return ListView_GetCountPerPage(GetHwnd()); } // Gets the edit control for editing labels. -wxTextCtrl* wxListCtrl::GetEditControl(void) const +wxTextCtrl* wxListCtrl::GetEditControl() const { return m_textCtrl; } @@ -787,7 +787,7 @@ bool wxListCtrl::SetItemPosition(long item, const wxPoint& pos) } // Gets the number of items in the list control -int wxListCtrl::GetItemCount(void) const +int wxListCtrl::GetItemCount() const { return ListView_GetItemCount(GetHwnd()); } @@ -801,13 +801,13 @@ int wxListCtrl::GetItemSpacing(bool isSmall) const } // Gets the number of selected items in the list control -int wxListCtrl::GetSelectedItemCount(void) const +int wxListCtrl::GetSelectedItemCount() const { return ListView_GetSelectedCount(GetHwnd()); } // Gets the text colour of the listview -wxColour wxListCtrl::GetTextColour(void) const +wxColour wxListCtrl::GetTextColour() const { COLORREF ref = ListView_GetTextColor(GetHwnd()); wxColour col(GetRValue(ref), GetGValue(ref), GetBValue(ref)); @@ -822,7 +822,7 @@ void wxListCtrl::SetTextColour(const wxColour& col) // Gets the index of the topmost visible item when in // list or report view -long wxListCtrl::GetTopItem(void) const +long wxListCtrl::GetTopItem() const { return (long) ListView_GetTopIndex(GetHwnd()); } diff --git a/src/msw/minifram.cpp b/src/msw/minifram.cpp index a8c7b9d0e8..e76e9f15de 100644 --- a/src/msw/minifram.cpp +++ b/src/msw/minifram.cpp @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -46,11 +46,9 @@ IMPLEMENT_DYNAMIC_CLASS(wxMiniFrame, wxFrame) #include "wx/minifram.h" #ifndef __TWIN32__ -#ifdef __GNUWIN32__ -#ifndef wxUSE_NORLANDER_HEADERS -#include "wx/msw/gnuwin32/extra.h" -#endif -#endif + #ifdef __GNUWIN32_OLD__ + #include "wx/msw/gnuwin32/extra.h" + #endif #endif IMPLEMENT_DYNAMIC_CLASS(wxMiniFrame, wxFrame) diff --git a/src/msw/notebook.cpp b/src/msw/notebook.cpp index 63d108cf32..b8ac425b2e 100644 --- a/src/msw/notebook.cpp +++ b/src/msw/notebook.cpp @@ -41,15 +41,13 @@ #include // for SetWindowFont #ifndef __TWIN32__ -#ifdef __GNUWIN32__ -#ifndef wxUSE_NORLANDER_HEADERS - #include "wx/msw/gnuwin32/extra.h" -#endif -#endif + #ifdef __GNUWIN32_OLD__ + #include "wx/msw/gnuwin32/extra.h" + #endif #endif -#if !defined(__GNUWIN32__) || defined(__TWIN32__) || defined(wxUSE_NORLANDER_HEADERS) - #include +#if defined(__WIN95__) && !(defined(__GNUWIN32_OLD__) || defined(__TWIN32__)) + #include #endif // ---------------------------------------------------------------------------- diff --git a/src/msw/registry.cpp b/src/msw/registry.cpp index 135825ec85..16ae2a1261 100644 --- a/src/msw/registry.cpp +++ b/src/msw/registry.cpp @@ -302,7 +302,7 @@ wxString wxRegKey::GetName(bool bShortPrefix) const return str; } -#if defined( __GNUWIN32__ ) && !defined(wxUSE_NORLANDER_HEADERS) +#if defined( __GNUWIN32_OLD__ ) bool wxRegKey::GetKeyInfo(size_t* pnSubKeys, size_t* pnMaxKeyLen, size_t* pnValues, diff --git a/src/msw/slider95.cpp b/src/msw/slider95.cpp index 69af911269..e5667dd391 100644 --- a/src/msw/slider95.cpp +++ b/src/msw/slider95.cpp @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -31,8 +31,8 @@ #include "wx/msw/slider95.h" #include "wx/msw/private.h" -#if (defined(__WIN95__) && !defined(__GNUWIN32__)) || defined(__TWIN32__) || defined(wxUSE_NORLANDER_HEADERS) -#include +#if defined(__WIN95__) && !(defined(__GNUWIN32_OLD__) || defined(__TWIN32__)) + #include #endif IMPLEMENT_DYNAMIC_CLASS(wxSlider95, wxControl) diff --git a/src/msw/spinbutt.cpp b/src/msw/spinbutt.cpp index 5159b21ceb..288b12374e 100644 --- a/src/msw/spinbutt.cpp +++ b/src/msw/spinbutt.cpp @@ -43,7 +43,7 @@ #include "wx/spinbutt.h" #include "wx/msw/private.h" -#if !defined(__GNUWIN32__) || defined(__TWIN32__) || defined(wxUSE_NORLANDER_HEADERS) +#if defined(__WIN95__) && !(defined(__GNUWIN32_OLD__) || defined(__TWIN32__)) #include #endif diff --git a/src/msw/spinctrl.cpp b/src/msw/spinctrl.cpp index 16672d0198..e8f8323ff3 100644 --- a/src/msw/spinctrl.cpp +++ b/src/msw/spinctrl.cpp @@ -40,7 +40,7 @@ #include "wx/spinctrl.h" #include "wx/msw/private.h" -#if (defined(__WIN95__) && !defined(__GNUWIN32__)) || defined(__TWIN32__) || defined(wxUSE_NORLANDER_HEADERS) +#if defined(__WIN95__) && !(defined(__GNUWIN32_OLD__) || defined(__TWIN32__)) #include #endif diff --git a/src/msw/statbr95.cpp b/src/msw/statbr95.cpp index 2749688b1f..a3c3bdb670 100644 --- a/src/msw/statbr95.cpp +++ b/src/msw/statbr95.cpp @@ -36,8 +36,8 @@ #include "wx/msw/private.h" #include -#if !defined(__GNUWIN32__) || defined(__TWIN32__) || defined(wxUSE_NORLANDER_HEADERS) -#include +#if !(defined(__GNUWIN32_OLD__) || defined(__TWIN32__)) + #include #endif // ---------------------------------------------------------------------------- diff --git a/src/msw/tabctrl.cpp b/src/msw/tabctrl.cpp index 57748ac81f..78f329f0d8 100644 --- a/src/msw/tabctrl.cpp +++ b/src/msw/tabctrl.cpp @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -32,16 +32,10 @@ #include -#if (defined(__WIN95__) && !defined(__GNUWIN32__)) || defined(__TWIN32__) || defined(wxUSE_NORLANDER_HEADERS) -#include -#endif - -#ifndef __TWIN32__ -#ifdef __GNUWIN32__ -#ifndef wxUSE_NORLANDER_HEADERS -#include "wx/msw/gnuwin32/extra.h" -#endif -#endif +#if !(defined(__GNUWIN32_OLD__) || defined(__TWIN32__)) + #include +#else + #include "wx/msw/gnuwin32/extra.h" #endif #include "wx/msw/dib.h" diff --git a/src/msw/taskbar.cpp b/src/msw/taskbar.cpp index cc82231d23..fc4f1cb9ca 100644 --- a/src/msw/taskbar.cpp +++ b/src/msw/taskbar.cpp @@ -1,13 +1,13 @@ ///////////////////////////////////////////////////////////////////////// // File: taskbar.cpp -// Purpose: Implements wxTaskBarIcon class for manipulating icons on +// Purpose: Implements wxTaskBarIcon class for manipulating icons on // the Windows task bar. // Author: Julian Smart // Modified by: // Created: 24/3/98 // RCS-ID: $Id$ // Copyright: (c) -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -40,19 +40,17 @@ #include "wx/msw/private.h" #ifndef __TWIN32__ -#ifdef __GNUWIN32__ -#ifndef wxUSE_NORLANDER_HEADERS -#include "wx/msw/gnuwin32/extra.h" -#endif -#endif + #ifdef __GNUWIN32_OLD__ + #include "wx/msw/gnuwin32/extra.h" + #endif #endif #ifdef __SALFORDC__ -#include + #include #endif LRESULT APIENTRY _EXPORT wxTaskBarIconWindowProc( HWND hWnd, unsigned msg, - UINT wParam, LONG lParam ); + UINT wParam, LONG lParam ); wxChar *wxTaskBarWindowClass = wxT("wxTaskBarWindowClass"); @@ -111,20 +109,20 @@ bool wxTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& tooltip) NOTIFYICONDATA notifyData; memset(¬ifyData, 0, sizeof(notifyData)); - notifyData.cbSize = sizeof(notifyData); - notifyData.hWnd = (HWND) m_hWnd; - notifyData.uCallbackMessage = sm_taskbarMsg; - notifyData.uFlags = NIF_MESSAGE ; - if (icon.Ok()) + notifyData.cbSize = sizeof(notifyData); + notifyData.hWnd = (HWND) m_hWnd; + notifyData.uCallbackMessage = sm_taskbarMsg; + notifyData.uFlags = NIF_MESSAGE ; + if (icon.Ok()) { - notifyData.uFlags |= NIF_ICON; - notifyData.hIcon = (HICON) icon.GetHICON(); + notifyData.uFlags |= NIF_ICON; + notifyData.hIcon = (HICON) icon.GetHICON(); } if (((const wxChar*) tooltip != NULL) && (tooltip != wxT(""))) { notifyData.uFlags |= NIF_TIP ; - lstrcpyn(notifyData.szTip, WXSTRINGCAST tooltip, sizeof(notifyData.szTip)); + lstrcpyn(notifyData.szTip, WXSTRINGCAST tooltip, sizeof(notifyData.szTip)); } notifyData.uID = 99; @@ -146,11 +144,11 @@ bool wxTaskBarIcon::RemoveIcon(void) NOTIFYICONDATA notifyData; memset(¬ifyData, 0, sizeof(notifyData)); - notifyData.cbSize = sizeof(notifyData); - notifyData.hWnd = (HWND) m_hWnd; - notifyData.uCallbackMessage = sm_taskbarMsg; - notifyData.uFlags = NIF_MESSAGE; - notifyData.hIcon = 0 ; // hIcon; + notifyData.cbSize = sizeof(notifyData); + notifyData.hWnd = (HWND) m_hWnd; + notifyData.uCallbackMessage = sm_taskbarMsg; + notifyData.uFlags = NIF_MESSAGE; + notifyData.hIcon = 0 ; // hIcon; notifyData.uID = 99; m_iconAdded = FALSE; @@ -265,8 +263,8 @@ bool wxTaskBarIcon::RegisterWindowClass() // Also register the taskbar message here sm_taskbarMsg = ::RegisterWindowMessage(wxT("wxTaskBarIconMessage")); - WNDCLASS wc; - bool rc; + WNDCLASS wc; + bool rc; HINSTANCE hInstance = GetModuleHandle(NULL); @@ -318,37 +316,37 @@ long wxTaskBarIcon::WindowProc( WXHWND hWnd, unsigned int msg, unsigned int wPar switch (lParam) { - case WM_LBUTTONDOWN: + case WM_LBUTTONDOWN: eventType = wxEVT_TASKBAR_LEFT_DOWN; break; - case WM_LBUTTONUP: + case WM_LBUTTONUP: eventType = wxEVT_TASKBAR_LEFT_UP; break; - case WM_RBUTTONDOWN: + case WM_RBUTTONDOWN: eventType = wxEVT_TASKBAR_RIGHT_DOWN; break; - case WM_RBUTTONUP: + case WM_RBUTTONUP: eventType = wxEVT_TASKBAR_RIGHT_UP; break; - case WM_LBUTTONDBLCLK: + case WM_LBUTTONDBLCLK: eventType = wxEVT_TASKBAR_LEFT_DCLICK; break; - case WM_RBUTTONDBLCLK: + case WM_RBUTTONDBLCLK: eventType = wxEVT_TASKBAR_RIGHT_DCLICK; break; - case WM_MOUSEMOVE: + case WM_MOUSEMOVE: eventType = wxEVT_TASKBAR_MOVE; break; - default: + default: break; - } + } if (eventType) { wxEvent event; @@ -361,7 +359,7 @@ long wxTaskBarIcon::WindowProc( WXHWND hWnd, unsigned int msg, unsigned int wPar } LRESULT APIENTRY _EXPORT wxTaskBarIconWindowProc( HWND hWnd, unsigned msg, - UINT wParam, LONG lParam ) + UINT wParam, LONG lParam ) { wxTaskBarIcon* obj = wxTaskBarIcon::FindObjectForHWND((WXHWND) hWnd); if (obj) diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index 794d146e78..91df514f6f 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -58,7 +58,7 @@ # include #endif -#if wxUSE_RICHEDIT && (!defined(__GNUWIN32__) || defined(wxUSE_NORLANDER_HEADERS)) +#if wxUSE_RICHEDIT && !defined(__GNUWIN32_OLD__) #include #endif diff --git a/src/msw/treectrl.cpp b/src/msw/treectrl.cpp index d328e047c7..072a4a63c7 100644 --- a/src/msw/treectrl.cpp +++ b/src/msw/treectrl.cpp @@ -47,13 +47,11 @@ #include "wx/treectrl.h" #include "wx/settings.h" -#ifdef __GNUWIN32__ -#ifndef wxUSE_NORLANDER_HEADERS -#include "wx/msw/gnuwin32/extra.h" -#endif +#ifdef __GNUWIN32_OLD__ + #include "wx/msw/gnuwin32/extra.h" #endif -#if (defined(__WIN95__) && !defined(__GNUWIN32__)) || defined(__TWIN32__) || defined(wxUSE_NORLANDER_HEADERS) +#if defined(__WIN95__) && !(defined(__GNUWIN32_OLD__) || defined(__TWIN32__)) #include #endif @@ -327,13 +325,14 @@ bool wxTreeCtrl::Create(wxWindow *parent, if ( m_windowStyle & wxTR_LINES_AT_ROOT ) wstyle |= TVS_LINESATROOT; -#if !defined( __GNUWIN32__ ) && !defined( __BORLANDC__ ) && !defined( __WATCOMC__ ) && !defined(wxUSE_NORLANDER_HEADERS) +#if !defined( __GNUWIN32_OLD__ ) && \ + !defined( __BORLANDC__ ) && \ + !defined( __WATCOMC__ ) && \ + (!defined(__VISUALC__) || (__VISUALC__ > 1010)) // we emulate the multiple selection tree controls by using checkboxes: set // up the image list we need for this if we do have multiple selections -#if !defined(__VISUALC__) || (__VISUALC__ > 1010) if ( m_windowStyle & wxTR_MULTIPLE ) wstyle |= TVS_CHECKBOXES; -#endif #endif // Create the tree control. diff --git a/src/msw/wave.cpp b/src/msw/wave.cpp index 8f2edf9af5..675d15c9ae 100644 --- a/src/msw/wave.cpp +++ b/src/msw/wave.cpp @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -31,16 +31,10 @@ #include #include -#if !defined( __GNUWIN32__ ) || defined(wxUSE_NORLANDER_HEADERS) -#include -#endif - -#ifndef __TWIN32__ -#ifdef __GNUWIN32__ -#ifndef wxUSE_NORLANDER_HEADERS -#include "wx/msw/gnuwin32/extra.h" -#endif -#endif +#ifdef __GNUWIN32_OLD__ + #include "wx/msw/gnuwin32/extra.h" +#else + #include #endif wxWave::wxWave() diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 9d9de397c0..f2c9d0594e 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -79,7 +79,7 @@ #include -#if !defined(__GNUWIN32__)|| defined(wxUSE_NORLANDER_HEADERS) +#ifndef __GNUWIN32_OLD__ #include #include #endif @@ -88,15 +88,13 @@ #include #endif -#if ( defined(__WIN95__) && !defined(__GNUWIN32__)) || defined(__TWIN32__ ) || defined(wxUSE_NORLANDER_HEADERS) - #include -#endif - -#ifndef __TWIN32__ - #ifdef __GNUWIN32__ - #ifndef wxUSE_NORLANDER_HEADERS - #include "wx/msw/gnuwin32/extra.h" - #endif +#if !defined(__GNUWIN32_OLD__) && !defined(__TWIN32__) + #ifndef __WIN95__ + #include + #endif +#else // broken compiler + #ifndef __TWIN32__ + #include "wx/msw/gnuwin32/extra.h" #endif #endif @@ -131,6 +129,10 @@ wxWindow *wxFindWinFromHandle(WXHWND hWnd); // mouse clicks static void TranslateKbdEventToMouse(wxWindow *win, int *x, int *y, WPARAM *flags); +// get the current state of SHIFT/CTRL keys +static inline bool IsShiftDown() { return GetKeyState(VK_SHIFT)& 0x100 != 0; } +static inline bool IsCtrlDown() { return GetKeyState(VK_CONTROL)& 0x100 != 0; } + // --------------------------------------------------------------------------- // event tables // --------------------------------------------------------------------------- @@ -1480,8 +1482,8 @@ bool wxWindow::MSWProcessMessage(WXMSG* pMsg) if ( bProcess ) { - bool bCtrlDown = (::GetKeyState(VK_CONTROL) & 0x100) != 0; - bool bShiftDown = (::GetKeyState(VK_SHIFT) & 0x100) != 0; + bool bCtrlDown = IsCtrlDown(); + bool bShiftDown = IsShiftDown(); // WM_GETDLGCODE: ask the control if it wants the key for itself, // don't process it if it's the case (except for Ctrl-Tab/Enter @@ -1596,8 +1598,7 @@ bool wxWindow::MSWProcessMessage(WXMSG* pMsg) // don't process system keys here if ( !(HIWORD(msg->lParam) & KF_ALTDOWN) ) { - if ( (msg->wParam == VK_TAB) && - (::GetKeyState(VK_CONTROL) & 0x100) != 0 ) + if ( (msg->wParam == VK_TAB) && IsCtrlDown() ) { // find the first notebook parent and change its page wxWindow *win = this; @@ -1610,7 +1611,7 @@ bool wxWindow::MSWProcessMessage(WXMSG* pMsg) if ( nbook ) { - bool forward = !(::GetKeyState(VK_SHIFT) & 0x100); + bool forward = !IsShiftDown(); nbook->AdvanceSelection(forward); } @@ -3149,12 +3150,43 @@ bool wxWindow::HandleMouseMove(int x, int y, WXUINT flags) // keyboard handling // --------------------------------------------------------------------------- +// create the key event of the given type for the given key - used by +// HandleChar and HandleKeyDown/Up +wxKeyEvent wxWindow::CreateKeyEvent(wxEventType evType, + int id, + WXLPARAM lParam) const +{ + wxKeyEvent event(evType); + event.SetId(GetId()); + event.m_shiftDown = IsShiftDown(); + event.m_controlDown = IsCtrlDown(); + event.m_altDown = (HIWORD(lParam) & KF_ALTDOWN) == KF_ALTDOWN; + + event.m_eventObject = (wxWindow *)this; // const_cast + event.m_keyCode = id; + event.SetTimestamp(s_currentMsg.time); + + // translate the position to client coords + POINT pt; + GetCursorPos(&pt); + RECT rect; + GetWindowRect(GetHwnd(),&rect); + pt.x -= rect.left; + pt.y -= rect.top; + + event.m_x = pt.x; + event.m_y = pt.y; + + return event; +} + // isASCII is TRUE only when we're called from WM_CHAR handler and not from // WM_KEYDOWN one bool wxWindow::HandleChar(WXWORD wParam, WXLPARAM lParam, bool isASCII) { + bool ctrlDown = FALSE; + int id; - bool tempControlDown = FALSE; if ( isASCII ) { // If 1 -> 26, translate to CTRL plus a letter. @@ -3163,142 +3195,86 @@ bool wxWindow::HandleChar(WXWORD wParam, WXLPARAM lParam, bool isASCII) { switch (id) { - case 13: - { + case 13: id = WXK_RETURN; break; - } - case 8: - { + + case 8: id = WXK_BACK; break; - } - case 9: - { + + case 9: id = WXK_TAB; break; - } - default: - { - tempControlDown = TRUE; + + default: + ctrlDown = TRUE; id = id + 96; - } } } } - else if ( (id = wxCharCodeMSWToWX(wParam)) == 0 ) { + else if ( (id = wxCharCodeMSWToWX(wParam)) == 0 ) + { // it's ASCII and will be processed here only when called from - // WM_CHAR (i.e. when isASCII = TRUE) + // WM_CHAR (i.e. when isASCII = TRUE), don't process it now id = -1; } if ( id != -1 ) { - wxKeyEvent event(wxEVT_CHAR); - event.m_shiftDown = (::GetKeyState(VK_SHIFT)&0x100?TRUE:FALSE); - event.m_controlDown = (::GetKeyState(VK_CONTROL)&0x100?TRUE:FALSE); - if ( (HIWORD(lParam) & KF_ALTDOWN) == KF_ALTDOWN ) - event.m_altDown = TRUE; - - event.m_eventObject = this; - event.m_keyCode = id; - event.SetTimestamp(s_currentMsg.time); - - POINT pt; - GetCursorPos(&pt); - RECT rect; - GetWindowRect(GetHwnd(),&rect); - pt.x -= rect.left; - pt.y -= rect.top; - - event.m_x = pt.x; event.m_y = pt.y; + wxKeyEvent event(CreateKeyEvent(wxEVT_CHAR, id, lParam)); + if ( ctrlDown ) + { + event.m_controlDown = TRUE; + } if ( GetEventHandler()->ProcessEvent(event) ) return TRUE; - else - return FALSE; } - else - return FALSE; + + return FALSE; } bool wxWindow::HandleKeyDown(WXWORD wParam, WXLPARAM lParam) { - int id; + int id = wxCharCodeMSWToWX(wParam); - if ( (id = wxCharCodeMSWToWX(wParam)) == 0 ) { + if ( !id ) + { + // normal ASCII char id = wParam; } - if ( id != -1 ) + if ( id != -1 ) // VZ: does this ever happen (FIXME)? { - wxKeyEvent event(wxEVT_KEY_DOWN); - event.m_shiftDown = (::GetKeyState(VK_SHIFT)&0x100?TRUE:FALSE); - event.m_controlDown = (::GetKeyState(VK_CONTROL)&0x100?TRUE:FALSE); - if ( (HIWORD(lParam) & KF_ALTDOWN) == KF_ALTDOWN ) - event.m_altDown = TRUE; - - event.m_eventObject = this; - event.m_keyCode = id; - event.SetTimestamp(s_currentMsg.time); - - POINT pt; - GetCursorPos(&pt); - RECT rect; - GetWindowRect(GetHwnd(),&rect); - pt.x -= rect.left; - pt.y -= rect.top; - - event.m_x = pt.x; event.m_y = pt.y; - + wxKeyEvent event(CreateKeyEvent(wxEVT_KEY_DOWN, id, lParam)); if ( GetEventHandler()->ProcessEvent(event) ) { return TRUE; } - else return FALSE; - } - else - { - return FALSE; } + + return FALSE; } bool wxWindow::HandleKeyUp(WXWORD wParam, WXLPARAM lParam) { - int id; + int id = wxCharCodeMSWToWX(wParam); - if ( (id = wxCharCodeMSWToWX(wParam)) == 0 ) { + if ( !id ) + { + // normal ASCII char id = wParam; } - if ( id != -1 ) + if ( id != -1 ) // VZ: does this ever happen (FIXME)? { - wxKeyEvent event(wxEVT_KEY_UP); - event.m_shiftDown = (::GetKeyState(VK_SHIFT)&0x100?TRUE:FALSE); - event.m_controlDown = (::GetKeyState(VK_CONTROL)&0x100?TRUE:FALSE); - if ( (HIWORD(lParam) & KF_ALTDOWN) == KF_ALTDOWN ) - event.m_altDown = TRUE; - - event.m_eventObject = this; - event.m_keyCode = id; - event.SetTimestamp(s_currentMsg.time); - - POINT pt; - GetCursorPos(&pt); - RECT rect; - GetWindowRect(GetHwnd(),&rect); - pt.x -= rect.left; - pt.y -= rect.top; - - event.m_x = pt.x; event.m_y = pt.y; - + wxKeyEvent event(CreateKeyEvent(wxEVT_KEY_UP, id, lParam)); if ( GetEventHandler()->ProcessEvent(event) ) return TRUE; - else - return FALSE; } - else - return FALSE; + + return FALSE; } // --------------------------------------------------------------------------- @@ -3716,7 +3692,7 @@ void wxSetKeyboardHook(bool doIt) UnhookWindowsHookEx(wxTheKeyboardHook); // avoids mingw warning about statement with no effect (FreeProcInstance // doesn't do anything under Win32) -#ifndef __GNUWIN32__ +#ifndef __GNUC__ FreeProcInstance(wxTheKeyboardHookProc); #endif } @@ -3737,8 +3713,8 @@ wxKeyboardHook(int nCode, WORD wParam, DWORD lParam) event.m_eventObject = NULL; event.m_keyCode = id; - event.m_shiftDown = ::GetKeyState(VK_SHIFT) & 0x100 != 0; - event.m_controlDown = ::GetKeyState(VK_CONTROL) & 0x100 != 0; + event.m_shiftDown = IsShiftDown(); + event.m_controlDown = IsCtrlDown(); event.SetTimestamp(s_currentMsg.time); wxWindow *win = wxGetActiveWindow(); -- 2.45.2