KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pinshape_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 "pinshape_combobox.h"
22#include <bitmaps.h>
23
24
25PINSHAPE_COMBOBOX::PINSHAPE_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 < GRAPHIC_PINSHAPES_TOTAL; ++ii )
32 {
33 GRAPHIC_PINSHAPE shape = static_cast<GRAPHIC_PINSHAPE>( ii );
34
35 wxString text = PinShapeGetText( shape );
36 BITMAPS bitmap = PinShapeGetBitmap( shape );
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<GRAPHIC_PINSHAPE>( GetSelection() );
49}
50
51
53{
54 WX_BITMAP_COMBOBOX::SetSelection( static_cast<int>( aShape ) );
55}
const char * name
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
Definition bitmap.cpp:106
BITMAPS
A list of all bitmap identifiers.
@ INVALID_BITMAP
PINSHAPE_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)
GRAPHIC_PINSHAPE GetPinShapeSelection()
void SetSelection(GRAPHIC_PINSHAPE aShape)
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))
wxString PinShapeGetText(GRAPHIC_PINSHAPE shape)
Definition pin_type.cpp:231
BITMAPS PinShapeGetBitmap(GRAPHIC_PINSHAPE shape)
Definition pin_type.cpp:245
#define GRAPHIC_PINSHAPES_TOTAL
Definition pin_type.h:95
GRAPHIC_PINSHAPE
Definition pin_type.h:80