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.

113 lines
3.7 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2009 Wayne Stambaugh <stambaughw@gmail.com>
  5. * Copyright (C) 2015-2019 KiCad Developers, see CHANGELOG.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. #ifndef __dialog_lib_new_component__
  25. #define __dialog_lib_new_component__
  26. /**
  27. * @file
  28. * Subclass of DIALOG_LIB_NEW_COMPONENT, which is generated by wxFormBuilder.
  29. */
  30. #include <widgets/unit_binder.h>
  31. #include <dialog_lib_new_component_base.h>
  32. class EDA_DRAW_FRAME;
  33. class wxArrayString;
  34. /** Implementing DIALOG_LIB_NEW_COMPONENT */
  35. class DIALOG_LIB_NEW_COMPONENT : public DIALOG_LIB_NEW_COMPONENT_BASE
  36. {
  37. public:
  38. /** Constructor */
  39. DIALOG_LIB_NEW_COMPONENT( EDA_DRAW_FRAME* parent,
  40. const wxArrayString* aRootSymbolNames = nullptr );
  41. void SetName( const wxString& name ) override { m_textName->SetValue( name ); }
  42. wxString GetName( void ) const override { return m_textName->GetValue(); }
  43. wxString GetParentSymbolName() const { return m_comboInheritanceSelect->GetValue(); }
  44. void SetReference( const wxString& reference )
  45. {
  46. m_textReference->SetValue( reference );
  47. }
  48. wxString GetReference( void ) { return m_textReference->GetValue(); }
  49. void SetPartCount( int count ) { m_spinPartCount->SetValue( count ); }
  50. int GetUnitCount( void ) { return m_spinPartCount->GetValue(); }
  51. void SetAlternateBodyStyle( bool enable )
  52. {
  53. m_checkHasConversion->SetValue( enable );
  54. }
  55. bool GetAlternateBodyStyle( void )
  56. {
  57. return m_checkHasConversion->GetValue();
  58. }
  59. void SetPowerSymbol( bool enable )
  60. {
  61. m_checkIsPowerSymbol->SetValue( enable );
  62. }
  63. bool GetPowerSymbol( void ) { return m_checkIsPowerSymbol->GetValue(); }
  64. void SetLockItems( bool enable ) { m_checkLockItems->SetValue( enable ); }
  65. bool GetLockItems( void ) { return m_checkLockItems->GetValue(); }
  66. void SetPinTextPosition( int position )
  67. {
  68. m_pinTextPosition.SetValue( position );
  69. }
  70. int GetPinTextPosition( void ) { return m_pinTextPosition.GetValue(); }
  71. void SetShowPinNumber( bool show )
  72. {
  73. m_checkShowPinNumber->SetValue( show );
  74. }
  75. bool GetShowPinNumber( void ) { return m_checkShowPinNumber->GetValue(); }
  76. void SetShowPinName( bool show )
  77. {
  78. m_checkShowPinName->SetValue( show );
  79. }
  80. bool GetShowPinName( void ) { return m_checkShowPinName->GetValue(); }
  81. void SetPinNameInside( bool show )
  82. {
  83. m_checkShowPinNameInside->SetValue( show );
  84. }
  85. bool GetPinNameInside( void ) { return m_checkShowPinNameInside->GetValue(); }
  86. protected:
  87. virtual void OnParentSymbolSelect( wxCommandEvent& event ) override;
  88. private:
  89. void syncControls( bool aIsDerivedPart );
  90. UNIT_BINDER m_pinTextPosition;
  91. };
  92. #endif // __dialog_lib_new_component__