use gtk_entry_set_activates_default() instead of redoing its work manually ourselves
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49625 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -176,6 +176,7 @@ protected:
|
|||||||
// set the given characteristic)
|
// set the given characteristic)
|
||||||
void GTKSetEditable();
|
void GTKSetEditable();
|
||||||
void GTKSetVisibility();
|
void GTKSetVisibility();
|
||||||
|
void GTKSetActivatesDefault();
|
||||||
void GTKSetWrapMode();
|
void GTKSetWrapMode();
|
||||||
void GTKSetJustification();
|
void GTKSetJustification();
|
||||||
|
|
||||||
|
@@ -747,6 +747,9 @@ bool wxTextCtrl::Create( wxWindow *parent,
|
|||||||
if (style & wxTE_READONLY)
|
if (style & wxTE_READONLY)
|
||||||
GTKSetEditable();
|
GTKSetEditable();
|
||||||
|
|
||||||
|
if (style & wxTE_PROCESS_ENTER)
|
||||||
|
GTKSetActivatesDefault();
|
||||||
|
|
||||||
// left justification (alignment) is the default anyhow
|
// left justification (alignment) is the default anyhow
|
||||||
if ( style & (wxTE_RIGHT | wxTE_CENTRE) )
|
if ( style & (wxTE_RIGHT | wxTE_CENTRE) )
|
||||||
GTKSetJustification();
|
GTKSetJustification();
|
||||||
@@ -824,9 +827,19 @@ void wxTextCtrl::GTKSetEditable()
|
|||||||
|
|
||||||
void wxTextCtrl::GTKSetVisibility()
|
void wxTextCtrl::GTKSetVisibility()
|
||||||
{
|
{
|
||||||
// VZ: shouldn't we assert if wxTE_PASSWORD is set for multiline control?
|
wxCHECK_RET( IsSingleLine(),
|
||||||
if ( IsSingleLine() )
|
"wxTE_PASSWORD is for single line text controls only" );
|
||||||
gtk_entry_set_visibility(GTK_ENTRY(m_text), !HasFlag(wxTE_PASSWORD));
|
|
||||||
|
gtk_entry_set_visibility(GTK_ENTRY(m_text), !HasFlag(wxTE_PASSWORD));
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxTextCtrl::GTKSetActivatesDefault()
|
||||||
|
{
|
||||||
|
wxCHECK_RET( IsSingleLine(),
|
||||||
|
"wxTE_PROCESS_ENTER is for single line text controls only" );
|
||||||
|
|
||||||
|
gtk_entry_set_activates_default(GTK_ENTRY(m_text),
|
||||||
|
!HasFlag(wxTE_PROCESS_ENTER));
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxTextCtrl::GTKSetWrapMode()
|
void wxTextCtrl::GTKSetWrapMode()
|
||||||
@@ -906,6 +919,9 @@ void wxTextCtrl::SetWindowStyleFlag(long style)
|
|||||||
if ( (style & wxTE_PASSWORD) != (styleOld & wxTE_PASSWORD) )
|
if ( (style & wxTE_PASSWORD) != (styleOld & wxTE_PASSWORD) )
|
||||||
GTKSetVisibility();
|
GTKSetVisibility();
|
||||||
|
|
||||||
|
if ( (style & wxTE_PROCESS_ENTER) != (styleOld & wxTE_PROCESS_ENTER) )
|
||||||
|
GTKSetActivatesDefault();
|
||||||
|
|
||||||
static const long flagsWrap = wxTE_WORDWRAP | wxTE_CHARWRAP | wxTE_DONTWRAP;
|
static const long flagsWrap = wxTE_WORDWRAP | wxTE_CHARWRAP | wxTE_DONTWRAP;
|
||||||
if ( (style & flagsWrap) != (styleOld & flagsWrap) )
|
if ( (style & flagsWrap) != (styleOld & flagsWrap) )
|
||||||
GTKSetWrapMode();
|
GTKSetWrapMode();
|
||||||
@@ -1537,29 +1553,6 @@ void wxTextCtrl::OnChar( wxKeyEvent &key_event )
|
|||||||
if ( GetEventHandler()->ProcessEvent(event) )
|
if ( GetEventHandler()->ProcessEvent(event) )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: this is not the right place to do it, wxDialog::OnCharHook()
|
|
||||||
// probably is
|
|
||||||
if ( IsSingleLine() )
|
|
||||||
{
|
|
||||||
// This will invoke the dialog default action, such
|
|
||||||
// as the clicking the default button.
|
|
||||||
|
|
||||||
wxWindow *top_frame = m_parent;
|
|
||||||
while (top_frame->GetParent() && !(top_frame->IsTopLevel()))
|
|
||||||
top_frame = top_frame->GetParent();
|
|
||||||
|
|
||||||
if (top_frame && GTK_IS_WINDOW(top_frame->m_widget))
|
|
||||||
{
|
|
||||||
GtkWindow *window = GTK_WINDOW(top_frame->m_widget);
|
|
||||||
|
|
||||||
if (window->default_widget)
|
|
||||||
{
|
|
||||||
gtk_widget_activate (window->default_widget);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
key_event.Skip();
|
key_event.Skip();
|
||||||
|
Reference in New Issue
Block a user