KiCad PCB EDA Suite
hierarch.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) 2004 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
6  * Copyright (C) 2004-2019 KiCad Developers, see AUTHORS.txt for contributors.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, you may find one here:
20  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21  * or you may search the http://www.gnu.org website for the version 2 license,
22  * or you may write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24  */
25 
26 
27 #ifndef HIERARCH_H
28 #define HIERARCH_H
29 
30 #include <dialog_shim.h>
31 #include <wx/imaglist.h>
32 #include <wx/object.h> // wxRTTI macros
33 #include <wx/treectrl.h>
34 
35 // The window name of the hierarchy navigator, used to find it
36 #define HIERARCHY_NAVIG_DLG_WNAME "hierarchy_navig_dlg"
37 
38 class SCH_EDIT_FRAME;
39 class SCH_SHEET_PATH;
40 
42 
46 class HIERARCHY_TREE : public wxTreeCtrl
47 {
48  // Need to use wxRTTI macros in order for OnCompareItems to work properly
49  // See: https://docs.wxwidgets.org/3.1/classwx_tree_ctrl.html#ab90a465793c291ca7aa827a576b7d146
51 
52 private:
54  wxImageList* imageList;
55 
56 public:
58 
59  // Closes the dialog on escape key
60  void onChar( wxKeyEvent& event );
61 
62  int OnCompareItems( const wxTreeItemId& item1, const wxTreeItemId& item2 ) override;
63 };
64 
66 {
67 private:
73 
74 public:
76 
78 
79  void OnCloseNav( wxCloseEvent& event );
80 
84  void UpdateHierarchyTree();
85 
86 private:
94  void buildHierarchyTree( SCH_SHEET_PATH* aList, wxTreeItemId* aPreviousmenu );
95 
100  void onSelectSheetPath( wxTreeEvent& event );
101 
106  wxString getRootString();
107 
114  wxString formatPageString( wxString aName, wxString aPage );
115 };
116 
117 #endif // HIERARCH_H
void onSelectSheetPath(wxTreeEvent &event)
Open the selected sheet and display the corresponding screen when a tree item is selected.
Definition: hierarch.cpp:245
wxImageList * imageList
Definition: hierarch.h:54
int OnCompareItems(const wxTreeItemId &item1, const wxTreeItemId &item2) override
Definition: hierarch.cpp:164
HIERARCHY_TREE * m_Tree
Definition: hierarch.h:71
Schematic editor (Eeschema) main window.
Handle hierarchy tree control.
Definition: hierarch.h:46
Dialog helper object to sit in the inheritance tree between wxDialog and any class written by wxFormB...
Definition: dialog_shim.h:83
wxString getRootString()
getRootString
Definition: hierarch.cpp:267
SCH_EDIT_FRAME * m_SchFrameEditor
Definition: hierarch.h:70
SCH_SHEET_PATH m_currSheet
Definition: hierarch.h:68
void UpdateHierarchyTree()
Update the hierarchical tree of the schematic.
Definition: hierarch.cpp:212
void onChar(wxKeyEvent &event)
Definition: hierarch.cpp:155
HIERARCHY_NAVIG_DLG(SCH_EDIT_FRAME *aParent)
Definition: hierarch.cpp:88
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
HIERARCHY_TREE(HIERARCHY_NAVIG_DLG *parent)
Definition: hierarch.cpp:70
void buildHierarchyTree(SCH_SHEET_PATH *aList, wxTreeItemId *aPreviousmenu)
Create the hierarchical tree of the schematic.
Definition: hierarch.cpp:176
SCH_SHEET_PATH m_list
Definition: hierarch.h:69
wxDECLARE_ABSTRACT_CLASS(HIERARCHY_TREE)
HIERARCHY_NAVIG_DLG * m_parent
Definition: hierarch.h:53
void OnCloseNav(wxCloseEvent &event)
Definition: hierarch.cpp:283
wxString formatPageString(wxString aName, wxString aPage)
formatPageString
Definition: hierarch.cpp:277