]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/wx-console/wxbtreectrl.h
This commit was manufactured by cvs2svn to create tag
[bacula/bacula] / bacula / src / wx-console / wxbtreectrl.h
1 /*
2  *
3  *   Custom tree control, which send "tree marked" events when the user right-
4  *   click on a item, or double-click on a mark.
5  *
6  *    Nicolas Boichat, April 2004
7  *
8  *    Version $Id$
9  */
10 /*
11    Copyright (C) 2004 Kern Sibbald and John Walker
12
13    This program is free software; you can redistribute it and/or
14    modify it under the terms of the GNU General Public License
15    as published by the Free Software Foundation; either version 2
16    of the License, or (at your option) any later version.
17
18    This program is distributed in the hope that it will be useful,
19    but WITHOUT ANY WARRANTY; without even the implied warranty of
20    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21    GNU General Public License for more details.
22
23    You should have received a copy of the GNU General Public License
24    along with this program; if not, write to the Free Software
25    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
26  */
27
28 #ifndef WXBTREECTRL_H
29 #define WXBTREECTRL_H
30
31 #include "wx/wxprec.h"
32
33 #ifndef WX_PRECOMP
34    #include "wx/wx.h"
35 #endif
36
37 #include <wx/treectrl.h>
38
39 BEGIN_DECLARE_EVENT_TYPES()
40    DECLARE_EVENT_TYPE(wxbTREE_MARKED_EVENT,       618)
41 END_DECLARE_EVENT_TYPES()
42
43 /* Customized tree event, used for marking events */
44 class wxbTreeMarkedEvent: public wxEvent {
45    public:
46       wxbTreeMarkedEvent(int id, wxTreeItemId& item);
47       ~wxbTreeMarkedEvent();
48       wxbTreeMarkedEvent(const wxbTreeMarkedEvent& te);
49       virtual wxEvent *Clone() const;
50
51       wxTreeItemId GetItem();
52    private:
53       wxTreeItemId item;
54 };
55
56 typedef void (wxEvtHandler::*wxTreeMarkedEventFunction)(wxbTreeMarkedEvent&);
57
58 #define EVT_TREE_MARKED_EVENT(id, fn) \
59     DECLARE_EVENT_TABLE_ENTRY( \
60         wxbTREE_MARKED_EVENT, id, wxID_ANY, \
61         (wxObjectEventFunction)(wxEventFunction)(wxTreeMarkedEventFunction)&fn, \
62         (wxObject *) NULL \
63     ),
64
65 /* Customized tree, which transmit double clicks on images */
66 class wxbTreeCtrl: public wxTreeCtrl {
67    public:
68       wxbTreeCtrl(wxWindow* parent, wxEvtHandler* handler, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize);
69       ~wxbTreeCtrl();
70
71    private:
72       void OnDoubleClicked(wxMouseEvent& event);
73       void OnRightClicked(wxMouseEvent& event);
74
75       wxEvtHandler* handler;
76
77       DECLARE_EVENT_TABLE();
78 };
79
80 #endif // WXBTREECTRL_H