Support wxCursorBundle on wx 3.3+

See https://gitlab.com/kicad/code/kicad/-/issues/16231
Fixes https://gitlab.com/kicad/code/kicad/-/issues/16224
This commit is contained in:
Alex Shvartzkop
2025-06-15 09:55:38 +03:00
parent 199c5bafb9
commit d928e3c4fe
6 changed files with 256 additions and 448 deletions
+10 -6
View File
@@ -1686,17 +1686,17 @@ bool CAIRO_GAL::updatedGalDisplayOptions( const GAL_DISPLAY_OPTIONS& aOptions )
bool CAIRO_GAL::SetNativeCursorStyle( KICURSOR aCursor, bool aHiDPI )
{
// Store the current cursor type and get the wxCursor for it
// Store the current cursor type and get the wx cursor for it
if( !GAL::SetNativeCursorStyle( aCursor, aHiDPI ) )
return false;
if( aHiDPI )
m_currentwxCursor = CURSOR_STORE::GetHiDPICursor( m_currentNativeCursor );
else
m_currentwxCursor = CURSOR_STORE::GetCursor( m_currentNativeCursor );
m_currentwxCursor = CURSOR_STORE::GetCursor( m_currentNativeCursor, aHiDPI );
// Update the cursor in the wx control
#if wxCHECK_VERSION( 3, 3, 0 )
wxWindow::SetCursorBundle( m_currentwxCursor );
#else
wxWindow::SetCursor( m_currentwxCursor );
#endif
return true;
}
@@ -1704,7 +1704,11 @@ bool CAIRO_GAL::SetNativeCursorStyle( KICURSOR aCursor, bool aHiDPI )
void CAIRO_GAL::onSetNativeCursor( wxSetCursorEvent& aEvent )
{
#if wxCHECK_VERSION( 3, 3, 0 )
aEvent.SetCursor( m_currentwxCursor.GetCursorFor( this ) );
#else
aEvent.SetCursor( m_currentwxCursor );
#endif
}
+182 -402
View File
@@ -22,6 +22,7 @@
*/
#include <vector>
#include <map>
#include <gal/cursors.h>
#include <kiplatform/ui.h>
@@ -88,513 +89,294 @@
#include <wx/bitmap.h>
#include <wx/debug.h>
#include <wx/bmpbndl.h>
static const std::vector<CURSOR_STORE::CURSOR_DEF> standard_cursors = {
static const std::map<KICURSOR, std::vector<CURSOR_STORE::CURSOR_DEF>> cursors_defs = {
{
KICURSOR::VOLTAGE_PROBE,
nullptr,
nullptr,
voltage_probe_xpm,
{ 32, 32 },
{ 1, 31 },
{
{ voltage_probe_xpm, { 1, 31 } },
{ voltage_probe64_xpm, { 1, 62 } }
}
},
{
KICURSOR::CURRENT_PROBE,
nullptr,
nullptr,
current_probe_xpm,
{ 32, 32 },
{ 4, 27 },
{
{ current_probe_xpm, { 4, 27 } },
{ current_probe64_xpm, { 8, 54 } }
}
},
{
KICURSOR::TUNE,
nullptr,
nullptr,
cursor_tune_xpm,
{ 32, 32 },
{ 1, 30 },
{
{ cursor_tune_xpm, { 1, 30 } },
{ cursor_tune64_xpm, { 2, 60 } }
}
},
{
KICURSOR::PENCIL,
nullptr,
nullptr,
cursor_pencil_xpm,
{ 32, 32 },
{ 4, 27 },
{
{ cursor_pencil_xpm, { 4, 27 } },
{ cursor_pencil64_xpm, { 8, 54 } }
}
},
{
KICURSOR::MOVING,
nullptr,
nullptr,
{
{
#ifdef __WINDOWS__
cursor_select_m_xpm,
cursor_select_m_xpm,
#else
cursor_select_m_black_xpm,
cursor_select_m_black_xpm,
#endif
{ 32, 32 },
{ 1, 1 },
{ 1, 1 }
},
{
#ifdef __WINDOWS__
cursor_select_m64_xpm,
#else
cursor_select_m_black64_xpm,
#endif
{ 2, 2 }
}
}
},
{
KICURSOR::REMOVE,
nullptr,
nullptr,
cursor_eraser_xpm,
{ 32, 32 },
{ 4, 4 },
{
{ cursor_eraser_xpm, { 4, 4 } },
{ cursor_eraser64_xpm, { 8, 8 } }
}
},
{
KICURSOR::TEXT,
nullptr,
nullptr,
cursor_text_xpm,
{ 32, 32 },
{ 7, 7 },
{
{ cursor_text_xpm, { 7, 7 } },
{ cursor_text64_xpm, { 14, 14 } }
}
},
{
KICURSOR::MEASURE,
nullptr,
nullptr,
cursor_measure_xpm,
{ 32, 32 },
{ 4, 4 },
{
{ cursor_measure_xpm, { 4, 4 } },
{ cursor_measure64_xpm, { 8, 8 } }
}
},
{
KICURSOR::ADD,
nullptr,
nullptr,
cursor_add_xpm,
{ 32, 32 },
{ 7, 7 },
{
{ cursor_add_xpm, { 7, 7 } },
{ cursor_add64_xpm, { 14, 14 } }
}
},
{
KICURSOR::SUBTRACT,
nullptr,
nullptr,
cursor_subtract_xpm,
{ 32, 32 },
{ 7, 7 },
{
{ cursor_subtract_xpm, { 7, 7 } },
{ cursor_subtract64_xpm, { 14, 14 } }
}
},
{
KICURSOR::XOR,
nullptr,
nullptr,
cursor_xor_xpm,
{ 32, 32 },
{ 7, 7 },
{
{ cursor_xor_xpm, { 7, 7 } },
{ cursor_xor64_xpm, { 14, 14 } }
}
},
{
KICURSOR::ZOOM_IN,
nullptr,
nullptr,
cursor_zoom_in_xpm,
{ 32, 32 },
{ 6, 6 },
{
{ cursor_zoom_in_xpm, { 6, 6 } },
{ cursor_zoom_in64_xpm, { 12, 12 } }
}
},
{
KICURSOR::ZOOM_OUT,
nullptr,
nullptr,
cursor_zoom_out_xpm,
{ 32, 32 },
{ 6, 6 },
{
{ cursor_zoom_out_xpm, { 6, 6 } },
{ cursor_zoom_out64_xpm, { 12, 12 } }
}
},
{
KICURSOR::LABEL_NET,
nullptr,
nullptr,
cursor_label_net_xpm,
{ 32, 32 },
{ 7, 7 },
{
{ cursor_label_net_xpm, { 7, 7 } },
{ cursor_label_net64_xpm, { 14, 14 } }
}
},
{
KICURSOR::LABEL_GLOBAL,
nullptr,
nullptr,
cursor_label_global_xpm,
{ 32, 32 },
{ 7, 7 },
{
{ cursor_label_global_xpm, { 7, 7 } },
{ cursor_label_global64_xpm, { 14, 14 } }
}
},
{
KICURSOR::COMPONENT,
nullptr,
nullptr,
cursor_component_xpm,
{ 32, 32 },
{ 7, 7 },
{
{ cursor_component_xpm, { 7, 7 } },
{ cursor_component64_xpm, { 14, 14 } }
}
},
{
KICURSOR::SELECT_LASSO,
nullptr,
nullptr,
cursor_select_lasso_xpm,
{ 32, 32 },
{ 7, 7 },
{
{ cursor_select_lasso_xpm, { 7, 7 } },
{ cursor_select_lasso64_xpm, { 14, 14 } }
}
},
{
KICURSOR::SELECT_WINDOW,
nullptr,
nullptr,
cursor_select_window_xpm,
{ 32, 32 },
{ 7, 10 },
{
{ cursor_select_window_xpm, { 7, 10 } },
{ cursor_select_window64_xpm, { 14, 20 } }
}
},
{
KICURSOR::LINE_BUS,
nullptr,
nullptr,
cursor_line_bus_xpm,
{ 32, 32 },
{ 5, 26 },
{
{ cursor_line_bus_xpm, { 5, 26 } },
{ cursor_line_bus64_xpm, { 10, 52 } }
}
},
{
KICURSOR::LINE_WIRE,
nullptr,
nullptr,
cursor_line_wire_xpm,
{ 32, 32 },
{ 5, 26 },
{
{ cursor_line_wire_xpm, { 5, 26 } },
{ cursor_line_wire64_xpm, { 10, 52 } }
}
},
{
KICURSOR::LINE_GRAPHIC,
nullptr,
nullptr,
cursor_line_graphic_xpm,
{ 32, 32 },
{ 5, 26 },
{
{ cursor_line_graphic_xpm, { 5, 26 } },
{ cursor_line_graphic64_xpm, { 10, 52 } }
}
},
{
KICURSOR::LABEL_HIER,
nullptr,
nullptr,
cursor_label_hier_xpm,
{ 32, 32 },
{ 7, 7 },
{
{ cursor_label_hier_xpm, { 7, 7 } },
{ cursor_label_hier64_xpm, { 14, 14 } }
}
},
{
KICURSOR::PLACE,
nullptr,
nullptr,
{
{
#ifdef __WINDOWS__
cursor_place_xpm,
cursor_place_xpm,
#else
cursor_place_black_xpm,
cursor_place_black_xpm,
#endif
{ 32, 32 },
{ 1, 1 },
},
};
static const std::vector<CURSOR_STORE::CURSOR_DEF> hidpi_cursors = {
{
KICURSOR::VOLTAGE_PROBE,
nullptr,
nullptr,
voltage_probe64_xpm,
{ 64, 64 },
{ 1, 62 },
},
{
KICURSOR::CURRENT_PROBE,
nullptr,
nullptr,
current_probe64_xpm,
{ 64, 64 },
{ 8, 54 },
},
{
KICURSOR::TUNE,
nullptr,
nullptr,
cursor_tune64_xpm,
{ 64, 64 },
{ 2, 60 },
},
{
KICURSOR::PENCIL,
nullptr,
nullptr,
cursor_pencil64_xpm,
{ 64, 64 },
{ 8, 54 },
},
{
KICURSOR::MOVING,
nullptr,
nullptr,
{ 1, 1 }
},
{
#ifdef __WINDOWS__
cursor_select_m64_xpm,
cursor_place64_xpm,
#else
cursor_select_m_black64_xpm,
cursor_place_black64_xpm,
#endif
{ 64, 64 },
{ 2, 2 },
},
{
KICURSOR::REMOVE,
nullptr,
nullptr,
cursor_eraser64_xpm,
{ 64, 64 },
{ 8, 8 },
},
{
KICURSOR::TEXT,
nullptr,
nullptr,
cursor_text64_xpm,
{ 64, 64 },
{ 14, 14 },
},
{
KICURSOR::MEASURE,
nullptr,
nullptr,
cursor_measure64_xpm,
{ 64, 64 },
{ 8, 8 },
},
{
KICURSOR::ADD,
nullptr,
nullptr,
cursor_add64_xpm,
{ 64, 64 },
{ 14, 14 },
},
{
KICURSOR::SUBTRACT,
nullptr,
nullptr,
cursor_subtract64_xpm,
{ 64, 64 },
{ 14, 14 },
},
{
KICURSOR::XOR,
nullptr,
nullptr,
cursor_xor64_xpm,
{ 64, 64 },
{ 14, 14 },
},
{
KICURSOR::ZOOM_IN,
nullptr,
nullptr,
cursor_zoom_in64_xpm,
{ 64, 64 },
{ 12, 12 },
},
{
KICURSOR::ZOOM_OUT,
nullptr,
nullptr,
cursor_zoom_out64_xpm,
{ 64, 64 },
{ 12, 12 },
},
{
KICURSOR::LABEL_NET,
nullptr,
nullptr,
cursor_label_net64_xpm,
{ 64, 64 },
{ 14, 14 },
},
{
KICURSOR::LABEL_GLOBAL,
nullptr,
nullptr,
cursor_label_global64_xpm,
{ 64, 64 },
{ 14, 14 },
},
{
KICURSOR::COMPONENT,
nullptr,
nullptr,
cursor_component64_xpm,
{ 64, 64 },
{ 14, 14 },
},
{
KICURSOR::SELECT_LASSO,
nullptr,
nullptr,
cursor_select_lasso64_xpm,
{ 64, 64 },
{ 14, 14 },
},
{
KICURSOR::SELECT_WINDOW,
nullptr,
nullptr,
cursor_select_window64_xpm,
{ 64, 64 },
{ 14, 20 },
},
{
KICURSOR::LINE_BUS,
nullptr,
nullptr,
cursor_line_bus64_xpm,
{ 64, 64 },
{ 10, 52 },
},
{
KICURSOR::LINE_WIRE,
nullptr,
nullptr,
cursor_line_wire64_xpm,
{ 64, 64 },
{ 10, 52 },
},
{
KICURSOR::LINE_GRAPHIC,
nullptr,
nullptr,
cursor_line_graphic64_xpm,
{ 64, 64 },
{ 10, 52 },
},
{
KICURSOR::LABEL_HIER,
nullptr,
nullptr,
cursor_label_hier64_xpm,
{ 64, 64 },
{ 14, 14 },
},
{
KICURSOR::PLACE,
nullptr,
nullptr,
#ifdef __WINDOWS__
cursor_place64_xpm,
#else
cursor_place_black64_xpm,
#endif
{ 64, 64 },
{ 2, 2 },
},
};
/**
* Construct a cursor for the given definition.
*
* How to do this depends on the platform, see
* http://docs.wxwidgets.org/trunk/classwx_cursor.html
*
* @param aDef the cursor definition
* @return a newly constructed cursor if the platform is supported,
* else wxNullCursor
*/
wxCursor constructCursor( const CURSOR_STORE::CURSOR_DEF& aDef )
{
if( aDef.m_xpm != nullptr )
{
wxImage xpmImage = wxImage( aDef.m_xpm );
xpmImage.SetOption( wxIMAGE_OPTION_CUR_HOTSPOT_X, aDef.m_hotspot.x );
xpmImage.SetOption( wxIMAGE_OPTION_CUR_HOTSPOT_Y, aDef.m_hotspot.y );
return wxCursor( xpmImage );
{ 2, 2 }
}
}
}
else if( aDef.m_image_data != nullptr && aDef.m_mask_data != nullptr )
};
CURSOR_STORE::CURSOR_STORE()
{
for( const auto& [cursorId, defs] : cursors_defs )
{
#if defined( __WXMSW__ ) || defined( __WXMAC__ )
wxCHECK2( !defs.empty(), continue );
wxBitmap img_bitmap(
reinterpret_cast<const char*>( aDef.m_image_data ), aDef.m_size.x, aDef.m_size.y );
wxBitmap msk_bitmap(
reinterpret_cast<const char*>( aDef.m_mask_data ), aDef.m_size.x, aDef.m_size.y );
img_bitmap.SetMask( new wxMask( msk_bitmap ) );
#if wxCHECK_VERSION( 3, 3, 0 )
// For wx 3.3+, create cursor bundles from the cursor definitions
std::vector<wxBitmap> bitmaps;
for( const auto& [xpm, hotspot_def] : defs )
{
wxCHECK2( xpm, continue );
bitmaps.push_back( wxBitmap( xpm ) );
}
wxImage image( img_bitmap.ConvertToImage() );
wxBitmapBundle bitmapBundle = wxBitmapBundle::FromBitmaps( bitmaps );
#if defined( __WXMSW__ )
image.SetMaskColour( 255, 255, 255 );
#endif
wxPoint hotspot = defs[0].m_hotspot; // Use hotspot from standard cursor
m_bundleMap[cursorId] = wxCursorBundle( bitmapBundle, hotspot );
#else
auto constructCursor = []( const CURSOR_STORE::CURSOR_DEF& aDef ) -> wxCursor
{
wxCHECK( aDef.m_xpm, wxNullCursor );
wxImage xpmImage = wxImage( aDef.m_xpm );
image.SetOption( wxIMAGE_OPTION_CUR_HOTSPOT_X, aDef.m_hotspot.x );
image.SetOption( wxIMAGE_OPTION_CUR_HOTSPOT_Y, aDef.m_hotspot.y );
xpmImage.SetOption( wxIMAGE_OPTION_CUR_HOTSPOT_X, aDef.m_hotspot.x );
xpmImage.SetOption( wxIMAGE_OPTION_CUR_HOTSPOT_Y, aDef.m_hotspot.y );
return wxCursor{ image };
#elif defined( __WXGTK__ ) || defined( __WXMOTIF__ )
return wxCursor{
reinterpret_cast<const char*>( aDef.m_image_data ),
aDef.m_size.x,
aDef.m_size.y,
aDef.m_hotspot.x,
aDef.m_hotspot.y,
reinterpret_cast<const char*>( aDef.m_mask_data ),
return wxCursor( xpmImage );
};
#else
wxASSERT_MSG( false, wxS( "Unknown platform for cursor construction." ) );
return wxNullCursor;
// Add standard cursor (first definition)
m_standardCursorMap[cursorId] = constructCursor( defs[0] );
// Add HiDPI cursor (second definition if available, otherwise fallback to standard)
if( defs.size() > 1 )
m_hidpiCursorMap[cursorId] = constructCursor( defs[1] );
else
m_hidpiCursorMap[cursorId] = m_standardCursorMap[cursorId];
#endif
}
wxASSERT_MSG( false, wxS( "Unknown to find cursor" ) );
return wxNullCursor;
}
CURSOR_STORE::CURSOR_STORE( const std::vector<CURSOR_DEF>& aDefs )
#if wxCHECK_VERSION( 3, 3, 0 )
const wxCursorBundle& CURSOR_STORE::storeGetBundle( KICURSOR aIdKey ) const
{
for( const auto& def : aDefs )
{
m_store[def.m_id_key] = constructCursor( def );
}
}
const auto find_iter = m_bundleMap.find( aIdKey );
const wxCursor& CURSOR_STORE::Get( KICURSOR aIdKey ) const
{
const auto find_iter = m_store.find( aIdKey );
if( find_iter != m_store.end() )
if( find_iter != m_bundleMap.end() )
return find_iter->second;
wxASSERT_MSG( false, wxString::Format( "Could not find cursor with ID %d",
wxASSERT_MSG( false, wxString::Format( "Could not find cursor bundle with ID %d",
static_cast<int>( aIdKey ) ) );
return wxCursorBundle();
}
#else
const wxCursor& CURSOR_STORE::storeGetCursor( KICURSOR aIdKey, bool aHiDPI ) const
{
const auto& store = aHiDPI ? m_hidpiCursorMap : m_standardCursorMap;
const auto find_iter = store.find( aIdKey );
if( find_iter != store.end() )
return find_iter->second;
wxASSERT_MSG( false, wxString::Format( "Could not find cursor with ID %d", static_cast<int>( aIdKey ) ) );
return wxNullCursor;
}
#endif
const wxCursor CURSOR_STORE::GetCursor( KICURSOR aCursorType )
/* static */
const WX_CURSOR_TYPE CURSOR_STORE::GetCursor( KICURSOR aCursorType, bool aHiDPI )
{
// Use a single cursor store instance
static CURSOR_STORE store;
wxStockCursor stock = GetStockCursor( aCursorType );
if( stock != wxCURSOR_MAX )
{
return wxCursor( stock );
}
return WX_CURSOR_TYPE( stock );
static CURSOR_STORE store( standard_cursors );
return store.Get( aCursorType );
#if wxCHECK_VERSION( 3, 3, 0 )
// For wx 3.3+, return the pre-built cursor bundle (aHiDPI is ignored as bundles contain both)
return store.storeGetBundle( aCursorType );
#else
return store.storeGetCursor( aCursorType, aHiDPI );
#endif
}
const wxCursor CURSOR_STORE::GetHiDPICursor( KICURSOR aCursorType )
{
wxStockCursor stock = GetStockCursor( aCursorType );
if( stock != wxCURSOR_MAX )
{
return wxCursor( stock );
}
static CURSOR_STORE store( hidpi_cursors );
return store.Get( aCursorType );
}
/* static */
wxStockCursor CURSOR_STORE::GetStockCursor( KICURSOR aCursorType )
{
wxStockCursor stockCursor;
@@ -618,9 +400,7 @@ wxStockCursor CURSOR_STORE::GetStockCursor( KICURSOR aCursorType )
}
if( !KIPLATFORM::UI::IsStockCursorOk( stockCursor ) )
{
stockCursor = wxCURSOR_MAX;
}
return stockCursor;
}
+11 -7
View File
@@ -2150,17 +2150,17 @@ void OPENGL_GAL::EndDiffLayer()
bool OPENGL_GAL::SetNativeCursorStyle( KICURSOR aCursor, bool aHiDPI )
{
// Store the current cursor type and get the wxCursor for it
// Store the current cursor type and get the wx cursor for it
if( !GAL::SetNativeCursorStyle( aCursor, aHiDPI ) )
return false;
if( aHiDPI )
m_currentwxCursor = CURSOR_STORE::GetHiDPICursor( m_currentNativeCursor );
else
m_currentwxCursor = CURSOR_STORE::GetCursor( m_currentNativeCursor );
m_currentwxCursor = CURSOR_STORE::GetCursor( m_currentNativeCursor, aHiDPI );
// Update the cursor in the wx control
HIDPI_GL_CANVAS::SetCursor( m_currentwxCursor );
#if wxCHECK_VERSION( 3, 3, 0 )
wxWindow::SetCursorBundle( m_currentwxCursor );
#else
wxWindow::SetCursor( m_currentwxCursor );
#endif
return true;
}
@@ -2168,7 +2168,11 @@ bool OPENGL_GAL::SetNativeCursorStyle( KICURSOR aCursor, bool aHiDPI )
void OPENGL_GAL::onSetNativeCursor( wxSetCursorEvent& aEvent )
{
#if wxCHECK_VERSION( 3, 3, 0 )
aEvent.SetCursor( m_currentwxCursor.GetCursorFor( this ) );
#else
aEvent.SetCursor( m_currentwxCursor );
#endif
}
+2 -1
View File
@@ -522,7 +522,8 @@ protected:
int m_wxBufferWidth;
bool m_isInitialized; ///< Are Cairo image & surface ready to use
COLOR4D m_backgroundColor; ///< Background color
wxCursor m_currentwxCursor; ///< wxCursor showing the current native cursor
WX_CURSOR_TYPE m_currentwxCursor; ///< wx cursor showing the current native cursor
};
} // namespace KIGFX
+49 -30
View File
@@ -29,6 +29,16 @@
#include <map>
#include <vector>
/**
* Represents either a wxCursorBundle for wx 3.3+ or a wxCursor for older versions.
* This allows consistent cursor handling across different wxWidgets versions.
*/
#if wxCHECK_VERSION( 3, 3, 0 )
typedef wxCursorBundle WX_CURSOR_TYPE;
#else
typedef wxCursor WX_CURSOR_TYPE;
#endif
enum class KICURSOR
{
@@ -101,50 +111,59 @@ public:
*/
struct CURSOR_DEF
{
///< The ID key used to uniquely identify a cursor in a given store
KICURSOR m_id_key;
///< The image data bitmap
const unsigned char* m_image_data;
///< The mask data bitmap
const unsigned char* m_mask_data;
const char** m_xpm;
///< The image size in pixels
wxSize m_size;
///< The "hotspot" where the cursor "is" in the image
wxPoint m_hotspot;
};
/**
* Construct a store with a pre-set list of cursors.
*
* In future, an "Add()" function could be added if stores need to
* dynamically add cursors.
*
* @param aDefs: the list of pre-set cursor definitions
* Get a cursor bundle (wx 3.3+) or appropriate cursor (older versions)
* @param aCursorType the cursor type to get
* @param aHiDPI whether to prefer HiDPI version for older wx versions
* @return the cursor bundle or cursor
*/
CURSOR_STORE( const std::vector<CURSOR_DEF>& aDefs );
static const WX_CURSOR_TYPE GetCursor( KICURSOR aCursorType, bool aHiDPI = false );
/**
* Get a given cursor by its ID
* @param aIdKey the ID key to look up
* @return the cursor, if found, else wxNullCursor
* Get stock cursor type for the given cursor
* @param aCursorType the cursor type
* @return stock cursor type, or wxCURSOR_MAX if not a stock cursor
*/
const wxCursor& Get( KICURSOR aIdKey ) const;
static const wxCursor GetCursor( KICURSOR aCursorType );
static const wxCursor GetHiDPICursor( KICURSOR aCursorType );
static wxStockCursor GetStockCursor( KICURSOR aCursorType );
private:
///< Internal store of cursors by ID
std::map<KICURSOR, wxCursor> m_store;
/**
* Construct a store with cursors for all defined types.
* The store will automatically contain both standard and HiDPI cursors.
*/
CURSOR_STORE();
#if wxCHECK_VERSION( 3, 3, 0 )
/**
* Get a cursor bundle by its ID (wx 3.3+ only)
* @param aIdKey the ID key to look up
* @return the cursor bundle, if found, else an invalid bundle
*/
const wxCursorBundle& storeGetBundle( KICURSOR aIdKey ) const;
#else
/**
* Get a cursor by its ID, automatically selecting the appropriate resolution
* @param aIdKey the ID key to look up
* @param aHiDPI whether to prefer HiDPI version if available
* @return the cursor, if found, else wxNullCursor
*/
const wxCursor& storeGetCursor( KICURSOR aIdKey, bool aHiDPI = false ) const;
#endif
#if wxCHECK_VERSION( 3, 3, 0 )
///< Internal store of cursor bundles for wx 3.3+
std::map<KICURSOR, wxCursorBundle> m_bundleMap;
#else
std::map<KICURSOR, wxCursor> m_standardCursorMap;
std::map<KICURSOR, wxCursor> m_hidpiCursorMap;
#endif
};
#endif // CURSOR_STORE__H
+2 -2
View File
@@ -378,8 +378,8 @@ private:
GLint ufm_pixelSizeMultiplier;
GLint ufm_antialiasingOffset;
/// wxCursor showing the current native cursor.
wxCursor m_currentwxCursor;
/// wx cursor showing the current native cursor.
WX_CURSOR_TYPE m_currentwxCursor;
std::unique_ptr<GL_BITMAP_CACHE> m_bitmapCache;