]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/cursor.cpp
Add some new files for interface additions
[wxWidgets.git] / src / msw / cursor.cpp
index e914dff561f34c9f134cba6ed08ab95e866198b7..0f7ce4ac2a91da7e1a7c7fbd0fc2ce18c882dddf 100644 (file)
@@ -37,6 +37,7 @@
     #include "wx/cursor.h"
 #endif
 
     #include "wx/cursor.h"
 #endif
 
+#include "wx/module.h"
 #include "wx/msw/private.h"
 #include "wx/msw/dib.h"
 
 #include "wx/msw/private.h"
 #include "wx/msw/dib.h"
 
 // wxWin macros
 // ----------------------------------------------------------------------------
 
 // wxWin macros
 // ----------------------------------------------------------------------------
 
-    IMPLEMENT_DYNAMIC_CLASS(wxCursor, wxCursorBase)
+IMPLEMENT_DYNAMIC_CLASS(wxCursor, wxCursorBase)
+
+// ----------------------------------------------------------------------------
+// globals
+// ----------------------------------------------------------------------------
+
+// Current cursor, in order to hang on to cursor handle when setting the cursor
+// globally
+static wxCursor *gs_globalCursor = NULL;
+
+// ----------------------------------------------------------------------------
+// private classes
+// ----------------------------------------------------------------------------
+
+class wxCursorModule : public wxModule
+{
+public:
+    virtual bool OnInit()
+    {
+        gs_globalCursor = new wxCursor;
+
+        return TRUE;
+    }
+
+    virtual void OnExit()
+    {
+        delete gs_globalCursor;
+        gs_globalCursor = (wxCursor *)NULL;
+    }
+};
+
+// ============================================================================
+// implementation
+// ============================================================================
 
 // ----------------------------------------------------------------------------
 // wxCursorRefData
 
 // ----------------------------------------------------------------------------
 // wxCursorRefData
@@ -255,6 +289,7 @@ wxCursor::wxCursor(int cursor_type)
     }
     case wxCURSOR_QUESTION_ARROW:
     {
     }
     case wxCURSOR_QUESTION_ARROW:
     {
+//      refData->m_hCursor = (WXHCURSOR) LoadImage(wxGetInstance(), wxT("wxCURSOR_QARROW"), IMAGE_CURSOR, 16, 16, LR_MONOCHROME);
       refData->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), wxT("wxCURSOR_QARROW"));
       break;
     }
       refData->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), wxT("wxCURSOR_QARROW"));
       break;
     }
@@ -278,16 +313,19 @@ wxCursor::~wxCursor()
 // Global cursor setting
 // ----------------------------------------------------------------------------
 
 // Global cursor setting
 // ----------------------------------------------------------------------------
 
-void wxSetCursor(const wxCursor& cursor)
+const wxCursor *wxGetGlobalCursor()
 {
 {
-    extern wxCursor *g_globalCursor;
+    return gs_globalCursor;
+}
 
 
-    if ( cursor.Ok() && cursor.GetHCURSOR() )
+void wxSetCursor(const wxCursor& cursor)
+{
+    if ( cursor.Ok() )
     {
     {
-        ::SetCursor((HCURSOR) cursor.GetHCURSOR());
+        ::SetCursor(GetHcursorOf(cursor));
 
 
-        if ( g_globalCursor )
-            (*g_globalCursor) = cursor;
+        if ( gs_globalCursor )
+            *gs_globalCursor = cursor;
     }
 }
 
     }
 }