KVIrc  4.9.2
DeveloperAPIs
KviWindowListBase.h
Go to the documentation of this file.
1 #ifndef _KVI_WINDOWLIST_H_
2 #define _KVI_WINDOWLIST_H_
3 //=============================================================================
4 //
5 // File : KviWindowListBase.h
6 // Creation date : Thu Jan 7 1999 03:56:50 by Szymon Stefanek
7 //
8 // This file is part of the KVIrc IRC client distribution
9 // Copyright (C) 1999-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 "KviPointerList.h"
29 #include "KviTalToolTip.h"
30 
31 #include <QPushButton>
32 #include <QToolButton>
33 #include <QBoxLayout>
34 #include <QFrame>
35 #include <QDockWidget>
36 
37 class QPixmap;
38 class KviWindow;
39 class KviMainWindow;
40 class KviDynamicToolTip;
41 class KviConsoleWindow;
42 
43 //
44 // KviWindowListItem
45 // The base class for the WindowList items
46 // this is the only interface to an item visible to external classes
47 //
48 
50 {
51 public:
53  virtual ~KviWindowListItem();
54 
55 protected:
59 
60 public:
61  KviWindow * kviWindow() { return m_pWindow; };
62  virtual void captionChanged(){};
63  virtual void highlight(int){};
64  virtual void setProgress(int){};
65  virtual bool active() { return false; };
66  virtual void unhighlight(){};
67  int progress() { return m_iProgress; };
68  int highlightLevel() { return m_iHighlightLevel; };
69 };
70 
71 //
72 // KviWindowListBase
73 // The base class for the WindowList implementations
74 // This is the basic interface that all the external classes should see
75 //
76 
77 class KVIRC_API KviWindowListBase : public QDockWidget
78 {
79  Q_OBJECT
80 public:
82  virtual ~KviWindowListBase();
83 
84 protected:
87  QWidget * m_pTitleWidget;
88  Qt::DockWidgetArea currentArea;
89 
90 public:
91  virtual KviWindowListItem * addItem(KviWindow *) { return 0; };
92  virtual bool removeItem(KviWindowListItem *) { return false; };
93  virtual void setActiveItem(KviWindowListItem *){};
94  virtual KviWindowListItem * firstItem() { return 0; };
95  virtual KviWindowListItem * lastItem(void) { return 0; }
96  virtual KviWindowListItem * nextItem() { return 0; };
97  virtual KviWindowListItem * prevItem(void) { return 0; }
98  virtual KviWindowListItem * item(int number);
99  virtual bool setIterationPointer(KviWindowListItem *) { return false; };
100  virtual void switchWindow(bool bNext, bool bInContextOnly, bool bHighlightedOnly = false);
101  virtual void updatePseudoTransparency(){};
102  virtual void applyOptions();
103  virtual void wheelEvent(QWheelEvent * e);
104  static void getTextForConsole(QString & szText, KviConsoleWindow * pConsole);
105  Qt::DockWidgetArea currentDockArea() { return currentArea; };
106 protected slots:
107  virtual void updateActivityMeter();
108  void updateDockLocation(Qt::DockWidgetArea newArea);
109 };
110 
111 //
112 // Implementation details: the following classes should be
113 // never used directly (with just the exception of KviMainWindow
114 // that creates the WindowList)
115 //
116 
118 
119 //
120 // KviWindowListButton
121 // Button to show/hide the window and containing the button to close it
122 //
123 
125 {
126  friend class KviClassicWindowList;
128  Q_OBJECT
129 public:
130  KviWindowListButton(QWidget * par, KviWindow * wnd, const char * name);
132 
133 protected:
134  bool m_bActive;
135  QBoxLayout * m_pLayout;
136  QToolButton * m_pTool;
138 
139 protected:
140  virtual void mousePressEvent(QMouseEvent * e);
141  virtual void contextMenuEvent(QContextMenuEvent * e);
142  virtual void drawButtonLabel(QPainter * p);
143  virtual void paintEvent(QPaintEvent * e);
144 
145 public:
146  virtual bool active() { return m_bActive; };
147  virtual void highlight(int iLevel = 1);
148  virtual void unhighlight();
149  virtual void setProgress(int progress);
150  virtual void captionChanged();
151 
152 protected:
153  void setActive(bool bActive);
154 protected slots:
155  void tipRequest(KviDynamicToolTip * tip, const QPoint & pnt);
156 };
157 
158 //
159 // KviClassicWindowListToolButton
160 // Button to close the window
161 //
162 
163 class KVIRC_API KviClassicWindowListToolButton : public QToolButton
164 {
165  Q_OBJECT
166 protected:
168 
169 public:
172 
173 protected:
174  virtual void mousePressEvent(QMouseEvent *e);
175 
176 public:
177  virtual QSize sizeHint() const;
178 };
179 
181 {
182  Q_OBJECT
183 public:
186 
187 protected:
190  QWidget * m_pBase;
191 
192 protected:
193  void calcButtonHeight();
194  void insertButton(KviWindowListButton * b);
195 
196 public:
197  virtual void resizeEvent(QResizeEvent * e);
198 
199 public:
200  virtual KviWindowListItem * addItem(KviWindow *);
201  virtual bool removeItem(KviWindowListItem *);
202  virtual void setActiveItem(KviWindowListItem *);
203  virtual KviWindowListItem * firstItem();
204  virtual KviWindowListItem * lastItem(void);
205  virtual KviWindowListItem * nextItem();
206  virtual KviWindowListItem * prevItem(void);
207  virtual bool setIterationPointer(KviWindowListItem * it);
208  virtual void updateActivityMeter();
209  virtual void applyOptions();
210 protected slots:
211  void orientationChangedSlot(Qt::Orientation o);
212  void doLayout();
213 };
214 
215 class KVIRC_API KviWindowListTitleWidget : public QWidget
216 {
217  Q_OBJECT
218 public:
219  KviWindowListTitleWidget(KviWindowListBase * parent) { m_pParent = parent; };
221 
222 private:
223  KviWindowListBase * m_pParent;
224 
225 public:
226  QSize sizeHint() const;
227  void paintEvent(QPaintEvent *);
228 };
229 
230 #endif //_KVI_WINDOWLIST_H_
Definition: KviDynamicToolTip.h:49
int highlightLevel()
Definition: KviWindowListBase.h:68
QWidget * m_pBase
Definition: KviWindowListBase.h:190
Definition: KviMainWindow.h:60
Definition: KviConsoleWindow.h:75
#define KVIRC_API
Definition: kvi_settings.h:128
KviWindowListTitleWidget(KviWindowListBase *parent)
Definition: KviWindowListBase.h:219
virtual void updateActivityMeter()
Definition: KviWindowListBase.cpp:93
virtual bool setIterationPointer(KviWindowListItem *)
Definition: KviWindowListBase.h:99
virtual void captionChanged()
Definition: KviWindowListBase.h:62
virtual void setProgress(int)
Definition: KviWindowListBase.h:64
QBoxLayout * m_pLayout
Definition: KviWindowListBase.h:135
virtual void mousePressEvent(QMouseEvent *e)
Definition: KviWindowListBase.cpp:567
KviWindowListButton * m_pPar
Definition: KviWindowListBase.h:167
virtual KviWindowListItem * addItem(KviWindow *)
Definition: KviWindowListBase.h:91
Qt::DockWidgetArea currentDockArea()
Definition: KviWindowListBase.h:105
virtual bool active()
Definition: KviWindowListBase.h:146
#define e
Definition: detector.cpp:69
QToolButton * m_pTool
Definition: KviWindowListBase.h:136
bool m_bActive
Definition: KviWindowListBase.h:134
virtual void updatePseudoTransparency()
Definition: KviWindowListBase.h:101
virtual KviWindowListItem * nextItem()
Definition: KviWindowListBase.h:96
KviDynamicToolTip * m_pTip
Definition: KviWindowListBase.h:137
KviWindow * kviWindow()
Definition: KviWindowListBase.h:61
virtual KviWindowListItem * lastItem(void)
Definition: KviWindowListBase.h:95
QTimer * m_pActivityMeterTimer
Definition: KviWindowListBase.h:86
Definition: KviWindowListBase.h:124
Definition: KviWindowListBase.h:215
virtual void highlight(int)
Definition: KviWindowListBase.h:63
virtual void setActiveItem(KviWindowListItem *)
Definition: KviWindowListBase.h:93
KviMainWindow * m_pFrm
Definition: KviWindowListBase.h:85
QWidget * m_pTitleWidget
Definition: KviWindowListBase.h:87
C++ Template based double linked pointer list class.
Base class for all windows in KVIrc.
Definition: KviWindow.h:74
virtual KviWindowListItem * firstItem()
Definition: KviWindowListBase.h:94
#define o
Definition: detector.cpp:79
int progress()
Definition: KviWindowListBase.h:67
Definition: KviWindowListBase.h:163
virtual bool removeItem(KviWindowListItem *)
Definition: KviWindowListBase.h:92
Definition: KviWindowListBase.h:77
QString name()
Definition: KviRuntimeInfo.cpp:655
virtual KviWindowListItem * prevItem(void)
Definition: KviWindowListBase.h:97
KviWindow * m_pWindow
Definition: KviWindowListBase.h:56
virtual void applyOptions()
Definition: KviWindowListBase.cpp:183
~KviClassicWindowListToolButton()
Definition: KviWindowListBase.h:171
int m_iHighlightLevel
Definition: KviWindowListBase.h:57
Qt::DockWidgetArea currentArea
Definition: KviWindowListBase.h:88
This file contains compile time settings.
Definition: KviWindowListBase.h:49
~KviWindowListTitleWidget()
Definition: KviWindowListBase.h:220
#define p
Definition: detector.cpp:80
int m_iButtonHeight
Definition: KviWindowListBase.h:189
KviPointerList< KviWindowListButton > * m_pButtonList
Definition: KviWindowListBase.h:188
Definition: KviWindowListBase.h:180
int m_iProgress
Definition: KviWindowListBase.h:58
virtual bool active()
Definition: KviWindowListBase.h:65
virtual void unhighlight()
Definition: KviWindowListBase.h:66