3 * Custom tree control, which send "tree marked" events when the user right-
4 * click on a item, or double-click on a mark.
6 * Nicolas Boichat, April 2004
10 Copyright (C) 2004 Kern Sibbald and John Walker
12 This program is free software; you can redistribute it and/or
13 modify it under the terms of the GNU General Public License
14 as published by the Free Software Foundation; either version 2
15 of the License, or (at your option) any later version.
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 #include "wxblistctrl.h"
30 #include "wxbmainframe.h"
32 BEGIN_EVENT_TABLE(wxbListCtrl, wxListCtrl)
33 EVT_LEFT_DCLICK(wxbListCtrl::OnDoubleClicked)
34 EVT_RIGHT_DOWN(wxbListCtrl::OnRightClicked)
37 DEFINE_LOCAL_EVENT_TYPE(wxbLIST_MARKED_EVENT)
39 wxbListCtrl::wxbListCtrl(
40 wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size):
41 wxListCtrl(parent, id, pos, size,wxLC_REPORT) {
44 wxbListCtrl::~wxbListCtrl() {}
47 * Send mark event if the user double-clicked on the icon.
49 void wxbListCtrl::OnDoubleClicked(wxMouseEvent& event) {
50 if (event.GetX() < GetColumnWidth(0)) {
51 wxbListMarkedEvent evt(GetId());
53 GetParent()->GetEventHandler()->ProcessEvent(evt);
55 //No Skip : we don't want to go in this directory (if it is a directory)
63 * Send mark event if the user right clicked on an item.
65 void wxbListCtrl::OnRightClicked(wxMouseEvent& event) {
66 wxbListMarkedEvent evt(GetId());
68 GetParent()->GetEventHandler()->ProcessEvent(evt);
71 /* Customized tree event, used for marking events */
73 wxbListMarkedEvent::wxbListMarkedEvent(int id): wxEvent(id, wxbLIST_MARKED_EVENT) {}
75 wxbListMarkedEvent::~wxbListMarkedEvent() {}
77 wxbListMarkedEvent::wxbListMarkedEvent(const wxbListMarkedEvent& te): wxEvent(te) {}
79 wxEvent *wxbListMarkedEvent::Clone() const {
80 return new wxbListMarkedEvent(*(this));