Don't require leading TAB in wxAcceleratorEntry::FromString().
FromString() should parse string returned by ToString() successfully but this wasn't the case because the accelerator parsing functions always insisted on having a TAB in the string. Fix this, document the string format and add a unit test checking for the correct behaviour. Closes #12745. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66308 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -103,10 +103,11 @@ public:
|
||||
bool IsOk() const;
|
||||
|
||||
/**
|
||||
Returns a wxString for this accelerator.
|
||||
Returns a textual representation of this accelerator.
|
||||
|
||||
This function formats it using the @c "flags-keycode" format
|
||||
where @c flags maybe a hyphen-separed list of @c "shift|alt|ctrl".
|
||||
The returned string is of the form <code>[Alt+][Ctrl+][Shift+]Key</code>
|
||||
where the modifier keys are present only if the corresponding flag is
|
||||
set.
|
||||
*/
|
||||
wxString ToString() const;
|
||||
|
||||
@@ -114,7 +115,11 @@ public:
|
||||
Parses the given string and sets the accelerator accordingly.
|
||||
|
||||
@param str
|
||||
Should be a string in the form "flags-keycode"
|
||||
This string may be either in the same format as returned by
|
||||
ToString(), i.e. contain the accelerator itself only, or have the
|
||||
format of a full menu item text with i.e. <code>Label TAB
|
||||
Accelerator</code>. In the latter case, the part of the string
|
||||
before the TAB is ignored.
|
||||
|
||||
@return @true if the given string correctly initialized this object
|
||||
(i.e. if IsOk() returns true after this call)
|
||||
|
Reference in New Issue
Block a user