Version: 0.6.0
command.h
1 /******************************************************************************
2  * Project: wxGIS (GIS Catalog)
3  * Purpose: wxGISCommonCmd class.
4  * Author: Dmitry Baryshnikov (aka Bishop), polimax@mail.ru
5  ******************************************************************************
6 * Copyright (C) 2009,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 
25 #define NO_CATEGORY wxString(_("[No category]"))
26 
27 class WXDLLIMPEXP_GIS_FRW wxGISApplicationBase;
34 enum wxGISEnumCommandKind
35 {
36  enumGISCommandSeparator = wxITEM_SEPARATOR,
37  enumGISCommandNormal = wxITEM_NORMAL,
38  enumGISCommandCheck = wxITEM_CHECK,
39  enumGISCommandRadio = wxITEM_RADIO,
40  enumGISCommandMax = wxITEM_MAX,
41  enumGISCommandMenu = wxITEM_MAX + 10,
42  enumGISCommandControl,
43  enumGISCommandDropDown
44 };
45 
53 class WXDLLIMPEXP_GIS_FRW wxGISCommand : public wxObject
54 {
55  //DECLARE_ABSTRACT_CLASS(wxGISCommand)
56 public:
60  wxGISCommand(void);
64  virtual ~wxGISCommand(void);
65  //pure virtual
66  virtual wxIcon GetBitmap(void) = 0;
67  virtual wxString GetCaption(void) = 0;
68  virtual wxString GetCategory(void) = 0;
69  virtual bool GetChecked(void) = 0;
70  virtual bool GetEnabled(void) = 0;
71  virtual wxString GetMessage(void) = 0;
72  virtual wxGISEnumCommandKind GetKind(void) = 0;
73  virtual void OnClick(void) = 0;
74  virtual bool OnCreate(wxGISApplicationBase* pApp) = 0;
75  virtual wxString GetTooltip(void) = 0;
76  virtual unsigned char GetCount(void) = 0;
77  virtual void SetId(long nId);
78  virtual long GetId(void) const;
79  //
80  virtual void SetSubType(unsigned char SubType);
81  virtual unsigned char GetSubType(void) const;
82 protected:
83  unsigned char m_subtype;
84  long m_CommandId;
85 };
86 
90 WX_DEFINE_ARRAY_PTR(wxGISCommand*, wxCommandPtrArray);
91 
93 {
94 public:
98  virtual ~IToolBarControl(void) {};
99  virtual void Activate(wxGISApplicationBase* pApp) = 0;
100  virtual void Deactivate(void) = 0;
101 };
102 
111 {
112 public:
116  virtual ~IToolControl(void) {};
117  virtual IToolBarControl* GetControl(void) = 0;
118  virtual wxString GetToolLabel(void) = 0;
119  virtual bool HasToolLabel(void) = 0;
120 };
121 
128 class ITool :
129  public wxGISCommand
130 {
131 public:
135  virtual ~ITool(void) {};
136  virtual void SetChecked(bool bCheck) = 0;
137  virtual wxCursor GetCursor(void) = 0;
138  virtual void OnMouseDown(wxMouseEvent& event) = 0;
139  virtual void OnMouseUp(wxMouseEvent& event) = 0;
140  virtual void OnMouseMove(wxMouseEvent& event) = 0;
141  virtual void OnMouseDoubleClick(wxMouseEvent& event) = 0;
142 };
143 
152 {
153 public:
157  virtual ~IDropDownCommand(void) {};
162  virtual wxMenu* GetDropDownMenu(void) = 0;
167  virtual void OnDropDownCommand(int nID) = 0;
168 };
169 
170 enum wxGISEnumCommonCmdType{
171  enumGISCommonCmdExit = 0, // 0 Exit
172  enumGISCommonCmdAbout, // 1 About
173  enumGISCommonCmdCustomize, // 2 Customize
174  enumGISCommonCmdSeparator, // 3 Separator
175  enumGISCommonCmdStatusBar, // 4 StatusBar
176  enumGISCommonCmdOptions, // 5 Options
177  enumGISCommonCmdFitToolbars,// 6 FitToolbars
178  enumGISCommonCmdOptimizeToolbars, // 7 OptimizeToolbars
179  enumGISCommonCmdMax
180 };
181 
183  public wxGISCommand
184 {
185  DECLARE_DYNAMIC_CLASS(wxGISCommonCmd)
186 
187 public:
188  wxGISCommonCmd(void);
189  virtual ~wxGISCommonCmd(void);
190  //wxGISCommand
191  virtual wxIcon GetBitmap(void);
192  virtual wxString GetCaption(void);
193  virtual wxString GetCategory(void);
194  virtual bool GetChecked(void);
195  virtual bool GetEnabled(void);
196  virtual wxString GetMessage(void);
197  virtual wxGISEnumCommandKind GetKind(void);
198  virtual void OnClick(void);
199  virtual bool OnCreate(wxGISApplicationBase* pApp);
200  virtual wxString GetTooltip(void);
201  virtual unsigned char GetCount(void);
202 private:
203  wxGISApplicationBase* m_pApp;
204  wxIcon m_IconOpt;
205 };
206 
virtual ~IToolBarControl(void)
A destructor.
Definition: command.h:98
virtual ~IToolControl(void)
A destructor.
Definition: command.h:116
Definition: command.h:110
Definition: applicationbase.h:65
virtual wxMenu * GetDropDownMenu(void)=0
Return DropDown Menu to show under button.
Definition: command.h:157
Definition: command.h:128
Definition: command.h:53
virtual ~ITool(void)
A destructor.
Definition: command.h:135
virtual ~IDropDownCommand(void)
A destructor.
Definition: command.h:157
Definition: command.h:92
Definition: command.h:151
Definition: command.h:182
virtual void OnDropDownCommand(int nID)=0
Execute the DropDown menu command.