You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

114 lines
4.3 KiB

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