Upstream tarball 20080414
[amule.git] / src / ChatSelector.h
blobd6ec845537e01b789426c67ee959c1e8f9017961
1 //
2 // This file is part of the aMule Project.
3 //
4 // Copyright (c) 2003-2008 aMule Team ( admin@amule.org / http://www.amule.org )
5 // Copyright (c) 2002 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.
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.
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
26 #ifndef CHATSELECTOR_H
27 #define CHATSELECTOR_H
29 #include "MuleTextCtrl.h"
30 #include "MuleNotebook.h"
31 #include "Types.h" // Needed for uint16
33 class CUpDownClient;
34 class CFriend;
35 class CDlgFriend;
38 /**
39 * This class is used to display chat sessions.
41 class CChatSession : public CMuleTextCtrl
43 public:
44 CChatSession(wxWindow *parent, wxWindowID id = -1, const wxString& value = wxT(""), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxTextCtrlNameStr );
45 ~CChatSession();
47 uint64 m_client_id;
48 bool m_active;
50 /**
51 * Appends the specified text.
53 * @param text The text to add.
54 * @param style The style of the new text.
55 * @param newline If a newline should be added to the end of the line.
57 * If newline is false, then no newlines will be at the end of added text,
58 * even if the passed string ends with newlines. Multiline strings are
59 * broken into indivudual lines and each are timestamped with the same date.
61 void AddText( const wxString& text, const wxTextAttr& style, bool newline = true );
65 class CChatSelector : public CMuleNotebook
67 public:
68 CChatSelector(wxWindow* parent, wxWindowID id, const wxPoint& pos, wxSize siz, long style);
69 virtual ~CChatSelector() {};
70 CChatSession* StartSession(uint64 client_id, const wxString& client_name, bool show = true);
71 void EndSession(uint64 client_id = 0);
72 CChatSession* GetPageByClientID(uint64 client_id);
73 int GetTabByClientID(uint64 client_id);
74 bool ProcessMessage(uint64 sender_id, const wxString& message);
75 bool SendMessage(const wxString& message, const wxString& client_name = wxEmptyString, uint64 to_id = 0);
76 void ConnectionResult(bool success, const wxString& message, uint64 id);
77 void RefreshFriend(uint64 toupdate_id, const wxString& new_name);
80 #endif
81 // File_checked_for_headers