Dedupe wxCB_READONLY check
This commit is contained in:
@@ -87,6 +87,7 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void SetActualValue(const wxString& value);
|
void SetActualValue(const wxString& value);
|
||||||
|
bool IsReadOnly() const;
|
||||||
|
|
||||||
// From wxTextEntry:
|
// From wxTextEntry:
|
||||||
virtual wxWindow *GetEditableWindow() wxOVERRIDE { return this; }
|
virtual wxWindow *GetEditableWindow() wxOVERRIDE { return this; }
|
||||||
|
@@ -171,7 +171,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
void wxComboBox::SetActualValue(const wxString &value)
|
void wxComboBox::SetActualValue(const wxString &value)
|
||||||
{
|
{
|
||||||
if ( HasFlag(wxCB_READONLY) )
|
if ( IsReadOnly() )
|
||||||
{
|
{
|
||||||
SetStringSelection( value );
|
SetStringSelection( value );
|
||||||
}
|
}
|
||||||
@@ -182,11 +182,16 @@ void wxComboBox::SetActualValue(const wxString &value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::IsReadOnly() const
|
||||||
|
{
|
||||||
|
return HasFlag( wxCB_READONLY );
|
||||||
|
}
|
||||||
|
|
||||||
void wxComboBox::SetValue(const wxString& value)
|
void wxComboBox::SetValue(const wxString& value)
|
||||||
{
|
{
|
||||||
SetActualValue( value );
|
SetActualValue( value );
|
||||||
|
|
||||||
if ( !HasFlag(wxCB_READONLY) )
|
if ( !IsReadOnly() )
|
||||||
SetInsertionPoint( 0 );
|
SetInsertionPoint( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -251,7 +256,7 @@ void wxComboBox::Dismiss()
|
|||||||
|
|
||||||
void wxComboBox::Clear()
|
void wxComboBox::Clear()
|
||||||
{
|
{
|
||||||
if ( !HasFlag(wxCB_READONLY) )
|
if ( !IsReadOnly() )
|
||||||
wxTextEntry::Clear();
|
wxTextEntry::Clear();
|
||||||
|
|
||||||
wxItemContainer::Clear();
|
wxItemContainer::Clear();
|
||||||
|
Reference in New Issue
Block a user