[f17e6dc6] | 1 | // |
---|
| 2 | // aventreectrl.h |
---|
| 3 | // |
---|
| 4 | // Tree control used for the survey tree. |
---|
| 5 | // |
---|
| 6 | // Copyright (C) 2001, Mark R. Shinwell. |
---|
[672459c] | 7 | // Copyright (C) 2002,2006,2018 Olly Betts |
---|
[887c26e] | 8 | // Copyright (C) 2005 Martin Green |
---|
[f17e6dc6] | 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 | // 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. |
---|
| 19 | // |
---|
| 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 |
---|
[ecbc6c18] | 22 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
[f17e6dc6] | 23 | // |
---|
| 24 | |
---|
| 25 | #ifndef aventreectrl_h |
---|
| 26 | #define aventreectrl_h |
---|
| 27 | |
---|
| 28 | #include "wx.h" |
---|
[1a46879] | 29 | |
---|
| 30 | #include "model.h" |
---|
[f17e6dc6] | 31 | |
---|
| 32 | class MainFrm; |
---|
[8734409] | 33 | class LabelInfo; |
---|
| 34 | |
---|
| 35 | class TreeData : public wxTreeItemData { |
---|
| 36 | const LabelInfo* m_Label; |
---|
[44ed489] | 37 | wxString survey; |
---|
[8734409] | 38 | |
---|
| 39 | public: |
---|
[fd4f6ff] | 40 | explicit TreeData(const LabelInfo* label) : m_Label(label) {} |
---|
| 41 | explicit TreeData(const wxString & survey_) |
---|
| 42 | : m_Label(NULL), survey(survey_) {} |
---|
[8734409] | 43 | const LabelInfo* GetLabel() const { return m_Label; } |
---|
[44ed489] | 44 | const wxString & GetSurvey() const { return survey; } |
---|
[8734409] | 45 | bool IsStation() const { return m_Label != NULL; } |
---|
| 46 | }; |
---|
[f17e6dc6] | 47 | |
---|
| 48 | class AvenTreeCtrl : public wxTreeCtrl { |
---|
| 49 | MainFrm* m_Parent; |
---|
| 50 | bool m_Enabled; |
---|
| 51 | wxTreeItemId m_LastItem; |
---|
[b9c240b] | 52 | wxColour m_BackgroundColour; |
---|
[b623b3e] | 53 | bool m_SelValid; |
---|
[5e0b9f9d] | 54 | const TreeData* menu_data; |
---|
[672459c] | 55 | wxTreeItemId menu_item; |
---|
[1a46879] | 56 | |
---|
| 57 | SurveyFilter filter; |
---|
[f17e6dc6] | 58 | |
---|
| 59 | public: |
---|
| 60 | AvenTreeCtrl(MainFrm* parent, wxWindow* window_parent); |
---|
| 61 | |
---|
[17a38ded] | 62 | void FillTree(const wxString& root_name); |
---|
| 63 | |
---|
[b623b3e] | 64 | void UnselectAll(); |
---|
[f17e6dc6] | 65 | |
---|
| 66 | void OnMouseMove(wxMouseEvent& event); |
---|
[887c26e] | 67 | void OnLeaveWindow(wxMouseEvent& event); |
---|
[f17e6dc6] | 68 | void OnSelChanged(wxTreeEvent& event); |
---|
[5901b62] | 69 | void OnKeyPress(wxKeyEvent &e); |
---|
[44ed489] | 70 | void OnItemActivated(wxTreeEvent& e); |
---|
[5e0b9f9d] | 71 | void OnMenu(wxTreeEvent& e); |
---|
| 72 | |
---|
| 73 | void OnRestrict(wxCommandEvent& e); |
---|
[672459c] | 74 | void OnHide(wxCommandEvent& e); |
---|
| 75 | void OnShow(wxCommandEvent& e); |
---|
| 76 | void OnHideSiblings(wxCommandEvent& e); |
---|
| 77 | void OnStateClick(wxTreeEvent& e); |
---|
[f17e6dc6] | 78 | |
---|
[570d62c3] | 79 | bool GetSelectionData(wxTreeItemData**) const; |
---|
| 80 | |
---|
| 81 | void SetHere(wxTreeItemId pos); |
---|
[f17e6dc6] | 82 | |
---|
[1a46879] | 83 | const SurveyFilter* GetFilter() const { |
---|
| 84 | return filter.empty() ? NULL : &filter; |
---|
[672459c] | 85 | } |
---|
| 86 | |
---|
[f17e6dc6] | 87 | private: |
---|
| 88 | DECLARE_EVENT_TABLE() |
---|
| 89 | }; |
---|
| 90 | |
---|
| 91 | #endif |
---|