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 |
|
---|
26 | class GAdvancedWidget : public QObject
|
---|
27 | {
|
---|
28 | Q_OBJECT
|
---|
29 | public:
|
---|
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 |
|
---|
53 | public:
|
---|
54 | class Private;
|
---|
55 | private:
|
---|
56 | Private *d;
|
---|
57 | };
|
---|
58 |
|
---|
59 | template <class BaseClass>
|
---|
60 | class AdvancedWidget : public BaseClass
|
---|
61 | {
|
---|
62 | private:
|
---|
63 | GAdvancedWidget *gAdvWidget;
|
---|
64 |
|
---|
65 | public:
|
---|
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 |
|
---|
100 | protected:
|
---|
101 | void windowActivationChange( bool oldstate )
|
---|
102 | {
|
---|
103 | gAdvWidget->windowActivationChange( oldstate );
|
---|
104 | BaseClass::windowActivationChange( oldstate );
|
---|
105 | }
|
---|
106 | };
|
---|
107 |
|
---|
108 | #endif
|
---|