2022-11-03 02:50:49 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors.
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation, either version 3 of the License, or (at your
|
|
|
|
* option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef KICAD_PG_EDITORS_H
|
|
|
|
#define KICAD_PG_EDITORS_H
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
#include <wx/propgrid/propgrid.h>
|
|
|
|
#include <wx/propgrid/editors.h>
|
|
|
|
|
|
|
|
class EDA_DRAW_FRAME;
|
|
|
|
class PROPERTY_EDITOR_UNIT_BINDER;
|
|
|
|
|
|
|
|
class PG_UNIT_EDITOR : public wxPGTextCtrlEditor
|
|
|
|
{
|
|
|
|
public:
|
2022-11-30 17:09:57 +00:00
|
|
|
static const wxString EDITOR_NAME;
|
|
|
|
|
2022-11-03 02:50:49 +00:00
|
|
|
PG_UNIT_EDITOR( EDA_DRAW_FRAME* aFrame );
|
|
|
|
|
|
|
|
virtual ~PG_UNIT_EDITOR();
|
|
|
|
|
2022-11-30 17:09:57 +00:00
|
|
|
wxString GetName() const override { return EDITOR_NAME; }
|
2022-11-03 02:50:49 +00:00
|
|
|
|
|
|
|
wxPGWindowList CreateControls( wxPropertyGrid* aPropGrid, wxPGProperty* aProperty,
|
|
|
|
const wxPoint& aPos, const wxSize& aSize ) const override;
|
|
|
|
|
|
|
|
bool GetValueFromControl( wxVariant& aVariant, wxPGProperty* aProperty,
|
|
|
|
wxWindow* aCtrl ) const override;
|
2022-11-29 16:31:00 +00:00
|
|
|
|
2022-12-03 00:37:44 +00:00
|
|
|
void UpdateControl( wxPGProperty* aProperty, wxWindow* aCtrl ) const override;
|
|
|
|
|
|
|
|
bool OnEvent( wxPropertyGrid* aPropGrid, wxPGProperty* aProperty, wxWindow* aCtrl,
|
|
|
|
wxEvent& aEvent ) const override;
|
|
|
|
|
2022-11-29 16:31:00 +00:00
|
|
|
/**
|
|
|
|
* When restarting an editor, the instance of PG_UNIT_EDITOR may be the same
|
|
|
|
* but the referenced frame is different. This re-binds the frame to the editor
|
|
|
|
* and associated controls
|
|
|
|
* @param aFrame New frame to bind
|
|
|
|
*/
|
|
|
|
void UpdateFrame( EDA_DRAW_FRAME* aFrame );
|
|
|
|
|
2022-11-03 02:50:49 +00:00
|
|
|
protected:
|
|
|
|
EDA_DRAW_FRAME* m_frame;
|
|
|
|
|
|
|
|
std::unique_ptr<PROPERTY_EDITOR_UNIT_BINDER> m_unitBinder;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif //KICAD_PG_EDITORS_H
|