libkdegames
kchatbase.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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