1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//
// This file is part of the aMule Project.
//
// Copyright (c) 2003-2011 aMule Team ( admin@amule.org / http://www.amule.org )
//
// Any parts of this program derived from the xMule, lMule or eMule project,
// or contributed by third-party developers are copyrighted by their
// respective authors.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA
//

#ifndef INTERNALEVENTS_H
#define INTERNALEVENTS_H


#include <wx/event.h>	// Needed for wxEvent


DECLARE_LOCAL_EVENT_TYPE(wxEVT_CORE_FINISHED_HTTP_DOWNLOAD, wxEVT_USER_FIRST+HTTP_DOWNLOAD_FINISHED)

DECLARE_LOCAL_EVENT_TYPE(wxEVT_CORE_SOURCE_DNS_DONE, wxEVT_USER_FIRST+SOURCE_DNS_DONE)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_CORE_UDP_DNS_DONE, wxEVT_USER_FIRST+UDP_DNS_DONE)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_CORE_SERVER_DNS_DONE, wxEVT_USER_FIRST+SERVER_DNS_DONE)


class CMuleInternalEvent : public wxEvent
{
public:
	CMuleInternalEvent(int event, int id = wxID_ANY)
		: wxEvent(id, event),
		  m_ptr(NULL),
		  m_value(0),
		  m_commandInt(0)
	{
	}

	wxEvent* Clone(void) const {
		return new CMuleInternalEvent(*this);
	}

	void SetExtraLong(long value) {
		m_value = value;
	}

	long GetExtraLong() {
		return m_value;
	}

	void SetInt(int i) {
		m_commandInt = i;
	}

	long GetInt() const {
		return m_commandInt;
	}

	void SetClientData(void *ptr) {
		m_ptr = ptr;
	}

	void *GetClientData() {
		return m_ptr;
	}

private:
	void*	m_ptr;
	long	m_value;
	int		m_commandInt;
};


typedef void (wxEvtHandler::*MuleInternalEventFunction)(CMuleInternalEvent&);

//! Event-handler for completed hashings of new shared files and partfiles.
#define EVT_MULE_INTERNAL(event, id, func) \
	DECLARE_EVENT_TABLE_ENTRY(event, id, -1, \
	(wxObjectEventFunction) (wxEventFunction) \
	wxStaticCastEvent(MuleInternalEventFunction, &func), (wxObject*) NULL),


#endif /* INTERNALEVENTS_H */
// File_checked_for_headers