1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2004-2020 KiCad Developers.
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 MENUS_HELPERS_H_
25 #define MENUS_HELPERS_H_
26 
27 /**
28  * @file menus_helpers.h
29  * @brief Macros and inline functions to create menus items in menubars or popup menus.
30  */
31 
32 
33 #include <wx/menu.h>
34 #include <wx/menuitem.h>
35 
36 class ACTION_MENU;
37 class TOOL_INTERACTIVE;
38 
39 void AddMenuLanguageList( ACTION_MENU* aMasterMenu, TOOL_INTERACTIVE* aControlTool );
40 
41 /**
42  * Add a bitmap to a menuitem.
43  *
44  * It is added only if use images in menus config option allows it.  For wxITEM_CHECK
45  * or wxITEM_RADIO menuitems, the bitmap is added only on Windows, other platforms do
46  * not support it
47  *
48  * @param aMenu is the menuitem.
49  * @param aImage is the icon to add to aMenu.
50  */
51 void AddBitmapToMenuItem( wxMenuItem* aMenu, const wxBitmap& aImage );
52 
53 
54 /**
55  * Create and insert a menu item with an icon into \a aMenu.
56  *
57  * @param aMenu is the menu to add the new item.
58  * @param aId is the command ID for the new menu item.
59  * @param aText is the string for the new menu item.
60  * @param aImage is the icon to add to the new menu item.
61  * @param aType is the type of menu :wxITEM_NORMAL (default), wxITEM_CHECK ...
62  * @return a pointer to the new created wxMenuItem.
63  */
64 wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText,
65                          const wxBitmap&  aImage, wxItemKind aType = wxITEM_NORMAL );
66 
67 
68 /**
69  * Create and insert a menu item with an icon and a help message string into \a aMenu.
70  *
71  * @param aMenu is the menu to add the new item.
72  * @param aId is the command ID for the new menu item.
73  * @param aText is the string for the new menu item.
74  * @param aHelpText is the help message string for the new menu item.
75  * @param aImage is the icon to add to the new menu item.
76  * @param aType is the type of menu :wxITEM_NORMAL (default), wxITEM_CHECK ...
77  * @return a pointer to the new created wxMenuItem.
78  */
79 wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText,
80                          const wxString& aHelpText, const wxBitmap& aImage,
81                          wxItemKind aType = wxITEM_NORMAL );
82 
83 
84 /**
85  * Create and insert a menu item with an icon into \a aSubMenu in \a aMenu.
86  *
87  * @param aMenu is the menu to add the new submenu item.
88  * @param aSubMenu is the submenu to add the new menu.
89  * @param aId is the command ID for the new menu item.
90  * @param aText is the string for the new menu item.
91  * @param aImage is the icon to add to the new menu item.
92  * @return a pointer to the new created wxMenuItem,
93  */
94 wxMenuItem* AddMenuItem( wxMenu* aMenu, wxMenu* aSubMenu, int aId,
95                          const wxString& aText, const wxBitmap& aImage );
96 
97 
98 /**
99  * Create and insert a menu item with an icon and a help message string into
100  * \a aSubMenu in \a aMenu.
101  *
102  * @param aMenu is the menu to add the new submenu item.
103  * @param aSubMenu is the submenu to add the new menu.
104  * @param aId is the command ID for the new menu item.
105  * @param aText is the string for the new menu item.
106  * @param aHelpText is the help message string for the new menu item.
107  * @param aImage is the icon to add to the new menu item.
108  * @return a pointer to the new created wxMenuItem.
109  */
110 wxMenuItem* AddMenuItem( wxMenu* aMenu, wxMenu* aSubMenu, int aId,
111                          const wxString& aText, const wxString& aHelpText,
112                          const wxBitmap&  aImage );
113 
114 #endif // MENUS_HELPERS_H_
115