KiCad PCB EDA Suite
Loading...
Searching...
No Matches
tool_menu.cpp
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 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
#include <
eda_draw_frame.h
>
21
#include <
tool/tool_menu.h
>
22
#include <
tool/tool_interactive.h
>
23
#include <
tool/action_menu.h
>
24
#include <
tool/actions.h
>
25
#include <
tool/selection.h
>
26
27
28
TOOL_MENU::TOOL_MENU
(
TOOL_INTERACTIVE
& aTool ) :
29
m_menu
( &aTool ),
30
m_tool
( aTool )
31
{
32
}
33
34
35
TOOL_MENU::~TOOL_MENU
()
36
{
37
}
38
39
40
CONDITIONAL_MENU
&
TOOL_MENU::GetMenu
()
41
{
42
return
m_menu
;
43
}
44
45
46
void
TOOL_MENU::RegisterSubMenu
( std::shared_ptr<ACTION_MENU> aSubMenu )
47
{
48
// store a copy of the menu (keeps a reference)
49
m_subMenus
.push_back( std::move( aSubMenu ) );
50
}
51
52
53
void
TOOL_MENU::ShowContextMenu
(
SELECTION
& aSelection )
54
{
55
m_menu
.Evaluate( aSelection );
56
m_menu
.UpdateAll();
57
m_menu
.ClearDirty();
58
m_tool
.SetContextMenu( &
m_menu
,
CMENU_NOW
);
59
}
60
61
62
void
TOOL_MENU::ShowContextMenu
()
63
{
64
m_menu
.SetDirty();
65
m_tool
.SetContextMenu( &
m_menu
,
CMENU_NOW
);
66
}
67
68
action_menu.h
actions.h
CONDITIONAL_MENU
Definition
conditional_menu.h:38
SELECTION
Definition
selection.h:35
TOOL_INTERACTIVE
Definition
tool_interactive.h:53
TOOL_MENU::GetMenu
CONDITIONAL_MENU & GetMenu()
Definition
tool_menu.cpp:40
TOOL_MENU::m_tool
TOOL_INTERACTIVE & m_tool
The tool that owns this menu.
Definition
tool_menu.h:106
TOOL_MENU::RegisterSubMenu
void RegisterSubMenu(std::shared_ptr< ACTION_MENU > aSubMenu)
Store a submenu of this menu model.
Definition
tool_menu.cpp:46
TOOL_MENU::ShowContextMenu
void ShowContextMenu()
Helper function to show a context menu without any selection for tools that can't make selections.
Definition
tool_menu.cpp:62
TOOL_MENU::~TOOL_MENU
~TOOL_MENU()
Destruct any submenus created with TOOL_MENU::CreateSubMenu().
Definition
tool_menu.cpp:35
TOOL_MENU::TOOL_MENU
TOOL_MENU(TOOL_INTERACTIVE &aTool)
Construct a new TOOL_MENU for a specific tool.
Definition
tool_menu.cpp:28
TOOL_MENU::m_subMenus
std::vector< std::shared_ptr< ACTION_MENU > > m_subMenus
Lifetime-managing container of submenus.
Definition
tool_menu.h:111
TOOL_MENU::m_menu
CONDITIONAL_MENU m_menu
The conditional menu displayed by the tool.
Definition
tool_menu.h:101
eda_draw_frame.h
selection.h
CMENU_NOW
@ CMENU_NOW
Right now (after TOOL_INTERACTIVE::SetContextMenu).
Definition
tool_event.h:152
tool_interactive.h
tool_menu.h
src
common
tool
tool_menu.cpp
Generated on Fri Jun 26 2026 00:05:33 for KiCad PCB EDA Suite by
1.13.2