1 /*
2  * This file is part of the Code::Blocks IDE and licensed under the GNU Lesser General Public License, version 3
3  * http://www.gnu.org/licenses/lgpl-3.0.html
4  */
5 
6 #ifndef CONFIGURATIONPANEL_H
7 #define CONFIGURATIONPANEL_H
8 
9 //-#include "globals.h"
10 //-#include "settings.h"
11 //-#include "scrollingdialog.h"
12 #include <wx/panel.h>
13 #include <wx/string.h>
14 #include <wx/msgdlg.h>
15 
16 class wxButton;
17 class wxWindow;
18 
19 /** @brief Base class for plugin configuration panels. */
20 //-class DLLIMPORT cbConfigurationPanel : public wxPanel //(pecan 2019/03/1)
21 class cbConfigurationPanel : public wxPanel
22 {
23     public:
cbConfigurationPanel()24         cbConfigurationPanel() : m_parentDialog(0) { ; }
~cbConfigurationPanel()25         ~cbConfigurationPanel() override{}
26 
27         /// @return the panel's title.
28         virtual wxString GetTitle() const = 0;
29         /// @return the panel's bitmap base name. You must supply two bitmaps: \<basename\>.png and \<basename\>-off.png...
30         virtual wxString GetBitmapBaseName() const = 0;
31         /// Called when the user chooses to apply the configuration.
32         virtual void OnApply() = 0;
33         /// Called when the user chooses to cancel the configuration.
34         virtual void OnCancel() = 0;
35 
36         /// Sets the panel's parent dialog
SetParentDialog(wxWindow * dialog)37         void SetParentDialog(wxWindow* dialog)
38         {
39             m_parentDialog = dialog;
40         }
41         /// Gets the panel's parent dialog
SetParentDialog()42         wxWindow* SetParentDialog()
43         {
44             return m_parentDialog;
45         }
46         /** Call global cbMessageBox with m_parentDialog as parent window when
47             no parent window specified */
48         int cbMessageBox(const wxString& message, const wxString& caption = wxEmptyString, int style = wxOK, wxWindow *parent = NULL, int x = -1, int y = -1)
49         {
50             if (parent)
51                 //-return ::cbMessageBox(message, caption, style, parent, x, y); //(pecan 2019/03/1)-
52                 return ::wxMessageBox(message, caption, style, parent, x, y);
53             else
54                 //-return ::cbMessageBox(message, caption, style, m_parentDialog, x, y); //(pecan 2019/03/1)
55                 return ::wxMessageBox(message, caption, style, m_parentDialog, x, y);
56         }
57     private:
58         wxWindow* m_parentDialog;
59 };
60 
61 /// @brief A simple dialog that wraps a cbConfigurationPanel.
62 //-class DLLIMPORT cbConfigurationDialog : public wxScrollingDialog //(pecan 2019/03/1)-
63 class cbConfigurationDialog : public wxDialog
64 {
65     public:
66         cbConfigurationDialog(wxWindow* parent, int id, const wxString& title);
67         void AttachConfigurationPanel(cbConfigurationPanel* panel);
68         ~cbConfigurationDialog() override;
69 
70         void EndModal(int retCode) override;
71     protected:
72         cbConfigurationPanel* m_pPanel;
73         wxButton* m_pOK;
74         wxButton* m_pCancel;
75     private:
76 
77 };
78 
79 #endif // CONFIGURATIONPANEL_H
80