KiCad PCB EDA Suite
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 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 #ifndef TOOLS_TOOL_MENU__H_
25 #define TOOLS_TOOL_MENU__H_
26 
27 #include <tool/conditional_menu.h>
28 #include <tool/tool_event.h>
29 
30 #include <vector>
31 #include <memory>
32 
33 class ACTION_MENU;
34 
47 class TOOL_MENU
48 {
49 public:
50 
60  TOOL_MENU( TOOL_INTERACTIVE& aTool );
61 
66  ~TOOL_MENU();
67 
75 
90  void AddSubMenu( std::shared_ptr<ACTION_MENU> aSubMenu );
91 
103  void ShowContextMenu( SELECTION& aSelection );
104 
111  void ShowContextMenu();
112 
113 private:
118 
123 
127  std::vector<std::shared_ptr<ACTION_MENU> > m_subMenus;
128 };
129 
130 #endif // TOOLS_TOOL_MENU__H_
TOOL_INTERACTIVE & m_tool
The tool that owns this menu.
Definition: tool_menu.h:122
void ShowContextMenu()
Function ShowContextMenu.
Definition: tool_menu.cpp:68
~TOOL_MENU()
Destructor, also destructs any submenus created with TOOL_MENU::CreateSubMenu().
Definition: tool_menu.cpp:41
Class ACTION_MENU.
Definition: action_menu.h:43
CONDITIONAL_MENU & GetMenu()
Function GetMenu.
Definition: tool_menu.cpp:46
Class TOOL_MENU.
Definition: tool_menu.h:47
CONDITIONAL_MENU m_menu
The conditional menu displayed by the tool.
Definition: tool_menu.h:117
std::vector< std::shared_ptr< ACTION_MENU > > m_subMenus
Lifetime-managing container of submenus.
Definition: tool_menu.h:127
void AddSubMenu(std::shared_ptr< ACTION_MENU > aSubMenu)
Function CreateSubMenu.
Definition: tool_menu.cpp:52
TOOL_MENU(TOOL_INTERACTIVE &aTool)
Function TOOL_MENU.
Definition: tool_menu.cpp:34