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 void SetColorScheme();
88 void RecalculateSize();
89
90private:
91 wxScrolledWindow *m_sWindow;
92 NotificationListPanel *m_notifications_list_panel;
93 wxButton *m_ackall_button;
94 DECLARE_EVENT_TABLE()
95};
96
98public:
101
102 void SetIconName(wxString &name) { m_NoteIconName = name; }
103 void SetIconSeverity(NotificationSeverity _severity);
104
105 bool IsShown() const { return m_shown; }
106 void Show(bool show) { m_shown = show; }
107 void Paint(ocpnDC &dc);
108
109 bool UpdateStatus(bool newColorScheme = false);
110
111 void SetColorScheme(ColorScheme cs);
112 float GetScaleFactor() { return m_scale; }
113 void SetScaleFactor(float factor);
114
115 void Move(const wxPoint &pt) { m_rect.SetPosition(pt); }
121 wxRect GetRect(void) const { return m_rect; }
126 wxRect GetLogicalRect(void) const;
127
128private:
129 void CreateBmp(bool bnew = false);
130 void CreateTexture();
131 void UpdateTexture();
132
133 ChartCanvas *m_parent;
134 wxBitmap m_StatBmp;
135 wxBitmap m_MaskBmp;
136 wxStaticBitmap *m_pStatBoxToolStaticBmp;
137
138 wxString m_lastNoteIconName;
139 wxString m_NoteIconName;
140
141 wxBitmap _img_gpsRed;
142 int m_xoffset;
143 int m_yoffset;
144 float m_scale;
145
150 wxRect m_rect;
151 bool m_shown;
152 ColorScheme m_cs;
153 bool m_texOK;
154
155#ifdef ocpnUSE_GL
156 unsigned int m_texobj;
157 int m_tex_w, m_tex_h;
158 int m_image_width, m_image_height;
159#endif
160};
161
162#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.