KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_unit_entry.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2020 Roberto Fernandez Bautista <[email protected]>
5 * Copyright (C) 2020-2023 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#include <eda_draw_frame.h>
27
28
30 const wxString& aLabel, long long int aDefaultValue ) :
31 WX_UNIT_ENTRY_DIALOG_BASE( ( wxWindow* ) aParent, wxID_ANY, aCaption ),
32 m_unit_binder( aParent, m_label, m_textCtrl, m_unit_label, true )
33{
34 m_label->SetLabel( aLabel );
35 m_unit_binder.SetValue( aDefaultValue );
36
39
40 Layout();
41 bSizerMain->Fit( this );
42}
43
44
46{
48}
49
50
51WX_PT_ENTRY_DIALOG::WX_PT_ENTRY_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aCaption,
52 const wxString& aLabelX, const wxString& aLabelY,
53 const VECTOR2I& aDefaultValue ) :
54 WX_PT_ENTRY_DIALOG_BASE( ( wxWindow* ) aParent, wxID_ANY, aCaption ),
55 m_unit_binder_x( aParent, m_labelX, m_textCtrlX, m_unitsX, true ),
56 m_unit_binder_y( aParent, m_labelY, m_textCtrlY, m_unitsY, true )
57{
58 m_labelX->SetLabel( aLabelX );
59 m_labelY->SetLabel( aLabelY );
60 m_unit_binder_x.SetValue( aDefaultValue.x );
61 m_unit_binder_y.SetValue( aDefaultValue.y );
62
65
66 Layout();
67 bSizerMain->Fit( this );
68}
69
70
72{
74}
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition: dialog_shim.h:102
void SetupStandardButtons(std::map< int, wxString > aLabels={})
The base class for create windows for drawing purpose.
int GetIntValue()
Definition: unit_binder.h:129
virtual void SetValue(long long int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
Class WX_PT_ENTRY_DIALOG_BASE.
wxBoxSizer * bSizerMain
wxStaticText * m_labelX
wxStaticText * m_labelY
wxTextCtrl * m_textCtrlX
UNIT_BINDER m_unit_binder_x
WX_PT_ENTRY_DIALOG(EDA_DRAW_FRAME *aParent, const wxString &aCaption, const wxString &aLabelX, const wxString &aLabelY, const VECTOR2I &aDefaultValue)
VECTOR2I GetValue()
Returns the value in internal units.
UNIT_BINDER m_unit_binder_y
Class WX_UNIT_ENTRY_DIALOG_BASE.
wxBoxSizer * bSizerMain
wxStaticText * m_label
wxTextCtrl * m_textCtrl
UNIT_BINDER m_unit_binder
WX_UNIT_ENTRY_DIALOG(EDA_DRAW_FRAME *aParent, const wxString &aCaption, const wxString &aLabel, long long int aDefaultValue)
int GetValue()
Returns the value in internal units.
VECTOR2< int32_t > VECTOR2I
Definition: vector2d.h:691