KiCad PCB EDA Suite
Loading...
Searching...
No Matches
cursors.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.TXT for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#ifndef CURSOR_STORE__H
25#define CURSOR_STORE__H
26
27#include <wx/cursor.h>
28
29#include <map>
30#include <vector>
31
36#if wxCHECK_VERSION( 3, 3, 0 )
37typedef wxCursorBundle WX_CURSOR_TYPE;
38#else
39typedef wxCursor WX_CURSOR_TYPE;
40#endif
41
42
43enum class KICURSOR
44{
45 DEFAULT,
46 ARROW,
47 ARROW64,
48 MOVING,
50 PENCIL,
52 REMOVE,
54 HAND,
55 HAND64,
62 TUNE,
63 TUNE64,
64 TEXT,
65 TEXT64,
66 MEASURE,
68 ADD,
69 ADD64,
72 XOR,
73 XOR64,
74 ZOOM_IN,
96 PLACE,
98};
99
107{
108public:
113 {
114 const char** m_xpm;
115
117 wxPoint m_hotspot;
118 };
119
126 static const WX_CURSOR_TYPE GetCursor( KICURSOR aCursorType, bool aHiDPI = false );
127
133 static wxStockCursor GetStockCursor( KICURSOR aCursorType );
134
135private:
140 CURSOR_STORE();
141
142#if wxCHECK_VERSION( 3, 3, 0 )
148 const wxCursorBundle& storeGetBundle( KICURSOR aIdKey ) const;
149#else
156 const wxCursor& storeGetCursor( KICURSOR aIdKey, bool aHiDPI = false ) const;
157#endif
158
159#if wxCHECK_VERSION( 3, 3, 0 )
161 std::map<KICURSOR, wxCursorBundle> m_bundleMap;
162#else
163 std::map<KICURSOR, wxCursor> m_standardCursorMap;
164 std::map<KICURSOR, wxCursor> m_hidpiCursorMap;
165#endif
166
167};
168
169#endif // CURSOR_STORE__H
Simple class to construct and store cursors against unique ID keys.
Definition: cursors.h:107
std::map< KICURSOR, wxCursor > m_hidpiCursorMap
Definition: cursors.h:164
static const WX_CURSOR_TYPE GetCursor(KICURSOR aCursorType, bool aHiDPI=false)
Get a cursor bundle (wx 3.3+) or appropriate cursor (older versions)
Definition: cursors.cpp:363
static wxStockCursor GetStockCursor(KICURSOR aCursorType)
Get stock cursor type for the given cursor.
Definition: cursors.cpp:382
CURSOR_STORE()
Construct a store with cursors for all defined types.
Definition: cursors.cpp:288
const wxCursor & storeGetCursor(KICURSOR aIdKey, bool aHiDPI=false) const
Get a cursor by its ID, automatically selecting the appropriate resolution.
Definition: cursors.cpp:348
std::map< KICURSOR, wxCursor > m_standardCursorMap
Definition: cursors.h:163
KICURSOR
Definition: cursors.h:44
@ LABEL_GLOBAL64
@ LINE_GRAPHIC64
@ SELECT_LASSO64
@ VOLTAGE_PROBE64
@ CURRENT_PROBE64
@ SELECT_WINDOW64
wxCursor WX_CURSOR_TYPE
Represents either a wxCursorBundle for wx 3.3+ or a wxCursor for older versions.
Definition: cursors.h:39
Definition of a cursor.
Definition: cursors.h:113
const char ** m_xpm
The "hotspot" where the cursor "is" in the image.
Definition: cursors.h:114