KiCad PCB EDA Suite
Loading...
Searching...
No Matches
design_block_control.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
25#ifndef DESIGN_BLOCK_CONTROL_H
26#define DESIGN_BLOCK_CONTROL_H
27
28#include <eda_draw_frame.h>
30
32class LIB_TREE_NODE;
33
37class DESIGN_BLOCK_CONTROL : public TOOL_INTERACTIVE, public wxEvtHandler
38{
39public:
40 DESIGN_BLOCK_CONTROL( const std::string& aName );
41 virtual ~DESIGN_BLOCK_CONTROL();
42
44 void Reset( RESET_REASON aReason ) override;
45
47
48 int PinLibrary( const TOOL_EVENT& aEvent );
49 int UnpinLibrary( const TOOL_EVENT& aEvent );
50
51 int NewLibrary( const TOOL_EVENT& aEvent );
52 int DeleteLibrary( const TOOL_EVENT& aEvent );
53
54 int DeleteDesignBlock( const TOOL_EVENT& aEvent );
55 int EditDesignBlockProperties( const TOOL_EVENT& aEvent );
56
57 int HideLibraryTree( const TOOL_EVENT& aEvent );
58
59protected:
60 bool selIsInLibrary( const SELECTION& aSel );
61 bool selIsDesignBlock( const SELECTION& aSel );
62
65 void setTransitions() override;
66
69
71 std::vector<FRAME_T> m_framesToNotify;
72 void notifyOtherFrames();
73
75};
76
77
78#endif
void setTransitions() override
This method is meant to be overridden in order to specify handlers for events.
int UnpinLibrary(const TOOL_EVENT &aEvent)
DESIGN_BLOCK_CONTROL(const std::string &aName)
void AddContextMenuItems(CONDITIONAL_MENU *aMenu)
virtual DESIGN_BLOCK_PANE * getDesignBlockPane()=0
LIB_ID getSelectedLibId()
Set up handlers for various events.
bool selIsInLibrary(const SELECTION &aSel)
LIB_TREE_NODE * getCurrentTreeNode()
bool selIsDesignBlock(const SELECTION &aSel)
int NewLibrary(const TOOL_EVENT &aEvent)
int HideLibraryTree(const TOOL_EVENT &aEvent)
int PinLibrary(const TOOL_EVENT &aEvent)
int EditDesignBlockProperties(const TOOL_EVENT &aEvent)
int DeleteLibrary(const TOOL_EVENT &aEvent)
std::vector< FRAME_T > m_framesToNotify
Notify other frames that the design block lib table has changed.
int DeleteDesignBlock(const TOOL_EVENT &aEvent)
The base class for create windows for drawing purpose.
A logical library item identifier and consists of various portions much like a URI.
Definition lib_id.h:49
Model class in the component selector Model-View-Adapter (mediated MVC) architecture.
RESET_REASON
Determine the reason of reset for a tool.
Definition tool_base.h:78
Generic, UI-independent tool event.
Definition tool_event.h:171
TOOL_INTERACTIVE(TOOL_ID aId, const std::string &aName)
Create a tool with given id & name.
void Reset() override