2016-02-28 17:33:29 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2015 Simon Richter <Simon.Richter@hogyros.de>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file pin_shape_combobox.cpp
|
|
|
|
* @brief ComboBox widget for pin shape
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "pin_shape_combobox.h"
|
|
|
|
|
2021-03-08 02:59:07 +00:00
|
|
|
#include <bitmaps.h>
|
2024-04-20 09:44:34 +00:00
|
|
|
#include <sch_pin.h>
|
2016-02-28 17:33:29 +00:00
|
|
|
|
|
|
|
PinShapeComboBox::PinShapeComboBox( wxWindow* parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxString& value,
|
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
int n,
|
|
|
|
const wxString choices[],
|
|
|
|
long style,
|
|
|
|
const wxValidator& validator,
|
|
|
|
const wxString& name ) :
|
|
|
|
wxBitmapComboBox( parent, id, value, pos, size, n, choices, style, validator, name )
|
|
|
|
{
|
2020-01-18 20:51:28 +00:00
|
|
|
for( unsigned ii = 0; ii < GRAPHIC_PINSHAPES_TOTAL; ++ii )
|
2016-02-28 17:33:29 +00:00
|
|
|
{
|
|
|
|
GRAPHIC_PINSHAPE shape = static_cast<GRAPHIC_PINSHAPE>( ii );
|
|
|
|
|
2020-07-29 15:03:40 +00:00
|
|
|
wxString text = PinShapeGetText( shape );
|
2021-03-08 02:59:07 +00:00
|
|
|
BITMAPS bitmap = PinShapeGetBitmap( shape );
|
2016-02-28 17:33:29 +00:00
|
|
|
|
2021-03-08 02:59:07 +00:00
|
|
|
if( bitmap == BITMAPS::INVALID_BITMAP )
|
2016-02-28 17:33:29 +00:00
|
|
|
Append( text );
|
|
|
|
else
|
2024-01-22 01:47:11 +00:00
|
|
|
Insert( text, KiBitmapBundle( bitmap ), ii );
|
2016-02-28 17:33:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-03-06 08:31:00 +00:00
|
|
|
GRAPHIC_PINSHAPE PinShapeComboBox::GetPinShapeSelection()
|
2016-02-28 17:33:29 +00:00
|
|
|
{
|
2016-03-06 08:31:00 +00:00
|
|
|
return static_cast<GRAPHIC_PINSHAPE>( GetSelection() );
|
2016-02-28 17:33:29 +00:00
|
|
|
}
|
2017-01-18 15:46:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
void PinShapeComboBox::SetSelection( GRAPHIC_PINSHAPE aShape )
|
|
|
|
{
|
2020-01-18 20:51:28 +00:00
|
|
|
wxBitmapComboBox::SetSelection( static_cast<int>( aShape ) );
|
2017-01-18 15:46:51 +00:00
|
|
|
}
|