KiCad PCB EDA Suite
class_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, jean-pierre.charras@ujf-grenoble.fr
5  * Copyright (C) 1992-2015 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 CLASS_PCB_PCB_LAYER_BOX_SELECTOR_H
26 #define CLASS_PCB_PCB_LAYER_BOX_SELECTOR_H 1
27 
29 
30 class PCB_BASE_FRAME;
31 
36 {
38 
39  LSET m_layerMaskDisable; // A mask to remove some (not allowed) layers
40  // from layer list
41  bool m_showNotEnabledBrdlayers; // true to list all allowed layers
42  // (with not activated layers flagged)
43 
44 public:
45  // Hotkey Info
47 
48 public:
49  // If you are thinking the constructor is a bit curious,
50  // just remember it is used by automatically generated by wxFormBuilder files,
51  // and it should mimic the wxBitmapComboBox constructor.
52  // Therefore, value, style are not yet used,
53  // but they are here for compatibility
54  PCB_LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id,
55  const wxString& value = wxEmptyString,
56  const wxPoint& pos = wxDefaultPosition,
57  const wxSize& size = wxDefaultSize,
58  int n = 0, const wxString choices[] = NULL, int style = 0 ) :
59  LAYER_BOX_SELECTOR( parent, id, pos, size, n, choices )
60  {
61  m_boardFrame = NULL;
62  m_hotkeys = NULL;
63  m_showNotEnabledBrdlayers = false;
64  }
65 
66  // Accessors
67 
68  // SetBoardFrame should be called after creating a PCB_LAYER_BOX_SELECTOR
69  // It is not passed through the constructor because when using wxFormBuilder
70  // we should use a constructor compatible with a wxBitmapComboBox
71  void SetBoardFrame( PCB_BASE_FRAME* aFrame ) { m_boardFrame = aFrame; };
72 
73  // SetLayerSet allows disableing some layers, which are not
74  // shown in list
75  void SetLayerSet( LSET aMask ) { m_layerMaskDisable = aMask; }
76 
77  // Reload the Layers names and bitmaps
78  // Virtual function
79  void Resync() override;
80 
81  // Allow (or not) the layers not activated for the current board to be shown
82  // in layer selector. Not actavated layers are flagged
83  // ( "(not activated)" added to the layer name )
84  void ShowNonActivatedLayers( bool aShow )
85  {
86  m_showNotEnabledBrdlayers = aShow;
87  }
88 
89 private:
90  // Returns a color index from the layer id
91  // Virtual function
92  COLOR4D GetLayerColor( LAYER_NUM aLayer ) const override;
93 
94  // Returns true if the layer id is enabled (i.e. is it should be displayed)
95  // Virtual function
96  bool IsLayerEnabled( LAYER_NUM aLayer ) const override;
97 
98  // Returns the name of the layer id
99  // Virtual function
100  wxString GetLayerName( LAYER_NUM aLayer ) const override;
101 
102  LSET getEnabledLayers() const;
103 };
104 
105 #endif // CLASS_PCB_PCB_LAYER_BOX_SELECTOR_H
Structure EDA_HOTKEY_CONFIG contains the information required to save hot key information to a config...
Definition: hotkeys_basic.h:87
Class to display a pcb layer list in a wxBitmapComboBox.
void SetBoardFrame(PCB_BASE_FRAME *aFrame)
Class LSET is a set of PCB_LAYER_IDs.
bool IsLayerEnabled(LAYER_NUM 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[]=NULL, int style=0)
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
COLOR4D GetLayerColor(LAYER_NUM aLayer) const override
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer...
wxString GetLayerName(LAYER_NUM aLayer) const override
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39