Fix truncating CJK mnemonics in control labels
13068d3603
introduced code for stripping
CJK mnemonics (i.e. trailing " (&X)") from the menu items, but due to
the use of wxStripMenuCodes() in wxControl::GetLabelText(), it also
applied to the control labels, resulting in wrongly measuring their size
(because the text used for measurement didn't include the "(&X)" part)
and truncating them in display.
Fix this by adding an explicit wxStrip_CJKMnemonics and using it only in
the code dealing with the menu item labels. This requires more changes
than just modifying GetLabelText() to use some wxStrip_NoCJKMnemonics
flag, but is more compatible as it's not impossible that some existing
code using wxStripMenuCodes() could be broken by this change too, while
now the existing behaviour is preserved.
Also improve wxStrip_XXX documentation.
Closes https://github.com/wxWidgets/wxWidgets/pull/1439
See #16736.
Closes #18452.
This commit is contained in:
@@ -652,8 +652,18 @@ enum
|
||||
// strip everything after '\t'
|
||||
wxStrip_Accel = 2,
|
||||
|
||||
// strip everything (this is the default)
|
||||
wxStrip_All = wxStrip_Mnemonics | wxStrip_Accel
|
||||
// strip mnemonics of the form "(&X)" appended to the string (used in CJK
|
||||
// translations)
|
||||
wxStrip_CJKMnemonics = 4,
|
||||
|
||||
// strip everything (this doesn't include wxStrip_CJKMnemonics for
|
||||
// compatibility)
|
||||
wxStrip_All = wxStrip_Mnemonics | wxStrip_Accel,
|
||||
|
||||
// strip everything including CJK mnemonics, suitable for menu items labels
|
||||
// only (despite its name, wxStripMenuCodes() is currently used for control
|
||||
// labels too)
|
||||
wxStrip_Menu = wxStrip_All | wxStrip_CJKMnemonics
|
||||
};
|
||||
|
||||
// strip mnemonics and/or accelerators from the label
|
||||
|
Reference in New Issue
Block a user