ToolMap
Loading...
Searching...
No Matches
queries_panel.h
1/***************************************************************************
2 queries_panel.h
3 Deals with the queries panel
4 -------------------
5 copyright : (C) 2008 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 _TM_QUERIESEDITOR_H_
18#define _TM_QUERIESEDITOR_H_
19
20#include <wx/listctrl.h>
21#include <wx/statusbr.h>
22#include <wx/tglbtn.h>
23
24#include "../core/queriesbuilder.h" // for query builder
25#include "../gis/tmmanagerevent.h" // for manager event
26#include "listgenreport_status.h" // for list with status support
27#include "managed_aui_wnd.h"
28#include "queries_panel_dlg.h" // for the queries edition dialog
29#include "wxflatbutton.h" // for flat button
30
31class DataBaseTM;
32
33class Queries_PANEL;
34
35const int ID_QUERIESEDITOR = 10049;
36const int ID_QUERIES_LIST = 10051;
37const int ID_QUERIES_ADD = 10052;
38const int ID_QUERIES_REMOVE = 10064;
39const int ID_QUERIES_RUN = 10236;
40const int ID_QUERIES_APPLY_SYMBOLOGY = 10066;
41const int ID_QUERIES_EDIT = 10067;
42#define SYMBOL_QUERIES_PANEL_STYLE wxCAPTION | wxRESIZE_BORDER | wxSYSTEM_MENU | wxCLOSE_BOX
43#define SYMBOL_QUERIES_PANEL_TITLE _("Queries")
44#define SYMBOL_QUERIES_PANEL_IDNAME ID_QUERIESEDITOR
45#define SYMBOL_QUERIES_PANEL_SIZE wxSize(200, 100)
46#define SYMBOL_QUERIES_PANEL_POSITION wxDefaultPosition
47
48DECLARE_EVENT_TYPE(tmEVT_QUERY_MENU, -1)
49
51 private:
52 DataBaseTM* m_pDB;
53 tmSelectedDataMemory* m_Selected;
54 Queries_PANEL* m_QueryPanel;
55
56 virtual void BeforeAdding();
57
58 virtual void AfterAdding(bool bRealyAddItem);
59
60 virtual void BeforeDeleting();
61
62 virtual void BeforeEditing();
63
64 virtual void AfterEditing(bool bRealyEdited);
65
66 virtual void OnDoubleClickItem(wxListEvent& event);
67
68 void OnQueryEdit(wxCommandEvent& event);
69
70 void OnQueryMenuUpdateUISelected(wxUpdateUIEvent& event);
71
72 DECLARE_EVENT_TABLE();
73
74 protected:
75 virtual void OnContextMenu(wxListEvent& event);
76
77 public:
78 QueriesList(wxWindow* parent, Queries_PANEL* queryparent, wxWindowID id, wxArrayString* pColsName,
79 wxArrayInt* pColsSize = nullptr, wxSize size = wxDefaultSize);
80
82
83 void OnContextualMenu(wxContextMenuEvent& event);
84
85 // setter
86 void SetDataBase(DataBaseTM* database) {
87 m_pDB = database;
88 }
89
90 void SetSelected(tmSelectedDataMemory* selected) {
91 m_Selected = selected;
92 }
93
94 virtual void AddItem();
95};
96
97/***************************************************************************/
104 private:
105 wxAuiPaneInfo m_PaneInfo;
106 DataBaseTM* m_pDB;
107 QueriesList* m_QueriesList;
108 wxWindow* m_ParentEvt;
109 bool m_IsProjectOpen;
110 TocCtrl* m_TocCtrl;
111
113 void InitMemberValues();
114
115 // event function
116 void OnPressQueryMenu(wxCommandEvent& event);
117
118 DECLARE_EVENT_TABLE()
119
120 public:
122 Queries_PANEL(wxWindow* parent, wxWindowID id, wxAuiManager* auimanager);
123
124 // public event function
125 void OnAddQueries(wxCommandEvent& event);
126
127 void OnRemoveQueries(wxCommandEvent& event);
128
129 void OnRunQueries(wxCommandEvent& event);
130
131 void OnQueryApplySymbology(wxCommandEvent& event);
132
135
137 wxSizer* CreateControls(wxWindow* parent, bool call_fit = true, bool set_sizer = true);
138
139 void SetDataBase(DataBaseTM* database);
140
141 void SetSelectedData(tmSelectedDataMemory* selected);
142
143 void SetTOCCtrl(TocCtrl* toc) {
144 m_TocCtrl = toc;
145 }
146
147 bool LoadQueries(DataBaseTM* database);
148
149 void EnableQueriesPanel(bool projectopen = true);
150
151 bool IsQuerySelected();
152};
153
154#endif
Definition database_tm.h:80
Definition listgenreport.h:319
Definition managed_aui_wnd.h:32
Definition queries_panel.h:50
Display the Queries Panel.
Definition queries_panel.h:103
void SetDataBase(DataBaseTM *database)
Set the database object.
Definition queries_panel.cpp:146
void OnRunQueries(wxCommandEvent &event)
User press the run query.
Definition queries_panel.cpp:240
void OnRemoveQueries(wxCommandEvent &event)
User press the remove queries.
Definition queries_panel.cpp:229
void EnableQueriesPanel(bool projectopen=true)
Indicate if a project is open or not.
Definition queries_panel.cpp:195
void OnAddQueries(wxCommandEvent &event)
User press the Add queries button.
Definition queries_panel.cpp:214
bool LoadQueries(DataBaseTM *database)
Load the queries from the database.
Definition queries_panel.cpp:164
wxSizer * CreateControls(wxWindow *parent, bool call_fit=true, bool set_sizer=true)
Creates the controls and sizers.
Definition queries_panel.cpp:104
~Queries_PANEL()
Destructor.
Definition queries_panel.cpp:83
Definition tocctrl.h:30
Store ID of selected data into memory.
Definition tmselecteddatamemory.h:43