-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmainframe.h
82 lines (67 loc) · 2.48 KB
/
mainframe.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
///////////////////////////////////////////////////////////////////////////////
// Project: wxECharts
// Home: https://github.com/PBfordev/wxecharts
// File Name: mainframe.h
// Purpose: Declaration of application's main frame
// Author: PB
// Created: 2024-08-22
// Copyright: (c) 2024 PB
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#pragma once
#include <wx/frame.h>
#include "charthelper.h"
#if !wxUSE_WEBVIEW
#error "wxWidgets must be built with a support for wxWebView"
#endif
#ifdef __WXMSW__
#if !wxUSE_WEBVIEW_EDGE
#error "On Windows, wxUSE_WEBVIEW_EDGE must be set to 1 (or ON) when building wxWidgets"
#endif// !wxUSE_WEBVIEW_EDGE
#define USING_WEBVIEW_EDGE 1
#else // #ifdef __WXMSW__
#define USING_WEBVIEW_EDGE 0
#endif
class wxArrayString;
class wxGrid;
class wxGridEvent;
class wxWebView;
class wxWebViewEvent;
class wxEChartsMainFrame : public wxFrame
{
public:
wxEChartsMainFrame(wxWindow* parent, const wxString& chartAssetsFolder);
private:
enum
{
ID_CHART_COLORS = wxID_HIGHEST + 10,
ID_CHART_SIZING_OPTIONS,
ID_SHOW_DEVTOOLS,
};
ChartHelper m_chartHelper;
wxGrid* m_grid{nullptr};
wxWebView* m_webView{nullptr};
bool m_webViewConfigured{false};
wxString m_webViewBackend;
void InitChartData();
void CreateGrid(wxWindow* parent);
void CreateWebView(wxWindow* parent, const wxString& assetsFolder);
void ConfigureWebView();
void OnGridCellChanging(wxGridEvent& e);
void OnGridCellChanged(wxGridEvent& e);
void OnChartColors(wxCommandEvent&);
void OnChartSizingOptions(wxCommandEvent&);
void OnChartSave(wxCommandEvent&);
void OnShowDevTools(wxCommandEvent&);
void OnWebViewPageLoaded(wxWebViewEvent&);
void OnWebViewError(wxWebViewEvent&);
void OnWebViewScriptResult(wxWebViewEvent&);
void OnWebViewMessageReceived(wxWebViewEvent& evt);
void ChartChangeColors(const wxString& colorsJSONStr);
void ChartChangeSizingOptions(const wxString& sizingOptionsJSONStr);
void ChartSavePNG(const wxString& PNGAsBase64Str);
void ChartShowVersion(const wxString& version);
void OnMessageChartError(const wxArrayString& params, const wxString& msg);
void OnMessageChartDoubleClick(const wxArrayString& params, const wxString& msg);
void OnMessageChartContextMenu();
};