KiCad PCB EDA Suite
Loading...
Searching...
No Matches
notifications_manager.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) 2023 Mark Roszko <[email protected]>
5 * Copyright (C) 2023 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 NOTIFICATIONS_MANAGER_H
26#define NOTIFICATIONS_MANAGER_H
27
28#include <functional>
29#include <vector>
30
31class wxString;
32class KISTATUSBAR;
33struct NOTIFICATION;
35class wxWindow;
36class wxCloseEvent;
37
38
40{
41public:
42 wxString title;
43 wxString description;
44 wxString href;
45 wxString key;
46 wxString date;
47};
48
49
51{
52 friend class NOTIFICATION_LIST;
53
54public:
56
66 void CreateOrUpdate( const wxString& aKey, const wxString& aTitle, const wxString& aDescription,
67 const wxString& aHref = wxEmptyString );
68
74 void Remove( const wxString& aKey );
75
79 void Load();
80
84 void Save();
85
89 void ShowList( wxWindow* aParent, wxPoint aPos );
90
94 void RegisterStatusBar( KISTATUSBAR* aStatusBar );
95
99 void UnregisterStatusBar( KISTATUSBAR* aStatusBar );
100
101private:
105 void onListWindowClosed( wxCloseEvent& aEvent );
106
108 std::vector<NOTIFICATION> m_notifications;
109
111 std::vector<NOTIFICATIONS_LIST*> m_shownDialogs;
112
114 std::vector<KISTATUSBAR*> m_statusBars;
115
117 wxFileName m_destFileName;
118};
119
120#endif
KISTATUSBAR is a wxStatusBar suitable for Kicad manager.
Definition: kistatusbar.h:43
void Save()
Saves notifications to disk.
void onListWindowClosed(wxCloseEvent &aEvent)
Handles removing the shown list window from our list of shown windows.
void Load()
Loads notifications stored from disk.
void RegisterStatusBar(KISTATUSBAR *aStatusBar)
Add a status bar for handling.
void CreateOrUpdate(const wxString &aKey, const wxString &aTitle, const wxString &aDescription, const wxString &aHref=wxEmptyString)
Creates a notification with the given parameters or updates an existing one with the same key.
void Remove(const wxString &aKey)
Remove a notification by key.
std::vector< KISTATUSBAR * > m_statusBars
The cached file path to read/write notifications on disk.
void UnregisterStatusBar(KISTATUSBAR *aStatusBar)
Removes status bar from handling.
std::vector< NOTIFICATION > m_notifications
Currently shown notification lists.
void ShowList(wxWindow *aParent, wxPoint aPos)
Shows the notification list.
std::vector< NOTIFICATIONS_LIST * > m_shownDialogs
Status bars registered for updates.
wxString key
Unique key to find a notification.
wxString description
Additional message displayed under title.
wxString title
Title of the notification.
wxString href
URL if any to link to for details.
wxString date
Date notification will display.