KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 The 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, see <https://www.gnu.org/licenses/>.
19 */
20
21#ifndef PROJECT_TREE_ITEM_H
22#define PROJECT_TREE_ITEM_H
23
24
25#include <wx/treebase.h>
26
27#include "tree_file_type.h"
28
30class wxTreeCtrl;
31
35class PROJECT_TREE_ITEM : public wxTreeItemData
36{
37public:
38
39 PROJECT_TREE_ITEM( TREE_FILE_TYPE type, const wxString& data, wxTreeCtrl* parent );
40
42 m_parent( nullptr )
43 { }
44
46 m_type( src.m_type ),
48 m_parent( src.m_parent )
49 {
50 SetState( src.m_state );
51 m_isPopulated = false;
52 }
53
54 TREE_FILE_TYPE GetType() const { return m_type; }
55 void SetType( TREE_FILE_TYPE 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( PROJECT_TREE_PANE* aTreePrjFrame );
77 void SetState( int state );
78
87 bool CanDelete() const;
88 bool CanRename() const { return CanDelete(); }
89
90private:
91 TREE_FILE_TYPE m_type; // = TREE_PROJECT, TREE_DIRECTORY ...
92 wxString m_file_name; // Filename for a file, or directory name
93 bool m_isRootFile; // True if m_Filename is a root schematic (same name as project)
94 bool m_isPopulated; // True if the name is a directory, and its content was read
95 wxTreeCtrl* m_parent;
97};
98
99#endif // PROJECT_TREE_ITEM_H
const char * name
bool CanDelete() const
Determine if a file can be deleted via the project tree pane.
void SetRootFile(bool aValue)
PROJECT_TREE_ITEM(const PROJECT_TREE_ITEM &src)
TREE_FILE_TYPE m_type
bool Rename(const wxString &name, bool check=true)
void SetState(int state)
const wxString & GetFileName() const
void SetType(TREE_FILE_TYPE aType)
bool IsPopulated() const
void SetPopulated(bool aValue)
TREE_FILE_TYPE GetType() const
PROJECT_TREE_ITEM(TREE_FILE_TYPE type, const wxString &data, wxTreeCtrl *parent)
Class PROJECT_TREE_ITEM is a derived class from wxTreeItemData and store info about a file or directo...
bool IsRootFile() const
void SetFileName(const wxString &name)
const wxString GetDir() const
void Activate(PROJECT_TREE_PANE *aTreePrjFrame)
PROJECT_TREE_PANE Window to display the tree files.
TREE_FILE_TYPE