KiCad PCB EDA Suite
enabler.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 CERN
3  * Author: Maciej Suminski <maciej.suminski@cern.ch>
4  *
5  * This program is free software: you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by the
7  * Free Software Foundation, either version 3 of the License, or (at your
8  * option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef ENABLER_H
20 #define ENABLER_H
21 
22 #include <wx/window.h>
23 
29 class ENABLER
30 {
31 public:
38  ENABLER( wxWindow& aObject, bool aState )
39  : m_object( aObject ), m_state( aState )
40  {
41  m_object.Enable( m_state );
42  }
43 
45  {
46  m_object.Enable( !m_state );
47  }
48 
49 private:
50  wxWindow& m_object;
51  bool m_state;
52 };
53 
54 #endif /* ENABLER_H */
~ENABLER()
Definition: enabler.h:44
wxWindow & m_object
Definition: enabler.h:50
ENABLER(wxWindow &aObject, bool aState)
Constructor.
Definition: enabler.h:38
Simple class to automatically enable/disable widgets.
Definition: enabler.h:29
bool m_state
Definition: enabler.h:51