KVIrc  4.9.2
DeveloperAPIs
KviTopicWidget.h
Go to the documentation of this file.
1 #ifndef _KVI_TOPICW_H_
2 #define _KVI_TOPICW_H_
3 //============================================================================
4 //
5 // File : KviTopicWidget.h
6 // Creation date : Fri Aug 4 2000 12:03:12 by Szymon Stefanek
7 //
8 // This file is part of the KVIrc IRC client distribution
9 // Copyright (C) 2000-2010 Szymon Stefanek (pragma at kvirc dot net)
10 //
11 // This program is FREE software. You can redistribute it and/or
12 // modify it under the terms of the GNU General Public License
13 // as published by the Free Software Foundation; either version 2
14 // of the License, or (at your option) any later version.
15 //
16 // This program is distributed in the HOPE that it will be USEFUL,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 // See the GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program. If not, write to the Free Software Foundation,
23 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 //
25 //============================================================================
26 
27 #include "kvi_settings.h"
28 #include "KviCString.h"
29 #include "KviApplication.h"
30 #include "KviInputEditor.h"
31 #include "KviTalListWidget.h"
33 
34 #include <QFrame>
35 #include <QPushButton>
36 
37 class QComboBox;
38 class KviChannelWindow;
39 class QMenu;
40 class KviIrcConnection;
41 class KviThemedLabel;
42 
44 {
45  Q_OBJECT
46 public:
47  KviTopicListBoxItemDelegate(QAbstractItemView * pWidget = 0);
49 
50 public:
51  QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const;
52  void paint(QPainter * pPainter, const QStyleOptionViewItem & option, const QModelIndex & index) const;
53 };
54 
56 {
57 public:
58  KviTopicListBoxItem(KviTalListWidget * pListBox = 0, const QString & text = QString());
60 
61 public:
62  virtual int width(const KviTalListWidget * pList) const;
63 };
64 
65 class KVIRC_API KviTopicWidget : public QWidget
66 {
67  Q_OBJECT
68  Q_PROPERTY(int TransparencyCapable READ dummyRead)
69  friend class KviChannelWindow;
70  friend class KviTalListWidget;
71 
72 public:
73  KviTopicWidget(QWidget * pParent, KviChannelWindow * pChannel, const char * name);
74  ~KviTopicWidget();
75 
76 private:
77  QString m_szTopic;
78  QString m_szSetBy;
79  QString m_szSetAt;
80  QPushButton * m_pAccept;
81  QPushButton * m_pDiscard;
82  QPushButton * m_pHistory;
83  QMenu * m_pContextPopup;
84  QAbstractItemDelegate * m_pItemDelegate;
85  KviThemedLabel * m_pLabel;
86  KviInputEditor * m_pInput;
87  KviTalListWidget * m_pCompletionBox;
88  KviChannelWindow * m_pKviChannelWindow;
89 
90 protected:
91  int m_iCursorPosition;
92 
93 private:
94  QChar getSubstituteChar(unsigned short uControlCode);
95 
96 protected:
97  void updateToolTip();
98  void deactivate();
99  void iconButtonClicked();
100  virtual bool eventFilter(QObject * o, QEvent * e);
101  virtual void mousePressEvent(QMouseEvent * e);
102  virtual void keyPressEvent(QKeyEvent * e);
103  virtual void resizeEvent(QResizeEvent * e);
104 
105 public:
106  void insertChar(QChar c);
107  void insertText(const QString & szText);
108  int dummyRead() const { return 0; };
109  void reset();
110 
111  void setTopic(const QString & szTopic);
112  void setTopicSetBy(const QString & szSetBy);
113  void setTopicSetAt(const QString & szSetAt);
114 
115  const QString & topic() { return m_szTopic; };
116  const QString & topicSetBy() { return m_szSetBy; };
117  const QString & topicSetAt() { return m_szSetAt; };
118  virtual QSize sizeHint() const;
119  void applyOptions();
120 
121  static void paintColoredText(QPainter * p, QString szText, const QPalette & palette, const QRect & rect);
122 protected slots:
123  void acceptClicked();
124  void discardClicked();
125  void historyClicked();
126  void contextPopupAboutToShow();
127  void copy();
128  void complete();
129  void popDownListBox();
130  void switchMode();
131 signals:
132  void topicSelected(const QString & szTopic);
133 };
134 
135 #endif //_KVI_TOPICW_H_
Definition: KviTalListWidget.h:35
#define KVIRC_API
Definition: kvi_settings.h:128
char s char s char s s s s s char char c s *s c s s s d c s *s d c d d d d c
Definition: KviIrcNumericCodes.h:391
Definition: KviTopicWidget.h:43
Definition: KviTalListWidget.h:64
int width(const KviTalListWidget *) const
Definition: KviTalListWidget.cpp:111
Input editor class.
Definition: KviInputEditor.h:85
An abstraction of a connection to an IRC server.
Definition: KviIrcConnection.h:95
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
Returns the size hint for the view.
Definition: KviTalIconAndRichTextItemDelegate.cpp:98
#define e
Definition: detector.cpp:69
void paint(QPainter *pPainter, const QStyleOptionViewItem &option, const QModelIndex &index) const
Paints the view.
Definition: KviTalIconAndRichTextItemDelegate.cpp:42
Definition: KviTopicWidget.h:55
Input editor.
Toolkit Abstraction Layer: itemdelegate class.
Definition: KviTalIconAndRichTextItemDelegate.h:52
const QString & topicSetAt()
Definition: KviTopicWidget.h:117
#define o
Definition: detector.cpp:79
Definition: KviThemedLabel.h:33
QString name()
Definition: KviRuntimeInfo.cpp:655
Class for item delegates.
Definition: KviTopicWidget.h:65
This file contains compile time settings.
const QString & topicSetBy()
Definition: KviTopicWidget.h:116
void copy(void *dst_ptr, const void *src_ptr, int len)
Moves len bytes from src_ptr to dst_ptr.
Definition: KviMemory.h:166
#define p
Definition: detector.cpp:80
const QString & topic()
Definition: KviTopicWidget.h:115
The class which manages a channel.
Definition: KviChannelWindow.h:113