KiCad PCB EDA Suite
Loading...
Searching...
No Matches
area_selector.cpp
Go to the documentation of this file.
2
3#include <algorithm>
4
5#include <board.h>
6#include <zone.h>
7
9{
10public:
11 AREA_SELECTOR_POPUP() : m_board( nullptr ) {}
12
13 void SetBoard( BOARD* aBoard )
14 {
15 m_board = aBoard;
17 }
18
19protected:
20 void getListContent( wxArrayString& aList ) override
21 {
22 aList.clear();
23
24 if( !m_board )
25 return;
26
27 for( ZONE* zone : m_board->Zones() )
28 {
29 if( zone->GetIsRuleArea() && !zone->GetZoneName().IsEmpty() )
30 aList.push_back( zone->GetZoneName() );
31 }
32
33 aList.Sort();
34 }
35
36private:
38};
39
40AREA_SELECTOR::AREA_SELECTOR( wxWindow* parent, wxWindowID id, const wxPoint& pos,
41 const wxSize& size, long style )
42 : FILTER_COMBOBOX( parent, id, pos, size, style|wxCB_READONLY )
43{
46}
47
49{
50 m_popup->SetBoard( aBoard );
51}
52
53void AREA_SELECTOR::SetSelectedArea( const wxString& aName )
54{
55 m_popup->SetSelectedString( aName );
56}
57
59{
60 return m_popup->GetStringValue();
61}
62
void getListContent(wxArrayString &aList) override
Fill the combobox list.
void SetBoard(BOARD *aBoard)
void SetSelectedArea(const wxString &aName)
AREA_SELECTOR_POPUP * m_popup
AREA_SELECTOR(wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0)
wxString GetSelectedArea()
void SetBoard(BOARD *aBoard)
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:322
void setFilterPopup(FILTER_COMBOPOPUP *aPopup)
FILTER_COMBOBOX(wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0)
void rebuildList()
Call this to rebuild the list from the getListContent() method.
Handle a list of polygons defining a copper zone.
Definition zone.h:74