Improve wxQT cursor implementation, thanks @seandepagnier
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77911 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
fc18330137
commit
b56a3f5235
@ -19,14 +19,16 @@ class WXDLLIMPEXP_CORE wxCursor : public wxGDIObject
|
||||
public:
|
||||
wxCursor() { }
|
||||
wxCursor( const wxCursor & );
|
||||
wxCursor( const wxImage& image ) { InitFromImage(image); }
|
||||
wxCursor( const wxString& name,
|
||||
wxBitmapType type = wxCURSOR_DEFAULT_TYPE,
|
||||
int hotSpotX = 0, int hotSpotY = 0 );
|
||||
wxCursor(wxStockCursor id) { InitFromStock(id); }
|
||||
#if WXWIN_COMPATIBILITY_2_8
|
||||
wxCursor(int id) { InitFromStock((wxStockCursor)id); }
|
||||
#endif
|
||||
#if wxUSE_IMAGE
|
||||
wxCursor( const wxImage & image );
|
||||
wxCursor(const wxString& name,
|
||||
wxBitmapType type = wxCURSOR_DEFAULT_TYPE,
|
||||
int hotSpotX = 0, int hotSpotY = 0);
|
||||
#endif
|
||||
|
||||
QCursor m_qtCursor;
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#ifndef _WX_QT_FONT_H_
|
||||
#define _WX_QT_FONT_H_
|
||||
|
||||
class QFont;
|
||||
class WXDLLIMPEXP_CORE wxFont : public wxFontBase
|
||||
{
|
||||
public:
|
||||
|
@ -43,28 +43,30 @@ wxCursor::wxCursor( const wxCursor &cursor )
|
||||
m_qtCursor = cursor.m_qtCursor;
|
||||
}
|
||||
|
||||
wxCursor::wxCursor(const wxString& filename,
|
||||
wxBitmapType kind,
|
||||
int hotSpotX,
|
||||
int hotSpotY)
|
||||
#if wxUSE_IMAGE
|
||||
wxCursor::wxCursor(const wxString& cursor_file,
|
||||
wxBitmapType type,
|
||||
int hotSpotX, int hotSpotY)
|
||||
{
|
||||
switch ( kind )
|
||||
{
|
||||
case wxBITMAP_TYPE_ICO:
|
||||
m_qtCursor = QCursor(
|
||||
*wxBitmap(filename, wxBITMAP_TYPE_ICO).GetHandle(),
|
||||
hotSpotX, hotSpotY );
|
||||
break;
|
||||
case wxBITMAP_TYPE_BMP:
|
||||
m_qtCursor = QCursor(
|
||||
*wxBitmap(filename, wxBITMAP_TYPE_ICO).GetHandle(),
|
||||
hotSpotX, hotSpotY );
|
||||
break;
|
||||
default:
|
||||
wxLogError( wxT("unknown cursor resource type '%d'"), kind );
|
||||
}
|
||||
wxImage img;
|
||||
if (!img.LoadFile(cursor_file, type))
|
||||
return;
|
||||
|
||||
// eventually set the hotspot:
|
||||
if (!img.HasOption(wxIMAGE_OPTION_CUR_HOTSPOT_X))
|
||||
img.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_X, hotSpotX);
|
||||
if (!img.HasOption(wxIMAGE_OPTION_CUR_HOTSPOT_Y))
|
||||
img.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_Y, hotSpotY);
|
||||
|
||||
InitFromImage(img);
|
||||
}
|
||||
|
||||
wxCursor::wxCursor(const wxImage& img)
|
||||
{
|
||||
InitFromImage(img);
|
||||
}
|
||||
#endif
|
||||
|
||||
void wxCursor::InitFromStock( wxStockCursor cursorId )
|
||||
{
|
||||
Qt::CursorShape qt_cur;
|
||||
|
Loading…
Reference in New Issue
Block a user