• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

libkdegames

kchatbase.h

Go to the documentation of this file.
00001 /*
00002     This file is part of the KDE games library
00003     Copyright (C) 2001 Andreas Beckermann (b_mann@gmx.de)
00004     Copyright (C) 2007 Gael de Chalendar (aka Kleag) <kleag@free.fr>
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License version 2 as published by the Free Software Foundation.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public License
00016     along with this library; see the file COPYING.LIB.  If not, write to
00017     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018     Boston, MA 02110-1301, USA.
00019 */
00020 #ifndef __KCHATBASE_H__
00021 #define __KCHATBASE_H__
00022 
00023 #include <QtGui/QFrame>
00024 
00025 #include <kglobalsettings.h>
00026 #include <libkdegames_export.h>
00027 
00028 class KConfig;
00029 
00030 class KChatBasePrivate;
00031 class KChatBaseModel;
00032 class KChatBaseItemDelegate;
00033 class QModelIndex;
00034 class QPoint;
00035 
00071 class KDEGAMES_EXPORT KChatBase : public QFrame
00072 {
00073     Q_OBJECT
00074 public:
00083     explicit KChatBase(QWidget* parent, KChatBaseModel* model=0, 
00084                            KChatBaseItemDelegate* delegate=0,
00085                            bool noComboBox = false);
00086 
00092     virtual ~KChatBase();
00093 
00094     enum SendingIds {
00095         SendToAll = 0
00096     };
00097 
00103     virtual QString fromName() const = 0;
00104 
00116     bool addSendingEntry(const QString& text, int id);
00117 
00129     bool insertSendingEntry(const QString& text, int id, int index = -1);
00130 
00136     void changeSendingEntry(const QString& text, int id);
00137 
00142     void setSendingEntry(int id);
00143 
00150     void removeSendingEntry(int id);
00151 
00159     int sendingEntry() const;
00160     
00164     int findIndex(int id) const;
00165 
00170     int nextId() const;
00171 
00178     virtual bool acceptMessage() const;
00179 
00183     void setCompletionMode(KGlobalSettings::Completion mode);
00184 
00189     void setNameFont(const QFont& font);
00190     
00195     void setMessageFont(const QFont& font);
00196 
00203     void setBothFont(const QFont& font);
00204 
00209     void setSystemNameFont(const QFont& font);
00210 
00215     void setSystemMessageFont(const QFont& font);
00216 
00221     void setSystemBothFont(const QFont& font);
00222 
00230     QFont nameFont() const;
00231 
00239     QFont messageFont() const;
00240 
00245     QFont systemNameFont() const;
00246 
00251     QFont systemMessageFont() const;
00252 
00262     virtual void saveConfig(KConfig* conf = 0);
00263 
00269     virtual void readConfig(KConfig* conf = 0);
00270 
00278     void setMaxItems(int maxItems);
00279 
00283     void clear();
00284 
00289     int maxItems() const;
00290 
00291      KChatBaseModel* model();
00292      void setModel(KChatBaseModel* m);
00293 
00294 public Q_SLOTS:
00306     virtual void addMessage(const QString& fromName, const QString& text);
00307 
00315     virtual void addSystemMessage(const QString& fromName, const QString& text);
00316 
00321     void slotClear();
00322 
00327     void setAcceptMessage(bool a);
00328 
00329 protected:
00341     virtual void returnPressed(const QString& text) = 0;
00342 
00350     virtual QString comboBoxItem(const QString& name) const;
00351 
00357         const QModelIndex indexAt(const QPoint& pos) const;
00358 
00359 private Q_SLOTS:
00365     void slotReturnPressed(const QString&);
00366 
00371         virtual void customMenuHandler(const QPoint &pos);
00372 
00373 private:
00374 
00375     KChatBasePrivate* d;
00376 };
00377 
00378 #endif

libkdegames

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

API Reference

Skip menu "API Reference"
  • kblackbox
  • kgoldrunner
  • kmahjongg
  • ksquares
  • libkdegames
  •   highscore
  •   kgame
  •   kggzgames
  •   kggzmod
  •   kggznet
  • libkmahjongg
Generated for API Reference by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal