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