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.
This commit is contained in:
Vadim Zeitlin
2020-03-27 11:48:35 +01:00
parent e7c8039d13
commit bb489418b0

View File

@@ -2262,17 +2262,39 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
wxMenu *menuFile = new wxMenu; wxMenu *menuFile = new wxMenu;
#if wxUSE_GRAPHICS_CONTEXT #if wxUSE_GRAPHICS_CONTEXT
m_menuItemUseDC = menuFile->AppendRadioItem(File_DC, "Use wx&DC\t0"); // Number the different renderer choices consecutively, starting from 0.
menuFile->AppendRadioItem(File_GC_Default, "Use default wx&GraphicContext\t1"); 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 #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 #endif // wxUSE_CAIRO
#ifdef __WXMSW__ #ifdef __WXMSW__
#if wxUSE_GRAPHICS_GDIPLUS #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 #endif
#if wxUSE_GRAPHICS_DIRECT2D #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
#endif // __WXMSW__ #endif // __WXMSW__
#endif // wxUSE_GRAPHICS_CONTEXT #endif // wxUSE_GRAPHICS_CONTEXT