71 const wxPoint& aPos,
const wxSize& aSize )
const
75 wxString
text = aProperty->GetValueAsString( wxPG_EDITABLE_VALUE );
76 wxWindow* win = aPropGrid->GenerateEditorTextCtrl(aPos, aSize,
text,
nullptr, 0, aProperty->GetMaxLength() );
77 wxPGWindowList ret( win,
nullptr );
101 wxVariant var = aProperty->GetValue();
103 if( var.GetType() == wxPG_VARIANT_TYPE_LONG )
107 else if( var.GetType() == wxPG_VARIANT_TYPE_DOUBLE )
111 else if( var.GetType() == wxT(
"EDA_ANGLE" ) )
116 else if( !aProperty->IsValueUnspecified() )
118 wxFAIL_MSG( wxT(
"PG_UNIT_EDITOR should only be used with numeric properties!" ) );
124 wxWindow* aCtrl, wxEvent& aEvent )
const
126 if( aEvent.GetEventType() == wxEVT_LEFT_UP )
128 if( wxTextCtrl* textCtrl =
dynamic_cast<wxTextCtrl*
>( aCtrl ) )
130 if( !textCtrl->HasFocus() )
132 textCtrl->SelectAll();
138 return wxPGTextCtrlEditor::OnEvent( aPropGrid, aProperty, aCtrl, aEvent );
143 wxWindow* aCtrl )
const
148 wxTextCtrl* textCtrl =
dynamic_cast<wxTextCtrl*
>( aCtrl );
149 wxCHECK_MSG( textCtrl,
false,
"PG_UNIT_EDITOR requires a text control!" );
150 wxString textVal = textCtrl->GetValue();
152 if( aProperty->UsesAutoUnspecified() && textVal.empty() )
163 if( aVariant.GetType() == wxT(
"EDA_ANGLE" ) )
166 changed = ( aVariant.IsNull() || angle != ad->
Angle() );
176 changed = ( aVariant.IsNull() || angle.
AsDegrees() != aVariant.GetDouble() );
188 changed = ( aVariant.IsNull() || result != aVariant.GetLong() );
199 if( !changed && aVariant.IsNull() )
213 const wxPoint& aPos,
const wxSize& aSize )
const
218 if( aProperty->IsValueUnspecified() )
219 aProperty->SetValueFromInt( 0 );
221 return wxPGCheckBoxEditor::CreateControls( aGrid, aProperty, aPos, aSize );
const EDA_ANGLE & Angle()
void SetAngle(const EDA_ANGLE &aAngle)
The base class for create windows for drawing purpose.
A wxEnumProperty that displays a color next to the enum value.
wxPGWindowList CreateControls(wxPropertyGrid *aGrid, wxPGProperty *aProperty, const wxPoint &aPos, const wxSize &aSize) const override
static const wxString EDITOR_NAME
std::unique_ptr< PROPERTY_EDITOR_UNIT_BINDER > m_unitBinder
wxPGWindowList CreateControls(wxPropertyGrid *aPropGrid, wxPGProperty *aProperty, const wxPoint &aPos, const wxSize &aSize) const override
static const wxString EDITOR_NAME
void UpdateControl(wxPGProperty *aProperty, wxWindow *aCtrl) const override
void UpdateFrame(EDA_DRAW_FRAME *aFrame)
When restarting an editor, the instance of PG_UNIT_EDITOR may be the same but the referenced frame is...
PG_UNIT_EDITOR(EDA_DRAW_FRAME *aFrame)
bool GetValueFromControl(wxVariant &aVariant, wxPGProperty *aProperty, wxWindow *aCtrl) const override
bool OnEvent(wxPropertyGrid *aPropGrid, wxPGProperty *aProperty, wxWindow *aCtrl, wxEvent &aEvent) const override
static wxString BuildEditorName(EDA_DRAW_FRAME *aFrame)
virtual ~PG_UNIT_EDITOR()
EDA_UNITS GetUserUnits() const