[f17e6dc6] | 1 | // |
---|
| 2 | // aventreectrl.h |
---|
| 3 | // |
---|
| 4 | // Tree control used for the survey tree. |
---|
| 5 | // |
---|
| 6 | // Copyright (C) 2001, Mark R. Shinwell. |
---|
[44ed489] | 7 | // Copyright (C) 2002,2006 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 |
---|
| 22 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
| 23 | // |
---|
| 24 | |
---|
| 25 | #ifndef aventreectrl_h |
---|
| 26 | #define aventreectrl_h |
---|
| 27 | |
---|
| 28 | #include "wx.h" |
---|
| 29 | |
---|
| 30 | class MainFrm; |
---|
[8734409] | 31 | class LabelInfo; |
---|
| 32 | |
---|
| 33 | class TreeData : public wxTreeItemData { |
---|
| 34 | const LabelInfo* m_Label; |
---|
[44ed489] | 35 | wxString survey; |
---|
[8734409] | 36 | |
---|
| 37 | public: |
---|
| 38 | TreeData(const LabelInfo* label) : m_Label(label) {} |
---|
[44ed489] | 39 | TreeData(const wxString & survey_) : m_Label(NULL), survey(survey_) {} |
---|
[8734409] | 40 | const LabelInfo* GetLabel() const { return m_Label; } |
---|
[44ed489] | 41 | const wxString & GetSurvey() const { return survey; } |
---|
[8734409] | 42 | bool IsStation() const { return m_Label != NULL; } |
---|
| 43 | }; |
---|
[f17e6dc6] | 44 | |
---|
| 45 | class AvenTreeCtrl : public wxTreeCtrl { |
---|
| 46 | MainFrm* m_Parent; |
---|
| 47 | bool m_Enabled; |
---|
| 48 | wxTreeItemId m_LastItem; |
---|
[b9c240b] | 49 | wxColour m_BackgroundColour; |
---|
[b623b3e] | 50 | bool m_SelValid; |
---|
[f17e6dc6] | 51 | |
---|
| 52 | public: |
---|
| 53 | AvenTreeCtrl(MainFrm* parent, wxWindow* window_parent); |
---|
| 54 | |
---|
| 55 | void SetEnabled(bool enabled = true); |
---|
[b623b3e] | 56 | void UnselectAll(); |
---|
[f17e6dc6] | 57 | |
---|
| 58 | void OnMouseMove(wxMouseEvent& event); |
---|
[887c26e] | 59 | void OnLeaveWindow(wxMouseEvent& event); |
---|
[f17e6dc6] | 60 | void OnSelChanged(wxTreeEvent& event); |
---|
[5901b62] | 61 | void OnKeyPress(wxKeyEvent &e); |
---|
[44ed489] | 62 | void OnItemActivated(wxTreeEvent& e); |
---|
[f17e6dc6] | 63 | |
---|
[570d62c3] | 64 | bool GetSelectionData(wxTreeItemData**) const; |
---|
| 65 | |
---|
| 66 | void SetHere(wxTreeItemId pos); |
---|
[f17e6dc6] | 67 | |
---|
[30987bd] | 68 | void DeleteAllItems(); |
---|
| 69 | |
---|
[f17e6dc6] | 70 | private: |
---|
| 71 | DECLARE_EVENT_TABLE() |
---|
| 72 | }; |
---|
| 73 | |
---|
| 74 | #endif |
---|