KiCad PCB EDA Suite
project_tree_item.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) 2010-2014 Jean-Pierre Charras
5  * Copyright (C) 2004-2020 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 PROJECT_TREE_ITEM_H
26 #define PROJECT_TREE_ITEM_H
27 
28 
29 #include <wx/treebase.h>
30 
31 #include "tree_file_type.h"
32 
33 class PROJECT_TREE_PANE;
34 class wxTreeCtrl;
35 
40 class PROJECT_TREE_ITEM : public wxTreeItemData
41 {
42 public:
43 
44  PROJECT_TREE_ITEM( TREE_FILE_TYPE type, const wxString& data, wxTreeCtrl* parent );
45 
47  m_parent( NULL )
48  { }
49 
51  m_type( src.m_type ),
52  m_file_name( src.m_file_name ),
53  m_parent( src.m_parent )
54  {
55  SetState( src.m_state );
56  m_isPopulated = false;
57  }
58 
59  TREE_FILE_TYPE GetType() const { return m_type; }
60  void SetType( TREE_FILE_TYPE aType ) { m_type = aType; }
61 
62  const wxString& GetFileName() const { return m_file_name; }
63  void SetFileName( const wxString& name ) { m_file_name = name; }
64 
65  bool IsRootFile() const { return m_isRootFile; }
66  void SetRootFile( bool aValue ) { m_isRootFile = aValue; }
67 
68  bool IsPopulated() const { return m_isPopulated; }
69  void SetPopulated( bool aValue ) { m_isPopulated = aValue; }
70 
76  const wxString GetDir() const;
77 
78  bool Rename( const wxString& name, bool check = true );
79  void Delete();
80  void Print();
81  void Activate( PROJECT_TREE_PANE* aTreePrjFrame );
82  void SetState( int state );
83 
84 
85 private:
86  TREE_FILE_TYPE m_type; // = TREE_PROJECT, TREE_DIRECTORY ...
87  wxString m_file_name; // Filename for a file, or directory name
88  bool m_isRootFile; // True if m_Filename is a root schematic (same name as project)
89  bool m_isPopulated; // True if the name is a directory, and its content was read
90  wxTreeCtrl* m_parent;
91  int m_state;
92 };
93 
94 #endif // PROJECT_TREE_ITEM_H
const wxString & GetFileName() const
void SetFileName(const wxString &name)
bool IsPopulated() const
void Activate(PROJECT_TREE_PANE *aTreePrjFrame)
TREE_FILE_TYPE GetType() const
TREE_FILE_TYPE
void SetPopulated(bool aValue)
bool IsRootFile() const
void SetState(int state)
PROJECT_TREE_PANE Window to display the tree files.
PROJECT_TREE_ITEM(const PROJECT_TREE_ITEM &src)
#define NULL
TREE_FILE_TYPE m_type
bool Rename(const wxString &name, bool check=true)
const wxString GetDir() const
wxTreeCtrl * m_parent
const char * name
Definition: DXF_plotter.cpp:59
void SetType(TREE_FILE_TYPE aType)
PROJECT_TREE_ITEM handles one item (a file or a directory name) for the tree file.
void SetRootFile(bool aValue)