KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pintype_combobox.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) 2015 Simon Richter <[email protected]>
5 * Copyright The 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, see <https://www.gnu.org/licenses/>.
19 */
20
21#include "pintype_combobox.h"
22#include <bitmaps.h>
23
24
25PINTYPE_COMBOBOX::PINTYPE_COMBOBOX( wxWindow* parent, wxWindowID id, const wxString& value,
26 const wxPoint& pos, const wxSize& size, int n,
27 const wxString choices[], long style,
28 const wxValidator& validator, const wxString& name ) :
29 WX_BITMAP_COMBOBOX( parent, id, value, pos, size, n, choices, style, validator, name )
30{
31 for( unsigned ii = 0; ii < ELECTRICAL_PINTYPES_TOTAL; ++ii )
32 {
33 ELECTRICAL_PINTYPE type = static_cast<ELECTRICAL_PINTYPE>( ii );
34
35 wxString text = ElectricalPinTypeGetText( type );
36 BITMAPS bitmap = ElectricalPinTypeGetBitmap( type );
37
38 if( bitmap == BITMAPS::INVALID_BITMAP )
39 Append( text );
40 else
41 Insert( text, KiBitmapBundle( bitmap ), ii );
42 }
43}
44
45
47{
48 return static_cast<ELECTRICAL_PINTYPE>( GetSelection() );
49}
50
51
53{
54 WX_BITMAP_COMBOBOX::SetSelection( static_cast<int>( aType ) );
55}
const char * name
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
Definition bitmap.cpp:106
BITMAPS
A list of all bitmap identifiers.
@ INVALID_BITMAP
PINTYPE_COMBOBOX(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &value=wxEmptyString, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, int n=0, const wxString choices[]=nullptr, long style=0, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxBitmapComboBoxNameStr)
ELECTRICAL_PINTYPE GetPinTypeSelection()
void SetSelection(ELECTRICAL_PINTYPE aType)
WX_BITMAP_COMBOBOX(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &value=wxEmptyString, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, int n=0, const wxString choices[]=NULL, long style=0, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxASCII_STR(wxBitmapComboBoxNameStr))
ELECTRICAL_PINTYPE
The symbol library pin object electrical types used in ERC tests.
Definition pin_type.h:32
BITMAPS ElectricalPinTypeGetBitmap(ELECTRICAL_PINTYPE)
Definition pin_type.cpp:217
#define ELECTRICAL_PINTYPES_TOTAL
Definition pin_type.h:52
wxString ElectricalPinTypeGetText(ELECTRICAL_PINTYPE)
Definition pin_type.cpp:203