Fix focus stealing from wxDataViewCtrl
This commit is contained in:
parent
84092ce6d4
commit
12305990bb
|
@ -172,13 +172,29 @@ bool KIUI::IsInputControlFocused()
|
|||
{
|
||||
wxWindow* focus = wxWindow::FindFocus();
|
||||
|
||||
if( !focus )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( focus );
|
||||
wxStyledTextCtrl* styledText = dynamic_cast<wxStyledTextCtrl*>( focus );
|
||||
wxListBox* listBox = dynamic_cast<wxListBox*>( focus );
|
||||
wxDataViewCtrl* dataViewCtrl = dynamic_cast<wxDataViewCtrl*>( focus );
|
||||
wxSearchCtrl* searchCtrl = dynamic_cast<wxSearchCtrl*>( focus );
|
||||
|
||||
return ( textEntry || styledText || listBox || dataViewCtrl || searchCtrl );
|
||||
// Data view control is annoying, the focus is on a "wxDataViewCtrlMainWindow"
|
||||
// class that is not formerly exported via the header.
|
||||
// However, we can test the parent is wxDataViewCtrl instead
|
||||
wxDataViewCtrl* dataViewCtrl = nullptr;
|
||||
|
||||
wxWindow* parent = focus->GetParent();
|
||||
|
||||
if( parent )
|
||||
{
|
||||
dataViewCtrl = dynamic_cast<wxDataViewCtrl*>( parent );
|
||||
}
|
||||
|
||||
return ( textEntry || styledText || listBox || dataViewCtrl || searchCtrl || dataViewCtrl );
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue