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 label;
44 wxString status;
45 wxColour statusColour;
47 bool checked = false;
48};
49
50
58{
59public:
60 void SetEntries( const std::vector<FILE_CHECKLIST_ENTRY>& aEntries );
61
63 const std::vector<wxString>& Sections() const { return m_sections; }
64
66 const std::vector<FILE_CHECKLIST_ENTRY>& Rows( const wxString& aSection ) const;
67
68 void SetChecked( const wxString& aPath, bool aChecked );
69 void SetSectionChecked( const wxString& aSection, bool aChecked );
70
73 bool IsSectionChecked( const wxString& aSection ) const;
74
76 std::vector<wxString> CheckedPaths() const;
77
78private:
79 std::vector<wxString> m_sections;
80 std::map<wxString, std::vector<FILE_CHECKLIST_ENTRY>> m_rowsBySection;
81};
82
83
85
86
96{
97public:
98 FILE_CHECKLIST_CTRL( wxWindow* aParent, wxWindowID aId = wxID_ANY );
99 ~FILE_CHECKLIST_CTRL() override;
100
101 void SetEntries( const std::vector<FILE_CHECKLIST_ENTRY>& aEntries );
102
103 void SetAllChecked( bool aChecked );
104
105 std::vector<wxString> GetCheckedPaths() const;
106
108 wxString GetItemPath( const wxDataViewItem& aItem ) const;
109
112 void DoSetToolTipText( const wxString& aTip ) override;
113
114private:
117 void onIdle( wxIdleEvent& aEvent );
118
119 wxObjectDataPtr<FILE_CHECKLIST_MODEL> m_model;
120
121 wxString m_ownerTooltip;
122 wxString m_shownTooltip;
123};
124
125#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 m_ownerTooltip
What the owner set, shown when no row has more to say.
wxString GetItemPath(const wxDataViewItem &aItem) const
Path of the file row for aItem, or empty for a section header or invalid item.
void onIdle(wxIdleEvent &aEvent)
wxDataViewCtrl sends no mouse moves, so the hovered row is read on idle.
wxString m_shownTooltip
What is on screen, so an unchanged hover is left alone.
void DoSetToolTipText(const wxString &aTip) override
WX_DATAVIEWCTRL drops tooltips for every data view it is the base of.
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.
wxString label
Shown in place of the path.
BITMAPS icon
wxString path
Row identity.
wxColour statusColour
Text colour for the status, or the default when not set.
wxString section
wxString status
Free text, e.g. "Modified".
bool checked