KiCad PCB EDA Suite
treeproject_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-2014 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 TREEPROJECT_ITEM_H_
26 #define TREEPROJECT_ITEM_H_
27 
28 
29 #include <wx/treebase.h>
30 
31 #include "kicad_manager_frame.h"
32 
33 
38 class TREEPROJECT_ITEM : public wxTreeItemData
39 {
40 public:
41 
42  TREEPROJECT_ITEM( TreeFileType type, const wxString& data,
43  wxTreeCtrl* parent );
44 
46 
48  m_Type( src.m_Type ), m_file_name( src.m_file_name ), m_parent( src.m_parent )
49  {
50  SetState( src.m_state );
51  m_IsPopulated = false;
52  }
53 
54  TreeFileType GetType() const { return m_Type; }
55  void SetType( TreeFileType aType ) { m_Type = aType; }
56 
57  const wxString& GetFileName() const { return m_file_name; }
58  void SetFileName( const wxString& name ) { m_file_name = name; }
59 
60  bool IsRootFile() const { return m_IsRootFile; }
61  void SetRootFile( bool aValue ) { m_IsRootFile = aValue; }
62 
63  bool IsPopulated() const { return m_IsPopulated; }
64  void SetPopulated( bool aValue ) { m_IsPopulated = aValue; }
65 
71  const wxString GetDir() const;
72 
73  bool Rename( const wxString& name, bool check = true );
74  void Delete();
75  void Print();
76  void Activate( TREE_PROJECT_FRAME* aTreePrjFrame );
77  void SetState( int state );
78 
79 
80 private:
81  TreeFileType m_Type; // = TREE_PROJECT, TREE_DIRECTORY ...
82  wxString m_file_name; // Filename for a file, or directory name
83  bool m_IsRootFile; // True if m_Filename is a root schematic (same name as project)
84  bool m_IsPopulated; // True if the name is a directory, and its content was read
85  wxTreeCtrl* m_parent;
86  int m_state;
87 };
88 
89 #endif // TREEPROJECT_ITEM_H_
bool IsRootFile() const
TREEPROJECT_ITEM handles one item (a file or a directory name) for the tree file.
TreeFileType GetType() const
const wxString GetDir() const
void SetRootFile(bool aValue)
void SetFileName(const wxString &name)
void Activate(TREE_PROJECT_FRAME *aTreePrjFrame)
bool IsPopulated() const
#define NULL
wxTreeCtrl * m_parent
TREE_PROJECT_FRAME Window to display the tree files.
TreeFileType
bool Rename(const wxString &name, bool check=true)
const char * name
Definition: DXF_plotter.cpp:60
void SetState(int state)
void SetType(TreeFileType aType)
TREEPROJECT_ITEM(const TREEPROJECT_ITEM &src)
const wxString & GetFileName() const
void SetPopulated(bool aValue)
TreeFileType m_Type