4 // Tree control used for the survey tree.
6 // Copyright (C) 2001, Mark R. Shinwell.
7 // Copyright (C) 2002,2006 Olly Betts
8 // Copyright (C) 2005 Martin Green
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
33 class TreeData
: public wxTreeItemData
{
34 const LabelInfo
* m_Label
;
38 explicit TreeData(const LabelInfo
* label
) : m_Label(label
) {}
39 explicit TreeData(const wxString
& survey_
)
40 : m_Label(NULL
), survey(survey_
) {}
41 const LabelInfo
* GetLabel() const { return m_Label
; }
42 const wxString
& GetSurvey() const { return survey
; }
43 bool IsStation() const { return m_Label
!= NULL
; }
46 class AvenTreeCtrl
: public wxTreeCtrl
{
49 wxTreeItemId m_LastItem
;
50 wxColour m_BackgroundColour
;
52 const TreeData
* menu_data
;
55 AvenTreeCtrl(MainFrm
* parent
, wxWindow
* window_parent
);
57 void SetEnabled(bool enabled
= true);
60 void OnMouseMove(wxMouseEvent
& event
);
61 void OnLeaveWindow(wxMouseEvent
& event
);
62 void OnSelChanged(wxTreeEvent
& event
);
63 void OnKeyPress(wxKeyEvent
&e
);
64 void OnItemActivated(wxTreeEvent
& e
);
65 void OnMenu(wxTreeEvent
& e
);
67 void OnRestrict(wxCommandEvent
& e
);
69 bool GetSelectionData(wxTreeItemData
**) const;
71 void SetHere(wxTreeItemId pos
);
73 void DeleteAllItems();