Fix label on declaration
[survex.git] / src / aventreectrl.h
bloba67b12e1948da392bcbc9cc68644d8b5808bc3da
1 //
2 // aventreectrl.h
3 //
4 // Tree control used for the survey tree.
5 //
6 // Copyright (C) 2001, Mark R. Shinwell.
7 // Copyright (C) 2002,2006,2018 Olly Betts
8 // Copyright (C) 2005 Martin Green
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.
15 // This program is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
20 // You should have received a copy of the GNU General Public License
21 // along with this program; if not, write to the Free Software
22 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 #ifndef aventreectrl_h
26 #define aventreectrl_h
28 #include "wx.h"
30 #include "model.h"
32 class MainFrm;
33 class LabelInfo;
35 class TreeData : public wxTreeItemData {
36 const LabelInfo* m_Label;
37 wxString survey;
39 public:
40 explicit TreeData(const LabelInfo* label) : m_Label(label) {}
41 explicit TreeData(const wxString & survey_)
42 : m_Label(NULL), survey(survey_) {}
43 const LabelInfo* GetLabel() const { return m_Label; }
44 const wxString & GetSurvey() const { return survey; }
45 bool IsStation() const { return m_Label != NULL; }
46 bool IsSurvey() const { return m_Label == NULL; }
49 class AvenTreeCtrl : public wxTreeCtrl {
50 MainFrm* m_Parent;
51 bool m_Enabled;
52 wxTreeItemId m_LastItem;
53 wxColour m_BackgroundColour;
54 bool m_SelValid;
55 const TreeData* menu_data;
56 wxTreeItemId menu_item;
58 SurveyFilter filter;
60 public:
61 AvenTreeCtrl(MainFrm* parent, wxWindow* window_parent);
63 void FillTree(const wxString& root_name);
65 void UnselectAll();
67 void OnMouseMove(wxMouseEvent& event);
68 void OnLeaveWindow(wxMouseEvent& event);
69 void OnSelChanged(wxTreeEvent& event);
70 void OnKeyPress(wxKeyEvent &e);
71 void OnItemActivated(wxTreeEvent& e);
72 void OnMenu(wxTreeEvent& e);
74 void OnRestrict(wxCommandEvent& e);
75 void OnHide(wxCommandEvent& e);
76 void OnShow(wxCommandEvent& e);
77 void OnHideSiblings(wxCommandEvent& e);
78 void OnStateClick(wxTreeEvent& e);
80 bool GetSelectionData(wxTreeItemData**) const;
82 void SetHere(wxTreeItemId pos);
84 const SurveyFilter* GetFilter() const {
85 return filter.empty() ? NULL : &filter;
88 void AddOverlay(const wxString& file);
89 void RemoveOverlay(const wxString& file);
91 wxTreeItemId FirstOverlay();
92 wxTreeItemId NextOverlay(wxTreeItemId id);
93 wxTreeItemId RemoveOverlay(wxTreeItemId id);
94 const wxString& GetOverlayFilename(wxTreeItemId id);
96 private:
97 DECLARE_EVENT_TABLE()
100 #endif