Code::Blocks  SVN r11506
wiz.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Code::Blocks IDE and licensed under the GNU General Public License, version 3
3  * http://www.gnu.org/licenses/gpl-3.0.html
4  */
5 
6 #ifndef WIZ_H
7 #define WIZ_H
8 
9 
10 #include <cbplugin.h> // the base class we 're inheriting
11 #include <settings.h> // needed to use the Code::Blocks SDK
12 #include <cbexception.h>
13 #include <wx/bitmap.h>
14 
15 class wxWizard;
16 class wxWizardPageSimple;
18 class WizFilePathPanel;
19 class WizCompilerPanel;
23 
24 struct WizardInfo
25 {
33 };
34 
37 
38 class Wiz : public cbWizardPlugin
39 {
40  public:
41  Wiz();
42  ~Wiz();
43 
44  Wiz& operator=(cb_unused const Wiz& rhs) // prevent assignment operator
45  {
46  cbThrow(_T("Can't assign an Wiz* !!!"));
47  return *this;
48  }
49 
50  int GetCount() const;
51  TemplateOutputType GetOutputType(int index) const;
52  wxString GetTitle(int index) const;
53  wxString GetDescription(int index) const;
54  wxString GetCategory(int index) const;
55  const wxBitmap& GetBitmap(int index) const;
56  wxString GetScriptFilename(int index) const;
57  CompileTargetBase* Launch(int index, wxString* pFilename = 0);
58 
59  CompileTargetBase* RunProjectWizard(wxString* pFilename); // called by Launch() for otProject wizards
60  CompileTargetBase* RunTargetWizard(wxString* pFilename); // called by Launch() for otTarget wizards (always returns NULL)
61  CompileTargetBase* RunFilesWizard(wxString* pFilename); // called by Launch() for otFiles wizards (always returns NULL)
62  CompileTargetBase* RunCustomWizard(wxString* pFilename); // called by Launch() for otCustom wizards (always returns NULL)
63 
64  // Scripting support
65  void AddWizard(TemplateOutputType otype,
66  const wxString& title,
67  const wxString& cat,
68  const wxString& script,
69  const wxString& templatePNG,
70  const wxString& wizardPNG,
71  const wxString& xrc);
72 
73  TemplateOutputType GetWizardType();
74 
75  void EnableWindow(const wxString& name, bool enable);
76 
77  void CheckCheckbox(const wxString& name, bool check);
78  bool IsCheckboxChecked(const wxString& name);
79 
80  void FillComboboxWithCompilers(const wxString& name);
81  void FillContainerWithSelectCompilers( const wxString& name, const wxString& validCompilerIDs );
82  void AppendContainerWithSelectCompilers( const wxString& name, const wxString& validCompilerIDs );
83  wxString GetCompilerFromCombobox(const wxString& name);
84  void FillContainerWithCompilers(const wxString& name, const wxString& compilerID,
85  const wxString& validCompilerIDs);
86 
87  wxString GetComboboxStringSelection(const wxString& name);
88  int GetComboboxSelection(const wxString& name);
89  void SetComboboxSelection(const wxString& name, int sel);
90 
91  void SetComboboxValue(const wxString& name, const wxString& value);
92  wxString GetComboboxValue(const wxString& name);
93 
94  int GetRadioboxSelection(const wxString& name);
95  void SetRadioboxSelection(const wxString& name, int sel);
96 
97  int GetListboxSelection(const wxString& name);
98  wxString GetListboxSelections(const wxString& name);
99  wxString GetListboxStringSelections(const wxString& name);
100  void SetListboxSelection(const wxString& name, int sel);
101 
102  wxString GetCheckListboxChecked(const wxString& name);
103  wxString GetCheckListboxStringChecked(const wxString& name);
104  bool IsCheckListboxItemChecked(const wxString& name, unsigned int item);
105  void CheckCheckListboxItem(const wxString& name, unsigned int item, bool check);
106 
107  void SetTextControlValue(const wxString& name, const wxString& value);
108  wxString GetTextControlValue(const wxString& name);
109 
110  void SetSpinControlValue(const wxString& name, int value);
111  int GetSpinControlValue(const wxString& name);
112 
113  // project path page
114  wxString GetProjectPath();
115  wxString GetProjectName();
116  wxString GetProjectFullFilename();
117  wxString GetProjectTitle();
118 
119  // compiler page
120  wxString GetCompilerID();
121  bool GetWantDebug();
122  wxString GetDebugName();
123  wxString GetDebugOutputDir();
124  wxString GetDebugObjectOutputDir();
125  bool GetWantRelease();
126  wxString GetReleaseName();
127  wxString GetReleaseOutputDir();
128  wxString GetReleaseObjectOutputDir();
129 
130  // build target page
131  wxString GetTargetCompilerID();
132  bool GetTargetEnableDebug();
133  wxString GetTargetName();
134  wxString GetTargetOutputDir();
135  wxString GetTargetObjectOutputDir();
136 
137  // file path page
138  wxString GetFileName();
139  wxString GetFileHeaderGuard();
140  bool GetFileAddToProject();
141  int GetFileTargetIndex();
142  void SetFilePathSelectionFilter(const wxString& filter);
143 
144  // compiler defaults
145  void SetCompilerDefault(const wxString& defCompilerID);
146  void SetDebugTargetDefaults(bool wantDebug,
147  const wxString& debugName,
148  const wxString& debugOut,
149  const wxString& debugObjOut);
150  void SetReleaseTargetDefaults(bool wantRelease,
151  const wxString& releaseName,
152  const wxString& releaseOut,
153  const wxString& releaseObjOut);
154 
155  int FillContainerWithChoices( const wxString& name, const wxString& choices );
156  int AppendContainerWithChoices( const wxString& name, const wxString& choices );
157  wxString GetWizardScriptFolder(void);
158 
159  // pre-defined pages
160  void AddInfoPage(const wxString& pageId, const wxString& intro_msg);
161  void AddFilePathPage(bool showHeaderGuard);
162  void AddProjectPathPage();
163  void AddCompilerPage(const wxString& compilerID, const wxString& validCompilerIDs, bool allowCompilerChange = true, bool allowConfigChange = true);
164  void AddBuildTargetPage(const wxString& targetName, bool isDebug, bool showCompiler = false, const wxString& compilerID = wxEmptyString, const wxString& validCompilerIDs = _T("*"), bool allowCompilerChange = true);
165  void AddGenericSingleChoiceListPage(const wxString& pageName, const wxString& descr, const wxString& choices, int defChoice);
166  void AddGenericSelectPathPage(const wxString& pageId, const wxString& descr, const wxString& label, const wxString& defValue);
167  // XRC pages
168  void AddPage(const wxString& panelName);
169 
170  void Finalize();
171  void RegisterWizard();
172  wxString FindTemplateFile(const wxString& filename);
173  protected:
174  void OnAttach();
175  void Clear();
176  void CopyFiles(cbProject* theproject, const wxString& prjdir, const wxString& srcdir);
177  wxString GenerateFile(const wxString& basePath, const wxString& filename, const wxString& contents);
178 
179  Wizards m_Wizards;
181  WizPages m_Pages;
188 
189  // default compiler settings (returned if no compiler page is added in the wizard)
200  private:
201  Wiz(cb_unused const Wiz& rhs); // prevent copy construction
202 };
203 
204 #endif // WIZ_H
205 
wxString m_DebugObjOutputDir
Definition: wiz.h:194
wxString m_DefCompilerID
Definition: wiz.h:190
Definition: wiz.h:38
wxString m_ReleaseObjOutputDir
Definition: wiz.h:198
wxString m_DebugOutputDir
Definition: wiz.h:193
WizCompilerPanel * m_pWizCompilerPanel
Definition: wiz.h:184
wxString m_ReleaseOutputDir
Definition: wiz.h:197
TemplateOutputType output_type
Definition: wiz.h:26
WX_DECLARE_OBJARRAY(WizardInfo, Wizards)
#define _T(string)
bool m_WantDebug
Definition: wiz.h:191
WizPages m_Pages
Definition: wiz.h:181
wxString m_DebugName
Definition: wiz.h:192
Wiz & operator=(cb_unused const Wiz &rhs)
Definition: wiz.h:44
int m_LaunchIndex
Definition: wiz.h:186
wxBitmap wizardPNG
Definition: wiz.h:31
Represents a Code::Blocks project.
Definition: cbproject.h:96
wxString xrc
Definition: wiz.h:32
Definition: wiz.h:24
WizBuildTargetPanel * m_pWizBuildTargetPanel
Definition: wiz.h:185
WizProjectPathPanel * m_pWizProjectPathPanel
Definition: wiz.h:182
wxBitmap templatePNG
Definition: wiz.h:30
wxString wxEmptyString
WX_DEFINE_ARRAY(wxWizardPageSimple *, WizPages)
bool m_WantRelease
Definition: wiz.h:195
wxString title
Definition: wiz.h:27
TemplateOutputType
Template output types.
Definition: globals.h:145
#define cbThrow(message)
Definition: cbexception.h:42
wxWizard * m_pWizard
Definition: wiz.h:180
Wizards m_Wizards
Definition: wiz.h:179
Base class for wizard plugins.
Definition: cbplugin.h:967
wxString m_ReleaseName
Definition: wiz.h:196
wxString m_WizardScriptFolder
Definition: wiz.h:199
WizFilePathPanel * m_pWizFilePathPanel
Definition: wiz.h:183
wxString script
Definition: wiz.h:29
wxString m_LastXRC
Definition: wiz.h:187
wxString cat
Definition: wiz.h:28
Base class for build target classes Each Code::Blocks project consists of at least one target...