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

libtdegames

  • libtdegames
kchatbase.h
1/*
2 This file is part of the TDE games library
3 Copyright (C) 2001 Andreas Beckermann (b_mann@gmx.de)
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License version 2 as published by the Free Software Foundation.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19#ifndef __KCHATBASE_H__
20#define __KCHATBASE_H__
21
22#include <tqframe.h>
23#include <tqstring.h>
24#include <tqlistbox.h>
25
26#include <tdeglobalsettings.h>
27#include <tdemacros.h>
28class TQListBoxItem;
29
30class TDEConfig;
31
32
33class KChatBaseTextPrivate;
34
49class KChatBaseText : public TQListBoxText
50{
51public:
52
56 KChatBaseText(const TQString& player, const TQString& text);
57
61 KChatBaseText(const TQString& text);
62
66 virtual ~KChatBaseText();
67
75 void setName(const TQString& name);
76
84 void setMessage(const TQString& message);
85
90 const TQString& name() const;
91
96 const TQString& message() const;
97
103 TQFont nameFont() const;
104
110 TQFont messageFont() const;
111
119 void setNameFont(const TQFont* font);
120
128 void setMessageFont(const TQFont* font);
129
132 virtual int width(TQListBox* ) const;
133
136 virtual int height(TQListBox* ) const;
137
138protected:
141 virtual void paint(TQPainter*);
142
143private:
144 void init();
145
146private:
147 KChatBaseTextPrivate* d;
148};
149
150
151class KChatBasePrivate;
152
184class TDE_EXPORT KChatBase : public TQFrame
185{
186 TQ_OBJECT
187
188public:
195 KChatBase(TQWidget* parent, bool noComboBox = false);
196
202 virtual ~KChatBase();
203
204 enum SendingIds {
205 SendToAll = 0
206 };
207
213 virtual const TQString& fromName() const = 0;
214
226 bool addSendingEntry(const TQString& text, int id);
227
239 bool insertSendingEntry(const TQString& text, int id, int index = -1);
240
246 void changeSendingEntry(const TQString& text, int id);
247
252 void setSendingEntry(int id);
253
260 void removeSendingEntry(int id);
261
269 int sendingEntry() const;
270
274 int findIndex(int id) const;
275
280 int nextId() const;
281
288 virtual bool acceptMessage() const;
289
293 void setCompletionMode(TDEGlobalSettings::Completion mode);
294
299 void setNameFont(const TQFont& font);
300
305 void setMessageFont(const TQFont& font);
306
313 void setBothFont(const TQFont& font);
314
319 void setSystemNameFont(const TQFont& font);
320
325 void setSystemMessageFont(const TQFont& font);
326
331 void setSystemBothFont(const TQFont& font);
332
340 const TQFont& nameFont() const;
341
349 const TQFont& messageFont() const;
350
355 const TQFont& systemNameFont() const;
356
361 const TQFont& systemMessageFont() const;
362
372 virtual void saveConfig(TDEConfig* conf = 0);
373
379 virtual void readConfig(TDEConfig* conf = 0);
380
388 void setMaxItems(int maxItems);
389
393 void clear();
394
399 int maxItems() const;
400
401
402public slots:
414 virtual void addMessage(const TQString& fromName, const TQString& text);
415
423 virtual void addSystemMessage(const TQString& fromName, const TQString& text);
424
435 virtual void addItem(const TQListBoxItem* item);
436
437
442 void slotClear();
443
448 void setAcceptMessage(bool a);
449
450signals:
455 void rightButtonClicked(TQListBoxItem*, const TQPoint&);
456
457protected:
469 virtual void returnPressed(const TQString& text) = 0;
470
478 virtual TQString comboBoxItem(const TQString& name) const;
479
486 virtual TQListBoxItem* layoutMessage(const TQString& fromName, const TQString& text);
487
495 virtual TQListBoxItem* layoutSystemMessage(const TQString& fromName, const TQString& text);
496
497private slots:
503 void slotReturnPressed(const TQString&);
504
505private:
506 void init(bool noComboBox);
507
508 KChatBasePrivate* d;
509};
510
511#endif
KChatBaseText
A TQListBoxText implementation for KChatBase.
Definition: kchatbase.h:50
KChatBaseText::KChatBaseText
KChatBaseText(const TQString &player, const TQString &text)
Constructs a KChatBaseText object with the player and text part.
Definition: kchatbase.cpp:50
KChatBaseText::~KChatBaseText
virtual ~KChatBaseText()
Destruct a KChatBaseText object.
Definition: kchatbase.cpp:63
KChatBaseText::message
const TQString & message() const
Definition: kchatbase.cpp:89
KChatBaseText::setMessage
void setMessage(const TQString &message)
Set the text part of a message.
Definition: kchatbase.cpp:80
KChatBaseText::name
const TQString & name() const
Definition: kchatbase.cpp:86
KChatBaseText::nameFont
TQFont nameFont() const
You can set the font of the sender name independently of the message itself.
Definition: kchatbase.cpp:92
KChatBaseText::messageFont
TQFont messageFont() const
You can set the font of the message independently of the sender name.
Definition: kchatbase.cpp:103
KChatBaseText::setMessageFont
void setMessageFont(const TQFont *font)
Set the font for the message text.
Definition: kchatbase.cpp:117
KChatBaseText::setName
void setName(const TQString &name)
Set the name part of a message.
Definition: kchatbase.cpp:73
KChatBaseText::setNameFont
void setNameFont(const TQFont *font)
Set the font for the name.
Definition: kchatbase.cpp:114
KChatBase
The base class for chat widgets.
Definition: kchatbase.h:185
KChatBase::fromName
virtual const TQString & fromName() const =0
KChatBase::rightButtonClicked
void rightButtonClicked(TQListBoxItem *, const TQPoint &)
Emitted when the user right-clicks on a list item.
KChatBase::returnPressed
virtual void returnPressed(const TQString &text)=0
This is called whenever the user pushed return ie wants to send a message.

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.4
This website is maintained by Timothy Pearson.