30#include <cursors/cursor-add.xpm>
31#include <cursors/cursor-component.xpm>
32#include <cursors/cursor-eraser.xpm>
33#include <cursors/cursor-label-global.xpm>
34#include <cursors/cursor-label-hier.xpm>
35#include <cursors/cursor-label-net.xpm>
36#include <cursors/cursor-line-bus.xpm>
37#include <cursors/cursor-line-graphic.xpm>
38#include <cursors/cursor-line-wire.xpm>
39#include <cursors/cursor-line-wire-add.xpm>
40#include <cursors/cursor-measure.xpm>
41#include <cursors/cursor-pencil.xpm>
42#include <cursors/cursor-select-lasso.xpm>
43#include <cursors/cursor-select-window.xpm>
44#include <cursors/cursor-subtract.xpm>
45#include <cursors/cursor-text.xpm>
46#include <cursors/cursor-xor.xpm>
47#include <cursors/cursor-zoom.xpm>
48#include <cursors/cursor-zoom-out.xpm>
52#include <cursors/cursor-place.xpm>
53#include <cursors/cursor-select-m.xpm>
55#include <cursors/cursor-place-black.xpm>
56#include <cursors/cursor-select-m-black.xpm>
63static const unsigned char voltage_probe[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
64 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
65 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00,
66 0x00, 0x30, 0x06, 0x00, 0x00, 0x18, 0x0c, 0x00, 0x00, 0x0e, 0x08, 0x00, 0x80, 0x07, 0x08, 0x00,
67 0xc0, 0x07, 0x18, 0x00, 0xe0, 0x07, 0x30, 0x00, 0xf0, 0x03, 0x60, 0x00, 0xf8, 0x01, 0x00, 0x00,
68 0xfc, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x80, 0x1f, 0x00, 0x00, 0xc0,
69 0x0f, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0xf0, 0x01, 0x00, 0x00, 0xf0,
70 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x02,
71 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
73static const unsigned char current_probe[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
74 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
75 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0x60, 0x06, 0x00,
76 0x00, 0x30, 0x0c, 0x00, 0x00, 0x1c, 0x08, 0x00, 0x00, 0x0f, 0x08, 0x00, 0x80, 0x0f, 0x18, 0x00,
77 0xc0, 0x0f, 0x30, 0x80, 0xe1, 0x07, 0x60, 0x80, 0xf1, 0x03, 0x00, 0x80, 0xf9, 0x01, 0x00, 0x80,
78 0xfd, 0x00, 0x00, 0x80, 0x7f, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x80, 0x1f, 0x00, 0x00, 0xc0,
79 0x0f, 0x00, 0x00, 0xf8, 0x07, 0x00, 0x00, 0xfe, 0x03, 0x00, 0x00, 0xc6, 0x01, 0x00, 0x00, 0x83,
80 0x01, 0x00, 0x00, 0x83, 0x01, 0x00, 0x00, 0x83, 0x01, 0x00, 0x00, 0xc2, 0x00, 0x00, 0x00, 0xfc,
81 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00 };
83static const unsigned char cursor_tune[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
84 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0xc0, 0x0f, 0x00,
85 0x00, 0xe0, 0x1f, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xfc, 0x07, 0x00,
86 0x00, 0xfe, 0x03, 0x00, 0x00, 0xff, 0x01, 0x00, 0x80, 0xff, 0x00, 0x00, 0xc0, 0x7f, 0x00, 0x00,
87 0xe0, 0x3f, 0x00, 0x00, 0xe0, 0x1f, 0x00, 0x00, 0xfc, 0x0f, 0x00, 0x00, 0xfc, 0x07, 0x00, 0x00,
88 0xfc, 0x03, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0xf4, 0x00, 0x00, 0x00, 0xea, 0x00, 0x00, 0x00,
89 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x50,
90 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x0a,
91 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00 };
93static const unsigned char cursor_tune_mask[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
94 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0xc0, 0x0f,
95 0x00, 0x00, 0xe0, 0x1f, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xfc, 0x07,
96 0x00, 0x00, 0xfe, 0x03, 0x00, 0x00, 0xff, 0x01, 0x00, 0x80, 0xff, 0x00, 0x00, 0xc0, 0x7f, 0x00,
97 0x00, 0xe0, 0x3f, 0x00, 0x00, 0xe0, 0x1f, 0x00, 0x00, 0xfc, 0x0f, 0x00, 0x00, 0xfc, 0x07, 0x00,
98 0x00, 0xfc, 0x03, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0xee, 0x00, 0x00,
99 0x00, 0x07, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00,
100 0x70, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00,
101 0x0e, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00 };
144 cursor_select_m_black_xpm,
217 cursor_label_net_xpm,
225 cursor_label_global_xpm,
233 cursor_component_xpm,
241 cursor_select_lasso_xpm,
249 cursor_select_window_xpm,
265 cursor_line_wire_xpm,
273 cursor_line_wire_add_xpm,
281 cursor_line_graphic_xpm,
289 cursor_label_hier_xpm,
300 cursor_place_black_xpm,
320 if( aDef.
m_xpm !=
nullptr )
322 wxImage xpmImage = wxImage( aDef.
m_xpm );
324 xpmImage.SetOption( wxIMAGE_OPTION_CUR_HOTSPOT_X, aDef.
m_hotspot.x );
325 xpmImage.SetOption( wxIMAGE_OPTION_CUR_HOTSPOT_Y, aDef.
m_hotspot.y );
327 return wxCursor( xpmImage );
331#if defined( __WXMSW__ ) || defined( __WXMAC__ )
337 img_bitmap.SetMask(
new wxMask( msk_bitmap ) );
339 wxImage
image( img_bitmap.ConvertToImage() );
341#if defined( __WXMSW__ )
342 image.SetMaskColour( 255, 255, 255 );
345 image.SetOption( wxIMAGE_OPTION_CUR_HOTSPOT_X, aDef.
m_hotspot.x );
346 image.SetOption( wxIMAGE_OPTION_CUR_HOTSPOT_Y, aDef.
m_hotspot.y );
348 return wxCursor{
image };
350#elif defined( __WXGTK__ ) || defined( __WXMOTIF__ )
362 wxASSERT_MSG(
false, wxS(
"Unknown platform for cursor construction." ) );
367 wxASSERT_MSG(
false, wxS(
"Unknown to find cursor" ) );
374 for(
const auto& def : aDefs )
383 const auto find_iter =
m_store.find( aIdKey );
385 if( find_iter !=
m_store.end() )
386 return find_iter->second;
388 wxASSERT_MSG(
false, wxString::Format(
"Could not find cursor with ID %d",
389 static_cast<int>( aIdKey ) ) );
396 wxStockCursor stock =
398 if( stock != wxCURSOR_MAX )
400 return wxCursor( stock );
404 return store.
Get( aCursorType );
410 wxStockCursor stockCursor;
411 switch( aCursorType )
413 case KICURSOR::MOVING:
414 stockCursor = wxCURSOR_SIZING;
416 case KICURSOR::BULLSEYE:
417 stockCursor = wxCURSOR_BULLSEYE;
420 stockCursor = wxCURSOR_HAND;
422 case KICURSOR::ARROW:
423 stockCursor = wxCURSOR_ARROW;
426 stockCursor = wxCURSOR_MAX;
432 stockCursor = wxCURSOR_MAX;
Simple class to construct and store cursors against unique ID keys.
const wxCursor & Get(KICURSOR aIdKey) const
Get a given cursor by its ID.
static wxStockCursor GetStockCursor(KICURSOR aCursorType)
static const wxCursor GetCursor(KICURSOR aCursorType)
CURSOR_STORE(const std::vector< CURSOR_DEF > &aDefs)
Construct a store with a pre-set list of cursors.
std::map< KICURSOR, wxCursor > m_store
< Internal store of cursors by ID
static const unsigned char current_probe[]
static const unsigned char voltage_probe[]
static const unsigned char cursor_tune[]
static const unsigned char cursor_tune_mask[]
wxCursor constructCursor(const CURSOR_STORE::CURSOR_DEF &aDef)
Construct a cursor for the given definition.
static const std::vector< CURSOR_STORE::CURSOR_DEF > standard_cursors
const unsigned char * m_image_data
The mask data bitmap.
const char ** m_xpm
The image size in pixels.
const unsigned char * m_mask_data
wxSize m_size
The "hotspot" where the cursor "is" in the image.