KiCad PCB EDA Suite
Loading...
Searching...
No Matches
action_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 (C) 2017-2021 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
30#ifndef CLASS_ACTION_PLUGIN_H
31#define CLASS_ACTION_PLUGIN_H
32#include <vector>
33#include <pcb_edit_frame.h>
34
39{
40public:
42 show_on_toolbar( false ) {}
43 virtual ~ACTION_PLUGIN();
44
48 virtual wxString GetCategoryName() = 0;
49
54 virtual wxString GetName() = 0;
55
59 virtual wxString GetDescription() = 0;
60
64 virtual bool GetShowToolbarButton() = 0;
65
70 virtual wxString GetIconFileName( bool aDark ) = 0;
71
75 virtual wxString GetPluginPath() = 0;
76
82 virtual void* GetObject() = 0;
83
87 virtual void Run() = 0;
88
93 void register_action();
94
95 // association between the plugin and its menu id
96 // m_actionMenuId set to 0 means the corresponding menuitem to call this
97 // action is not yet created
99
100 // Same for button id
102
103 // Icon for the action button and menu entry
104 wxBitmap iconBitmap;
105
106 // If show_on_toolbar is true a button will be added to top toolbar
108
109};
110
111
116{
117public:
124 static void register_action( ACTION_PLUGIN* aAction );
125
133 static bool deregister_object( void* aObject );
134
139 static ACTION_PLUGIN* GetAction( const wxString& aName );
140
147 static void SetActionMenu( int aIndex, int idMenu );
148
155 static ACTION_PLUGIN* GetActionByMenu( int aMenu );
156
163 static void SetActionButton( ACTION_PLUGIN* aAction, int idButton );
164
171 static ACTION_PLUGIN* GetActionByButton( int aButton );
172
179 static ACTION_PLUGIN* GetActionByPath( const wxString& aPath );
180
185 static ACTION_PLUGIN* GetAction( int aIndex );
186
190 static int GetActionsCount();
191
195 static bool IsActionRunning();
196
200 static void SetActionRunning( bool aRunning );
201
205 static void UnloadAll();
206
207private:
211 static std::vector<ACTION_PLUGIN*> m_actionsList;
212 static bool m_actionRunning;
213};
214
215#endif /* PCBNEW_ACTION_PLUGINS_H */
Mainly static.
static void UnloadAll()
Unload (deregister) all action plugins.
static bool deregister_object(void *aObject)
Deregister an object which builds a action.
static ACTION_PLUGIN * GetActionByMenu(int aMenu)
Find action plugin associated to a menu ID.
static ACTION_PLUGIN * GetActionByPath(const wxString &aPath)
Find action plugin by module path.
static std::vector< ACTION_PLUGIN * > m_actionsList
ACTION_PLUGIN system wide static list.
static int GetActionsCount()
static void register_action(ACTION_PLUGIN *aAction)
An action calls this static method when it wants to register itself into the system actions.
static ACTION_PLUGIN * GetAction(const wxString &aName)
static void SetActionButton(ACTION_PLUGIN *aAction, int idButton)
Associate a button id to an action plugin.
static void SetActionMenu(int aIndex, int idMenu)
Associate a menu id to an action plugin.
static void SetActionRunning(bool aRunning)
static bool m_actionRunning
static ACTION_PLUGIN * GetActionByButton(int aButton)
Find action plugin associated to a button ID.
static bool IsActionRunning()
This is the parent class from where any action plugin class must derive.
Definition: action_plugin.h:39
virtual wxString GetIconFileName(bool aDark)=0
wxBitmap iconBitmap
void register_action()
It's the standard method of a "ACTION_PLUGIN" to register itself into the ACTION_PLUGINS singleton ma...
virtual wxString GetDescription()=0
virtual wxString GetPluginPath()=0
virtual wxString GetCategoryName()=0
virtual void * GetObject()=0
This method gets the pointer to the object from where this action constructs.
virtual ~ACTION_PLUGIN()
virtual wxString GetName()=0
virtual void Run()=0
This method the the action.
virtual bool GetShowToolbarButton()=0