Merge branch 'updateui-ischeckable'

Add a flag to wxUpdateUIEvent to tell if the item supports the check
action.

See https://github.com/wxWidgets/wxWidgets/pull/2027
This commit is contained in:
Vadim Zeitlin
2020-09-02 19:34:05 +02:00
8 changed files with 53 additions and 7 deletions

View File

@@ -211,6 +211,11 @@ public:
void SetAlignment(int l) { m_alignment = l; }
int GetAlignment() const { return m_alignment; }
bool CanBeToggled() const
{
return m_kind == wxITEM_CHECK || m_kind == wxITEM_RADIO;
}
private:
wxWindow* m_window; // item's associated window

View File

@@ -2892,6 +2892,7 @@ public:
m_setShown =
m_setText =
m_setChecked = false;
m_isCheckable = true;
}
wxUpdateUIEvent(const wxUpdateUIEvent& event)
: wxCommandEvent(event),
@@ -2902,6 +2903,7 @@ public:
m_setShown(event.m_setShown),
m_setText(event.m_setText),
m_setChecked(event.m_setChecked),
m_isCheckable(event.m_isCheckable),
m_text(event.m_text)
{ }
@@ -2919,6 +2921,10 @@ public:
void Show(bool show) { m_shown = show; m_setShown = true; }
void SetText(const wxString& text) { m_text = text; m_setText = true; }
// A flag saying if the item can be checked. True by default.
bool IsCheckable() const { return m_isCheckable; }
void DisallowCheck() { m_isCheckable = false; }
// Sets the interval between updates in milliseconds.
// Set to -1 to disable updates, or to 0 to update as frequently as possible.
static void SetUpdateInterval(long updateInterval) { sm_updateInterval = updateInterval; }
@@ -2951,6 +2957,7 @@ protected:
bool m_setShown;
bool m_setText;
bool m_setChecked;
bool m_isCheckable;
wxString m_text;
#if wxUSE_LONGLONG
static wxLongLong sm_lastUpdate;