1 
2 ///////////////////////////////////////////////////////////
3 //                                                       //
4 //                         SAGA                          //
5 //                                                       //
6 //      System for Automated Geoscientific Analyses      //
7 //                                                       //
8 //                    User Interface                     //
9 //                                                       //
10 //                    Program: SAGA                      //
11 //                                                       //
12 //-------------------------------------------------------//
13 //                                                       //
14 //                  dlg_table_control.h                  //
15 //                                                       //
16 //          Copyright (C) 2015 by Olaf Conrad            //
17 //                                                       //
18 //-------------------------------------------------------//
19 //                                                       //
20 // This file is part of 'SAGA - System for Automated     //
21 // Geoscientific Analyses'. SAGA is free software; you   //
22 // can redistribute it and/or modify it under the terms  //
23 // of the GNU General Public License as published by the //
24 // Free Software Foundation, either version 2 of the     //
25 // License, or (at your option) any later version.       //
26 //                                                       //
27 // SAGA is distributed in the hope that it will be       //
28 // useful, but WITHOUT ANY WARRANTY; without even the    //
29 // implied warranty of MERCHANTABILITY or FITNESS FOR A  //
30 // PARTICULAR PURPOSE. See the GNU General Public        //
31 // License for more details.                             //
32 //                                                       //
33 // You should have received a copy of the GNU General    //
34 // Public License along with this program; if not, see   //
35 // <http://www.gnu.org/licenses/>.                       //
36 //                                                       //
37 //-------------------------------------------------------//
38 //                                                       //
39 //    contact:    Olaf Conrad                            //
40 //                Institute of Geography                 //
41 //                University of Hamburg                  //
42 //                Germany                                //
43 //                                                       //
44 //    e-mail:     oconrad@saga-gis.org                   //
45 //                                                       //
46 ///////////////////////////////////////////////////////////
47 
48 //---------------------------------------------------------
49 #ifndef _HEADER_INCLUDED__SAGA_GUI__dlg_table_control_H
50 #define _HEADER_INCLUDED__SAGA_GUI__dlg_table_control_H
51 
52 
53 ///////////////////////////////////////////////////////////
54 //														 //
55 //														 //
56 //														 //
57 ///////////////////////////////////////////////////////////
58 
59 //---------------------------------------------------------
60 #include <wx/grid.h>
61 
62 
63 ///////////////////////////////////////////////////////////
64 //														 //
65 //														 //
66 //														 //
67 ///////////////////////////////////////////////////////////
68 
69 //---------------------------------------------------------
70 class CDLG_Table_Control : public wxGrid
71 {
72 	DECLARE_CLASS(CDLG_Table_Control)
73 
74 public:
75 	CDLG_Table_Control(wxWindow *pParent, class CSG_Table *pTable);
76 	virtual ~CDLG_Table_Control(void);
77 
Get_Table(void)78 	CSG_Table &					Get_Table			(void)	{	return( m_Table );	}
79 
80 	bool						Load				(void);
81 	bool						Save				(void);
82 
83 	bool						Update_Table		(void);
84 	bool						Update_Selection	(void);
85 
86 	bool						Add_Record			(void);
87 	bool						Ins_Record			(void);
88 	bool						Del_Record			(void);
89 	bool						Del_Records			(void);
90 
91 
92 protected:
93 
94 //	void						On_Selecting		(wxGridRangeSelectEvent &event);
95 	void						On_Selected			(wxGridRangeSelectEvent &event);
96 
97 	void						On_Changed			(wxGridEvent     &event);
98 
99 	void						On_LClick			(wxGridEvent     &event);
100 	void						On_LDClick			(wxGridEvent     &event);
101 	void						On_LClick_Label		(wxGridEvent     &event);
102 	void						On_LDClick_Label	(wxGridEvent     &event);
103 
104 	void						On_RClick			(wxGridEvent     &event);
105 	void						On_RClick_Label		(wxGridEvent     &event);
106 
107 	void						On_Autosize_Cols	(wxCommandEvent  &event);
108 	void						On_Autosize_Rows	(wxCommandEvent  &event);
109 
110 	void						On_Cell_Open		(wxCommandEvent  &event);
111 
112 	void						On_Record_Add		(wxCommandEvent  &event);
113 	void						On_Record_Add_UI	(wxUpdateUIEvent &event);
114 	void						On_Record_Ins		(wxCommandEvent  &event);
115 	void						On_Record_Ins_UI	(wxUpdateUIEvent &event);
116 	void						On_Record_Del		(wxCommandEvent  &event);
117 	void						On_Record_Del_UI	(wxUpdateUIEvent &event);
118 	void						On_Record_Clr		(wxCommandEvent  &event);
119 	void						On_Record_Clr_UI	(wxUpdateUIEvent &event);
120 
121 	void						On_Field_Sort		(wxCommandEvent  &event);
122 	void						On_Field_Sort_UI	(wxUpdateUIEvent &event);
123 
124 
125 private:
126 
127 	int							m_LUT_Type;
128 
129 	CSG_Table					m_Table;
130 
131 	class CVIEW_Table_Data		*m_pData;
132 
133 
134 	bool						_Update_Records		(void);
135 	bool						_Update_Selection	(void);
136 
137 
138 	//-----------------------------------------------------
139 	DECLARE_EVENT_TABLE()
140 };
141 
142 
143 ///////////////////////////////////////////////////////////
144 //														 //
145 //														 //
146 //														 //
147 ///////////////////////////////////////////////////////////
148 
149 //---------------------------------------------------------
150 #endif // #ifndef _HEADER_INCLUDED__SAGA_GUI__dlg_table_control_H
151