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