2019-04-02 11:39:09 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2021-10-06 02:46:53 +00:00
|
|
|
* Copyright (C) 2019-2021 KiCad Developers, see AUTHORS.TXT for contributors.
|
2019-04-02 11:39:09 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef CURSOR_STORE__H
|
|
|
|
#define CURSOR_STORE__H
|
|
|
|
|
|
|
|
#include <wx/cursor.h>
|
|
|
|
|
|
|
|
#include <map>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
2020-10-08 00:50:28 +00:00
|
|
|
enum class KICURSOR
|
|
|
|
{
|
|
|
|
DEFAULT,
|
|
|
|
ARROW,
|
2024-02-21 00:14:02 +00:00
|
|
|
ARROW64,
|
2020-10-08 00:50:28 +00:00
|
|
|
MOVING,
|
2024-02-21 00:14:02 +00:00
|
|
|
MOVING64,
|
2020-10-08 00:50:28 +00:00
|
|
|
PENCIL,
|
2024-02-21 00:14:02 +00:00
|
|
|
PENCIL64,
|
2020-10-08 00:50:28 +00:00
|
|
|
REMOVE,
|
2024-02-21 00:14:02 +00:00
|
|
|
REMOVE64,
|
2020-10-08 00:50:28 +00:00
|
|
|
HAND,
|
2024-02-21 00:14:02 +00:00
|
|
|
HAND64,
|
2020-10-08 00:50:28 +00:00
|
|
|
BULLSEYE,
|
2024-02-21 00:14:02 +00:00
|
|
|
BULLSEYE64,
|
2020-10-08 00:50:28 +00:00
|
|
|
VOLTAGE_PROBE,
|
2024-02-21 00:14:02 +00:00
|
|
|
VOLTAGE_PROBE64,
|
2020-10-08 00:50:28 +00:00
|
|
|
CURRENT_PROBE,
|
2024-02-21 00:14:02 +00:00
|
|
|
CURRENT_PROBE64,
|
2020-10-08 00:50:28 +00:00
|
|
|
TUNE,
|
2024-02-21 00:14:02 +00:00
|
|
|
TUNE64,
|
2020-10-08 00:50:28 +00:00
|
|
|
TEXT,
|
2024-02-21 00:14:02 +00:00
|
|
|
TEXT64,
|
2020-10-08 00:50:28 +00:00
|
|
|
MEASURE,
|
2024-02-21 00:14:02 +00:00
|
|
|
MEASURE64,
|
2020-10-08 00:50:28 +00:00
|
|
|
ADD,
|
2024-02-21 00:14:02 +00:00
|
|
|
ADD64,
|
2020-10-08 00:50:28 +00:00
|
|
|
SUBTRACT,
|
2024-02-21 00:14:02 +00:00
|
|
|
SUBTRACT64,
|
2020-10-09 00:08:44 +00:00
|
|
|
XOR,
|
2024-02-21 00:14:02 +00:00
|
|
|
XOR64,
|
2020-10-09 00:08:44 +00:00
|
|
|
ZOOM_IN,
|
2024-02-21 00:14:02 +00:00
|
|
|
ZOOM_IN64,
|
2020-10-09 00:40:03 +00:00
|
|
|
ZOOM_OUT,
|
2024-02-21 00:14:02 +00:00
|
|
|
ZOOM_OUT64,
|
2020-10-10 22:25:28 +00:00
|
|
|
LABEL_NET,
|
2024-02-21 00:14:02 +00:00
|
|
|
LABEL_NET64,
|
2020-10-10 22:25:28 +00:00
|
|
|
LABEL_GLOBAL,
|
2024-02-21 00:14:02 +00:00
|
|
|
LABEL_GLOBAL64,
|
2020-10-09 01:24:26 +00:00
|
|
|
COMPONENT,
|
2024-02-21 00:14:02 +00:00
|
|
|
COMPONENT64,
|
2020-10-09 01:24:26 +00:00
|
|
|
SELECT_WINDOW,
|
2024-02-21 00:14:02 +00:00
|
|
|
SELECT_WINDOW64,
|
2020-10-10 22:25:28 +00:00
|
|
|
SELECT_LASSO,
|
2024-02-21 00:14:02 +00:00
|
|
|
SELECT_LASSO64,
|
2020-10-10 22:25:28 +00:00
|
|
|
LINE_BUS,
|
2024-02-21 00:14:02 +00:00
|
|
|
LINE_BUS64,
|
2020-10-10 22:25:28 +00:00
|
|
|
LINE_GRAPHIC,
|
2024-02-21 00:14:02 +00:00
|
|
|
LINE_GRAPHIC64,
|
2020-10-10 22:25:28 +00:00
|
|
|
LINE_WIRE,
|
2024-02-21 00:14:02 +00:00
|
|
|
LINE_WIRE64,
|
2020-10-10 22:25:28 +00:00
|
|
|
LINE_WIRE_ADD,
|
2024-02-21 00:14:02 +00:00
|
|
|
LINE_WIRE_ADD64,
|
2020-10-11 03:45:21 +00:00
|
|
|
LABEL_HIER,
|
2024-02-21 00:14:02 +00:00
|
|
|
LABEL_HIER64,
|
|
|
|
PLACE,
|
|
|
|
PLACE64
|
2020-10-08 00:50:28 +00:00
|
|
|
};
|
|
|
|
|
2019-04-02 11:39:09 +00:00
|
|
|
/**
|
|
|
|
* Simple class to construct and store cursors against unique ID keys.
|
|
|
|
*
|
|
|
|
* This can be used to lazily construct cursors as needed for specific
|
|
|
|
* applications.
|
|
|
|
*/
|
|
|
|
class CURSOR_STORE
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Definition of a cursor
|
|
|
|
*/
|
|
|
|
struct CURSOR_DEF
|
|
|
|
{
|
2021-01-25 12:42:36 +00:00
|
|
|
///< The ID key used to uniquely identify a cursor in a given store
|
2020-10-08 00:50:28 +00:00
|
|
|
KICURSOR m_id_key;
|
2019-04-02 11:39:09 +00:00
|
|
|
|
2021-01-25 12:42:36 +00:00
|
|
|
///< The image data bitmap
|
2019-04-02 11:39:09 +00:00
|
|
|
const unsigned char* m_image_data;
|
|
|
|
|
2021-01-25 12:42:36 +00:00
|
|
|
///< The mask data bitmap
|
2019-04-02 11:39:09 +00:00
|
|
|
const unsigned char* m_mask_data;
|
|
|
|
|
2020-10-08 00:50:28 +00:00
|
|
|
const char** m_xpm;
|
|
|
|
|
2021-01-25 12:42:36 +00:00
|
|
|
///< The image size in pixels
|
2019-04-02 11:39:09 +00:00
|
|
|
wxSize m_size;
|
|
|
|
|
2021-01-25 12:42:36 +00:00
|
|
|
///< The "hotspot" where the cursor "is" in the image
|
2019-04-02 11:39:09 +00:00
|
|
|
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
|
|
|
|
*/
|
|
|
|
CURSOR_STORE( const std::vector<CURSOR_DEF>& aDefs );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get a given cursor by its ID
|
|
|
|
* @param aIdKey the ID key to look up
|
|
|
|
* @return the cursor, if found, else wxNullCursor
|
|
|
|
*/
|
2020-10-08 00:50:28 +00:00
|
|
|
const wxCursor& Get( KICURSOR aIdKey ) const;
|
|
|
|
|
|
|
|
static const wxCursor GetCursor( KICURSOR aCursorType );
|
|
|
|
|
2024-02-21 00:14:02 +00:00
|
|
|
static const wxCursor GetHiDPICursor( KICURSOR aCursorType );
|
|
|
|
|
2023-05-19 01:34:30 +00:00
|
|
|
static wxStockCursor GetStockCursor( KICURSOR aCursorType );
|
2019-04-02 11:39:09 +00:00
|
|
|
|
|
|
|
private:
|
2021-01-25 12:42:36 +00:00
|
|
|
///< Internal store of cursors by ID
|
2020-10-08 00:50:28 +00:00
|
|
|
std::map<KICURSOR, wxCursor> m_store;
|
2019-04-02 11:39:09 +00:00
|
|
|
};
|
|
|
|
|
2021-01-05 17:42:03 +00:00
|
|
|
#endif // CURSOR_STORE__H
|