Code::Blocks  SVN r11506
app.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 CODEBLOCKS_APP_H
7 #define CODEBLOCKS_APP_H
8 
9 #include <wx/wxprec.h>
10 
11 #ifdef __BORLANDC__
12  #pragma hdrstop
13 #endif
14 
15 #if !defined(WX_PRECOMP)
16  #include <wx/wx.h>
17  #include <wx/intl.h>
18  #include <wx/laywin.h>
19  #include <wx/image.h>
20  #include <wx/filename.h>
21  #include <wx/hashmap.h>
22  #include <wx/docview.h> // recent files history
23 #endif
24 
25 #if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__) || defined(__WXMGL__) || defined(__WXX11__)
26  #include "resources/icons/app.xpm"
27 #endif
28 
29 #include <wx/taskbar.h>
30 #include <wx/splash.h>
31 #include <wx/snglinst.h>
32 #include "manager.h"
33 #include "main.h"
34 
105 class cbSplashScreen;
106 
107 class CodeBlocksApp : public wxApp
108 {
109  public:
110  virtual bool OnInit();
111  virtual int OnExit();
112  virtual int OnRun();
113  wxString GetAppPath() const;
114  int ParseCmdLine(MainFrame* handlerFrame, const wxString& CmdLine = wxEmptyString);
115  void OnAppActivate(wxActivateEvent& event);
116  bool OnCmdLineParsed(wxCmdLineParser& parser);
117  void OnFatalException();
118  void LoadDelayedFiles(MainFrame* frame); // command line or DDE (if available) files
119  void SetAutoFile(wxString& file); // method to set m_AutoFile
120  void AttachDebugger();
121 #ifdef __WXMAC__
122  // in response of an open-document apple event
123  virtual void MacOpenFile(const wxString &fileName) ;
124  // in response of a print-document apple event
125  virtual void MacPrintFile(const wxString &fileName) ;
126 #endif
127  void AddFileToOpenDelayed(const wxString& filename);
128  protected:
129  void OnBatchBuildDone(CodeBlocksEvent& event);
131  bool LoadConfig();
132  void InitDebugConsole();
133  void InitExceptionHandler();
134  bool InitXRCStuff();
135  MainFrame* InitFrame();
136  void CheckVersion();
137  void InitLocale();
138  int BatchJob();
139  wxLocale m_locale; // locale we'll be using
141  private:
142  void SetupPersonality(const wxString& personality);
143 
144 
145  wxString m_Prefix; // directory specified in --prefix switch
146  wxString m_UserDataDir; // directory specified in --user-data-dir switch
149  wxString m_AutoFile; // --file foo.cpp[:line]
152 
156 
157  bool m_Batch;
159  bool m_BatchWindowAutoClose; // default: true
160  bool m_Build;
161  bool m_ReBuild;
162  bool m_Clean;
165  bool m_Splash; // splash screen enabled
166  bool m_HasDebugLog; // display debug log
167  bool m_CrashHandler; // crash handler enabled
168  bool m_SafeMode; // all plugins disabled
169 
170  void InitAssociations();
171 
172  bool m_DDE; // DDE enabled?
173 #ifdef __WXMSW__
174  bool m_Assocs; // associations check enabled
175 #endif
177 
178  DECLARE_EVENT_TABLE()
179 };
180 
182 
183 #endif // CODEBLOCKS_APP_H
Definition: main.h:60
bool m_DDE
Definition: app.h:172
bool m_HasProject
Definition: app.h:163
void OnAppActivate(wxActivateEvent &event)
Definition: app.cpp:1409
bool m_CrashHandler
Definition: app.h:167
wxString GetAppPath() const
Definition: app.cpp:1065
wxString m_BatchTarget
Definition: app.h:147
wxString m_DebuggerAttach
Definition: app.h:150
int m_BatchExitCode
Definition: app.h:176
void InitExceptionHandler()
Definition: app.cpp:472
void LoadDelayedFiles(MainFrame *frame)
Definition: app.cpp:1240
virtual void MacOpenFile(const wxString &fileName)
bool m_ReBuild
Definition: app.h:161
void InitDebugConsole()
Definition: app.cpp:457
wxString m_DebuggerConfig
Definition: app.h:151
A generic Code::Blocks event.
Definition: sdk_events.h:20
virtual int OnRun()
Definition: app.cpp:865
wxString m_Prefix
Definition: app.h:145
void SetAutoFile(wxString &file)
Definition: app.cpp:1102
virtual int OnExit()
Definition: app.cpp:820
int BatchJob()
Definition: app.cpp:914
void SetupPersonality(const wxString &personality)
Definition: app.cpp:1223
MainFrame * m_Frame
Definition: app.h:154
void InitAssociations()
Definition: app.cpp:425
void AddFileToOpenDelayed(const wxString &filename)
Definition: app.cpp:1460
bool m_Clean
Definition: app.h:162
bool OnCmdLineParsed(wxCmdLineParser &parser)
Definition: app.cpp:894
MainFrame * InitFrame()
Definition: app.cpp:501
int ParseCmdLine(MainFrame *handlerFrame, const wxString &CmdLine=wxEmptyString)
Definition: app.cpp:1107
wxString wxEmptyString
virtual void MacPrintFile(const wxString &fileName)
bool m_Splash
Definition: app.h:165
bool m_BatchNotify
Definition: app.h:158
void OnTBIconLeftDown(wxTaskBarIconEvent &event)
Definition: app.cpp:1055
bool LoadConfig()
wxLocale m_locale
Definition: app.h:139
bool m_HasDebugLog
Definition: app.h:166
wxSingleInstanceChecker * m_pSingleInstance
Definition: app.h:155
void OnFatalException()
Definition: app.cpp:899
wxString m_UserDataDir
Definition: app.h:146
bool InitXRCStuff()
Definition: app.cpp:479
bool m_BatchWindowAutoClose
Definition: app.h:159
wxScrollingDialog * m_pBatchBuildDialog
Definition: app.h:153
wxArrayString m_DelayedFilesToOpen
Definition: app.h:140
DECLARE_APP(CodeBlocksApp)
wxString m_Script
Definition: app.h:148
void CheckVersion()
Definition: app.cpp:515
bool m_Build
Definition: app.h:160
bool m_Batch
Definition: app.h:157
bool m_SafeMode
Definition: app.h:168
virtual bool OnInit()
Definition: app.cpp:572
bool m_HasWorkSpace
Definition: app.h:164
void OnBatchBuildDone(CodeBlocksEvent &event)
Definition: app.cpp:1018
void InitLocale()
Definition: app.cpp:524
wxString m_AutoFile
Definition: app.h:149
bool m_Assocs
Definition: app.h:174
void AttachDebugger()
Definition: app.cpp:1289