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, wxEvtHandler* handler, wxWindowID id, const wxPoint& pos, const wxSize& size):
41 wxListCtrl(parent, id, pos, size, wxLC_REPORT | wxSUNKEN_BORDER) {
42 this->handler = handler;
45 wxbListCtrl::~wxbListCtrl() {}
48 * Send mark event if the user double-clicked on the icon.
50 void wxbListCtrl::OnDoubleClicked(wxMouseEvent& event) {
51 if (event.GetX() < GetColumnWidth(0)) {
52 wxbListMarkedEvent evt(GetId());
54 handler->ProcessEvent(evt);
56 //No Skip : we don't want to go in this directory (if it is a directory)
64 * Send mark event if the user right clicked on an item.
66 void wxbListCtrl::OnRightClicked(wxMouseEvent& event) {
67 wxbListMarkedEvent evt(GetId());
69 handler->ProcessEvent(evt);
72 /* Customized tree event, used for marking events */
74 wxbListMarkedEvent::wxbListMarkedEvent(int id): wxEvent(id, wxbLIST_MARKED_EVENT) {}
76 wxbListMarkedEvent::~wxbListMarkedEvent() {}
78 wxbListMarkedEvent::wxbListMarkedEvent(const wxbListMarkedEvent& te): wxEvent(te) {}
80 wxEvent *wxbListMarkedEvent::Clone() const {
81 return new wxbListMarkedEvent(*(this));