OpenCPN Partial API docs
Loading...
Searching...
No Matches
notification_manager_gui.h
1/***************************************************************************
2 *
3 * Project: OpenCPN
4 * Purpose: Notification Manager GUI
5 * Author: David Register
6 *
7 ***************************************************************************
8 * Copyright (C) 2025 by David S. Register *
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 * This program is distributed in the hope that it will be useful, *
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18 * GNU General Public License for more details. *
19 * *
20 * You should have received a copy of the GNU General Public License *
21 * along with this program; if not, write to the *
22 * Free Software Foundation, Inc., *
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
24 **************************************************************************/
25#ifndef _NOTIFICATION_MANAGER_GUI_H__
26#define _NOTIFICATION_MANAGER_GUI_H__
27
28#include <memory>
29#include <vector>
30
31#include "wx/wxprec.h"
32#ifndef WX_PRECOMP
33#include "wx/wx.h"
34#endif // precompiled headers
35
36#include "model/notification.h"
37#include "color_types.h"
38
39class ocpnDC;
40class ChartCanvas;
42
43class NotificationPanel : public wxPanel {
44 DECLARE_EVENT_TABLE()
45
46public:
48 NotificationPanel(wxPanel *parent, wxWindowID id, const wxPoint &pos,
49 const wxSize &size,
50 std::shared_ptr<Notification> _notification,
51 int _repeat_count);
52
54 void OnAckButton(wxCommandEvent &event);
55 void OnPaint(wxPaintEvent &event);
56 std::shared_ptr<Notification> GetNotification() { return notification; }
57
58private:
59 std::shared_ptr<Notification> notification;
60 NotificationListPanel *Notification_list;
61 wxBitmap notification_bitmap;
62 wxStaticBitmap *m_itemStaticBitmap;
63 wxButton *m_ack_button;
64 int repeat_count;
65};
66
67class NotificationListPanel : public wxScrolledWindow {
68public:
69 NotificationListPanel(wxWindow *parent, wxWindowID id, const wxPoint &pos,
70 const wxSize &size);
72
73 void AddNotificationPanel(NotificationPanel *_panel);
74 void ReloadNotificationPanels();
75 std::vector<NotificationPanel *> GetPanels() { return panels; }
76
77private:
78 std::vector<NotificationPanel *> panels;
79};
80
81class NotificationsList : public wxDialog {
82public:
83 NotificationsList(wxWindow *parent);
84
85 void OnClose(wxCloseEvent &event);
86 void ReloadNotificationList();
87 void OnAckAllButton(wxCommandEvent &event);
88 void SetColorScheme();
89 void RecalculateSize();
90
91private:
92 wxScrolledWindow *m_sWindow;
93 NotificationListPanel *m_notifications_list_panel;
94 wxButton *m_ackall_button;
95 DECLARE_EVENT_TABLE()
96};
97
99public:
102
103 void SetIconName(wxString &name) { m_NoteIconName = name; }
104 void SetIconSeverity(NotificationSeverity _severity);
105
106 bool IsShown() const { return m_shown; }
107 void Show(bool show) { m_shown = show; }
108 void Paint(ocpnDC &dc);
109
110 bool UpdateStatus(bool newColorScheme = false);
111
112 void SetColorScheme(ColorScheme cs);
113 float GetScaleFactor() { return m_scale; }
114 void SetScaleFactor(float factor);
115
116 void Move(const wxPoint &pt) { m_rect.SetPosition(pt); }
122 wxRect GetRect(void) const { return m_rect; }
127 wxRect GetLogicalRect(void) const;
128
129private:
130 void CreateBmp(bool bnew = false);
131 void CreateTexture();
132 void UpdateTexture();
133
134 ChartCanvas *m_parent;
135 wxBitmap m_StatBmp;
136 wxBitmap m_MaskBmp;
137 wxStaticBitmap *m_pStatBoxToolStaticBmp;
138
139 wxString m_lastNoteIconName;
140 wxString m_NoteIconName;
141
142 wxBitmap _img_gpsRed;
143 int m_xoffset;
144 int m_yoffset;
145 float m_scale;
146
151 wxRect m_rect;
152 bool m_shown;
153 ColorScheme m_cs;
154 bool m_texOK;
155
156#ifdef ocpnUSE_GL
157 unsigned int m_texobj;
158 int m_tex_w, m_tex_h;
159 int m_image_width, m_image_height;
160#endif
161};
162
163#endif
ChartCanvas - Main chart display and interaction component.
Definition chcanv.h:151
wxRect GetLogicalRect(void) const
Return the coordinates of the widget, in logical pixels.
wxRect GetRect(void) const
Return the coordinates of the widget, in physical pixels relative to the canvas window.
Device context class that can use either wxDC or OpenGL for drawing.
Definition ocpndc.h:60
Class Notification.