]> git.saurik.com Git - wxWidgets.git/commitdiff
fixes for compilation with the old mingw32, wxUSE_NORLANDER_HEADERS is always
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 14 Feb 2000 18:21:21 +0000 (18:21 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 14 Feb 2000 18:21:21 +0000 (18:21 +0000)
defined (as 0 or 1)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6012 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

29 files changed:
include/wx/defs.h
include/wx/msw/private.h
include/wx/msw/registry.h
include/wx/msw/window.h
src/msw/app.cpp
src/msw/checklst.cpp
src/msw/control.cpp
src/msw/curico.cpp
src/msw/dc.cpp
src/msw/dib.cpp
src/msw/dirdlg.cpp
src/msw/gauge95.cpp
src/msw/gsocket.c
src/msw/joystick.cpp
src/msw/listbox.cpp
src/msw/listctrl.cpp
src/msw/minifram.cpp
src/msw/notebook.cpp
src/msw/registry.cpp
src/msw/slider95.cpp
src/msw/spinbutt.cpp
src/msw/spinctrl.cpp
src/msw/statbr95.cpp
src/msw/tabctrl.cpp
src/msw/taskbar.cpp
src/msw/textctrl.cpp
src/msw/treectrl.cpp
src/msw/wave.cpp
src/msw/window.cpp

index 0b6b3cb00d5f6b85d09698dd146b22bbe64470b8..5a81d4ac0cc45eae5a4df29f050a65e6d444b745 100644 (file)
 // 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
index f932c659c01093afe1e3d9f95772a41e91f5a4b7..c23c71526614730a9528fd161d8162440872d9c9 100644 (file)
@@ -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)
index 958b78c878df9fd6e4040a734577c875b5b907f4..c08a75110a9d076b2cefcfe3841623acbaf5a7af 100644 (file)
@@ -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
index fd873efbde0dd5a8fd69e84925db3513e5587174..20f6cbb2aa05d4203f0e11ea3189a0da19aeb811 100644 (file)
@@ -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()
 };
index 50df9a440dd08799f5641d66c4476f273d699b74..cb05b27011235e7e5fd6beb5f5f7921b8d58d48c 100644 (file)
     #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 <ole2.h>
@@ -87,7 +86,7 @@
 #include <string.h>
 #include <ctype.h>
 
-#if (defined(__WIN95__) && !defined(__GNUWIN32__)) || defined(__TWIN32__) || defined(wxUSE_NORLANDER_HEADERS)
+#if defined(__WIN95__) && !(defined(__GNUWIN32_OLD__) || defined(__TWIN32__))
     #include <commctrl.h>
 #endif
 
index ea5b2a56f29fc056e0505cccdd4d289f7c58dea2..5747dc5e79475b7be57fee33259107b700455bc4 100644 (file)
@@ -45,8 +45,8 @@
 #include <windows.h>
 #include <windowsx.h>
 
-#if defined(__GNUWIN32__) && !defined(wxUSE_NORLANDER_HEADERS)
-#include "wx/msw/gnuwin32/extra.h"
+#ifdef __GNUWIN32_OLD__
+    #include "wx/msw/gnuwin32/extra.h"
 #endif
 
 // ----------------------------------------------------------------------------
index 89ddd5c54680727beeb67932f3b04d3699cf4db4..ce7b2fca18b6f4c5dfca6a4d06a4ce56bace7879 100644 (file)
@@ -30,8 +30,8 @@
 
 #include "wx/msw/private.h"
 
-#if (defined(__WIN95__) && !defined(__GNUWIN32__)) || defined(__TWIN32__) || defined(wxUSE_NORLANDER_HEADERS)
-#include <commctrl.h>
+#if defined(__WIN95__) && !(defined(__GNUWIN32_OLD__) || defined(__TWIN32__))
+    #include <commctrl.h>
 #endif
 
 IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
