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 Bacula® - The Network Backup Solution
13 Copyright (C) 2004-2006 Free Software Foundation Europe e.V.
15 The main author of Bacula is Kern Sibbald, with contributions from
16 many others, a complete list can be found in the file AUTHORS.
17 This program is Free Software; you can redistribute it and/or
18 modify it under the terms of version two of the GNU General Public
19 License as published by the Free Software Foundation plus additions
20 that are listed in the file LICENSE.
22 This program is distributed in the hope that it will be useful, but
23 WITHOUT ANY WARRANTY; without even the implied warranty of
24 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25 General Public License for more details.
27 You should have received a copy of the GNU General Public License
28 along with this program; if not, write to the Free Software
29 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
32 Bacula® is a registered trademark of John Walker.
33 The licensor of Bacula is the Free Software Foundation Europe
34 (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
35 Switzerland, email:ftf@fsfeurope.org.
38 /* Windows debug builds set _DEBUG which is used by wxWidgets to select their
39 * debug memory allocator. Unfortunately it conflicts with Bacula's SmartAlloc.
40 * So we turn _DEBUG off since we aren't interested in things it enables.
47 #include "wxblistctrl.h"
49 #include "wxbmainframe.h"
51 BEGIN_EVENT_TABLE(wxbListCtrl, wxListCtrl)
52 EVT_LEFT_DCLICK(wxbListCtrl::OnDoubleClicked)
53 EVT_RIGHT_DOWN(wxbListCtrl::OnRightClicked)
56 DEFINE_LOCAL_EVENT_TYPE(wxbLIST_MARKED_EVENT)
58 wxbListCtrl::wxbListCtrl(
59 wxWindow* parent, wxEvtHandler* handler, wxWindowID id, const wxPoint& pos, const wxSize& size):
60 wxListCtrl(parent, id, pos, size, wxLC_REPORT | wxSUNKEN_BORDER) {
61 this->handler = handler;
64 wxbListCtrl::~wxbListCtrl() {}
67 * Send mark event if the user double-clicked on the icon.
69 void wxbListCtrl::OnDoubleClicked(wxMouseEvent& event) {
70 if (event.GetX() < GetColumnWidth(0)) {
71 wxbListMarkedEvent evt(GetId());
73 handler->ProcessEvent(evt);
75 //No Skip : we don't want to go in this directory (if it is a directory)
83 * Send mark event if the user right clicked on an item.
85 void wxbListCtrl::OnRightClicked(wxMouseEvent& event) {
86 wxbListMarkedEvent evt(GetId());
88 handler->ProcessEvent(evt);
91 /* Customized tree event, used for marking events */
93 wxbListMarkedEvent::wxbListMarkedEvent(int id): wxEvent(id, wxbLIST_MARKED_EVENT) {}
95 wxbListMarkedEvent::~wxbListMarkedEvent() {}
97 wxbListMarkedEvent::wxbListMarkedEvent(const wxbListMarkedEvent& te): wxEvent(te) {}
99 wxEvent *wxbListMarkedEvent::Clone() const {
100 return new wxbListMarkedEvent(*(this));