Use scalable icon in the menu sample

Replace the old XPM with a call to wxArtProvider::GetBitmapBundle(),
which looks well even in high DPI.

Also add an item to a popup menu for testing.
This commit is contained in:
Vadim Zeitlin
2022-02-05 20:53:36 +01:00
parent 338cd95c2d
commit a34ddaa006
3 changed files with 5 additions and 49 deletions

View File

@@ -1,44 +0,0 @@
/* XPM */
static const char *const copy_xpm[] = {
/* columns rows colors chars-per-pixel */
"16 15 23 1",
"+ c #769CDA",
": c #DCE6F6",
"X c #3365B7",
"* c #FFFFFF",
"o c #9AB6E4",
"< c #EAF0FA",
"# c #B1C7EB",
". c #6992D7",
"3 c #F7F9FD",
", c #F0F5FC",
"$ c #A8C0E8",
" c None",
"- c #FDFEFF",
"& c #C4D5F0",
"1 c #E2EAF8",
"O c #89A9DF",
"= c #D2DFF4",
"4 c #FAFCFE",
"2 c #F5F8FD",
"; c #DFE8F7",
"% c #B8CCEC",
"> c #E5EDF9",
"@ c #648FD6",
/* pixels */
" .....XX ",
" .oO+@X#X ",
" .$oO+X##X ",
" .%$o........ ",
" .&%$.*=&#o.-. ",
" .=&%.*;=&#.--. ",
" .:=&.*>;=&.... ",
" .>:=.*,>;=&#o. ",
" .<1:.*2,>:=&#. ",
" .2<1.*32,>:=&. ",
" .32<.*432,>:=. ",
" .32<.*-432,>:. ",
" .....**-432,>. ",
" .***-432,. ",
" .......... "
};

View File

@@ -32,6 +32,7 @@
#include "wx/textdlg.h" #include "wx/textdlg.h"
#endif #endif
#include "wx/artprov.h"
#include "wx/filehistory.h" #include "wx/filehistory.h"
#include "wx/filename.h" #include "wx/filename.h"
@@ -56,8 +57,6 @@
#define USE_LOG_WINDOW 0 #define USE_LOG_WINDOW 0
#endif #endif
#include "copy.xpm"
#ifndef wxHAS_IMAGES_IN_RESOURCES #ifndef wxHAS_IMAGES_IN_RESOURCES
#include "../sample.xpm" #include "../sample.xpm"
#endif #endif
@@ -559,7 +558,7 @@ MyFrame::MyFrame()
#if USE_LOG_WINDOW #if USE_LOG_WINDOW
wxMenuItem *item = new wxMenuItem(fileMenu, Menu_File_ClearLog, wxMenuItem *item = new wxMenuItem(fileMenu, Menu_File_ClearLog,
"Clear &log\tCtrl-L"); "Clear &log\tCtrl-L");
item->SetBitmap(wxBitmap(copy_xpm)); item->SetBitmap(wxArtProvider::GetBitmapBundle(wxART_DELETE, wxART_MENU));
fileMenu->Append(item); fileMenu->Append(item);
fileMenu->AppendSeparator(); fileMenu->AppendSeparator();
#endif // USE_LOG_WINDOW #endif // USE_LOG_WINDOW
@@ -1248,7 +1247,8 @@ void MyFrame::ShowContextMenu(const wxPoint& pos)
menu.Append(Menu_Popup_ToBeGreyed, "To be &greyed", menu.Append(Menu_Popup_ToBeGreyed, "To be &greyed",
"This menu item should be initially greyed out"); "This menu item should be initially greyed out");
menu.AppendSeparator(); menu.AppendSeparator();
menu.Append(Menu_File_Quit, "E&xit"); menu.Append(Menu_File_Quit, "E&xit")
->SetBitmap(wxArtProvider::GetBitmapBundle(wxART_QUIT, wxART_MENU));
menu.Delete(Menu_Popup_ToBeDeleted); menu.Delete(Menu_Popup_ToBeDeleted);
menu.Check(Menu_Popup_ToBeChecked, true); menu.Check(Menu_Popup_ToBeChecked, true);