KiCad PCB EDA Suite
Loading...
Searching...
No Matches
tool_menu.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-2020 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
#ifndef TOOLS_TOOL_MENU__H_
25
#define TOOLS_TOOL_MENU__H_
26
27
#include <
tool/conditional_menu.h
>
28
29
#include <vector>
30
#include <memory>
31
32
class
ACTION_MENU
;
33
class
TOOL_INTERACTIVE
;
34
42
class
TOOL_MENU
43
{
44
public
:
45
53
TOOL_MENU
(
TOOL_INTERACTIVE
& aTool );
54
58
~TOOL_MENU
();
59
64
CONDITIONAL_MENU
&
GetMenu
();
65
75
void
RegisterSubMenu
( std::shared_ptr<ACTION_MENU> aSubMenu );
76
80
std::vector<std::shared_ptr<ACTION_MENU> >&
GetSubMenus
()
81
{
82
return
m_subMenus
;
83
}
84
93
void
ShowContextMenu
(
SELECTION
& aSelection );
94
99
void
ShowContextMenu
();
100
101
private
:
105
CONDITIONAL_MENU
m_menu
;
106
110
TOOL_INTERACTIVE
&
m_tool
;
111
115
std::vector<std::shared_ptr<ACTION_MENU> >
m_subMenus
;
116
};
117
118
#endif
// TOOLS_TOOL_MENU__H_
ACTION_MENU
Defines the structure of a menu based on ACTIONs.
Definition:
action_menu.h:49
CONDITIONAL_MENU
Definition:
conditional_menu.h:42
SELECTION
Definition:
selection.h:39
TOOL_INTERACTIVE
Definition:
tool_interactive.h:57
TOOL_MENU
Manage a CONDITIONAL_MENU and some number of CONTEXT_MENUs as sub-menus.
Definition:
tool_menu.h:43
TOOL_MENU::GetMenu
CONDITIONAL_MENU & GetMenu()
Definition:
tool_menu.cpp:44
TOOL_MENU::m_tool
TOOL_INTERACTIVE & m_tool
The tool that owns this menu.
Definition:
tool_menu.h:110
TOOL_MENU::RegisterSubMenu
void RegisterSubMenu(std::shared_ptr< ACTION_MENU > aSubMenu)
Store a submenu of this menu model.
Definition:
tool_menu.cpp:50
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:66
TOOL_MENU::~TOOL_MENU
~TOOL_MENU()
Destruct any submenus created with TOOL_MENU::CreateSubMenu().
Definition:
tool_menu.cpp:39
TOOL_MENU::m_subMenus
std::vector< std::shared_ptr< ACTION_MENU > > m_subMenus
Lifetime-managing container of submenus.
Definition:
tool_menu.h:115
TOOL_MENU::m_menu
CONDITIONAL_MENU m_menu
The conditional menu displayed by the tool.
Definition:
tool_menu.h:105
TOOL_MENU::GetSubMenus
std::vector< std::shared_ptr< ACTION_MENU > > & GetSubMenus()
Definition:
tool_menu.h:80
conditional_menu.h
src
include
tool
tool_menu.h
Generated on Thu Nov 21 2024 00:06:43 for KiCad PCB EDA Suite by
1.9.6