index e3ee90176fdf0a938de29b69d52f634dbdafe7f5..1629b21398dc7b1dc412148e918a1318724f2d46 100644 (file)
 #include <winuser.h>
 #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"
index 8af1f9b5061e257c149319f47c804281a0f049c7..5190c3b350d466a5c902f0096eb7bdf41c3ebf29 100644 (file)
@@ -48,9 +48,6 @@
 #include "wx/msw/private.h" // needs to be before #include <commdlg.h>
 
 #if wxUSE_COMMON_DIALOGS
-#if wxUSE_NORLANDER_HEADERS
-    #include <windows.h>
-#endif
     #include <commdlg.h>
 #endif
 
index 47c855e7665bd3cbb016f3afe9f296aa12ab1e98..5952c60152f77ed52287d50b1d6a8e0a47633d86 100644 (file)
 
 #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
index 460491c1f3b01bef59c52aa71cdbd0ba4dfe8756..f8de559fa21c4a45b08edac84702eebcc9dea4a1 100644 (file)
@@ -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"
index 74e164915802718a47474ba21a655bc666257a2e..c43b527cb65784d1744231e7116aecc1d10f465a 100644 (file)
@@ -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 <commctrl.h>
+#if defined(__WIN95__) && !(defined(__GNUWIN32_OLD__) || defined(__TWIN32__))
+    #include <commctrl.h>
 #endif
 
 IMPLEMENT_DYNAMIC_CLASS(wxGauge95, wxControl)
index dc1090f62557f7023b2b24f130df8629de34c453..66dc5acfc64060b81381a7ecfb72c664d3ae57fb 100644 (file)
 #include <ctype.h>
 #include <winsock.h>
 
