1//
2// This file is part of the aMule Project.
3//
4// Copyright (c) 2003-2011 aMule Team ( admin@amule.org / http://www.amule.org )
5// Copyright (c) 2002-2011 Merkur ( devs@emule-project.net / http://www.emule-project.net )
6//
7// Any parts of this program derived from the xMule, lMule or eMule project,
8// or contributed by third-party developers are copyrighted by their
9// respective authors.
10//
11// This program is free software; you can redistribute it and/or modify
12// it under the terms of the GNU General Public License as published by
13// the Free Software Foundation; either version 2 of the License, or
14// (at your option) any later version.
15//
16// This program is distributed in the hope that it will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19// GNU General Public License for more details.
20//
21// You should have received a copy of the GNU General Public License
22// along with this program; if not, write to the Free Software
23// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA
24//
25
26#ifndef CHATWND_H
27#define CHATWND_H
28
29#include <wx/panel.h>		// Needed for wxPanel
30#include <wx/notebook.h>		// Needed for wxNotebookEvent
31#include "Types.h"
32
33class CFriend;
34class CChatSelector;
35class CFriendListCtrl;
36class CMD4Hash;
37
38class CChatWnd : public wxPanel
39{
40public:
41	CChatWnd(wxWindow* pParent = NULL);
42	~CChatWnd() {};
43
44	void StartSession(CFriend* friend_client, bool setfocus = true);
45
46	void	UpdateFriend(CFriend* toupdate);
47	void	RemoveFriend(CFriend* todel);
48
49	void	ProcessMessage(uint64 sender, const wxString& message);
50	void 	ConnectionResult(bool success, const wxString& message, uint64 id);
51
52	void	SendMessage(const wxString& message, const wxString& client_name = wxEmptyString, uint64 to_id = 0);
53
54	bool	IsIdValid(uint64 id);
55	void	ShowCaptchaResult(uint64 id, bool ok);
56	void	EndSession(uint64 id);
57
58protected:
59	/**
60	 * Event-handler for displaying the chat-popup menu.
61	 */
62	void	OnNMRclickChatTab(wxMouseEvent& evt);
63	/**
64	 * Event-handler fo the Close item on the popup-menu.
65	 */
66	void	OnPopupClose(wxCommandEvent& evt);
67
68	/**
69	 * Event-handler fo the CloseAll item on the popup-menu.
70	 */
71	void	OnPopupCloseAll(wxCommandEvent& evt);
72
73	/**
74	 * Event-handler fo the CloseOthers item on the popup-menu.
75	 */
76	void	OnPopupCloseOthers(wxCommandEvent& evt);
77
78	/**
79	 * Event-handler fo the AddFriend item on the popup-menu.
80	 */
81	void	OnAddFriend(wxCommandEvent& evt);
82
83	void	OnBnClickedCsend(wxCommandEvent& evt);
84	void	OnBnClickedCclose(wxCommandEvent& evt);
85	void	OnAllPagesClosed(wxNotebookEvent& evt);
86	void	CheckNewButtonsState();
87
88	DECLARE_EVENT_TABLE()
89
90	//! Variable used to ensure that the popup menu doesn't get displayed twice.
91	wxMenu* m_menu;
92	//! Pointer to the control serving as the friend list
93	CFriendListCtrl* friendlistctrl;
94	//! Pointer to the chat tabs.
95	CChatSelector*	chatselector;
96};
97
98#endif
99// File_checked_for_headers
100