X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3c203a185145a1aa720faf53e7f6fbebb35bce7a..3a4cf8a84d9a41c63125c1c1cdd6d0fbb98f41f0:/src/os2/cursor.cpp diff --git a/src/os2/cursor.cpp b/src/os2/cursor.cpp index b2413b0df2..bf5bc9c84f 100644 --- a/src/os2/cursor.cpp +++ b/src/os2/cursor.cpp @@ -1,10 +1,9 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: cursor.cpp +// Name: src/os2/cursor.cpp // Purpose: wxCursor class // Author: David Webster // Modified by: // Created: 10/13/99 -// RCS-ID: $Id$ // Copyright: (c) David Webster // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -12,19 +11,20 @@ // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" -#ifndef WX_PRECOMP -#include -#include "wx/setup.h" -#include "wx/list.h" -#include "wx/utils.h" -#include "wx/app.h" #include "wx/cursor.h" -#include "wx/icon.h" + +#ifndef WX_PRECOMP + #include + #include "wx/list.h" + #include "wx/utils.h" + #include "wx/app.h" + #include "wx/icon.h" + #include "wx/image.h" + #include "wx/log.h" #endif #include "wx/os2/private.h" #include "wx/os2/wxrsc.h" -#include "wx/image.h" #include "assert.h" @@ -35,7 +35,7 @@ wxCursorRefData::wxCursorRefData(void) m_nWidth = 32; m_nHeight = 32; m_hCursor = 0 ; - m_bDestroyCursor = FALSE; + m_bDestroyCursor = false; } void wxCursorRefData::Free() @@ -53,39 +53,26 @@ wxCursor::wxCursor(void) { } -wxCursor::wxCursor( - const char WXUNUSED(bits)[] -, int WXUNUSED(width) -, int WXUNUSED(height) -, int WXUNUSED(hotSpotX) -, int WXUNUSED(hotSpotY) -, const char WXUNUSED(maskBits)[] -) +wxCursor::wxCursor(const wxImage& rImage) { -} - -wxCursor::wxCursor( - const wxImage& rImage -) -{ - wxImage vImage32 = rImage.Scale(32,32); - int nWidth = vImage32.GetWidth(); - int nHeight = vImage32.GetHeight(); + wxImage vImage32 = rImage.Scale(32,32); + int nWidth = vImage32.GetWidth(); + int nHeight = vImage32.GetHeight(); // // Need a bitmap handle somehow // - HBITMAP hBitmap = wxBitmap(vImage32).GetHBITMAP(); - int nHotSpotX = vImage32.GetOptionInt(wxCUR_HOTSPOT_X); - int nHotSpotY = vImage32.GetOptionInt(wxCUR_HOTSPOT_Y); + HBITMAP hBitmap = wxBitmap(vImage32).GetHBITMAP(); + int nHotSpotX = vImage32.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_X); + int nHotSpotY = vImage32.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_Y); if (nHotSpotX < 0 || nHotSpotX >= nWidth) - nHotSpotX = 0; + nHotSpotX = 0; if (nHotSpotY < 0 || nHotSpotY >= nHeight) - nHotSpotY = 0; + nHotSpotY = 0; - wxCursorRefData* pRefData = new wxCursorRefData; + wxCursorRefData* pRefData = new wxCursorRefData; m_refData = pRefData; pRefData->m_hCursor = (WXHCURSOR) ::WinCreatePointer( HWND_DESKTOP @@ -97,31 +84,29 @@ wxCursor::wxCursor( } // end of wxCursor::wxCursor -wxCursor::wxCursor( - const wxString& rsCursorFile -, long lFlags -, int nHotSpotX -, int nHotSpotY -) +wxCursor::wxCursor( const wxString& WXUNUSED(rsCursorFile), + wxBitmapType type, + int WXUNUSED(nHotSpotX), + int WXUNUSED(nHotSpotY) ) { - wxCursorRefData* pRefData = new wxCursorRefData; + wxCursorRefData* pRefData = new wxCursorRefData; pRefData = new wxCursorRefData; m_refData = pRefData; - pRefData->m_bDestroyCursor = FALSE; - if (lFlags == wxBITMAP_TYPE_CUR_RESOURCE) + pRefData->m_bDestroyCursor = false; + if (type == wxBITMAP_TYPE_CUR_RESOURCE) { pRefData->m_hCursor = (WXHCURSOR) ::WinLoadPointer( HWND_DESKTOP ,0 - ,(ULONG)lFlags // if OS/2 this should be the resource Id + ,(ULONG)type // if OS/2 this should be the resource Id ); } + else + wxLogError("Invalid cursor bitmap type '%d'", type); } // end of wxCursor::wxCursor // Cursors by stock number -wxCursor::wxCursor( - int nCursorType -) +void wxCursor::InitFromStock(wxStockCursor nCursorType) { wxCursorRefData* pRefData = new wxCursorRefData; @@ -308,7 +293,7 @@ wxCursor::wxCursor( // // No need to destroy the stock cursors // - ((wxCursorRefData *)m_refData)->m_bDestroyCursor = FALSE; + ((wxCursorRefData *)m_refData)->m_bDestroyCursor = false; } // end of wxCursor::wxCursor // Global cursor setting @@ -316,7 +301,7 @@ void wxSetCursor(const wxCursor& cursor) { extern wxCursor *g_globalCursor; - if ( cursor.Ok() && cursor.GetHCURSOR() ) + if ( cursor.IsOk() && cursor.GetHCURSOR() ) { // ::SetCursor((HCURSOR) cursor.GetHCURSOR()); @@ -324,4 +309,3 @@ void wxSetCursor(const wxCursor& cursor) (*g_globalCursor) = cursor; } } -