KiCad PCB EDA Suite
Loading...
Searching...
No Matches
file_checklist_ctrl.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 The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 3
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef FILE_CHECKLIST_CTRL_H
21#define FILE_CHECKLIST_CTRL_H
22
23#include <map>
24#include <vector>
25
26#include <wx/string.h>
27
30#include <wx/colour.h>
31#include <wx/event.h>
32#include <kicommon.h>
33
34
40{
41 wxString section;
42 wxString path;
43 wxString status;
44 wxColour statusColour;
46 bool checked = false;
47};
48
49
57{
58public:
59 void SetEntries( const std::vector<FILE_CHECKLIST_ENTRY>& aEntries );
60
62 const std::vector<wxString>& Sections() const { return m_sections; }
63
65 const std::vector<FILE_CHECKLIST_ENTRY>& Rows( const wxString& aSection ) const;
66
67 void SetChecked( const wxString& aPath, bool aChecked );
68 void SetSectionChecked( const wxString& aSection, bool aChecked );
69
72 bool IsSectionChecked( const wxString& aSection ) const;
73
75 std::vector<wxString> CheckedPaths() const;
76
77private:
78 std::vector<wxString> m_sections;
79 std::map<wxString, std::vector<FILE_CHECKLIST_ENTRY>> m_rowsBySection;
80};
81
82
84
85
95{
96public:
97 FILE_CHECKLIST_CTRL( wxWindow* aParent, wxWindowID aId = wxID_ANY );
98 ~FILE_CHECKLIST_CTRL() override;
99
100 void SetEntries( const std::vector<FILE_CHECKLIST_ENTRY>& aEntries );
101
102 void SetAllChecked( bool aChecked );
103
104 std::vector<wxString> GetCheckedPaths() const;
105
107 wxString GetItemPath( const wxDataViewItem& aItem ) const;
108
109private:
110 wxObjectDataPtr<FILE_CHECKLIST_MODEL> m_model;
111};
112
113#endif // FILE_CHECKLIST_CTRL_H
BITMAPS
A list of all bitmap identifiers.
@ INVALID_BITMAP
FILE_CHECKLIST_CTRL(wxWindow *aParent, wxWindowID aId=wxID_ANY)
void SetAllChecked(bool aChecked)
std::vector< wxString > GetCheckedPaths() const
wxString GetItemPath(const wxDataViewItem &aItem) const
Path of the file row for aItem, or empty for a section header or invalid item.
wxObjectDataPtr< FILE_CHECKLIST_MODEL > m_model
void SetEntries(const std::vector< FILE_CHECKLIST_ENTRY > &aEntries)
The rows and tick states behind FILE_CHECKLIST_CTRL.
const std::vector< wxString > & Sections() const
Section headings in the order they were added.
std::vector< wxString > m_sections
void SetEntries(const std::vector< FILE_CHECKLIST_ENTRY > &aEntries)
std::map< wxString, std::vector< FILE_CHECKLIST_ENTRY > > m_rowsBySection
Extension of the wxDataViewCtrl to include some helper functions for working with items.
#define KICOMMON_API
Definition kicommon.h:27
One file row in a FILE_CHECKLIST_CTRL.
BITMAPS icon
wxString path
Row identity, and what the row shows.
wxColour statusColour
Text colour for the status, or the default when not set.
wxString section
wxString status
Free text, e.g. "Modified".
bool checked