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