it is not possible to show/hide the window from the UpdateUI event handler; refactored the code by moving control-specific parts into the derived classes (patch 1338350)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37536 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -108,6 +108,13 @@ public:
|
||||
|
||||
virtual bool HasTransparentBackground() { return true; }
|
||||
|
||||
// wxCheckBox-specific processing after processing the update event
|
||||
virtual void DoUpdateWindowUI(wxUpdateUIEvent& event)
|
||||
{
|
||||
if ( event.GetSetChecked() )
|
||||
SetValue(event.GetChecked());
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void DoSet3StateValue(wxCheckBoxState WXUNUSED(state)) { wxFAIL; }
|
||||
|
||||
|
||||
@@ -62,6 +62,9 @@ public:
|
||||
virtual void SetLabel( const wxString &label );
|
||||
virtual bool SetFont(const wxFont& font);
|
||||
|
||||
// wxControl-specific processing after processing the update event
|
||||
virtual void DoUpdateWindowUI(wxUpdateUIEvent& event);
|
||||
|
||||
// Reserved for future use
|
||||
virtual void ReservedControlFunc1() {}
|
||||
virtual void ReservedControlFunc2() {}
|
||||
|
||||
@@ -1667,7 +1667,9 @@ public:
|
||||
{
|
||||
m_checked =
|
||||
m_enabled =
|
||||
m_shown =
|
||||
m_setEnabled =
|
||||
m_setShown =
|
||||
m_setText =
|
||||
m_setChecked = false;
|
||||
}
|
||||
@@ -1675,7 +1677,9 @@ public:
|
||||
: wxCommandEvent(event),
|
||||
m_checked(event.m_checked),
|
||||
m_enabled(event.m_enabled),
|
||||
m_shown(event.m_shown),
|
||||
m_setEnabled(event.m_setEnabled),
|
||||
m_setShown(event.m_setShown),
|
||||
m_setText(event.m_setText),
|
||||
m_setChecked(event.m_setChecked),
|
||||
m_text(event.m_text)
|
||||
@@ -1683,13 +1687,16 @@ public:
|
||||
|
||||
bool GetChecked() const { return m_checked; }
|
||||
bool GetEnabled() const { return m_enabled; }
|
||||
bool GetShown() const { return m_shown; }
|
||||
wxString GetText() const { return m_text; }
|
||||
bool GetSetText() const { return m_setText; }
|
||||
bool GetSetChecked() const { return m_setChecked; }
|
||||
bool GetSetEnabled() const { return m_setEnabled; }
|
||||
bool GetSetShown() const { return m_setShown; }
|
||||
|
||||
void Check(bool check) { m_checked = check; m_setChecked = true; }
|
||||
void Enable(bool enable) { m_enabled = enable; m_setEnabled = true; }
|
||||
void Show(bool show) { m_shown = show; m_setShown = true; }
|
||||
void SetText(const wxString& text) { m_text = text; m_setText = true; }
|
||||
|
||||
// Sets the interval between updates in milliseconds.
|
||||
@@ -1719,7 +1726,9 @@ public:
|
||||
protected:
|
||||
bool m_checked;
|
||||
bool m_enabled;
|
||||
bool m_shown;
|
||||
bool m_setEnabled;
|
||||
bool m_setShown;
|
||||
bool m_setText;
|
||||
bool m_setChecked;
|
||||
wxString m_text;
|
||||
|
||||
@@ -607,7 +607,10 @@ public:
|
||||
void InitCommandEvent(wxCommandEvent& event) const;
|
||||
|
||||
/// do the window-specific processing after processing the update event
|
||||
// (duplicated code from wxTextCtrlBase)
|
||||
#if !wxRICHTEXT_DERIVES_FROM_TEXTCTRLBASE
|
||||
virtual void DoUpdateWindowUI(wxUpdateUIEvent& event);
|
||||
#endif
|
||||
|
||||
/// Should we inherit colours?
|
||||
virtual bool ShouldInheritColours() const { return false; }
|
||||
|
||||
Reference in New Issue
Block a user