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 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 NOTIFICATIONS_MANAGER_H
22#define NOTIFICATIONS_MANAGER_H
23
24#include <kicommon.h>
25#include <functional>
26#include <vector>
27
28class wxString;
29class KISTATUSBAR;
30struct NOTIFICATION;
32class wxWindow;
33class wxCloseEvent;
34
35
37{
38public:
39 wxString title;
40 wxString description;
41 wxString href;
42 wxString key;
43 wxString date;
44};
45
46
48{
49public:
51
62 void CreateOrUpdate( const wxString& aKey, const wxString& aTitle, const wxString& aDescription,
63 const wxString& aHref = wxEmptyString );
64
70 void Remove( const wxString& aKey );
71
75 void Load();
76
80 void Save();
81
85 void ShowList( wxWindow* aParent, wxPoint aPos );
86
90 void RegisterStatusBar( KISTATUSBAR* aStatusBar );
91
95 void UnregisterStatusBar( KISTATUSBAR* aStatusBar );
96
97private:
101 void onListWindowClosed( wxCloseEvent& aEvent );
102
103private:
105 std::vector<NOTIFICATION> m_notifications;
106
108 std::vector<NOTIFICATIONS_LIST*> m_shownDialogs;
109
111 std::vector<KISTATUSBAR*> m_statusBars;
112
114 wxFileName m_destFileName;
115};
116
117#endif
KICAD_PLUGIN_EXPORT SCENEGRAPH * Load(char const *aFileName)
Read a model file and creates a generic display structure.
void Save()
Save notifications to disk.
void onListWindowClosed(wxCloseEvent &aEvent)
Handle removing the shown list window from our list of shown windows.
wxFileName m_destFileName
The cached file path to read/write notifications on 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)
Create 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
Status bars registered for updates.
void UnregisterStatusBar(KISTATUSBAR *aStatusBar)
Remove status bar from handling.
std::vector< NOTIFICATION > m_notifications
Current stack of notifications.
void ShowList(wxWindow *aParent, wxPoint aPos)
Show the notification list.
std::vector< NOTIFICATIONS_LIST * > m_shownDialogs
Currently shown notification lists.
#define KICOMMON_API
Definition kicommon.h:27
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.