You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
2.7 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2020 Roberto Fernandez Bautista <roberto.fer.bau@gmail.com>
  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. #include <eda_draw_frame.h>
  25. #include <dialogs/dialog_unit_entry.h>
  26. WX_UNIT_ENTRY_DIALOG::WX_UNIT_ENTRY_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aCaption,
  27. const wxString& aLabel, long long int aDefaultValue ) :
  28. WX_UNIT_ENTRY_DIALOG_BASE( ( wxWindow* ) aParent, wxID_ANY, aCaption ),
  29. m_unit_binder( aParent, m_label, m_textCtrl, m_unit_label, true )
  30. {
  31. m_label->SetLabel( aLabel );
  32. m_unit_binder.SetValue( aDefaultValue );
  33. SetInitialFocus( m_textCtrl );
  34. SetupStandardButtons();
  35. Layout();
  36. bSizerMain->Fit( this );
  37. }
  38. int WX_UNIT_ENTRY_DIALOG::GetValue()
  39. {
  40. return m_unit_binder.GetIntValue();
  41. }
  42. WX_PT_ENTRY_DIALOG::WX_PT_ENTRY_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aCaption,
  43. const wxString& aLabelX, const wxString& aLabelY,
  44. const VECTOR2I& aDefaultValue ) :
  45. WX_PT_ENTRY_DIALOG_BASE( ( wxWindow* ) aParent, wxID_ANY, aCaption ),
  46. m_unit_binder_x( aParent, m_labelX, m_textCtrlX, m_unitsX, true ),
  47. m_unit_binder_y( aParent, m_labelY, m_textCtrlY, m_unitsY, true )
  48. {
  49. m_labelX->SetLabel( aLabelX );
  50. m_labelY->SetLabel( aLabelY );
  51. m_unit_binder_x.SetValue( aDefaultValue.x );
  52. m_unit_binder_y.SetValue( aDefaultValue.y );
  53. SetInitialFocus( m_textCtrlX );
  54. SetupStandardButtons();
  55. Layout();
  56. bSizerMain->Fit( this );
  57. }
  58. VECTOR2I WX_PT_ENTRY_DIALOG::GetValue()
  59. {
  60. return VECTOR2I( m_unit_binder_x.GetIntValue(), m_unit_binder_y.GetIntValue() );
  61. }