KiCad PCB EDA Suite
Loading...
Searching...
No Matches
listbox_tricks.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#pragma once
21
22#include <map>
23
24#include <wx/event.h>
25#include <wx/window.h>
26
27class wxListBox;
28
29
30// Declare LISTBOX_TRICKS events
31wxDECLARE_EVENT( EDA_EVT_LISTBOX_COPY, wxCommandEvent );
32wxDECLARE_EVENT( EDA_EVT_LISTBOX_CUT, wxCommandEvent );
33wxDECLARE_EVENT( EDA_EVT_LISTBOX_PASTE, wxCommandEvent );
34wxDECLARE_EVENT( EDA_EVT_LISTBOX_DELETE, wxCommandEvent );
35wxDECLARE_EVENT( EDA_EVT_LISTBOX_DUPLICATE, wxCommandEvent );
36
37// The event when the tricks change something
38wxDECLARE_EVENT( EDA_EVT_LISTBOX_CHANGED, wxCommandEvent );
39
40
41class LISTBOX_TRICKS : public wxEvtHandler
42{
43public:
44 LISTBOX_TRICKS( wxWindow& aWindow, wxListBox& aListBox );
46
51 {
52 ID_COPY = wxID_HIGHEST + 1,
57 };
58
59private:
60 // Custom event handlers
61 void OnListBoxCopy( wxCommandEvent& aEvent );
62 void OnListBoxCut( wxCommandEvent& aEvent );
63 void OnListBoxPaste( wxCommandEvent& aEvent );
64 void OnListBoxDelete( wxCommandEvent& aEvent );
65 void OnListBoxDuplicate( wxCommandEvent& aEvent );
66
67 // UI event handlers
68 void OnListBoxRDown( wxMouseEvent& aEvent );
69 void OnListBoxKeyDown( wxKeyEvent& aEvent );
70
71 // Internals
72 void listBoxCopy();
73 void listBoxCut();
74 void listBoxPaste();
75
76 wxArrayString listBoxGetSelected() const;
77
83 wxArrayInt listBoxDeleteSelected();
84
89
90 wxWindow& m_parent;
91 wxListBox& m_listBox;
92};
wxListBox & m_listBox
void OnListBoxCut(wxCommandEvent &aEvent)
void listBoxDuplicateSelected()
Duplicate the selected filters.
void OnListBoxDuplicate(wxCommandEvent &aEvent)
LISTBOX_TRICKS(wxWindow &aWindow, wxListBox &aListBox)
void OnListBoxPaste(wxCommandEvent &aEvent)
void OnListBoxCopy(wxCommandEvent &aEvent)
wxArrayString listBoxGetSelected() const
void OnListBoxDelete(wxCommandEvent &aEvent)
void OnListBoxKeyDown(wxKeyEvent &aEvent)
MENU_ID
These are the ids for the menu.
wxArrayInt listBoxDeleteSelected()
Delete the selected filters.
wxWindow & m_parent
void OnListBoxRDown(wxMouseEvent &aEvent)
wxDECLARE_EVENT(EDA_EVT_LISTBOX_COPY, wxCommandEvent)