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-2021 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
34class wxTreeCtrl;
35
39class PROJECT_TREE_ITEM : public wxTreeItemData
40{
41public:
42
43 PROJECT_TREE_ITEM( TREE_FILE_TYPE type, const wxString& data, wxTreeCtrl* parent );
44
46 m_parent( nullptr )
47 { }
48
50 m_type( src.m_type ),
52 m_parent( src.m_parent )
53 {
54 SetState( src.m_state );
55 m_isPopulated = false;
56 }
57
58 TREE_FILE_TYPE GetType() const { return m_type; }
59 void SetType( TREE_FILE_TYPE aType ) { m_type = aType; }
60
61 const wxString& GetFileName() const { return m_file_name; }
62 void SetFileName( const wxString& name ) { m_file_name = name; }
63
64 bool IsRootFile() const { return m_isRootFile; }
65 void SetRootFile( bool aValue ) { m_isRootFile = aValue; }
66
67 bool IsPopulated() const { return m_isPopulated; }
68 void SetPopulated( bool aValue ) { m_isPopulated = aValue; }
69
75 const wxString GetDir() const;
76
77 bool Rename( const wxString& name, bool check = true );
78 void Delete();
79 void Print();
80 void Activate( PROJECT_TREE_PANE* aTreePrjFrame );
81 void SetState( int state );
82
91 bool CanDelete() const;
92 bool CanRename() const { return CanDelete(); }
93
94private:
95 TREE_FILE_TYPE m_type; // = TREE_PROJECT, TREE_DIRECTORY ...
96 wxString m_file_name; // Filename for a file, or directory name
97 bool m_isRootFile; // True if m_Filename is a root schematic (same name as project)
98 bool m_isPopulated; // True if the name is a directory, and its content was read
99 wxTreeCtrl* m_parent;
101};
102
103#endif // PROJECT_TREE_ITEM_H
const char * name
Definition: DXF_plotter.cpp:56
Handle one item (a file or a directory name) for the tree file.
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)
wxTreeCtrl * m_parent
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
bool IsRootFile() const
void SetFileName(const wxString &name)
bool CanRename() const
const wxString GetDir() const
void Activate(PROJECT_TREE_PANE *aTreePrjFrame)
PROJECT_TREE_PANE Window to display the tree files.
TREE_FILE_TYPE