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.

107 lines
4.0 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2004-2017 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 Usefull macros and inline functions to create menus items
  28. * in menubars or popup menus
  29. */
  30. #include <wx/menu.h>
  31. #include <wx/menuitem.h>
  32. #include <bitmaps.h>
  33. /**
  34. * Function AddMenuItem
  35. * is an inline helper function to create and insert a menu item with an icon
  36. * into \a aMenu
  37. *
  38. * @param aMenu is the menu to add the new item.
  39. * @param aId is the command ID for the new menu item.
  40. * @param aText is the string for the new menu item.
  41. * @param aImage is the icon to add to the new menu item.
  42. * @param aType is the type of menu :wxITEM_NORMAL (default), wxITEM_CHECK ...
  43. * @return a pointer to the new created wxMenuItem
  44. */
  45. wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText,
  46. const wxBitmap& aImage, wxItemKind aType = wxITEM_NORMAL );
  47. /**
  48. * Function AddMenuItem
  49. * is an inline helper function to create and insert a menu item with an icon
  50. * and a help message string into \a aMenu
  51. *
  52. * @param aMenu is the menu to add the new item.
  53. * @param aId is the command ID for the new menu item.
  54. * @param aText is the string for the new menu item.
  55. * @param aHelpText is the help message string for the new menu item.
  56. * @param aImage is the icon to add to the new menu item.
  57. * @param aType is the type of menu :wxITEM_NORMAL (default), wxITEM_CHECK ...
  58. * @return a pointer to the new created wxMenuItem
  59. */
  60. wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText,
  61. const wxString& aHelpText, const wxBitmap& aImage,
  62. wxItemKind aType = wxITEM_NORMAL );
  63. /**
  64. * Function AddMenuItem
  65. * is an inline helper function to create and insert a menu item with an icon
  66. * into \a aSubMenu in \a aMenu
  67. *
  68. * @param aMenu is the menu to add the new submenu item.
  69. * @param aSubMenu is the submenu to add the new menu.
  70. * @param aId is the command ID for the new menu item.
  71. * @param aText is the string for the new menu item.
  72. * @param aImage is the icon to add to the new menu item.
  73. * @return a pointer to the new created wxMenuItem
  74. */
  75. wxMenuItem* AddMenuItem( wxMenu* aMenu, wxMenu* aSubMenu, int aId,
  76. const wxString& aText, const wxBitmap& aImage );
  77. /**
  78. * Function AddMenuItem
  79. * is an inline helper function to create and insert a menu item with an icon
  80. * and a help message string into \a aSubMenu in \a aMenu
  81. *
  82. * @param aMenu is the menu to add the new submenu item.
  83. * @param aSubMenu is the submenu to add the new menu.
  84. * @param aId is the command ID for the new menu item.
  85. * @param aText is the string for the new menu item.
  86. * @param aHelpText is the help message string for the new menu item.
  87. * @param aImage is the icon to add to the new menu item.
  88. * @return a pointer to the new created wxMenuItem
  89. */
  90. wxMenuItem* AddMenuItem( wxMenu* aMenu, wxMenu* aSubMenu, int aId,
  91. const wxString& aText, const wxString& aHelpText,
  92. const wxBitmap& aImage );
  93. #endif // MENUS_HELPERS_H_