KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_layer_box_selector.h
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) 2012-2015 Jean-Pierre Charras, [email protected]
5 * Copyright (C) 1992-2021 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, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#ifndef PCB_LAYER_BOX_SELECTOR_H
26#define PCB_LAYER_BOX_SELECTOR_H
27
28#include <lset.h>
30
31class PCB_BASE_FRAME;
32
37{
38public:
39 // If you are thinking the constructor is a bit curious, just remember it is automatically
40 // generated when used in wxFormBuilder files, and so must have the same signature as the
41 // wxBitmapComboBox constructor. In particular, value and style are not used by this class.
42 PCB_LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id,
43 const wxString& value = wxEmptyString,
44 const wxPoint& pos = wxDefaultPosition,
45 const wxSize& size = wxDefaultSize,
46 int n = 0, const wxString choices[] = nullptr, int style = 0 ) :
47 LAYER_BOX_SELECTOR( parent, id, pos, size, n, choices )
48 {
49 m_boardFrame = nullptr;
51 }
52
53 // SetBoardFrame should be called after creating a PCB_LAYER_BOX_SELECTOR. It is not passed
54 // through the constructor because it must have the same signature as wxBitmapComboBox for
55 // use with wxFormBuilder.
56 void SetBoardFrame( PCB_BASE_FRAME* aFrame ) { m_boardFrame = aFrame; };
57
58 // SetLayerSet allows disabling some layers, which are not shown in list
60
61 // If the UNDEFINED_LAYER should be selectable, give it a name here. Usually either
62 // INDETERMINATE_STATE or INDETERMINATE_ACTION.
63 void SetUndefinedLayerName( const wxString& aName ) { m_undefinedLayerName = aName; }
64
65 // Reload the Layers names and bitmaps
66 void Resync() override;
67
68 // Allow (or not) the layers not activated for the current board to be shown in layer
69 // selector. Not activated layers have their names appended with "(not activated)".
70 void ShowNonActivatedLayers( bool aShow ) { m_showNotEnabledBrdlayers = aShow; }
71
72private:
73 // Returns a color index from the layer id
74 COLOR4D getLayerColor( int aLayer ) const override;
75
76 // Returns true if the layer id is enabled (i.e. if it should be displayed)
77 bool isLayerEnabled( int aLayer ) const override;
78
79 // Returns the name of the layer id
80 wxString getLayerName( int aLayer ) const override;
81
82 LSET getEnabledLayers() const;
83
85
86 LSET m_layerMaskDisable; // A mask to remove some (not allowed) layers
87 // from layer list
88 bool m_showNotEnabledBrdlayers; // true to list all allowed layers
89 // (with not activated layers flagged)
90 wxString m_undefinedLayerName; // if not empty add an item with this name which sets
91 // the layer to UNDEFINED_LAYER
92};
93
94#endif // PCB_LAYER_BOX_SELECTOR_H
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
LSET is a set of PCB_LAYER_IDs.
Definition: lset.h:35
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
Class to display a pcb layer list in a wxBitmapComboBox.
void SetBoardFrame(PCB_BASE_FRAME *aFrame)
void SetNotAllowedLayerSet(LSET aMask)
void ShowNonActivatedLayers(bool aShow)
COLOR4D getLayerColor(int aLayer) const override
void SetUndefinedLayerName(const wxString &aName)
bool isLayerEnabled(int aLayer) const override
PCB_LAYER_BOX_SELECTOR(wxWindow *parent, wxWindowID id, const wxString &value=wxEmptyString, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, int n=0, const wxString choices[]=nullptr, int style=0)
wxString getLayerName(int aLayer) const override