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-2005 Kern Sibbald
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 version 2 as ammended with additional clauses defined in the
16 file LICENSE in the main source directory.
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 the file LICENSE for additional details.
25 #include "wxblistctrl.h"
28 #include "wxbmainframe.h"
30 BEGIN_EVENT_TABLE(wxbListCtrl, wxListCtrl)
31 EVT_LEFT_DCLICK(wxbListCtrl::OnDoubleClicked)
32 EVT_RIGHT_DOWN(wxbListCtrl::OnRightClicked)
35 DEFINE_LOCAL_EVENT_TYPE(wxbLIST_MARKED_EVENT)
37 wxbListCtrl::wxbListCtrl(
38 wxWindow* parent, wxEvtHandler* handler, wxWindowID id, const wxPoint& pos, const wxSize& size):
39 wxListCtrl(parent, id, pos, size, wxLC_REPORT | wxSUNKEN_BORDER) {
40 this->handler = handler;
43 wxbListCtrl::~wxbListCtrl() {}
46 * Send mark event if the user double-clicked on the icon.
48 void wxbListCtrl::OnDoubleClicked(wxMouseEvent& event) {
49 if (event.GetX() < GetColumnWidth(0)) {
50 wxbListMarkedEvent evt(GetId());
52 handler->ProcessEvent(evt);
54 //No Skip : we don't want to go in this directory (if it is a directory)
62 * Send mark event if the user right clicked on an item.
64 void wxbListCtrl::OnRightClicked(wxMouseEvent& event) {
65 wxbListMarkedEvent evt(GetId());
67 handler->ProcessEvent(evt);
70 /* Customized tree event, used for marking events */
72 wxbListMarkedEvent::wxbListMarkedEvent(int id): wxEvent(id, wxbLIST_MARKED_EVENT) {}
74 wxbListMarkedEvent::~wxbListMarkedEvent() {}
76 wxbListMarkedEvent::wxbListMarkedEvent(const wxbListMarkedEvent& te): wxEvent(te) {}
78 wxEvent *wxbListMarkedEvent::Clone() const {
79 return new wxbListMarkedEvent(*(this));