make wxControlContainer accept focus depending on whether it has any focusable children when using native TAB navigation too but also allow to manually override this automatic detection; added wxWindow::SetCanFocus() to notify GTK+ about changed focus state

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45267 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-04-05 22:29:14 +00:00
parent 30d560f4cf
commit 80332672ab
5 changed files with 212 additions and 92 deletions

View File

@@ -2532,9 +2532,7 @@ void wxWindowGTK::PostCreation()
if ( !AcceptsFocusFromKeyboard() )
{
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
if (m_wxwindow && (m_widget != m_wxwindow))
GTK_WIDGET_UNSET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
SetCanFocus(false);
g_signal_connect(m_widget, "focus",
G_CALLBACK(wx_window_focus_callback), this);
@@ -3242,6 +3240,22 @@ void wxWindowGTK::SetFocus()
}
}
void wxWindowGTK::SetCanFocus(bool canFocus)
{
if ( canFocus )
GTK_WIDGET_SET_FLAGS(m_widget, GTK_CAN_FOCUS);
else
GTK_WIDGET_UNSET_FLAGS(m_widget, GTK_CAN_FOCUS);
if ( m_wxwindow && (m_widget != m_wxwindow) )
{
if ( canFocus )
GTK_WIDGET_SET_FLAGS(m_wxwindow, GTK_CAN_FOCUS);
else
GTK_WIDGET_UNSET_FLAGS(m_wxwindow, GTK_CAN_FOCUS);
}
}
bool wxWindowGTK::Reparent( wxWindowBase *newParentBase )
{
wxCHECK_MSG( (m_widget != NULL), false, wxT("invalid window") );