KiCad PCB EDA Suite
dialog_env_var_config.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) 2015 Wayne Stambaugh <stambaughw@gmail.com>
5  * Copyright (C) 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 _DIALOG_ENV_VAR_CONFIG_H_
26 #define _DIALOG_ENV_VAR_CONFIG_H_
27 
28 class EDA_DRAW_FRAME;
29 
30 #include <../common/dialogs/dialog_env_var_config_base.h>
31 
32 #include <pgm_base.h>
33 
34 
40 {
41 private:
43  bool m_extDefsChanged = false;
44 
45 protected:
46 
50  void PopulatePathList();
51 
55  void EditSelectedEntry();
56 
57  // Various button callbacks
58  virtual void OnAddButton( wxCommandEvent& event ) override;
59  virtual void OnEditButton( wxCommandEvent& event ) override;
60  virtual void OnRemoveButton( wxCommandEvent& event ) override;
61  virtual void OnHelpButton( wxCommandEvent& event ) override;
62 
63  virtual void OnPathSelected( wxListEvent& event ) override;
64  virtual void OnPathActivated( wxListEvent& event ) override;
65 
66  // Variable for keeping track of currently selected list index
67  unsigned int m_pathIndex = 0;
68 
74  bool GetPathAtIndex( unsigned int aIndex, wxString& aEnvVar, wxString& aEnvPath );
75 
80  bool IsEnvVarImmutable( const wxString aEnvVar );
81 
85  void SelectListIndex( unsigned int aIndex );
86 
87 public:
88  DIALOG_ENV_VAR_CONFIG( wxWindow* parent, const ENV_VAR_MAP& aEnvVarMap );
90 
91  bool TransferDataToWindow() override;
92  bool TransferDataFromWindow() override;
93 
94  bool ExternalDefsChanged() const { return m_extDefsChanged; }
95 
96  const ENV_VAR_MAP& GetEnvVarMap() const
97  {
98  return m_envVarMap;
99  }
100 };
101 
102 #endif // _DIALOG_ENV_VAR_CONFIG_H_
void EditSelectedEntry()
Edit the currently selected ENV_VAR entry.
bool GetPathAtIndex(unsigned int aIndex, wxString &aEnvVar, wxString &aEnvPath)
Extract the NAME and PATH data from the ENV_VAR at the provided index.
bool TransferDataFromWindow() override
virtual void OnEditButton(wxCommandEvent &event) override
Class DIALOG_ENV_VAR_CONFIG_BASE.
virtual void OnRemoveButton(wxCommandEvent &event) override
Class EDA_DRAW_FRAME is the base class for create windows for drawing purpose.
Definition: draw_frame.h:54
void PopulatePathList()
Update the displayed list of ENV_VAR paths.
virtual void OnPathActivated(wxListEvent &event) override
void SelectListIndex(unsigned int aIndex)
Select the ENV_VAR at the provided index.
const ENV_VAR_MAP & GetEnvVarMap() const
std::map< wxString, ENV_VAR_ITEM > ENV_VAR_MAP
Definition: pgm_base.h:87
bool IsEnvVarImmutable(const wxString aEnvVar)
Determine if a particular ENV_VAR is protected.
virtual void OnHelpButton(wxCommandEvent &event) override
DIALOG_ENV_VAR_CONFIG class declaration.
see class PGM_BASE
virtual void OnAddButton(wxCommandEvent &event) override
DIALOG_ENV_VAR_CONFIG(wxWindow *parent, const ENV_VAR_MAP &aEnvVarMap)
virtual void OnPathSelected(wxListEvent &event) override
bool TransferDataToWindow() override