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.

121 lines
4.5 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. class ACTION_MENU;
  34. class TOOL_INTERACTIVE;
  35. void AddMenuLanguageList( ACTION_MENU* aMasterMenu, TOOL_INTERACTIVE* aControlTool );
  36. /**
  37. * Add a bitmap to a menuitem
  38. * @param aMenu is the menuitem.
  39. * @param aImage is the icon to add to aMenu.
  40. * It is added only if use images in menus config option allows it.
  41. * For wxITEM_CHECK or wxITEM_RADIO menuitems, the bitmap is added only
  42. * on Windows, other platforms do not support it
  43. */
  44. void AddBitmapToMenuItem( wxMenuItem* aMenu, const wxBitmap& aImage );
  45. /**
  46. * Function AddMenuItem
  47. * is an inline helper function to create and insert a menu item with an icon
  48. * into \a aMenu
  49. *
  50. * @param aMenu is the menu to add the new item.
  51. * @param aId is the command ID for the new menu item.
  52. * @param aText is the string for the new menu item.
  53. * @param aImage is the icon to add to the new menu item.
  54. * @param aType is the type of menu :wxITEM_NORMAL (default), wxITEM_CHECK ...
  55. * @return a pointer to the new created wxMenuItem
  56. */
  57. wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText,
  58. const wxBitmap& aImage, wxItemKind aType = wxITEM_NORMAL );
  59. /**
  60. * Function AddMenuItem
  61. * is an inline helper function to create and insert a menu item with an icon
  62. * and a help message string into \a aMenu
  63. *
  64. * @param aMenu is the menu to add the new item.
  65. * @param aId is the command ID for the new menu item.
  66. * @param aText is the string for the new menu item.
  67. * @param aHelpText is the help message string for the new menu item.
  68. * @param aImage is the icon to add to the new menu item.
  69. * @param aType is the type of menu :wxITEM_NORMAL (default), wxITEM_CHECK ...
  70. * @return a pointer to the new created wxMenuItem
  71. */
  72. wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText,
  73. const wxString& aHelpText, const wxBitmap& aImage,
  74. wxItemKind aType = wxITEM_NORMAL );
  75. /**
  76. * Function AddMenuItem
  77. * is an inline helper function to create and insert a menu item with an icon
  78. * into \a aSubMenu in \a aMenu
  79. *
  80. * @param aMenu is the menu to add the new submenu item.
  81. * @param aSubMenu is the submenu to add the new menu.
  82. * @param aId is the command ID for the new menu item.
  83. * @param aText is the string for the new menu item.
  84. * @param aImage is the icon to add to the new menu item.
  85. * @return a pointer to the new created wxMenuItem
  86. */
  87. wxMenuItem* AddMenuItem( wxMenu* aMenu, wxMenu* aSubMenu, int aId,
  88. const wxString& aText, const wxBitmap& aImage );
  89. /**
  90. * Function AddMenuItem
  91. * is an inline helper function to create and insert a menu item with an icon
  92. * and a help message string into \a aSubMenu in \a aMenu
  93. *
  94. * @param aMenu is the menu to add the new submenu item.
  95. * @param aSubMenu is the submenu to add the new menu.
  96. * @param aId is the command ID for the new menu item.
  97. * @param aText is the string for the new menu item.
  98. * @param aHelpText is the help message string for the new menu item.
  99. * @param aImage is the icon to add to the new menu item.
  100. * @return a pointer to the new created wxMenuItem
  101. */
  102. wxMenuItem* AddMenuItem( wxMenu* aMenu, wxMenu* aSubMenu, int aId,
  103. const wxString& aText, const wxString& aHelpText,
  104. const wxBitmap& aImage );
  105. #endif // MENUS_HELPERS_H_