1 /*
2 * This file is part of wxSmith plugin for Code::Blocks Studio
3 * Copyright (C) 2006-2007  Bartlomiej Swiecki
4 *
5 * wxSmith is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * wxSmith is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with wxSmith. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * $Revision: 10684 $
19 * $Id: wxwidgetsguiappadoptingdlg.h 10684 2016-01-22 10:49:37Z mortenmacfly $
20 * $HeadURL: svn://svn.code.sf.net/p/codeblocks/code/branches/release-20.xx/src/plugins/contrib/wxSmith/wxwidgets/wxwidgetsguiappadoptingdlg.h $
21 */
22 
23 #ifndef WXWIDGETSGUIAPPADOPTINGDLG_H
24 #define WXWIDGETSGUIAPPADOPTINGDLG_H
25 
26 //(*Headers(wxWidgetsGUIAppAdoptingDlg)
27 #include <wx/sizer.h>
28 #include <wx/stattext.h>
29 #include <wx/listbox.h>
30 #include <wx/statline.h>
31 #include <wx/button.h>
32 #include "scrollingdialog.h"
33 #include <wx/gauge.h>
34 //*)
35 
36 #include <wx/timer.h>
37 #include <projectfile.h>
38 
39 class wxWidgetsGUI;
40 
41 /** \brief Dialog used when adopting wxApp class
42  * \note most of work while scanning sources and
43  *       adding wxApp support is done in wxGUI class
44  *       actually, this dialog is only to represent
45  *       results and get user choice what to do after
46  *       scanning
47  */
48 class wxWidgetsGUIAppAdoptingDlg: public wxScrollingDialog
49 {
50     public:
51 
52         wxWidgetsGUIAppAdoptingDlg(wxWindow* parent,wxWidgetsGUI* GUI,wxWindowID id = -1);
53         virtual ~wxWidgetsGUIAppAdoptingDlg();
54 
55         //(*Identifiers(wxWidgetsGUIAppAdoptingDlg)
56         static const long ID_LISTBOX1;
57         static const long ID_GAUGE1;
58         static const long ID_STATICTEXT1;
59         static const long ID_STATICTEXT2;
60         static const long ID_BUTTON5;
61         static const long ID_BUTTON2;
62         static const long ID_BUTTON3;
63         static const long ID_STATICLINE2;
64         static const long ID_BUTTON4;
65         static const long ID_STATICLINE1;
66         static const long ID_BUTTON6;
67         //*)
68 
69         wxString m_RelativeFileName;
70 
71     protected:
72 
73         //(*Handlers(wxWidgetsGUIAppAdoptingDlg)
74         void OnButton6Click(wxCommandEvent& event);
75         void OnButton4Click(wxCommandEvent& event);
76         void OnClose(wxCloseEvent& event);
77         void OnTimer(wxTimerEvent& event);
78         void OnUseFileBtnClick(wxCommandEvent& event);
79         void OnSelectBtnClick(wxCommandEvent& event);
80         void OnCreateBtnClick(wxCommandEvent& event);
81         //*)
82 
83         //(*Declarations(wxWidgetsGUIAppAdoptingDlg)
84         wxButton* Button4;
85         wxButton* CreateBtn;
86         wxBoxSizer* BoxSizer2;
87         wxStaticLine* StaticLine2;
88         wxButton* Button6;
89         wxButton* SelectBtn;
90         wxStaticLine* StaticLine1;
91         wxButton* UseFileBtn;
92         wxGauge* Progress;
93         wxStaticText* ScanningFile;
94         wxStaticText* ScanningTxt;
95         wxListBox* FoundFiles;
96         //*)
97 
98     private:
99 
100         /** \brief Starting scanning of files
101          *  \note This function creates it's own
102          *        event-dispatching loop while searching inside files
103          */
104         void Run();
105 
106         /** \brief Scanning one file
107          *  \return true when file can be used as wxApp container, false otherwise
108          */
109         bool ScanFile(ProjectFile* File);
110 
111         /** \brief Adding smith bindings for given file */
112         void AddSmith(wxString RelativeFileName);
113 
114         cbProject* m_Project;       ///< \brief Helper pointer to C::B project
115         wxWidgetsGUI* m_GUI;        ///< \brief GUI which has requested the scan
116         wxTimer m_Timer;            ///< \brief Timer used to call Run() after dialog is shown
117         bool m_Run;                 ///< \brief Flag used to break scanning of files after closing dialog
118 
119         DECLARE_EVENT_TABLE()
120 };
121 
122 #endif
123