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
30#include "wx/wxprec.h"
31#ifndef WX_PRECOMP
32#include "wx/wx.h"
33#endif // precompiled headers
34
35#include "model/notification.h"
36#include "color_types.h"
37
38class ocpnDC;
39class ChartCanvas;
41
42class NotificationPanel : public wxPanel {
43 DECLARE_EVENT_TABLE()
44
45public:
47 NotificationPanel(wxPanel *parent, wxWindowID id, const wxPoint &pos,
48 const wxSize &size,
49 std::shared_ptr<Notification> _notification,
50 int _repeat_count);
51
53 void OnAckButton(wxCommandEvent &event);
54 void OnPaint(wxPaintEvent &event);
55 std::shared_ptr<Notification> GetNotification() { return notification; }
56
57private:
58 std::shared_ptr<Notification> notification;
59 NotificationListPanel *Notification_list;
60 wxBitmap notification_bitmap;
61 wxStaticBitmap *m_itemStaticBitmap;
62 wxButton *m_ack_button;
63 int repeat_count;
64};
65
66class NotificationListPanel : public wxScrolledWindow {
67public:
68 NotificationListPanel(wxWindow *parent, wxWindowID id, const wxPoint &pos,
69 const wxSize &size);
71
72 void AddNotificationPanel(NotificationPanel *_panel);
73 void ReloadNotificationPanels();
74 std::vector<NotificationPanel *> GetPanels() { return panels; }
75
76private:
77 std::vector<NotificationPanel *> panels;
78};
79
80class NotificationsList : public wxDialog {
81public:
82 NotificationsList(wxWindow *parent);
83
84 void OnClose(wxCloseEvent &event);
85 void ReloadNotificationList();
86 void OnAckAllButton(wxCommandEvent &event);
87
88private:
89 wxScrolledWindow *m_sWindow;
90 NotificationListPanel *m_notifications_list_panel;
91 wxButton *m_ackall_button;
92 DECLARE_EVENT_TABLE()
93};
94
96public:
99
100 void SetIconName(wxString &name) { m_NoteIconName = name; }
101 void SetIconSeverity(NotificationSeverity _severity);
102
103 bool IsShown() const { return m_shown; }
104 void Show(bool show) { m_shown = show; }
105 void Paint(ocpnDC &dc);
106
107 bool UpdateStatus(bool newColorScheme = false);
108
109 void SetColorScheme(ColorScheme cs);
110 float GetScaleFactor() { return m_scale; }
111 void SetScaleFactor(float factor);
112
113 void Move(const wxPoint &pt) { m_rect.SetPosition(pt); }
119 wxRect GetRect(void) const { return m_rect; }
124 wxRect GetLogicalRect(void) const;
125
126private:
127 void CreateBmp(bool bnew = false);
128 void CreateTexture();
129 void UpdateTexture();
130
131 ChartCanvas *m_parent;
132 wxBitmap m_StatBmp;
133 wxBitmap m_MaskBmp;
134 wxStaticBitmap *m_pStatBoxToolStaticBmp;
135
136 wxString m_lastNoteIconName;
137 wxString m_NoteIconName;
138
139 wxBitmap _img_gpsRed;
140 int m_xoffset;
141 int m_yoffset;
142 float m_scale;
143
148 wxRect m_rect;
149 bool m_shown;
150 ColorScheme m_cs;
151 bool m_texOK;
152
153#ifdef ocpnUSE_GL
154 unsigned int m_texobj;
155 int m_tex_w, m_tex_h;
156 int m_image_width, m_image_height;
157#endif
158};
159
160#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:64
Class Notification.