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