• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • libtdegames
 

libtdegames

  • libtdegames
  • kgame
kgamechat.h
1 /*
2  This file is part of the TDE games library
3  Copyright (C) 2001-2002 Andreas Beckermann (b_mann@gmx.de)
4  Copyright (C) 2001 Martin Heni (martin@heni-online.de)
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License version 2 as published by the Free Software Foundation.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 */
20 
21 #ifndef __KGAMECHAT_H__
22 #define __KGAMECHAT_H__
23 
24 #include <tqstring.h>
25 
26 #include "kchatbase.h"
27 #include <tdemacros.h>
28 class KPlayer;
29 class KGame;
30 class KGamePropertyBase;
31 
32 class KGameChatPrivate;
33 
43 class TDE_EXPORT KGameChat : public KChatBase
44 {
45  TQ_OBJECT
46 
47 public:
53  KGameChat(KGame* game, int msgid, KPlayer* fromPlayer, TQWidget * parent);
54 
60  KGameChat(KGame* game, int msgId, TQWidget* parent);
61 
68  KGameChat(TQWidget* parent);
69 
70  virtual ~KGameChat();
71 
72  enum SendingIds {
73  SendToGroup = 1
74  };
75 
82  void setFromPlayer(KPlayer* player);
83 
84  KPlayer* fromPlayer() const;
85 
93  void setKGame(KGame* g);
94 
95  KGame* game() const;
96 
101  int messageId() const;
102 
112  void setMessageId(int msgid);
113 
118  virtual const TQString& fromName() const;
119 
120 
121 public slots:
122  virtual void addMessage(const TQString& fromName, const TQString& text) { KChatBase::addMessage(fromName, text);}
123  virtual void addMessage(int fromId, const TQString& text);
124 
125  void slotReceiveMessage(int, const TQByteArray&, TQ_UINT32 receiver, TQ_UINT32 sender);
126 
127 protected:
133  bool isSendToAllMessage(int id) const;
134 
144  bool isToGroupMessage(int id) const;
145 
146 
159  bool isToPlayerMessage(int id) const;
160 
170  int playerId(int id) const;
171 
177  int sendingId(int playerId) const;
178 
183  bool hasPlayer(int id) const;
184 
191  virtual TQString sendToPlayerEntry(const TQString& name) const;
192 
193 
194 protected slots:
200  void slotUnsetKGame();
201 
202 
203  void slotPropertyChanged(KGamePropertyBase*, KPlayer*);
204  void slotAddPlayer(KPlayer*);
205  void slotRemovePlayer(KPlayer*);
206 
212  void slotReceivePrivateMessage(int msgid, const TQByteArray& buffer, TQ_UINT32 sender, KPlayer* me);
213 
214 protected:
215  virtual void returnPressed(const TQString& text);
216 
217 private:
218  void init(KGame* g, int msgid);
219 
220 private:
221  KGameChatPrivate* d;
222 };
223 
224 #endif
KChatBase
The base class for chat widgets.
Definition: kchatbase.h:185
KChatBase::fromName
virtual const TQString & fromName() const =0
KChatBase::addMessage
virtual void addMessage(const TQString &fromName, const TQString &text)
Add a text in the listbox.
Definition: kchatbase.cpp:349
KChatBase::returnPressed
virtual void returnPressed(const TQString &text)=0
This is called whenever the user pushed return ie wants to send a message.
KGameChat
A Chat widget for KGame-based games.
Definition: kgamechat.h:44
KGamePropertyBase
Base class of KGameProperty.
Definition: kgameproperty.h:43
KGame
The main KDE game object.
Definition: kgame.h:63
KPlayer
Base class for a game player.
Definition: kplayer.h:70

libtdegames

Skip menu "libtdegames"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

libtdegames

Skip menu "libtdegames"
  • libtdegames
Generated for libtdegames by doxygen 1.9.1
This website is maintained by Timothy Pearson.