Version: 0.6.0
applicationbase.h
1 /******************************************************************************
2  * Project: wxGIS
3  * Purpose: wxGISApplicationBase class. Base application functionality (commands, menues, etc.)
4  * Author: Dmitry Baryshnikov (aka Bishop), polimax@mail.ru
5  ******************************************************************************
6 * Copyright (C) 2012 Dmitry Baryshnikov
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  ****************************************************************************/
21 #pragma once
22 
23 #include "wxgis/framework/framework.h"
24 #include "wxgis/core/app.h"
25 #include "wxgis/framework/commandbar.h"
26 #include "wxgis/framework/menubar.h"
27 
28 #include <wx/window.h>
29 #include <wx/dynarray.h>
30 #include <set>
31 
32 
41 enum wxGISPluginIDs
42 {
43  ID_PLUGINCMD = wxID_HIGHEST + 2001,
44  ID_PLUGINCMDMAX = ID_PLUGINCMD + 255,
45  ID_TOOLBARCMD = ID_PLUGINCMDMAX + 1,
46  ID_TOOLBARCMDMAX = ID_TOOLBARCMD + 255,
47  ID_MENUCMD = ID_TOOLBARCMDMAX + 1,
48  ID_MENUCMDMAX = ID_MENUCMD + 255
49 };
50 
57 typedef wxArrayInt WINDOWARRAY;
58 
65 class WXDLLIMPEXP_GIS_FRW wxGISApplicationBase : public IApplication
66 {
67  DECLARE_CLASS(wxGISApplicationBase)
68 public:
70  virtual ~wxGISApplicationBase();
71  virtual wxGISCommandBarPtrArray GetCommandBars(void) const;
72  virtual wxCommandPtrArray GetCommands(void) const;
73  virtual wxGISCommandBar* GetCommandBar(const wxString &sName) const;
74  virtual void RemoveCommandBar(wxGISCommandBar* pBar);
75  virtual bool AddCommandBar(wxGISCommandBar* pBar);
76  virtual void Customize(void){};
77  virtual void FitToolbars(void){};
78  virtual void OptimizeToolbars(void){};
79  virtual wxIcon GetAppIcon(void){return wxNullIcon;};
80  virtual wxGISCommand* GetCommand(long CmdID) const;
81  virtual wxGISCommand* GetCommand(const wxString &sCmdName, unsigned char nCmdSubType) const;
82  virtual wxGISStatusBar* GetStatusBar(void) const{return NULL;};
83  virtual void ShowStatusBar(bool bShow){};
84  virtual bool IsStatusBarShown(void){return false;};
85  virtual void ShowToolBarMenu(void){};
86  virtual wxGISMenuBar* GetGISMenuBar(void) const;
87  virtual void ShowApplicationWindow(wxWindow* pWnd, bool bShow = true){};
88  virtual bool IsApplicationWindowShown(wxWindow* pWnd){return true;};
89  virtual WINDOWARRAY GetChildWindows(void) const{return m_anWindowsIDs;};
90  virtual void RegisterChildWindow(wxWindowID nWndID);
91  virtual void UnRegisterChildWindow(wxWindowID nWndID);
92  virtual wxWindow* GetRegisteredWindowByType(const wxClassInfo * info) const;
93  virtual void Command(wxGISCommand* pCmd);
94  //IApplication
95  virtual wxString GetAppName(void) const{return wxEmptyString;};
96  virtual wxString GetAppVersionString(void) const{return wxEmptyString;};
97  virtual void OnAppAbout(void){};
98  virtual void OnAppOptions(void){};
99  virtual bool CreateApp(void);
100  virtual bool SetupLog(const wxString &sLogPath, const wxString &sNamePrefix = wxEmptyString){return true;};
101  virtual bool SetupLoc(const wxString &sLoc, const wxString &sLocPath){return true;};
102  virtual wxString GetDecimalPoint(void) const {return wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT, wxLOCALE_CAT_NUMBER);};
103  virtual bool SetupSys(const wxString &sSysPath){return true;};
104  virtual void SetDebugMode(bool bDebugMode){};
105  //events
106  virtual void OnMouseDown(wxMouseEvent& event);
107  virtual void OnMouseUp(wxMouseEvent& event);
108  virtual void OnMouseDoubleClick(wxMouseEvent& event);
109  virtual void OnMouseMove(wxMouseEvent& event);
110 protected:
111  virtual void LoadCommands(wxXmlNode* pRootNode);
112  virtual void LoadMenues(wxXmlNode* pRootNode);
113 protected:
114  wxCommandPtrArray m_CommandArray;
115  wxGISCommandBarPtrArray m_CommandBarArray;
116  ITool* m_CurrentTool;
117  wxGISMenuBar* m_pMenuBar;
118  WINDOWARRAY m_anWindowsIDs;
119 };
120 
127 void WXDLLIMPEXP_GIS_FRW wxGISErrorMessageBox(const wxString& sAppErr, const wxString &sLibError = wxEmptyString, const wxString &sLibErrorPrepend = wxEmptyString);
Definition: applicationbase.h:65
Definition: menubar.h:42
Definition: command.h:128
Definition: command.h:53
Definition: commandbar.h:60
Definition: statusbar.h:58
Definition: app.h:32