ToolMap
Loading...
Searching...
No Matches
objectdefinitionlistdlg.h
1/***************************************************************************
2 objectdefinitionlistdlg.h
3 Contain description of class used for ProjectEditObjectDefinitionDLG
4 -------------------
5 copyright : (C) 2007 CREALP Lucien Schreiber
6 ***************************************************************************/
7
8/***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17#ifndef _OBJECTDEFINITIONLISTDLG_H_
18#define _OBJECTDEFINITIONLISTDLG_H_
19
20#include <wx/statline.h>
21#include <wx/valtext.h>
22
23#include "../core/prjdefmemmanage.h"
24#include "../core/projectdefmemory.h"
25#include "../core/tmvalidator.h" // for controls validation
26#include "listgenreport_status.h" // for list with status
27
28class DataBaseTM;
29
30#define ID_OBJECTDEFINITIONLISTDLG 10030
31#define ID_DLGODD_LIST_LYR_NAME 10265
32#define ID_DLGODD_FREQUENCY 10266
33#define SYMBOL_OBJECTDEFINITIONLISTDLG_STYLE wxCAPTION | wxRESIZE_BORDER | wxSYSTEM_MENU | wxCLOSE_BOX | wxTAB_TRAVERSAL
34#define SYMBOL_OBJECTDEFINITIONLISTDLG_TITLE _("Edit Object Kind")
35#define SYMBOL_OBJECTDEFINITIONLISTDLG_IDNAME ID_OBJECTDEFINITIONLISTDLG
36#define SYMBOL_OBJECTDEFINITIONLISTDLG_SIZE wxSize(400, 300)
37#define SYMBOL_OBJECTDEFINITIONLISTDLG_POSITION wxDefaultPosition
38
39/******************************** EDIT OBJECT DEFINITION DLG ************************/
40class ObjectDefinitionListDlg : public wxDialog {
41 private:
42 int m_ParentListType;
43 DataBaseTM* m_pDatabase;
44
45 // Controls identifiers
46 wxTextCtrl* m_DLGODD_Code;
47 wxTextCtrl* m_DLGODD_Description;
48 wxChoice* m_DLGODD_List_Lyr_Name;
49 wxRadioBox* m_DLGODD_Frequency;
50 wxButton* m_DLGODD_SaveBtn;
51
52 // event function
53 void OnIdleActivateOKButton(wxIdleEvent& event);
54
55 virtual bool TransferDataToWindow();
56
57 virtual bool TransferDataFromWindow();
58
59 void _SetValidator();
60
61 // used for data transfert
62 ProjectDefMemoryObjects* m_ObjectObj;
63
64 DECLARE_DYNAMIC_CLASS(ObjectDefinitionListDlg)
65
66 DECLARE_EVENT_TABLE()
67
68 public:
70
71 ObjectDefinitionListDlg(wxWindow* parent, int iListlayerType, DataBaseTM* DBHandler,
72 wxWindowID id = SYMBOL_OBJECTDEFINITIONLISTDLG_IDNAME,
73 const wxString& caption = SYMBOL_OBJECTDEFINITIONLISTDLG_TITLE,
74 const wxPoint& pos = SYMBOL_OBJECTDEFINITIONLISTDLG_POSITION,
75 const wxSize& size = SYMBOL_OBJECTDEFINITIONLISTDLG_SIZE,
76 long style = SYMBOL_OBJECTDEFINITIONLISTDLG_STYLE);
77
79
80 bool Create(wxWindow* parent, wxWindowID id = SYMBOL_OBJECTDEFINITIONLISTDLG_IDNAME,
81 const wxString& caption = SYMBOL_OBJECTDEFINITIONLISTDLG_TITLE,
82 const wxPoint& pos = SYMBOL_OBJECTDEFINITIONLISTDLG_POSITION,
83 const wxSize& size = SYMBOL_OBJECTDEFINITIONLISTDLG_SIZE,
84 long style = SYMBOL_OBJECTDEFINITIONLISTDLG_STYLE);
85
86 void Init();
87
88 void CreateControls();
89
90 void SetMemoryObjectObject(ProjectDefMemoryObjects* myObjectObj) {
91 m_ObjectObj = myObjectObj;
92 }
93};
94
95/******************************** LIST OF OBJECT DEFINITION ************************/
97 private:
98 PRJDEF_LAYERS_TYPE m_layertype;
99 DataBaseTM* m_DBHandler;
100 wxCheckBox* m_CheckBox;
101 wxChoice* m_ChoiceLayer;
102 int m_ListSpatType;
103
104 // get a memory layer object for storing changes
105 PrjDefMemManage* m_MemoryObject;
106 ProjectDefMemoryObjects* m_ObjectObj;
107
108 // index for adding items
109 static int iAddItems;
110
111 // init list with database values
112 bool SetListText(int ilayertype);
113
114 wxCheckBoxState GetFreqStatus(int iIndex = -1);
115
116 wxString GetLayerStatus(int iIndex = -1);
117
118 // derived functions to implement
119 virtual void BeforeAdding();
120
121 virtual void AfterAdding(bool bRealyAddItem);
122
123 virtual void BeforeDeleting();
124
125 virtual void BeforeEditing();
126
127 virtual void AfterEditing(bool bRealyEdited);
128
129 bool m_bAscending[4];
130
131 virtual void OnSortColumns(wxListEvent& event);
132
133 // event functions
134 void OnItemSelectChange(wxListEvent& event);
135
136 DECLARE_EVENT_TABLE()
137
138 public:
140 ObjectDefinitionList(wxWindow* parent, wxWindowID id, PrjDefMemManage* memory, PRJDEF_LAYERS_TYPE paneltype,
141 DataBaseTM* database, wxArrayString* pColsName, wxArrayInt* pColsSize = nullptr,
142 wxSize size = wxDefaultSize);
143
146
147 void SetObjectToList(ProjectDefMemoryObjects* object, int iIndex = -1);
148
149 void GetObjectFromList(ProjectDefMemoryObjects* object, int iIndex);
150
151 void SetListSpatialType(int iSpatialType) {
152 m_ListSpatType = iSpatialType;
153 }
154
155 // virtual int ImportParsedFileToListCtrl(const wxString & filename,
156 // const int & FilterIndex);
157
158 // pass pointer to ctrls to the list
159 void SetListCtrls(wxChoice* layerchoice, wxCheckBox* checkboxfreq = nullptr);
160
161 void SetFreqStatus(int frequency, wxArrayLong* iIndexes);
162
163 void SetLayerStatus(const wxString& layer, wxArrayLong* iIndexes);
164};
165
166#endif
Definition database_tm.h:80
Enhance the ListGenReportWithDialog for supporting status bar.
Definition listgenreport_status.h:50
Definition objectdefinitionlistdlg.h:40
Definition objectdefinitionlistdlg.h:96
void SetObjectToList(ProjectDefMemoryObjects *object, int iIndex=-1)
Update list values with ProjectDefMemoryObjects.
Definition objectdefinitionlistdlg.cpp:424
void GetObjectFromList(ProjectDefMemoryObjects *object, int iIndex)
Get list values into ProjectDefMemoryObjects.
Definition objectdefinitionlistdlg.cpp:458
void SetLayerStatus(const wxString &layer, wxArrayLong *iIndexes)
Update layer name in response to event.
Definition objectdefinitionlistdlg.cpp:389
~ObjectDefinitionList()
Destructor.
Definition objectdefinitionlistdlg.cpp:223
void SetFreqStatus(int frequency, wxArrayLong *iIndexes)
Update layer freqency in response to event.
Definition objectdefinitionlistdlg.cpp:354
Definition prjdefmemmanage.h:54
Storing object properties in memory.
Definition projectdefmemory.h:168