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.

69 lines
2.1 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2015 Simon Richter <Simon.Richter@hogyros.de>
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version 2
  9. * of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, you may find one here:
  18. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  19. * or you may search the http://www.gnu.org website for the version 2 license,
  20. * or you may write to the Free Software Foundation, Inc.,
  21. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  22. */
  23. /**
  24. * @file pin_shape_combobox.cpp
  25. * @brief ComboBox widget for pin shape
  26. */
  27. #include "pin_shape_combobox.h"
  28. #include <lib_pin.h>
  29. PinShapeComboBox::PinShapeComboBox( wxWindow* parent,
  30. wxWindowID id,
  31. const wxString& value,
  32. const wxPoint& pos,
  33. const wxSize& size,
  34. int n,
  35. const wxString choices[],
  36. long style,
  37. const wxValidator& validator,
  38. const wxString& name ) :
  39. wxBitmapComboBox( parent, id, value, pos, size, n, choices, style, validator, name )
  40. {
  41. for( unsigned ii = 0; ii < PINSHAPE_COUNT; ++ii )
  42. {
  43. GRAPHIC_PINSHAPE shape = static_cast<GRAPHIC_PINSHAPE>( ii );
  44. wxString text = GetText( shape );
  45. BITMAP_DEF bitmap = GetBitmap( shape );
  46. if( bitmap == NULL )
  47. Append( text );
  48. else
  49. Insert( text, KiBitmap( bitmap ), ii );
  50. }
  51. }
  52. GRAPHIC_PINSHAPE PinShapeComboBox::GetPinShapeSelection()
  53. {
  54. return static_cast<GRAPHIC_PINSHAPE>( GetSelection() );
  55. }
  56. void PinShapeComboBox::SetSelection( GRAPHIC_PINSHAPE aShape )
  57. {
  58. wxBitmapComboBox::SetSelection( aShape );
  59. }