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 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#ifndef PCB_LAYER_BOX_SELECTOR_H
22#define PCB_LAYER_BOX_SELECTOR_H
23
24#include <memory>
25
26#include <lset.h>
28
29class PCB_BASE_FRAME;
31
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, const wxString& value = wxEmptyString,
43 const wxPoint& pos = wxDefaultPosition,
44 const wxSize& size = wxDefaultSize, int n = 0,
45 const wxString choices[] = nullptr, int style = 0 );
46
47 // SetBoardFrame should be called after creating a PCB_LAYER_BOX_SELECTOR. It is not passed
48 // through the constructor because it must have the same signature as wxBitmapComboBox for
49 // use with wxFormBuilder.
50 void SetBoardFrame( PCB_BASE_FRAME* aFrame );
51
52 // SetLayerSet allows disabling some layers, which are not shown in list
53 void SetNotAllowedLayerSet( const LSET& aMask ) { m_layerMaskDisable = aMask; }
54
55 // If the UNDEFINED_LAYER should be selectable, give it a name here. Usually either
56 // INDETERMINATE_STATE or INDETERMINATE_ACTION.
57 void SetUndefinedLayerName( const wxString& aName ) { m_undefinedLayerName = aName; }
58
59 // Reload the Layers names and bitmaps
60 void Resync() override;
61
62 // Allow (or not) the layers not activated for the current board to be shown in layer
63 // selector. Not activated layers have their names appended with "(not activated)".
64 void ShowNonActivatedLayers( bool aShow ) { m_showNotEnabledBrdlayers = aShow; }
65
66private:
67 // Returns true if the layer id is enabled (i.e. if it should be displayed)
68 bool isLayerEnabled( int aLayer ) const override;
69
70 LSET getEnabledLayers() const;
71
73
74 LSET m_layerMaskDisable; // A mask to remove some (not allowed) layers
75 // from layer list
76 bool m_showNotEnabledBrdlayers; // true to list all allowed layers
77 // (with not activated layers flagged)
78 wxString m_undefinedLayerName; // if not empty add an item with this name which sets
79 // the layer to UNDEFINED_LAYER
80
81 std::unique_ptr<PCB_LAYER_PRESENTATION> m_layerPresentation;
82};
83
84#endif // PCB_LAYER_BOX_SELECTOR_H
LAYER_BOX_SELECTOR(wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, int n=0, const wxString choices[]=nullptr)
LSET is a set of PCB_LAYER_IDs.
Definition lset.h:37
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
void SetBoardFrame(PCB_BASE_FRAME *aFrame)
void ShowNonActivatedLayers(bool aShow)
void SetUndefinedLayerName(const wxString &aName)
bool isLayerEnabled(int aLayer) const override
Return true if the layer id is enabled (i.e. is it should be displayed).
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)
void SetNotAllowedLayerSet(const LSET &aMask)
std::unique_ptr< PCB_LAYER_PRESENTATION > m_layerPresentation
Class that manages the presentation of PCB layers in a PCB frame.