source: psi/trunk/src/tools/advwidget/advwidget.h

Last change on this file was 2, checked in by dmik, 19 years ago

Imported original Psi 0.10 sources from Affinix

File size: 2.6 KB
Line 
1/*
2 * advwidget.h - AdvancedWidget template class
3 * Copyright (C) 2005 Michail Pishchagin
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 */
20
21#ifndef ADVWIDGET_H
22#define ADVWIDGET_H
23
24#include <qwidget.h>
25
26class GAdvancedWidget : public QObject
27{
28 Q_OBJECT
29public:
30 GAdvancedWidget(QWidget *parent, const char *name = 0);
31 ~GAdvancedWidget();
32
33 static bool stickEnabled();
34 static void setStickEnabled(bool val);
35
36 static int stickAt();
37 static void setStickAt(int val);
38
39 static bool stickToWindows();
40 static void setStickToWindows(bool val);
41
42 void doFlash(bool on);
43
44#ifdef Q_OS_WIN
45 bool winEvent(MSG *msg);
46#endif
47
48 void preSetCaption();
49 void postSetCaption();
50
51 void windowActivationChange(bool oldstate);
52
53public:
54 class Private;
55private:
56 Private *d;
57};
58
59template <class BaseClass>
60class AdvancedWidget : public BaseClass
61{
62private:
63 GAdvancedWidget *gAdvWidget;
64
65public:
66 AdvancedWidget( QWidget *parent = 0, const char *name = 0, Qt::WFlags f = 0 )
67 : BaseClass( parent, name, f )
68 {
69 gAdvWidget = new GAdvancedWidget( this );
70 }
71
72 static bool stickEnabled() { return GAdvancedWidget::stickEnabled(); }
73 static void setStickEnabled( bool val ) { GAdvancedWidget::setStickEnabled( val ); }
74
75 static int stickAt() { return GAdvancedWidget::stickAt(); }
76 static void setStickAt( int val ) { GAdvancedWidget::setStickAt( val ); }
77
78 static bool stickToWindows() { return GAdvancedWidget::stickToWindows(); }
79 static void setStickToWindows( bool val ) { GAdvancedWidget::setStickToWindows( val ); }
80
81 void doFlash( bool on )
82 {
83 gAdvWidget->doFlash( on );
84 }
85
86#ifdef Q_OS_WIN
87 bool winEvent( MSG *msg )
88 {
89 return gAdvWidget->winEvent( msg );
90 }
91#endif
92
93 void setCaption( const QString &c )
94 {
95 gAdvWidget->preSetCaption();
96 BaseClass::setCaption( c );
97 gAdvWidget->postSetCaption();
98 }
99
100protected:
101 void windowActivationChange( bool oldstate )
102 {
103 gAdvWidget->windowActivationChange( oldstate );
104 BaseClass::windowActivationChange( oldstate );
105 }
106};
107
108#endif
Note: See TracBrowser for help on using the repository browser.