Document restrictions on changing menu items appearance

Make it more clear that doing this should be avoided in portable code
and mention that owner drawn items are incompatible with dark mode.

See #23028.
This commit is contained in:
Vadim Zeitlin 2023-03-12 13:35:51 +01:00
parent 67683ab72a
commit 2ad3c0b428

View file

@ -13,9 +13,6 @@
Note that you usually don't have to deal with it directly as wxMenu methods
usually construct an object of this class for you.
Also please note that the methods related to fonts and bitmaps are currently
only implemented for Windows, Mac and GTK+.
@beginEventEmissionTable{wxCommandEvent,wxMenuEvent}
@event{EVT_MENU(id, func)}
Process a @c wxEVT_MENU command, which is generated by a menu item.
@ -41,6 +38,17 @@
This type of event is sent as wxMenuEvent.
@endEventTable
@section menuitem_ownerdrawn Customizing Menu Items Appearance
This class provides several functions for customizing the menu items
appearance that are available only in wxMSW port. These functions should
not be used in portable programs and, moreover, have some known limitations
even in wxMSW: using them switches the menu item in a "owner drawn" mode,
where it is painted by wxWidgets itself and not the system, which may
result in a slightly different appearance for it. Owner drawn items are
also incompatible with dark mode support and using them makes the entire
menu containing them to use standard light mode colours even in dark mode.
@library{wxcore}
@category{menus}
@ -364,7 +372,9 @@ public:
/**
Sets the background colour associated with the menu item.
@onlyfor{wxmsw}
Please note that this function only exists in wxMSW and works by making
the menu item "owner-drawn" there, please see the note about such items
in this class description.
*/
void SetBackgroundColour(const wxColour& colour);
@ -412,7 +422,9 @@ public:
/**
Sets the font associated with the menu item.
@onlyfor{wxmsw}
Please note that this function only exists in wxMSW and works by making
the menu item "owner-drawn" there, please see the note about such items
in this class description.
*/
void SetFont(const wxFont& font);
@ -583,7 +595,9 @@ public:
/**
Sets the text colour associated with the menu item.
@onlyfor{wxmsw}
Please note that this function only exists in wxMSW and works by making
the menu item "owner-drawn" there, please see the note about such items
in this class description.
*/
void SetTextColour(const wxColour& colour);