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 QListWidgetItem;
00029 
00030 class KConfig;
00031 
00032 class KChatBasePrivate;
00033 class KChatBaseModel;
00034 class KChatBaseItemDelegate;
00035 
00069 class KDEGAMES_EXPORT KChatBase : public QFrame
00070 {
00071         Q_OBJECT
00072 public:
00081         explicit KChatBase(QWidget* parent, KChatBaseModel* model=0, 
00082                            KChatBaseItemDelegate* delegate=0,
00083                            bool noComboBox = false);
00084 
00090         virtual ~KChatBase();
00091 
00092         enum SendingIds {
00093                 SendToAll = 0
00094         };
00095 
00101         virtual QString fromName() const = 0;
00102 
00114         bool addSendingEntry(const QString& text, int id);
00115 
00127         bool insertSendingEntry(const QString& text, int id, int index = -1);
00128 
00134         void changeSendingEntry(const QString& text, int id);
00135 
00140         void setSendingEntry(int id);
00141 
00148         void removeSendingEntry(int id);
00149 
00157         int sendingEntry() const;
00158         
00162         int findIndex(int id) const;
00163 
00168         int nextId() const;
00169 
00176         virtual bool acceptMessage() const;
00177 
00181         void setCompletionMode(KGlobalSettings::Completion mode);
00182 
00187         void setNameFont(const QFont& font);
00188         
00193         void setMessageFont(const QFont& font);
00194 
00201         void setBothFont(const QFont& font);
00202 
00207         void setSystemNameFont(const QFont& font);
00208 
00213         void setSystemMessageFont(const QFont& font);
00214 
00219         void setSystemBothFont(const QFont& font);
00220 
00228         QFont nameFont() const;
00229 
00237         QFont messageFont() const;
00238 
00243         QFont systemNameFont() const;
00244 
00249         QFont systemMessageFont() const;
00250 
00260         virtual void saveConfig(KConfig* conf = 0);
00261 
00267         virtual void readConfig(KConfig* conf = 0);
00268 
00276         void setMaxItems(int maxItems);
00277 
00281         void clear();
00282 
00287         int maxItems() const;
00288 
00289          KChatBaseModel* model();
00290          void setModel(KChatBaseModel* m);
00291 
00292 public Q_SLOTS:
00304         virtual void addMessage(const QString& fromName, const QString& text);
00305 
00313         virtual void addSystemMessage(const QString& fromName, const QString& text);
00314 
00319         void slotClear();
00320 
00325         void setAcceptMessage(bool a);
00326         
00327 protected:
00339         virtual void returnPressed(const QString& text) = 0;
00340 
00348         virtual QString comboBoxItem(const QString& name) const;
00349 
00350 private Q_SLOTS:
00356         void slotReturnPressed(const QString&);
00357 
00358 private:
00359 
00360         KChatBasePrivate* d;
00361 };
00362 
00363 #endif

Generated on Sun Mar 16 08:02:52 2008 for Libkdegames by  doxygen 1.5.3