Version: 0.6.0
customizedlg.h
1 /******************************************************************************
2  * Project: wxGIS (GIS Catalog)
3  * Purpose: customize dialog class. Customize menues & toolbars
4  * Author: Dmitry Baryshnikov (aka Bishop), polimax@mail.ru
5  ******************************************************************************
6  * Copyright (C) 2009,2011-2014 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/framework/applicationex.h"
25 
26 #include "wx/intl.h"
27 
28 #include "wx/gdicmn.h"
29 #include "wx/aui/auibook.h"
30 #include "wx/font.h"
31 #include "wx/colour.h"
32 #include "wx/settings.h"
33 #include "wx/string.h"
34 #include "wx/sizer.h"
35 #include "wx/button.h"
36 #include "wx/dialog.h"
37 #include "wx/splitter.h"
38 #include "wx/checklst.h"
39 #include "wx/listctrl.h"
40 #include "wx/treectrl.h"
41 #include "wx/panel.h"
42 
49 class wxBarTreeItemData : public wxTreeItemData
50 {
51 public:
53  {
54  m_pBar = pBar;
55  }
56 
57  ~wxBarTreeItemData(void)
58  {
59  }
60 
61  wxGISCommandBar* m_pBar;
62 };
63 
70 class wxGISToolBarPanel : public wxPanel
71 {
72  enum
73  {
74  //ID_CHKLSTBX = wxID_HIGHEST + 30,
75  ID_TREECTRL = wxID_HIGHEST + 3010,
76  ID_BUTTONSLST,
77  ID_ONSETKEYCODE,
78  ID_CREATECB,
79  ID_DELETECB,
80  ID_ADDBUTTON,
81  ID_REMOVEBUTTON,
82  ID_MOVECONTROLUP,
83  ID_MOVECONTROLDOWN
84  };
85 public:
86  wxGISToolBarPanel(wxGISApplicationEx* pApp, wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
88  void SplitterOnIdle( wxIdleEvent& )
89  {
90  m_Splitter->SetSashPosition( m_nSashPos );
91  m_Splitter->Unbind( wxEVT_IDLE, &wxGISToolBarPanel::SplitterOnIdle, this );
92  //m_Splitter->Disconnect( wxEVT_IDLE, wxIdleEventHandler( wxGISToolBarPanel::SplitterOnIdle ), NULL, this );
93  }
94  //events
95  void OnSelChanged(wxTreeEvent& event);
96  //void OnListboxSelect(wxCommandEvent& event);
97  void OnDoubleClickSash(wxSplitterEvent& event);
98  //void OnCheckboxToggle(wxCommandEvent& event);
99  void OnListctrlActivated(wxListEvent& event);
100  void OnListctrlRClick(wxListEvent& event);
101  void OnSetKeyCode(wxCommandEvent& event);
102  void OnUpdateUI(wxUpdateUIEvent& event);
103  void OnCreateCommandBar(wxCommandEvent& event);
104  void OnDeleteCommandBar(wxCommandEvent& event);
105  void OnAddButton(wxCommandEvent& event);
106  void OnRemoveButton(wxCommandEvent& event);
107  void OnMoveUp(wxCommandEvent& event);
108  void OnMoveDown(wxCommandEvent& event);
109  void OnLeftDown(wxMouseEvent& event);
110 
111  void SetKeyCode(int pos);
112  long GetSelectedCommandItem(void);
113  void LoadCommands(void);
114 //private:
115 // COMMANDBARARRAY m_CategoryArray;
116 protected:
117  wxSplitterWindow* m_Splitter;
118  //wxCheckListBox* m_commandbarlist;
119  wxTreeCtrl* m_pTreeCtrl;
120  wxListView* m_buttonslist;
121  wxButton* m_createbutton;
122  wxButton* m_deletebutton;
123  wxButton* m_addbutton;
124  wxButton* m_rembutton;
125  wxButton* m_moveup;
126  wxButton* m_movedown;
127  wxGISApplicationEx* m_pApp;
128  wxImageList m_ImageList, m_TreeImageList;
129  wxMenu* m_pContextMenu;
130  bool m_bToolsFocus, m_bCmdFocus;
131  //int m_nContextMenuPos, m_nMenubarPos, m_nToolbarPos;
132  wxTreeItemId m_nMenubarId, m_nContextMenuesId, m_nNewMenuesId, m_nToolBarsId;
133 protected:
134  virtual void SerializePanel(bool bSave = false);
135 protected:
136  int m_nSashPos;
137 private:
138  DECLARE_EVENT_TABLE()
139 };
140 
147 class wxGISCommandPanel : public wxPanel
148 {
149  enum
150  {
151  ID_LSTBX = wxID_HIGHEST + 2501,
152  ID_LSTCTRL,
153  ID_ONSETKEYCODE
154  };
155 public:
156  typedef std::map<wxString, wxCommandPtrArray> CATEGORYMAP;
157 
158 private:
159  CATEGORYMAP m_CategoryMap;
160 
161 protected:
162  wxSplitterWindow* m_splitter2;
163  wxListBox* m_listBox1;
164  wxListCtrl* m_listCtrl3;
165  wxGISApplicationEx* m_pApp;
166  wxImageList m_ImageList;
167  wxMenu* m_pContextMenu;
168  int m_CurSelection;
169 
170 public:
171  wxGISCommandPanel(wxGISApplicationEx* pApp, wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
173  void m_splitter2OnIdle( wxIdleEvent& )
174  {
175  m_splitter2->SetSashPosition( m_nSashPos );
176  m_splitter2->Unbind( wxEVT_IDLE, &wxGISCommandPanel::m_splitter2OnIdle, this );
177  //m_splitter2->Disconnect( wxEVT_IDLE, wxIdleEventHandler( wxGISCommandPanel::m_splitter2OnIdle ), NULL, this );
178  }
179  //events
180  void OnListboxSelect(wxCommandEvent& event);
181  void OnDoubleClickSash(wxSplitterEvent& event);
182  void OnListctrlActivated(wxListEvent& event);
183  void OnListctrlRClick(wxListEvent& event);
184  void OnSetKeyCode(wxCommandEvent& event);
185 
186  void SetKeyCode(int pos);
187 protected:
188  virtual void SerializePanel(bool bSave = false);
189 protected:
190  int m_nSashPos;
191 private:
192  DECLARE_EVENT_TABLE()
193 };
194 
201 class WXDLLIMPEXP_GIS_FRW wxGISCustomizeDlg : public wxDialog
202 {
203 public:
204  wxGISCustomizeDlg( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Customize"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER );
206  //events
207  virtual void EndModal (int retCode);
208 protected:
209  virtual void SerializeFramePos(bool bSave = false);
210 protected:
211  wxAuiNotebook* m_AuiNotebook;
212  wxStdDialogButtonSizer* m_sdbSizer;
213  wxButton* m_sdbSizerOK;
214  //wxButton* m_sdbSizerCancel;
215  wxGISApplicationEx* m_pApp;
216 };
217 
Definition: customizedlg.h:70
Definition: customizedlg.h:201
Definition: commandbar.h:60
wxGISToolBarPanel(wxGISApplicationEx *pApp, wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
Class wxGISToolBarPanel.
Definition: customizedlg.cpp:52
wxGISCommandPanel(wxGISApplicationEx *pApp, wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
Class wxGISCommandPanel.
Definition: customizedlg.cpp:668
Definition: customizedlg.h:49
Definition: applicationex.h:61
Definition: customizedlg.h:147