wxMaxima
Loading...
Searching...
No Matches
GenWizPanel.h
1// -*- mode: c++; c-file-style: "linux"; c-basic-offset: 2; indent-tabs-mode: nil -*-
2//
3// Copyright (C) 2004-2015 Andrej Vodopivec <andrej.vodopivec@gmail.com>
4// Copyright (C) 2017-2018 Gunter Königsmann <wxMaxima@physikbuch.de>
5//
6// This program is free software; you can redistribute it and/or modify
7// it under the terms of the GNU General Public License as published by
8// the Free Software Foundation; either version 2 of the License, or
9// (at your option) any later version.
10//
11// This program is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15//
16//
17// You should have received a copy of the GNU General Public License
18// along with this program; if not, write to the Free Software
19// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20//
21// SPDX-License-Identifier: GPL-2.0+
22
23#ifndef GENWIZ_PANEL_H
24#define GENWIZ_PANEL_H
25
26#include "precomp.h"
27#include <wx/wx.h>
28#include <wx/statline.h>
29#include <vector>
30#include <wx/cshelp.h>
31#include "../BTextCtrl.h"
32#include <wx/notebook.h>
33#include "MaximaManual.h"
34#include <wx/hashmap.h>
35#include <unordered_map>
36
37
42class GenWizPanel : public wxPanel
43{
44public:
45 GenWizPanel(wxWindow *parent, Configuration *cfg, MaximaManual *manual,
46 const wxString &description, const wxString &description_tooltip,
47 const wxString &commandRule,
48 const wxString &label1, const wxString &defaultval1, const wxString &tooltip1 = {},
49 const wxString &label2 = {}, const wxString &defaultval2 = {}, const wxString &tooltip2 = {},
50 const wxString &label3 = {}, const wxString &defaultval3 = {}, const wxString &tooltip3 = {},
51 const wxString &label4 = {}, const wxString &defaultval4 = {}, const wxString &tooltip4 = {},
52 const wxString &label5 = {}, const wxString &defaultval5 = {}, const wxString &tooltip5 = {},
53 const wxString &label6 = {}, const wxString &defaultval6 = {}, const wxString &tooltip6 = {},
54 const wxString &label7 = {}, const wxString &defaultval7 = {}, const wxString &tooltip7 = {},
55 const wxString &label8 = {}, const wxString &defaultval8 = {}, const wxString &tooltip8 = {},
56 const wxString &label9 = {}, const wxString &defaultval9 = {}, const wxString &tooltip9 = {});
57
58 GenWizPanel(wxWindow *parent, Configuration *cfg, MaximaManual *manual,
59 const wxString &description = {}, const wxString &description_tooltip = {},
60 const wxString &commandRule = {}, bool dockable = true,
61 const wxString &label1 = {}, const wxString &defaultval1 = {}, const wxString &tooltip1 = {},
62 const wxString &label2 = {}, const wxString &defaultval2 = {}, const wxString &tooltip2 = {},
63 const wxString &label3 = {}, const wxString &defaultval3 = {}, const wxString &tooltip3 = {},
64 const wxString &label4 = {}, const wxString &defaultval4 = {}, const wxString &tooltip4 = {},
65 const wxString &label5 = {}, const wxString &defaultval5 = {}, const wxString &tooltip5 = {},
66 const wxString &label6 = {}, const wxString &defaultval6 = {}, const wxString &tooltip6 = {},
67 const wxString &label7 = {}, const wxString &defaultval7 = {}, const wxString &tooltip7 = {},
68 const wxString &label8 = {}, const wxString &defaultval8 = {}, const wxString &tooltip8 = {},
69 const wxString &label9 = {}, const wxString &defaultval9 = {}, const wxString &tooltip9 = {});
70
72 void NewWizard(wxString description, const wxString &description_tooltip,
73 const wxString &commandRule,
74 const wxString &label1, const wxString &defaultval1, const wxString &tooltip1,
75 const wxString &label2, const wxString &defaultval2, const wxString &tooltip2,
76 const wxString &label3, const wxString &defaultval3, const wxString &tooltip3,
77 const wxString &label4, const wxString &defaultval4, const wxString &tooltip4,
78 const wxString &label5, const wxString &defaultval5, const wxString &tooltip5,
79 const wxString &label6, const wxString &defaultval6, const wxString &tooltip6,
80 const wxString &label7, const wxString &defaultval7, const wxString &tooltip7,
81 const wxString &label8, const wxString &defaultval8, const wxString &tooltip8,
82 const wxString &label9, const wxString &defaultval9, const wxString &tooltip9);
83
85 wxString operator[](int i) const { return m_textctrl[i]->GetValue(); }
86
88 wxString GetOutput() const {return m_output->GetValue();}
89
90#if defined __WXMSW__
91 wxButton *GetOKButton() const {return button_1;}
92 wxButton *GetAbortButton() const {return button_2;}
93#else
94 wxButton *GetOKButton() const {return button_2;}
95 wxButton *GetAbortButton() const {return button_1;}
96#endif
97 wxButton *GetInsertButton() const{return m_insertButton;}
98 wxString GetHelpKeyword(wxWindowID ID);
99 virtual ~GenWizPanel();
100protected:
101 typedef std::unordered_map <wxString, int, wxStringHash> keywordHash;
102
103 void OnSize(wxSizeEvent &event);
104 wxNotebook *m_notebook;
105 void UpdateOutput();
106 void OnParamChange(wxCommandEvent& event);
107 void OnTextEnter(wxCommandEvent& event);
108 void OnNotebookPageChange(wxBookCtrlEvent& event);
109
110 std::vector<BTextCtrl*> m_textctrl;
111 std::vector<wxStaticText *> m_label;
112 wxButton *button_1;
113 wxButton *button_2;
114 wxContextHelpButton *m_helpButton = NULL;
115 wxButton *m_insertButton;
116 wxString m_commandRule;
117 wxTextCtrl *m_output;
118 wxString m_description;
119 wxString m_descriptionToolTip;
120 wxString m_title;
121 Configuration *m_configuration;
122 MaximaManual *m_maximaManual;
123private:
124 int m_topicButtonID0;
125 std::vector<wxWindowIDRef> m_topicButtonIDs;
126 bool m_ignorePageChange = true;
127 keywordHash m_manualKeywords;
128};
129
130#endif // GENWIZ_PANEL_H
This file declares the class MaximaManual.
The configuration storage for the current worksheet.
Definition: Configuration.h:85
A dockable, embeddable generic wizard.
Definition: GenWizPanel.h:43
void NewWizard(wxString description, const wxString &description_tooltip, const wxString &commandRule, const wxString &label1, const wxString &defaultval1, const wxString &tooltip1, const wxString &label2, const wxString &defaultval2, const wxString &tooltip2, const wxString &label3, const wxString &defaultval3, const wxString &tooltip3, const wxString &label4, const wxString &defaultval4, const wxString &tooltip4, const wxString &label5, const wxString &defaultval5, const wxString &tooltip5, const wxString &label6, const wxString &defaultval6, const wxString &tooltip6, const wxString &label7, const wxString &defaultval7, const wxString &tooltip7, const wxString &label8, const wxString &defaultval8, const wxString &tooltip8, const wxString &label9, const wxString &defaultval9, const wxString &tooltip9)
Replace the contents of this panel with a new wizard.
Definition: GenWizPanel.cpp:150
wxString GetOutput() const
Returns the command the wizard has generated, if commandRule wasn't empty.
Definition: GenWizPanel.h:88
wxString operator[](int i) const
Returns the contents of the nth field.
Definition: GenWizPanel.h:85
Definition: MaximaManual.h:59