| 1 |
#ifndef __wxcrafter_plugin__ |
| 2 |
#define __wxcrafter_plugin__ |
| 3 |
|
| 4 |
#include "NewFormWizard.h" |
| 5 |
#include "Notebook.h" |
| 6 |
#include "cl_command_event.h" // clDebugEvent |
| 7 |
#include "import_dlg.h" |
| 8 |
#include "main.h" |
| 9 |
#include "plugin.h" |
| 10 |
|
| 11 |
class EventsEditorPane; |
| 12 |
class GUICraftMainPanel; |
| 13 |
class wxcTreeView; |
| 14 |
|
| 15 |
struct GeneratedClass { |
| 16 |
wxString classname; |
| 17 |
wxFileName derivedSource; |
| 18 |
wxFileName derivedHeader; |
| 19 |
|
| 20 |
void Clear() |
| 21 |
{ |
| 22 |
classname.Clear(); |
| 23 |
derivedSource.Clear(); |
| 24 |
derivedHeader.Clear(); |
| 25 |
} |
| 26 |
}; |
| 27 |
|
| 28 |
class wxCrafterPlugin : public IPlugin |
| 29 |
{ |
| 30 |
GUICraftMainPanel* m_mainPanel = nullptr; |
| 31 |
wxcTreeView* m_treeView = nullptr; |
| 32 |
wxMenuItem* m_separatorItem = nullptr; |
| 33 |
GeneratedClass m_generatedClassInfo; |
| 34 |
bool m_allEditorsClosing = false; |
| 35 |
bool m_addFileMenu = false; |
| 36 |
bool m_useFrame = true; |
| 37 |
MainFrame* m_mainFrame = nullptr; |
| 38 |
bool m_serverMode = false; |
| 39 |
wxFileName m_selectedFile; |
| 40 |
|
| 41 |
protected: |
| 42 |
wxMenu* DoCreateFolderMenu(); |
| 43 |
wxMenu* DoProjectMenu(); |
| 44 |
void DoUpdateDerivedClassEventHandlers(); |
| 45 |
bool DoReadFileContentAndPrompt(const wxFileName& fn, wxString& content, IEditor** editor); |
| 46 |
void DoWriteFileContent(const wxFileName& fn, const wxString& content, IEditor* editor); |
| 47 |
void DoGenerateCode(const NewFormDetails& fd); |
| 48 |
/** |
| 49 |
* @brief return true if the tab was created, false otherwise. |
| 50 |
* Note that this function only return true if the tab was allocated |
| 51 |
* by this function |
| 52 |
*/ |
| 53 |
bool DoShowDesigner(bool createIfNotExist = true); |
| 54 |
bool DoCreateVirtualFolder(const wxString& vdFullPath); |
| 55 |
void DoSelectWorkspaceTab(); |
| 56 |
void DoLoadAfterImport(ImportDlg::ImportFileData& data); |
| 57 |
void DoImportFB(const wxString& filename = ""); |
| 58 |
void DoInitDone(wxObject* obj = NULL); |
| 59 |
void DoLoadWxcProject(const wxFileName& filename); |
| 60 |
void UpdateFileNameInStatusBar(); |
| 61 |
|
| 62 |
protected: |
| 63 |
// Event handlers |
| 64 |
void OnInitDone(wxCommandEvent& e); |
| 65 |
void OnShowDesigner(wxCommandEvent& e); |
| 66 |
void OnReGenerateForProject(wxCommandEvent& e); |
| 67 |
void OnDesignerDelete(wxCommandEvent& e); |
| 68 |
void OnBitmapCodeGenerationCompleted(wxCommandEvent& e); |
| 69 |
void OnNewForm(wxCommandEvent& e); |
| 70 |
void OnOpenFile(clCommandEvent& e); |
| 71 |
void OnPageClosing(wxNotifyEvent& e); |
| 72 |
void OnProjectModified(wxCommandEvent& e); |
| 73 |
void OnProjectSynched(wxCommandEvent& e); |
| 74 |
void OnPageChanged(wxCommandEvent& e); |
| 75 |
void OnWorkspaceTabSelected(wxBookCtrlEvent& e); |
| 76 |
void OnDesignerItemSelected(wxCommandEvent& e); |
| 77 |
void OnWorkspaceClosed(clWorkspaceEvent& e); |
| 78 |
void OnBuildStarting(wxCommandEvent& e); |
| 79 |
void OnAllEditorsClosing(wxCommandEvent& e); |
| 80 |
void OnAllEditorsClosed(wxCommandEvent& e); |
| 81 |
void OnDebugStarting(clDebugEvent& e); |
| 82 |
void OnSave(wxCommandEvent& e); |
| 83 |
void OnSaveAll(clCommandEvent& e); |
| 84 |
void OnSaveProject(wxCommandEvent& e); |
| 85 |
void OnSaveProjectUI(wxUpdateUIEvent& e); |
| 86 |
void OnOpenProject(wxCommandEvent& e); |
| 87 |
void OnSettings(wxCommandEvent& e); |
| 88 |
void OnOpenProjectUI(wxUpdateUIEvent& e); |
| 89 |
void OnCloseProject(wxCommandEvent& e); |
| 90 |
void OnCloseProjectUI(wxUpdateUIEvent& e); |
| 91 |
void OnImportwxFBProject(wxCommandEvent& e); |
| 92 |
void OnImportwxSmith(wxCommandEvent& e); |
| 93 |
void OnImportXRC(wxCommandEvent& e); |
| 94 |
void OnDefineCustomControls(wxCommandEvent& e); |
| 95 |
void OnEditCustomControls(wxCommandEvent& e); |
| 96 |
void OnDeleteCustomControls(wxCommandEvent& e); |
| 97 |
void OnAbout(wxCommandEvent& e); |
| 98 |
void OnProjectLoaded(wxCommandEvent& e); |
| 99 |
void OnFileContextMenu(clContextMenuEvent& event); |
| 100 |
void OnVirtualFolderContextMenu(clContextMenuEvent& event); |
| 101 |
void OnProjectContextMenu(clContextMenuEvent& event); |
| 102 |
void OnImportFBProject(wxCommandEvent& event); |
| 103 |
void OnOpenWxcpProject(wxCommandEvent& event); |
| 104 |
void OnImportwxSmithProject(wxCommandEvent& event); |
| 105 |
void OnToggleView(clCommandEvent& event); |
| 106 |
void OnSaveUI(clCommandEvent& event); |
| 107 |
|
| 108 |
public: |
| 109 |
wxCrafterPlugin(IManager* manager, bool serverMode); |
| 110 |
~wxCrafterPlugin(); |
| 111 |
|
| 112 |
MainFrame* GetMainFrame() const { return m_mainFrame; } |
| 113 |
|
| 114 |
//-------------------------------------------- |
| 115 |
// Abstract methods |
| 116 |
//-------------------------------------------- |
| 117 |
virtual void CreateToolBar(clToolBarGeneric* toolbar); |
| 118 |
virtual void CreatePluginMenu(wxMenu* pluginsMenu); |
| 119 |
virtual void UnPlug(); |
| 120 |
|
| 121 |
IManager* GetManager() { return m_mgr; } |
| 122 |
bool IsTabMode() const { return !m_mainFrame; } |
| 123 |
|
| 124 |
bool IsMainViewActive(); |
| 125 |
}; |
| 126 |
|
| 127 |
#endif //__wxcrafter_plugin__ |