KiCad PCB EDA Suite
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 (C) 2017-2019 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, 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
#include <
eda_draw_frame.h
>
25
#include <
tool/tool_menu.h
>
26
#include <
tool/tool_interactive.h
>
27
#include <
tool/action_menu.h
>
28
#include <
tool/actions.h
>
29
#include <
tool/zoom_menu.h
>
30
#include <
tool/grid_menu.h
>
31
#include <
tool/selection.h
>
32
33
34
TOOL_MENU::TOOL_MENU
(
TOOL_INTERACTIVE
& aTool ) :
35
m_menu( true, &aTool ),
36
m_tool( aTool )
37
{
38
}
39
40
41
TOOL_MENU::~TOOL_MENU
()
42
{
43
}
44
45
46
CONDITIONAL_MENU
&
TOOL_MENU::GetMenu
()
47
{
48
return
m_menu
;
49
}
50
51
52
void
TOOL_MENU::AddSubMenu
( std::shared_ptr<ACTION_MENU> aSubMenu )
53
{
54
// store a copy of the menu (keeps a reference)
55
m_subMenus
.push_back( std::move( aSubMenu ) );
56
}
57
58
59
void
TOOL_MENU::ShowContextMenu
(
SELECTION
& aSelection )
60
{
61
m_menu
.
Evaluate
( aSelection );
62
m_menu
.
UpdateAll
();
63
m_menu
.
ClearDirty
();
64
m_tool
.
SetContextMenu
( &
m_menu
,
CMENU_NOW
);
65
}
66
67
68
void
TOOL_MENU::ShowContextMenu
()
69
{
70
m_menu
.
SetDirty
();
71
m_tool
.
SetContextMenu
( &
m_menu
,
CMENU_NOW
);
72
}
73
74
TOOL_MENU::m_tool
TOOL_INTERACTIVE & m_tool
The tool that owns this menu.
Definition:
tool_menu.h:122
TOOL_MENU::ShowContextMenu
void ShowContextMenu()
Function ShowContextMenu.
Definition:
tool_menu.cpp:68
TOOL_MENU::~TOOL_MENU
~TOOL_MENU()
Destructor, also destructs any submenus created with TOOL_MENU::CreateSubMenu().
Definition:
tool_menu.cpp:41
tool_interactive.h
actions.h
grid_menu.h
TOOL_MENU::GetMenu
CONDITIONAL_MENU & GetMenu()
Function GetMenu.
Definition:
tool_menu.cpp:46
ACTION_MENU::ClearDirty
void ClearDirty()
Function ClearDirty() Clears the dirty flag on the menu and all descendants.
Definition:
action_menu.cpp:251
ACTION_MENU::UpdateAll
void UpdateAll()
Function UpdateAll() Runs update handlers for the menu and its submenus.
Definition:
action_menu.cpp:233
TOOL_INTERACTIVE::SetContextMenu
void SetContextMenu(ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
Function SetContextMenu()
Definition:
tool_interactive.cpp:76
selection.h
TOOL_MENU::m_menu
CONDITIONAL_MENU m_menu
The conditional menu displayed by the tool.
Definition:
tool_menu.h:117
TOOL_MENU::m_subMenus
std::vector< std::shared_ptr< ACTION_MENU > > m_subMenus
Lifetime-managing container of submenus.
Definition:
tool_menu.h:127
action_menu.h
CONDITIONAL_MENU::Evaluate
void Evaluate(SELECTION &aSelection)
Function Evaluate()
Definition:
conditional_menu.cpp:142
zoom_menu.h
TOOL_INTERACTIVE
Definition:
tool_interactive.h:36
SELECTION
Definition:
selection.h:35
TOOL_MENU::AddSubMenu
void AddSubMenu(std::shared_ptr< ACTION_MENU > aSubMenu)
Function CreateSubMenu.
Definition:
tool_menu.cpp:52
CMENU_NOW
Definition:
tool_event.h:162
TOOL_MENU::TOOL_MENU
TOOL_MENU(TOOL_INTERACTIVE &aTool)
Function TOOL_MENU.
Definition:
tool_menu.cpp:34
CONDITIONAL_MENU
Definition:
conditional_menu.h:39
tool_menu.h
eda_draw_frame.h
ACTION_MENU::SetDirty
void SetDirty()
Definition:
action_menu.cpp:258
common
tool
tool_menu.cpp
Generated on Sun Nov 17 2019 23:55:03 for KiCad PCB EDA Suite by
1.8.15