Reimplement adding items to radio groups in wxMenu (wxOSX)

Rewrote wxOSX radio groups-related code reusing the code which works on
wxMSW and which seems to provide more rich functionality (supports adding
radio as well as no-radio items) and to have known bugs fixed.
The ranges of all radio groups are stored in wxMenu itself instead of
storing the information about the radio group an item belongs to in
the item itself - see 89511b4268.

Closes #14213.
Closes #17568.
This commit is contained in:
Artur Wieczorek
2017-08-13 01:11:35 +02:00
parent 4bc1c6fb7c
commit b6e4bdce3d
5 changed files with 60 additions and 234 deletions

View File

@@ -53,41 +53,10 @@ public:
void UpdateItemText() ;
void UpdateItemStatus() ;
// mark item as belonging to the given radio group
void SetAsRadioGroupStart(bool start = true);
void SetRadioGroupStart(int start);
void SetRadioGroupEnd(int end);
// return true if this is the starting item of a radio group
bool IsRadioGroupStart() const;
// get the start of the radio group this item belongs to: should not be
// called for the starting radio group item itself because it doesn't have
// this information
int GetRadioGroupStart() const;
// get the end of the radio group this item belongs to: should be only
// called for the starting radio group item, i.e. if IsRadioGroupStart() is
// true
int GetRadioGroupEnd() const;
wxMenuItemImpl* GetPeer() { return m_peer; }
private:
void UncheckRadio() ;
// the positions of the first and last items of the radio group this item
// belongs to or -1: start is the radio group start and is valid for all
// but first radio group items (m_isRadioGroupStart == FALSE), end is valid
// only for the first one
union
{
int start;
int end;
} m_radioGroup;
// does this item start a radio group?
bool m_isRadioGroupStart;
wxBitmap m_bitmap; // Bitmap for menuitem, if any
wxMenuItemImpl* m_peer;