KiCad PCB EDA Suite
Loading...
Searching...
No Matches
spnav_2d_plugin.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 CHANGELOG.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 3
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, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef PCBNEW_SPACENAV_2D_PLUGIN_H
21#define PCBNEW_SPACENAV_2D_PLUGIN_H
22
23#include <memory>
24#include <wx/timer.h>
25
26#include <kicommon.h>
27#include <math/vector2d.h>
30
32namespace KIGFX
33{
34 class VIEW;
35}
36
37class KICOMMON_API SPNAV_2D_PLUGIN : public wxEvtHandler, public SPACEMOUSE_HANDLER
38{
39public:
40 explicit SPNAV_2D_PLUGIN( EDA_DRAW_PANEL_GAL* aCanvas );
42
43 void SetFocus( bool aFocus = true );
44
45 void SetCanvas( EDA_DRAW_PANEL_GAL* aCanvas );
46
47 void SetScale( double aScale )
48 {
49 m_scale = aScale;
50 }
51
52 void OnPan( double x, double y, double z ) override;
53 void OnRotate( double rx, double ry, double rz ) override;
54 void OnButton( int button, bool pressed ) override;
55
56private:
57 void onPollTimer( wxTimerEvent& evt );
58
59 std::unique_ptr<SPACENAV_DRIVER> m_driver;
60 wxTimer m_timer;
63 double m_scale;
65};
66
67#endif // PCBNEW_SPACENAV_2D_PLUGIN_H
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition view.h:63
virtual void OnPan(double x, double y, double z)=0
Handle translation (pan) events.
virtual void OnRotate(double rx, double ry, double rz)=0
Handle rotational events.
virtual void OnButton(int button, bool pressed)=0
Handle button press/release events.
KIGFX::VIEW * m_view
void SetFocus(bool aFocus=true)
void SetCanvas(EDA_DRAW_PANEL_GAL *aCanvas)
std::unique_ptr< SPACENAV_DRIVER > m_driver
EDA_DRAW_PANEL_GAL * m_canvas
void SetScale(double aScale)
SPNAV_2D_PLUGIN(EDA_DRAW_PANEL_GAL *aCanvas)
#define KICOMMON_API
Definition kicommon.h:27
The Cairo implementation of the graphics abstraction layer.
Definition eda_group.h:29