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
11 Copyright (C) 2004 Kern Sibbald and John Walker
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.
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.
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.
28 #include "wxblistctrl.h"
31 #include "wxbmainframe.h"
33 BEGIN_EVENT_TABLE(wxbListCtrl, wxListCtrl)
34 EVT_LEFT_DCLICK(wxbListCtrl::OnDoubleClicked)
35 EVT_RIGHT_DOWN(wxbListCtrl::OnRightClicked)
38 DEFINE_LOCAL_EVENT_TYPE(wxbLIST_MARKED_EVENT)
40 wxbListCtrl::wxbListCtrl(
41 wxWindow* parent, wxEvtHandler* handler, wxWindowID id, const wxPoint& pos, const wxSize& size):
42 wxListCtrl(parent, id, pos, size, wxLC_REPORT | wxSUNKEN_BORDER) {
43 this->handler = handler;
46 wxbListCtrl::~wxbListCtrl() {}
49 * Send mark event if the user double-clicked on the icon.
51 void wxbListCtrl::OnDoubleClicked(wxMouseEvent& event) {
52 if (event.GetX() < GetColumnWidth(0)) {
53 wxbListMarkedEvent evt(GetId());
55 handler->ProcessEvent(evt);
57 //No Skip : we don't want to go in this directory (if it is a directory)
65 * Send mark event if the user right clicked on an item.
67 void wxbListCtrl::OnRightClicked(wxMouseEvent& event) {
68 wxbListMarkedEvent evt(GetId());
70 handler->ProcessEvent(evt);
73 /* Customized tree event, used for marking events */
75 wxbListMarkedEvent::wxbListMarkedEvent(int id): wxEvent(id, wxbLIST_MARKED_EVENT) {}
77 wxbListMarkedEvent::~wxbListMarkedEvent() {}
79 wxbListMarkedEvent::wxbListMarkedEvent(const wxbListMarkedEvent& te): wxEvent(te) {}
81 wxEvent *wxbListMarkedEvent::Clone() const {
82 return new wxbListMarkedEvent(*(this));