KiCad PCB EDA Suite
dialog_edit_one_field.h
Go to the documentation of this file.
1 
2 #ifndef DIALOG_EDIT_ONE_FIELD_H_
3 #define DIALOG_EDIT_ONE_FIELD_H_
4 
5 /*
6  * This program source code file is part of KiCad, a free EDA CAD application.
7  *
8  * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.com
9  * Copyright (C) 2016 Wayne Stambaugh, stambaughw@gmail.com
10  * Copyright (C) 2004-2016 KiCad Developers, see change_log.txt for contributors.
11  *
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License
14  * as published by the Free Software Foundation; either version 2
15  * of the License, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, you may find one here:
24  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
25  * or you may search the http://www.gnu.org website for the version 2 license,
26  * or you may write to the Free Software Foundation, Inc.,
27  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
28  */
29 
31 
32 class SCH_BASE_FRAME;
33 class LIB_FIELD;
34 class SCH_FIELD;
35 class EDA_TEXT;
36 
37 
48 {
49 public:
50  DIALOG_EDIT_ONE_FIELD( SCH_BASE_FRAME* aParent, const wxString& aTitle,
51  const EDA_TEXT* aTextItem );
52 
54 
55  virtual bool TransferDataToWindow() override;
56 
57  virtual bool TransferDataFromWindow() override;
58 
59  SCH_BASE_FRAME* GetParent() { return dynamic_cast< SCH_BASE_FRAME* >( wxDialog::GetParent() ); }
60 
61  const wxString& GetText() const { return m_text; }
62 
63 protected:
64 
65  void init();
66 
67  void updateText( EDA_TEXT* aText );
68 
78  void OnTextValueSelectButtonClick( wxCommandEvent& aEvent ) override;
79 
82  void OnOkClick( wxCommandEvent& aEvent ) override
83  {
84  if( IsQuasiModal() )
85  EndQuasiModal( wxID_OK );
86  else
87  EndDialog( wxID_OK );
88  }
89 
90  void OnCancelClick( wxCommandEvent& event ) override
91  {
92  if( IsQuasiModal() )
93  EndQuasiModal( wxID_CANCEL );
94  else
95  EndDialog( wxID_CANCEL );
96  }
97 
98  void OnCloseDialog( wxCloseEvent& aEvent ) override
99  {
100  if( IsQuasiModal() )
101  EndQuasiModal( wxID_CANCEL );
102  else
103  EndDialog( wxID_CANCEL );
104  }
105 
107  bool m_isPower;
108  wxString m_text;
109  int m_style;
110  int m_size;
115 };
116 
117 
126 {
127 public:
128  DIALOG_LIB_EDIT_ONE_FIELD( SCH_BASE_FRAME* aParent, const wxString& aTitle,
129  const LIB_FIELD* aField );
130 
132 
133  void UpdateField( LIB_FIELD* aField )
134  {
135  aField->SetText( m_text );
136  updateText( aField );
137  }
138 };
139 
140 
149 {
150 public:
151  DIALOG_SCH_EDIT_ONE_FIELD( SCH_BASE_FRAME* aParent, const wxString& aTitle,
152  const SCH_FIELD* aField );
153 
155 
156  void UpdateField( SCH_FIELD* aField, SCH_SHEET_PATH* aSheetPath );
157 };
158 
159 #endif // DIALOG_EDIT_ONE_FIELD_H_
Class SCH_FIELD instances are attached to a component and provide a place for the component's value...
Definition: sch_field.h:56
void OnCancelClick(wxCommandEvent &event) override
Class LIB_FIELD is used in symbol libraries.
Definition: lib_field.h:60
void UpdateField(LIB_FIELD *aField)
void UpdateField(SCH_FIELD *aField, SCH_SHEET_PATH *aSheetPath)
DIALOG_EDIT_ONE_FIELD(SCH_BASE_FRAME *aParent, const wxString &aTitle, const EDA_TEXT *aTextItem)
DIALOG_SCH_EDIT_ONE_FIELD(SCH_BASE_FRAME *aParent, const wxString &aTitle, const SCH_FIELD *aField)
Class EDA_TEXT is a mix-in class (via multiple inheritance) that handles texts such as labels...
Definition: eda_text.h:114
DIALOG_LIB_EDIT_ONE_FIELD(SCH_BASE_FRAME *aParent, const wxString &aTitle, const LIB_FIELD *aField)
Class DIALOG_EDIT_ONE_FIELD is a base class to edit schematic and component library fields...
Class DIALOG_LIB_EDIT_ONE_FIELD is a the class to handle editing a single component field in the libr...
void SetText(const wxString &aText) override
Sets the field text to aText.
Definition: lib_field.cpp:675
bool IsQuasiModal()
Definition: dialog_shim.h:93
Class SCH_SHEET_PATH.
Class DIALOG_SCH_EDIT_ONE_FIELD is a the class to handle editing a single component field in the sche...
virtual bool TransferDataToWindow() override
const wxString & GetText() const
void updateText(EDA_TEXT *aText)
Class DIALOG_LIB_EDIT_TEXT_BASE.
SCH_BASE_FRAME * GetParent()
void EndQuasiModal(int retCode)
void OnTextValueSelectButtonClick(wxCommandEvent &aEvent) override
Function OnTextValueSelectButtonClick Handles the select button next to the text value field...
virtual bool TransferDataFromWindow() override
Class SCH_BASE_FRAME is a shim class between EDA_DRAW_FRAME and several derived classes: LIB_EDIT_FRA...
void OnCloseDialog(wxCloseEvent &aEvent) override
void OnOkClick(wxCommandEvent &aEvent) override