Accept bitmap bundles for menu items (but don't use it yet).

This commit is contained in:
Alex Shvartzkop 2024-05-27 01:02:09 +03:00
parent 284cda1fca
commit b6aa01a572
2 changed files with 21 additions and 16 deletions

View File

@ -355,7 +355,7 @@ void KIUI::Disable( wxWindow* aWindow )
} }
void KIUI::AddBitmapToMenuItem( wxMenuItem* aMenu, const wxBitmap& aImage ) void KIUI::AddBitmapToMenuItem( wxMenuItem* aMenu, const wxBitmapBundle& aImage )
{ {
// Retrieve the global application show icon option: // Retrieve the global application show icon option:
bool useImagesInMenus = Pgm().GetCommonSettings()->m_Appearance.use_icons_in_menus; bool useImagesInMenus = Pgm().GetCommonSettings()->m_Appearance.use_icons_in_menus;
@ -369,8 +369,8 @@ void KIUI::AddBitmapToMenuItem( wxMenuItem* aMenu, const wxBitmap& aImage )
} }
wxMenuItem* KIUI::AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText, const wxBitmap& aImage, wxMenuItem* KIUI::AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText,
wxItemKind aType ) const wxBitmapBundle& aImage, wxItemKind aType )
{ {
wxMenuItem* item = new wxMenuItem( aMenu, aId, aText, wxEmptyString, aType ); wxMenuItem* item = new wxMenuItem( aMenu, aId, aText, wxEmptyString, aType );
AddBitmapToMenuItem( item, aImage ); AddBitmapToMenuItem( item, aImage );
@ -381,8 +381,9 @@ wxMenuItem* KIUI::AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText, co
} }
wxMenuItem* KIUI::AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText, const wxString& aHelpText, wxMenuItem* KIUI::AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText,
const wxBitmap& aImage, wxItemKind aType ) const wxString& aHelpText, const wxBitmapBundle& aImage,
wxItemKind aType )
{ {
wxMenuItem* item = new wxMenuItem( aMenu, aId, aText, aHelpText, aType ); wxMenuItem* item = new wxMenuItem( aMenu, aId, aText, aHelpText, aType );
AddBitmapToMenuItem( item, aImage ); AddBitmapToMenuItem( item, aImage );
@ -394,7 +395,7 @@ wxMenuItem* KIUI::AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText, co
wxMenuItem* KIUI::AddMenuItem( wxMenu* aMenu, wxMenu* aSubMenu, int aId, const wxString& aText, wxMenuItem* KIUI::AddMenuItem( wxMenu* aMenu, wxMenu* aSubMenu, int aId, const wxString& aText,
const wxBitmap& aImage ) const wxBitmapBundle& aImage )
{ {
wxMenuItem* item = new wxMenuItem( aMenu, aId, aText ); wxMenuItem* item = new wxMenuItem( aMenu, aId, aText );
item->SetSubMenu( aSubMenu ); item->SetSubMenu( aSubMenu );
@ -407,7 +408,7 @@ wxMenuItem* KIUI::AddMenuItem( wxMenu* aMenu, wxMenu* aSubMenu, int aId, const w
wxMenuItem* KIUI::AddMenuItem( wxMenu* aMenu, wxMenu* aSubMenu, int aId, const wxString& aText, wxMenuItem* KIUI::AddMenuItem( wxMenu* aMenu, wxMenu* aSubMenu, int aId, const wxString& aText,
const wxString& aHelpText, const wxBitmap& aImage ) const wxString& aHelpText, const wxBitmapBundle& aImage )
{ {
wxMenuItem* item = new wxMenuItem( aMenu, aId, aText, aHelpText ); wxMenuItem* item = new wxMenuItem( aMenu, aId, aText, aHelpText );
item->SetSubMenu( aSubMenu ); item->SetSubMenu( aSubMenu );

View File

@ -31,6 +31,7 @@
#include <wx/string.h> #include <wx/string.h>
#include <wx/font.h> #include <wx/font.h>
class wxBitmapBundle;
class wxSize; class wxSize;
class wxTextCtrl; class wxTextCtrl;
class wxTextEntry; class wxTextEntry;
@ -142,7 +143,7 @@ KICOMMON_API extern const wxString s_FocusStealableInputName;
* @param aMenu is the menuitem. * @param aMenu is the menuitem.
* @param aImage is the icon to add to aMenu. * @param aImage is the icon to add to aMenu.
*/ */
KICOMMON_API void AddBitmapToMenuItem( wxMenuItem* aMenu, const wxBitmap& aImage ); KICOMMON_API void AddBitmapToMenuItem( wxMenuItem* aMenu, const wxBitmapBundle& aImage );
/** /**
@ -155,8 +156,9 @@ KICOMMON_API void AddBitmapToMenuItem( wxMenuItem* aMenu, const wxBitmap& aImage
* @param aType is the type of menu :wxITEM_NORMAL (default), wxITEM_CHECK ... * @param aType is the type of menu :wxITEM_NORMAL (default), wxITEM_CHECK ...
* @return a pointer to the new created wxMenuItem. * @return a pointer to the new created wxMenuItem.
*/ */
KICOMMON_API wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText, const wxBitmap& aImage, KICOMMON_API wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText,
wxItemKind aType = wxITEM_NORMAL ); const wxBitmapBundle& aImage,
wxItemKind aType = wxITEM_NORMAL );
/** /**
@ -170,8 +172,9 @@ KICOMMON_API wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aT
* @param aType is the type of menu :wxITEM_NORMAL (default), wxITEM_CHECK ... * @param aType is the type of menu :wxITEM_NORMAL (default), wxITEM_CHECK ...
* @return a pointer to the new created wxMenuItem. * @return a pointer to the new created wxMenuItem.
*/ */
KICOMMON_API wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText, const wxString& aHelpText, KICOMMON_API wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText,
const wxBitmap& aImage, wxItemKind aType = wxITEM_NORMAL ); const wxString& aHelpText, const wxBitmapBundle& aImage,
wxItemKind aType = wxITEM_NORMAL );
/** /**
@ -184,8 +187,8 @@ KICOMMON_API wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aT
* @param aImage is the icon to add to the new menu item. * @param aImage is the icon to add to the new menu item.
* @return a pointer to the new created wxMenuItem, * @return a pointer to the new created wxMenuItem,
*/ */
KICOMMON_API wxMenuItem* AddMenuItem( wxMenu* aMenu, wxMenu* aSubMenu, int aId, const wxString& aText, KICOMMON_API wxMenuItem* AddMenuItem( wxMenu* aMenu, wxMenu* aSubMenu, int aId,
const wxBitmap& aImage ); const wxString& aText, const wxBitmapBundle& aImage );
/** /**
@ -200,8 +203,9 @@ KICOMMON_API wxMenuItem* AddMenuItem( wxMenu* aMenu, wxMenu* aSubMenu, int aId,
* @param aImage is the icon to add to the new menu item. * @param aImage is the icon to add to the new menu item.
* @return a pointer to the new created wxMenuItem. * @return a pointer to the new created wxMenuItem.
*/ */
KICOMMON_API wxMenuItem* AddMenuItem( wxMenu* aMenu, wxMenu* aSubMenu, int aId, const wxString& aText, KICOMMON_API wxMenuItem* AddMenuItem( wxMenu* aMenu, wxMenu* aSubMenu, int aId,
const wxString& aHelpText, const wxBitmap& aImage ); const wxString& aText, const wxString& aHelpText,
const wxBitmapBundle& aImage );
} }
KICOMMON_API SEVERITY SeverityFromString( const wxString& aSeverity ); KICOMMON_API SEVERITY SeverityFromString( const wxString& aSeverity );