2 // This file is part of the aMule Project.
4 // Copyright (c) 2004-2011 aMule Team ( admin@amule.org / http://www.amule.org )
6 // Any parts of this program derived from the xMule, lMule or eMule project,
7 // or contributed by third-party developers are copyrighted by their
10 // This program is free software; you can redistribute it and/or modify
11 // it under the terms of the GNU General Public License as published by
12 // the Free Software Foundation; either version 2 of the License, or
13 // (at your option) any later version.
15 // This program is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
20 // You should have received a copy of the GNU General Public License
21 // along with this program; if not, write to the Free Software
22 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 #ifndef MULETEXTCTRL_H
26 #define MULETEXTCTRL_H
28 #include <wx/textctrl.h>
36 * This class is a slightly improved wxTextCtrl that supports the traditional
37 * popup-menu usually provided by text-ctrls. It provides the following options:
44 * Other than that, it acts exactly like an ordinary wxTextCtrl.
46 class CMuleTextCtrl
: public wxTextCtrl
50 * Constructor is identical to the wxTextCtrl one.
52 CMuleTextCtrl(wxWindow
* parent
, wxWindowID id
, const wxString
& value
= wxEmptyString
, const wxPoint
& pos
= wxDefaultPosition
, const wxSize
& size
= wxDefaultSize
, long style
= 0, const wxValidator
& validator
= wxDefaultValidator
, const wxString
& name
= wxTextCtrlNameStr
);
55 * Destructor, which currently does nothing.
57 virtual ~CMuleTextCtrl() {};
61 * Hack to fix fonts getting reset when Clear() is called.
68 * This function takes care of creating the popup-menu.
70 * Please note that by using the RIGHT_DOWN event, I'm disabling the second
71 * type of selection that the wxTextCtrl supports. However, I frankly only
72 * noticed that second selection type while implementing this, so I doubth
73 * that anyone will be missing it ...
75 void OnRightDown( wxMouseEvent
& evt
);
78 * This function takes care of pasting text.
80 * Pleaes note that it is only needed because wxMenu disallows enabling and
81 * disabling of items that use the predefined wxID_PASTE id. This is the
82 * only one of the already provided commands we need to override, since the
83 * others already work just fine.
85 void OnPaste( wxCommandEvent
& evt
);
88 * This functions takes care of selecting all text.
90 void OnSelAll( wxCommandEvent
& evt
);
93 * This functions takes care of clearing the text.
95 void OnClear( wxCommandEvent
& evt
);
103 // File_checked_for_headers