From bb489418b092e15e4bf32770ead13016f6c4e242 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 27 Mar 2020 11:48:35 +0100 Subject: [PATCH] Number renderers using consecutive digits in the sample This has the disadvantage of not using the same accelerators in different wxWidgets builds, but the advantage of appearing logical to a casual user when running the sample, while having "0, 1, 3, 4" sequence was surprising. Alternatively, we could always add all menu items, but disable the ones that are not available in the current build. It could be surprising to see "GDI+" under non-MSW systems too though. --- samples/drawing/drawing.cpp | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/samples/drawing/drawing.cpp b/samples/drawing/drawing.cpp index 2391d55b2b..8a502ad97b 100644 --- a/samples/drawing/drawing.cpp +++ b/samples/drawing/drawing.cpp @@ -2262,17 +2262,39 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) wxMenu *menuFile = new wxMenu; #if wxUSE_GRAPHICS_CONTEXT - m_menuItemUseDC = menuFile->AppendRadioItem(File_DC, "Use wx&DC\t0"); - menuFile->AppendRadioItem(File_GC_Default, "Use default wx&GraphicContext\t1"); + // Number the different renderer choices consecutively, starting from 0. + int accel = 0; + m_menuItemUseDC = menuFile->AppendRadioItem + ( + File_DC, + wxString::Format("Use wx&DC\t%d", accel++) + ); + menuFile->AppendRadioItem + ( + File_GC_Default, + wxString::Format("Use default wx&GraphicContext\t%d", accel++) + ); #if wxUSE_CAIRO - menuFile->AppendRadioItem(File_GC_Cairo, "Use &Cairo\t2"); + menuFile->AppendRadioItem + ( + File_GC_Cairo, + wxString::Format("Use &Cairo\t%d", accel++) + ); #endif // wxUSE_CAIRO #ifdef __WXMSW__ #if wxUSE_GRAPHICS_GDIPLUS - menuFile->AppendRadioItem(File_GC_GDIPlus, "Use &GDI+\t3"); + menuFile->AppendRadioItem + ( + File_GC_GDIPlus, + wxString::Format("Use &GDI+\t%d", accel++) + ); #endif #if wxUSE_GRAPHICS_DIRECT2D - menuFile->AppendRadioItem(File_GC_Direct2D, "Use &Direct2D\t4"); + menuFile->AppendRadioItem + ( + File_GC_Direct2D, + wxString::Format("Use &Direct2D\t%d", accel++) + ); #endif #endif // __WXMSW__ #endif // wxUSE_GRAPHICS_CONTEXT