+/* 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"
 
index cd636fba81cc321dcfde821d03902a42976c4ed4..28c0752f0595ba5cb3f2ee757bb3dbdcfc20190f 100644 (file)
@@ -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 <mmsystem.h>
+#ifndef __GNUWIN32_OLD__
+    #include <mmsystem.h>
 #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);
index 128111853e8d173a71dfe3578d3a7fbb462c2f2f..067fc11d9099b88a701f949a118d3eb7643ad822 100644 (file)
 #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
 
index f38207bed6ecbe520be77703f31222ea49f019c5..f747968d69dbb5ca8a96971fcc93a97ca32e02f6 100644 (file)
@@ -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 <commctrl.h>
@@ -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());
 }
index a8c7b9d0e8c52bc10359233b65e800c15d78633e..e76e9f15dec0f75f9e7cf2297d7f2f1fad037acb 100644 (file)
@@ -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)
index 63d108cf3288c7bca8c0aa5fb398a47f9d3111c0..b8ac425b2e9234a2cdada25fd631ccac2907cf1c 100644 (file)
 #include  <windowsx.h>  // 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 <commctrl.h>
+#if defined(__WIN95__) && !(defined(__GNUWIN32_OLD__) || defined(__TWIN32__))
+    #include <commctrl.h>
 #endif
 
 // ----------------------------------------------------------------------------
index 135825ec85051164bc7deceb8c1fb5498b3385c6..16ae2a1261ff94ea0cd45f20f2abf718769a5855 100644 (file)
@@ -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,
index 69af9112696afef235262b108398e1a397bc159c..e5667dd39178d6711f4b6dfe1eb9c217a2233f4a 100644 (file)
@@ -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 <commctrl.h>
+#if defined(__WIN95__) && !(defined(__GNUWIN32_OLD__) || defined(__TWIN32__))
+    #include <commctrl.h>
 #endif
 
 IMPLEMENT_DYNAMIC_CLASS(wxSlider95, wxControl)
index 5159b21ceb495373605c21cbf28266a85cb1aa82..288b12374e88d27fb1145d746d90c5a792c52ee4 100644 (file)
@@ -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 <commctrl.h>
 #endif
 
index 16672d01988996228f4fc947480f4601cf8cca27..e8f8323ff3c8d073644f5212d9523217d08c6973 100644 (file)
@@ -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 <commctrl.h>
 #endif
 
index 2749688b1f1f89fdb887ffb32d957d86c16f3879..a3c3bdb670e51dba200baa55b2737cb60be2dabd 100644 (file)
@@ -36,8 +36,8 @@
 #include "wx/msw/private.h"
 #include <windowsx.h>
 
-#if !defined(__GNUWIN32__) || defined(__TWIN32__) || defined(wxUSE_NORLANDER_HEADERS)
-#include <commctrl.h>
+#if !(defined(__GNUWIN32_OLD__) || defined(__TWIN32__))
+    #include <commctrl.h>
 #endif
 
 // ----------------------------------------------------------------------------
index 57748ac81f68f07a306dc3d84dcf1cb3dd207814..78f329f0d8c2a34081d1527540380ffb610e258f 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     04/01/98
 // RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart
-// Licence:       wxWindows license
+// Licence:     wxWindows license
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
 
 #include <windows.h>
 
-#if (defined(__WIN95__) && !defined(__GNUWIN32__)) || defined(__TWIN32__) || defined(wxUSE_NORLANDER_HEADERS)
-#include <commctrl.h>
-#endif
-
-#ifndef __TWIN32__
-#ifdef __GNUWIN32__
-#ifndef wxUSE_NORLANDER_HEADERS
-#include "wx/msw/gnuwin32/extra.h"
-#endif
-#endif
+#if !(defined(__GNUWIN32_OLD__) || defined(__TWIN32__))
+    #include <commctrl.h>
+#else
+    #include "wx/msw/gnuwin32/extra.h"
 #endif
 
 #include "wx/msw/dib.h"
index cc82231d233cc9d7691913d6fff48827a0c773c6..fc4f1cb9ca45607fe2b69d5b25f784eede15f2da 100644 (file)
@@ -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__
 #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 <shellapi.h>
+    #include <shellapi.h>
 #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(&notifyData, 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(&notifyData, 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)
index 794d146e783f4a06d6d1f95a6b52191b665809e8..91df514f6f1d197ec8861fee3dc7dd32b7b60281 100644 (file)
@@ -58,7 +58,7 @@
 #   include <fstream>
 #endif
 
-#if wxUSE_RICHEDIT && (!defined(__GNUWIN32__) || defined(wxUSE_NORLANDER_HEADERS))
+#if wxUSE_RICHEDIT && !defined(__GNUWIN32_OLD__)
     #include <richedit.h>
 #endif
 
index d328e047c7ebe6bc6e02992b395072315780f130..072a4a63c7702d0435148b3e438e7ba0102c827c 100644 (file)
 #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 <commctrl.h>
 #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.
index 8f2edf9af5267b985a06b7a3dbda32d4b7aa6aa5..675d15c9aeb6b96afbd757dd69de5e433dcc4084 100644 (file)
@@ -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__
 #include <windows.h>
 #include <windowsx.h>
 
-#if !defined( __GNUWIN32__ ) || defined(wxUSE_NORLANDER_HEADERS)
-#include <mmsystem.h>
-#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 <mmsystem.h>
 #endif
 
 wxWave::wxWave()
index 9d9de397c007dd3ae50c3871e94f7ad67a038063..f2c9d0594e257c93ca248e56f2934824704f6490 100644 (file)
@@ -79,7 +79,7 @@
 
 #include <string.h>
 
-#if !defined(__GNUWIN32__)|| defined(wxUSE_NORLANDER_HEADERS)
+#ifndef __GNUWIN32_OLD__
     #include <shellapi.h>
     #include <mmsystem.h>
 #endif
     #include <windowsx.h>
 #endif
 
-#if ( defined(__WIN95__) && !defined(__GNUWIN32__)) || defined(__TWIN32__ ) || defined(wxUSE_NORLANDER_HEADERS)
-    #include <commctrl.h>
-#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 <commctrl.h>
+    #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();