KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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) 2011-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 1992-2023 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 LAYER_BOX_SELECTOR_H
26#define LAYER_BOX_SELECTOR_H
27
28#include <wx/bmpcbox.h>
29
30
35{
36public:
38
39 virtual ~LAYER_SELECTOR() { }
40
41 bool SetLayersHotkeys( bool value );
42
43protected:
44 // Return true if the layer id is enabled (i.e. is it should be displayed)
45 virtual bool isLayerEnabled( int aLayer ) const = 0;
46
48};
49
50
51/*
52 * Display a layer list in a wxBitmapComboBox.
53 */
54class LAYER_BOX_SELECTOR : public wxBitmapComboBox, public LAYER_SELECTOR
55{
56public:
57 LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition,
58 const wxSize& size = wxDefaultSize, int n = 0,
59 const wxString choices[] = nullptr );
60
61 ~LAYER_BOX_SELECTOR() override;
62
63 int GetLayerSelection() const;
64
65 int SetLayerSelection( int layer );
66
67 // Reload the Layers
68 // Virtual pure function because GerbView uses its own functions in a derived class
69 virtual void Resync() = 0;
70
71private:
72#ifdef __WXMAC__
73 void onKeyDown( wxKeyEvent& aEvent );
74 void OnDrawBackground( wxDC& dc, const wxRect& rect, int item, int flags) const override;
75#endif
76};
77
78#endif // LAYER_BOX_SELECTOR_H
int SetLayerSelection(int layer)
virtual void Resync()=0
Base class to build a layer list.
virtual bool isLayerEnabled(int aLayer) const =0
bool SetLayersHotkeys(bool value)
virtual ~LAYER_SELECTOR()