KVIrc 5.2.4
Developer APIs
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
37class QPixmap;
38class KviWindow;
39class KviMainWindow;
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{
51public:
53 virtual ~KviWindowListItem();
54
55protected:
59
60public:
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
77class KVIRC_API KviWindowListBase : public QDockWidget
78{
79 Q_OBJECT
80public:
83
84protected:
87 QWidget * m_pTitleWidget;
88 Qt::DockWidgetArea currentArea;
89
90public:
91 virtual KviWindowListItem * addItem(KviWindow *) { return nullptr; }
92 virtual bool removeItem(KviWindowListItem *) { return false; };
94 virtual KviWindowListItem * firstItem() { return nullptr; }
95 virtual KviWindowListItem * lastItem(void) { return nullptr; }
96 virtual KviWindowListItem * nextItem() { return nullptr; }
97 virtual KviWindowListItem * prevItem(void) { return nullptr; }
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 void wheelEvent(QWheelEvent * e) override;
104 static void getTextForConsole(QString & szText, KviConsoleWindow * pConsole);
105 Qt::DockWidgetArea currentDockArea() { return currentArea; };
106protected 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{
128 Q_OBJECT
129public:
130 KviWindowListButton(QWidget * par, KviWindow * wnd, const char * name);
132
133protected:
135 QBoxLayout * m_pLayout;
136 QToolButton * m_pTool;
138
139protected:
140 void mousePressEvent(QMouseEvent * e) override;
141 void contextMenuEvent(QContextMenuEvent * e) override;
142 virtual void drawButtonLabel(QPainter * p);
143 void paintEvent(QPaintEvent * e) override;
144
145public:
146 bool active() override { return m_bActive; }
147 void highlight(int iLevel = 1) override;
148 void unhighlight() override;
149 void setProgress(int progress) override;
150 void captionChanged() override;
151
152protected:
153 void setActive(bool bActive);
154protected slots:
155 void tipRequest(KviDynamicToolTip * tip, const QPoint & pnt);
156};
157
158//
159// KviClassicWindowListToolButton
160// Button to close the window
161//
162
164{
165 Q_OBJECT
166protected:
168
169public:
172
173protected:
174 void mousePressEvent(QMouseEvent *e) override;
175
176public:
177 QSize sizeHint() const override;
178};
179
181{
182 Q_OBJECT
183public:
186
187protected:
190 QWidget * m_pBase;
191
192protected:
193 void calcButtonHeight();
194 void insertButton(KviWindowListButton * b);
195
196public:
197 void resizeEvent(QResizeEvent * e) override;
198
199public:
200 KviWindowListItem * addItem(KviWindow *) override;
201 bool removeItem(KviWindowListItem *) override;
202 void setActiveItem(KviWindowListItem *) override;
203 KviWindowListItem * firstItem() override;
204 KviWindowListItem * lastItem(void) override;
205 KviWindowListItem * nextItem() override;
206 KviWindowListItem * prevItem(void) override;
207 bool setIterationPointer(KviWindowListItem * it) override;
208 void updateActivityMeter() override;
209 void applyOptions() override;
210protected slots:
211 void orientationChangedSlot(Qt::Orientation o);
212 void doLayout();
213};
214
216{
217 Q_OBJECT
218public:
219 KviWindowListTitleWidget(KviWindowListBase * parent) { m_pParent = parent; };
221
222private:
224
225public:
226 QSize sizeHint() const override;
227 void paintEvent(QPaintEvent *) override;
228};
229
230#endif //_KVI_WINDOWLIST_H_
C++ Template based double linked pointer list class.
Definition KviWindowListBase.h:164
~KviClassicWindowListToolButton()
Definition KviWindowListBase.h:171
KviWindowListButton * m_pPar
Definition KviWindowListBase.h:167
Definition KviWindowListBase.h:181
int m_iButtonHeight
Definition KviWindowListBase.h:189
KviPointerList< KviWindowListButton > * m_pButtonList
Definition KviWindowListBase.h:188
QWidget * m_pBase
Definition KviWindowListBase.h:190
Definition KviConsoleWindow.h:74
Definition KviDynamicToolTip.h:50
Definition KviMainWindow.h:58
A template double linked list of pointers.
Definition KviPointerList.h:371
Definition KviWindowListBase.h:78
Qt::DockWidgetArea currentDockArea()
Definition KviWindowListBase.h:105
virtual void setActiveItem(KviWindowListItem *)
Definition KviWindowListBase.h:93
virtual KviWindowListItem * nextItem()
Definition KviWindowListBase.h:96
virtual KviWindowListItem * lastItem(void)
Definition KviWindowListBase.h:95
virtual void updatePseudoTransparency()
Definition KviWindowListBase.h:101
QWidget * m_pTitleWidget
Definition KviWindowListBase.h:87
virtual bool setIterationPointer(KviWindowListItem *)
Definition KviWindowListBase.h:99
virtual KviWindowListItem * prevItem(void)
Definition KviWindowListBase.h:97
virtual KviWindowListItem * addItem(KviWindow *)
Definition KviWindowListBase.h:91
KviMainWindow * m_pFrm
Definition KviWindowListBase.h:85
virtual KviWindowListItem * firstItem()
Definition KviWindowListBase.h:94
QTimer * m_pActivityMeterTimer
Definition KviWindowListBase.h:86
virtual bool removeItem(KviWindowListItem *)
Definition KviWindowListBase.h:92
Qt::DockWidgetArea currentArea
Definition KviWindowListBase.h:88
Definition KviWindowListBase.h:125
bool active() override
Definition KviWindowListBase.h:146
KviDynamicToolTip * m_pTip
Definition KviWindowListBase.h:137
QToolButton * m_pTool
Definition KviWindowListBase.h:136
QBoxLayout * m_pLayout
Definition KviWindowListBase.h:135
bool m_bActive
Definition KviWindowListBase.h:134
Definition KviWindowListBase.h:50
KviWindow * m_pWindow
Definition KviWindowListBase.h:56
virtual void highlight(int)
Definition KviWindowListBase.h:63
int progress()
Definition KviWindowListBase.h:67
int m_iProgress
Definition KviWindowListBase.h:58
int highlightLevel()
Definition KviWindowListBase.h:68
virtual void unhighlight()
Definition KviWindowListBase.h:66
int m_iHighlightLevel
Definition KviWindowListBase.h:57
KviWindow * kviWindow()
Definition KviWindowListBase.h:61
virtual void setProgress(int)
Definition KviWindowListBase.h:64
virtual void captionChanged()
Definition KviWindowListBase.h:62
virtual bool active()
Definition KviWindowListBase.h:65
Definition KviWindowListBase.h:216
KviWindowListBase * m_pParent
Definition KviWindowListBase.h:223
KviWindowListTitleWidget(KviWindowListBase *parent)
Definition KviWindowListBase.h:219
~KviWindowListTitleWidget()
Definition KviWindowListBase.h:220
Base class for all windows in KVIrc.
Definition KviWindow.h:75
#define e
Definition detector.cpp:70
#define o
Definition detector.cpp:80
#define p
Definition detector.cpp:81
This file contains compile time settings.
#define KVIRC_API
Definition kvi_settings.h:127