Always make wxWindow::SetFocus() focus the window, overriding SetCanFocus, some more focus related docs

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48747 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2007-09-17 10:17:12 +00:00
parent 16a6b53ddc
commit 00ff24c81c
5 changed files with 85 additions and 59 deletions

View File

@@ -25,7 +25,6 @@
#include "wx/settings.h"
#include "wx/msgdlg.h"
#include "wx/textctrl.h"
#include "wx/radiobut.h"
#include "wx/toolbar.h"
#include "wx/combobox.h"
#include "wx/layout.h"
@@ -3172,24 +3171,6 @@ bool wxWindowGTK::GTKSetDelayedFocusIfNeeded()
return false;
}
void wxWindowGTK::SetFocusIgnoringChildren()
{
wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
if ( m_hasFocus )
{
// don't do anything if we already have focus
return;
}
if (m_wxwindow)
{
if (!GTK_WIDGET_CAN_FOCUS(m_wxwindow))
GTK_WIDGET_SET_FLAGS(m_wxwindow, GTK_CAN_FOCUS);
}
wxWindowGTK::SetFocus();
}
void wxWindowGTK::SetFocus()
{
wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
@@ -3201,6 +3182,11 @@ void wxWindowGTK::SetFocus()
if (m_wxwindow)
{
// wxWindow::SetFocus() should really set the focus to
// this control, whatever the flags are
if (!GTK_WIDGET_CAN_FOCUS(m_wxwindow))
GTK_WIDGET_SET_FLAGS(m_wxwindow, GTK_CAN_FOCUS);
if (!GTK_WIDGET_HAS_FOCUS (m_wxwindow))
{
gtk_widget_grab_focus (m_wxwindow);
@@ -3208,15 +3194,18 @@ void wxWindowGTK::SetFocus()
}
else if (m_widget)
{
// wxWindow::SetFocus() should really set the focus to
// this control, whatever the flags are
if (!GTK_WIDGET_CAN_FOCUS(m_widget))
GTK_WIDGET_SET_FLAGS(m_widget, GTK_CAN_FOCUS);
if (GTK_IS_CONTAINER(m_widget))
{
#if wxUSE_RADIOBTN
if (IsKindOf(CLASSINFO(wxRadioButton)))
if (GTK_IS_RADIO_BUTTON(m_widget))
{
gtk_widget_grab_focus (m_widget);
return;
}
#endif // wxUSE_RADIOBTN
gtk_widget_child_focus( m_widget, GTK_DIR_TAB_FORWARD );
}