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, see <https://www.gnu.org/licenses/>.
18 */
19
20
21#ifndef DESIGN_BLOCK_CONTROL_H
22#define DESIGN_BLOCK_CONTROL_H
23
24#include <eda_draw_frame.h>
26
28class LIB_TREE_NODE;
29
33class DESIGN_BLOCK_CONTROL : public TOOL_INTERACTIVE, public wxEvtHandler
34{
35public:
36 DESIGN_BLOCK_CONTROL( const std::string& aName );
37 virtual ~DESIGN_BLOCK_CONTROL();
38
40 void Reset( RESET_REASON aReason ) override;
41
43
44 int PinLibrary( const TOOL_EVENT& aEvent );
45 int UnpinLibrary( const TOOL_EVENT& aEvent );
46
47 int NewLibrary( const TOOL_EVENT& aEvent );
48 int DeleteLibrary( const TOOL_EVENT& aEvent );
49
50 int DeleteDesignBlock( const TOOL_EVENT& aEvent );
51 int EditDesignBlockProperties( const TOOL_EVENT& aEvent );
52
53 int HideLibraryTree( const TOOL_EVENT& aEvent );
54
55protected:
56 bool selIsInLibrary( const SELECTION& aSel );
57 bool selIsDesignBlock( const SELECTION& aSel );
58
61 void setTransitions() override;
62
65
67 std::vector<FRAME_T> m_framesToNotify;
68 void notifyOtherFrames();
69
71};
72
73
74#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:45
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:74
Generic, UI-independent tool event.
Definition tool_event.h:167
TOOL_INTERACTIVE(TOOL_ID aId, const std::string &aName)
Create a tool with given id & name.
void Reset() override