KVIrc  4.9.2
DeveloperAPIs
KviStatusBar.h
Go to the documentation of this file.
1 #ifndef _KVI_STATUSBAR_H_
2 #define _KVI_STATUSBAR_H_
3 //=============================================================================
4 //
5 // File : KviStatusBar.h
6 // Creation date : Tue 07 Sep 2004 03:56:46 by Szymon Stefanek
7 //
8 // This file is part of the KVIrc IRC client distribution
9 // Copyright (C) 2004-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 
38 #include "kvi_settings.h"
39 #include "KviPointerList.h"
40 #include "KviHeapObject.h"
41 #include "KviPointerHashTable.h"
42 #include "KviTalHBox.h"
43 
44 #include <QString>
45 #include <QStatusBar>
46 #include <QHelpEvent>
47 
48 class QTimer;
49 class QLabel;
50 class KviMainWindow;
51 class QMenu;
52 class KviStatusBarApplet;
54 class KviIrcContext;
55 class KviDynamicToolTip;
56 
57 #define VMARGIN 3
58 //#define HMARGIN 4
59 //#define SPACING 3
60 #define RICHTEXTLABELTRICK 2
61 
67 {
68  friend class KviStatusBar;
69 
70 protected:
71  QString m_szText;
72  unsigned int m_uTimeout;
73  unsigned int m_uPriority;
74 
75 public:
83  KviStatusBarMessage(const QString & szText, unsigned int uTimeout = 8000, unsigned int uPriority = 0)
84  : KviHeapObject(), m_szText(szText), m_uTimeout(uTimeout), m_uPriority(uPriority){};
85 
90 
91 public:
96  const QString & text() { return m_szText; };
97 
102  unsigned int timeout() { return m_uTimeout; };
103 
108  unsigned int priority() { return m_uPriority; };
109 };
110 
115 class KVIRC_API KviStatusBar : public QStatusBar
116 {
117  friend class KviStatusBarApplet;
118  friend class KviMainWindow;
119  Q_OBJECT
120 public:
126  KviStatusBar(KviMainWindow * pFrame);
127 
131  ~KviStatusBar();
132 
133 protected:
137  QTimer * m_pMessageTimer;
138  QLabel * m_pMessageLabel;
147 
148 public:
153  KviMainWindow * frame() { return m_pFrame; };
154 
160  bool appletExists(KviStatusBarApplet * pApplet);
161 
172  KviStatusBarApplet * appletAt(const QPoint & pnt, bool bBestMatch = false);
173 
174  //QMenu * contextPopup();
175 
182  void queueMessage(KviStatusBarMessage * pMsg);
183 
189  void registerAppletDescriptor(KviStatusBarAppletDescriptor * d);
190 
197  int insertPermanentWidgetAtTheEnd(QWidget * widget, int stretch = 0);
198 
199  //void addApplet(KviStatusBarApplet * pApplet);
200  //void removeApplet(KviStatusBarApplet * pApplet);
201 protected:
206  void showFirstMessageInQueue();
207 
213  void registerApplet(KviStatusBarApplet * pApplet);
214 
220  void unregisterApplet(KviStatusBarApplet * pApplet);
221 
226  void recalcMinimumHeight();
227 
232  void save();
233 
238  void load();
239 
248  KviStatusBarApplet * createApplet(const QString & szInternalName);
249 
254  void showLayoutHelp();
255 
264  void tipRequest(QHelpEvent * e);
265 protected slots:
273  void messageTimerFired();
274 
280  void contextMenuRequested(const QPoint & pos);
281 
286  void contextPopupAboutToShow();
287 
292  void appletsPopupAboutToShow();
293 
299  void appletsPopupActivated(QAction * pAction);
300 
305  void removeClickedApplet();
306 
313  void setPermanentMessage();
314 
315 protected:
316  virtual void mousePressEvent(QMouseEvent * e);
317  virtual void mouseDoubleClickEvent(QMouseEvent * e);
318  virtual bool event(QEvent * e);
319  void dropEvent(QDropEvent * de);
320  void dragMoveEvent(QDragMoveEvent * de);
321  void dragEnterEvent(QDragEnterEvent * event);
322 };
323 
324 #endif // _KVI_STATUSBAR_H_
KviPointerHashTable< QString, KviStatusBarAppletDescriptor > * m_pAppletDescriptors
Definition: KviStatusBar.h:140
Toolkit Abstraction Layer: hbox class.
Definition: KviTalHBox.h:44
Definition: KviDynamicToolTip.h:49
Definition: KviHeapObject.h:124
Definition: KviMainWindow.h:60
#define KVIRC_API
Definition: kvi_settings.h:128
Definition: KviStatusBarApplet.h:52
Class for horizontal box.
KviDynamicToolTip * m_pToolTip
Definition: KviStatusBar.h:146
KviTalHBox * m_pBox
Definition: KviStatusBar.h:134
~KviStatusBarMessage()
Destroys the statusbar message object.
Definition: KviStatusBar.h:89
unsigned int m_uTimeout
Definition: KviStatusBar.h:72
QTimer * m_pMessageTimer
Definition: KviStatusBar.h:137
Status Bar class.
Definition: KviStatusBar.h:115
KviStatusBarApplet * m_pClickedApplet
Definition: KviStatusBar.h:143
QString m_szText
Definition: KviStatusBar.h:71
unsigned int priority()
Returns the priority of the message.
Definition: KviStatusBar.h:108
#define e
Definition: detector.cpp:69
QLabel * m_pMessageLabel
Definition: KviStatusBar.h:138
int m_iLastMinimumHeight
Definition: KviStatusBar.h:144
Pointer Hash Table.
KviMainWindow * m_pFrame
Definition: KviStatusBar.h:135
KviStatusBarMessage(const QString &szText, unsigned int uTimeout=8000, unsigned int uPriority=0)
Constructs the statusbar message object.
Definition: KviStatusBar.h:83
char s d
Definition: KviIrcNumericCodes.h:391
const QString & text()
Returns the text of the message.
Definition: KviStatusBar.h:96
bool save(KviThemeInfo &options, bool bSaveIcons)
Definition: KviOptions.cpp:986
unsigned int timeout()
Returns the timeout of the message.
Definition: KviStatusBar.h:102
KviPointerList< KviStatusBarMessage > * m_pMessageQueue
Definition: KviStatusBar.h:136
bool m_bStopLayoutOnAddRemove
Definition: KviStatusBar.h:145
A class that hold the statusbar message.
Definition: KviStatusBar.h:66
C++ Template based double linked pointer list class.
Heap Object.
unsigned int m_uPriority
Definition: KviStatusBar.h:73
KviPointerList< KviStatusBarApplet > * m_pAppletList
Definition: KviStatusBar.h:139
KviMainWindow * frame()
Returns the frame pointer.
Definition: KviStatusBar.h:153
Definition: KviStatusBarApplet.h:86
This file contains compile time settings.
Definition: KviIrcContext.h:58
QMenu * m_pContextPopup
Definition: KviStatusBar.h:141
QMenu * m_pAppletsPopup
Definition: KviStatusBar.h:142