Workaround for GTK+ sensitivity bug
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@58188 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -154,6 +154,8 @@ wxGTK:
|
||||
- Fixed printing to use fonts sizes adjustment consistent with wxMSW.
|
||||
- Make colours used by list, tree and status bar controls more consistent with
|
||||
the system theme settings (Tim Kosse).
|
||||
- Worked around bug in GTK+ < 2.14 where enabling some controls such
|
||||
as wxButton didn't re-enable sensitivity until the mouse was moved.
|
||||
|
||||
2.8.9
|
||||
-----
|
||||
|
@@ -102,4 +102,7 @@ private:
|
||||
DECLARE_DYNAMIC_CLASS(wxControl)
|
||||
};
|
||||
|
||||
// Fix sensitivity due to bug in GTK+ < 2.14
|
||||
void wxGtkFixSensitivity(wxWindow* ctrl);
|
||||
|
||||
#endif // _WX_GTK_CONTROL_H_
|
||||
|
@@ -249,11 +249,16 @@ void wxButton::SetLabel( const wxString &lbl )
|
||||
|
||||
bool wxButton::Enable( bool enable )
|
||||
{
|
||||
bool isEnabled = IsEnabled();
|
||||
|
||||
if ( !wxControl::Enable( enable ) )
|
||||
return false;
|
||||
|
||||
gtk_widget_set_sensitive(GTK_BIN(m_widget)->child, enable);
|
||||
|
||||
if (!isEnabled && enable)
|
||||
wxGtkFixSensitivity(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -209,11 +209,16 @@ void wxCheckBox::SetLabel( const wxString& label )
|
||||
|
||||
bool wxCheckBox::Enable( bool enable )
|
||||
{
|
||||
bool isEnabled = IsEnabled();
|
||||
|
||||
if ( !wxControl::Enable( enable ) )
|
||||
return false;
|
||||
|
||||
gtk_widget_set_sensitive( m_widgetLabel, enable );
|
||||
|
||||
if (!isEnabled && enable)
|
||||
wxGtkFixSensitivity(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#endif
|
||||
|
||||
#include "wx/fontutil.h"
|
||||
#include "wx/utils.h"
|
||||
#include "wx/gtk/private.h"
|
||||
|
||||
// ============================================================================
|
||||
@@ -377,4 +378,23 @@ void wxControl::OnInternalIdle()
|
||||
UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
|
||||
}
|
||||
|
||||
// Fix sensitivity due to bug in GTK+ < 2.14
|
||||
void wxGtkFixSensitivity(wxWindow* ctrl)
|
||||
{
|
||||
#ifdef __WXGTK24__
|
||||
// Work around a GTK+ bug whereby button is insensitive after being
|
||||
// enabled
|
||||
if (gtk_check_version(2,14,0))
|
||||
{
|
||||
wxPoint pt = wxGetMousePosition();
|
||||
wxRect rect(ctrl->ClientToScreen(wxPoint(0, 0)), ctrl->GetSize());
|
||||
if (rect.Contains(pt))
|
||||
{
|
||||
ctrl->Hide();
|
||||
ctrl->Show();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // wxUSE_CONTROLS
|
||||
|
@@ -473,6 +473,8 @@ void wxRadioBox::SetString(unsigned int item, const wxString& label)
|
||||
|
||||
bool wxRadioBox::Enable( bool enable )
|
||||
{
|
||||
bool isEnabled = IsEnabled();
|
||||
|
||||
if ( !wxControl::Enable( enable ) )
|
||||
return false;
|
||||
|
||||
@@ -487,6 +489,9 @@ bool wxRadioBox::Enable( bool enable )
|
||||
node = node->GetNext();
|
||||
}
|
||||
|
||||
if (!isEnabled && enable)
|
||||
wxGtkFixSensitivity(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -151,11 +151,16 @@ bool wxRadioButton::GetValue() const
|
||||
|
||||
bool wxRadioButton::Enable( bool enable )
|
||||
{
|
||||
bool isEnabled = IsEnabled();
|
||||
|
||||
if ( !wxControl::Enable( enable ) )
|
||||
return FALSE;
|
||||
|
||||
gtk_widget_set_sensitive(GTK_BIN(m_widget)->child, enable);
|
||||
|
||||
if (!isEnabled && enable)
|
||||
wxGtkFixSensitivity(this);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@@ -145,11 +145,16 @@ void wxToggleBitmapButton::OnSetBitmap()
|
||||
|
||||
bool wxToggleBitmapButton::Enable(bool enable /*=true*/)
|
||||
{
|
||||
bool isEnabled = IsEnabled();
|
||||
|
||||
if (!wxControl::Enable(enable))
|
||||
return false;
|
||||
|
||||
gtk_widget_set_sensitive(GTK_BIN(m_widget)->child, enable);
|
||||
|
||||
if (!isEnabled && enable)
|
||||
wxGtkFixSensitivity(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -269,11 +274,16 @@ void wxToggleButton::SetLabel(const wxString& label)
|
||||
|
||||
bool wxToggleButton::Enable(bool enable /*=true*/)
|
||||
{
|
||||
bool isEnabled = IsEnabled();
|
||||
|
||||
if (!wxControl::Enable(enable))
|
||||
return false;
|
||||
|
||||
gtk_widget_set_sensitive(GTK_BIN(m_widget)->child, enable);
|
||||
|
||||
if (!isEnabled && enable)
|
||||
wxGtkFixSensitivity(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user