Diffstat (limited to 'libopie2/opieui/otaskbarapplet.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opieui/otaskbarapplet.h | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/libopie2/opieui/otaskbarapplet.h b/libopie2/opieui/otaskbarapplet.h index 074367f..0c85ee7 100644 --- a/libopie2/opieui/otaskbarapplet.h +++ b/libopie2/opieui/otaskbarapplet.h | |||
@@ -12,119 +12,118 @@ | |||
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 13 | ._= =} : or (at your option) any later version. |
14 | .%`+i> _;_. | 14 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | 29 | ||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #ifndef OTASKBARAPPLET_H | 32 | #ifndef OTASKBARAPPLET_H |
33 | #define OTASKBARAPPLET_H | 33 | #define OTASKBARAPPLET_H |
34 | 34 | ||
35 | #include <qpe/taskbarappletinterface.h> | 35 | #include <qpe/taskbarappletinterface.h> |
36 | #include <qpe/qcom.h> | ||
36 | 37 | ||
38 | #include <qwidget.h> | ||
39 | |||
40 | class QMouseEvent; | ||
41 | |||
42 | namespace Opie { | ||
43 | namespace Ui { | ||
44 | namespace Private { | ||
37 | /*====================================================================================== | 45 | /*====================================================================================== |
38 | * OTaskbarAppletWrapper | 46 | * OTaskbarAppletWrapper |
39 | *======================================================================================*/ | 47 | *======================================================================================*/ |
40 | 48 | ||
49 | class OTaskbarAppletWrapperPrivate; | ||
41 | template<class T> class OTaskbarAppletWrapper : public TaskbarAppletInterface | 50 | template<class T> class OTaskbarAppletWrapper : public TaskbarAppletInterface |
42 | { | 51 | { |
43 | public: | 52 | public: |
44 | OTaskbarAppletWrapper():_applet( 0 ) | 53 | OTaskbarAppletWrapper():_applet( 0 ) |
45 | { | 54 | { |
46 | } | 55 | } |
47 | 56 | ||
48 | virtual ~OTaskbarAppletWrapper() | 57 | virtual ~OTaskbarAppletWrapper() |
49 | { | 58 | { |
50 | delete _applet; | 59 | delete _applet; |
51 | } | 60 | } |
52 | 61 | ||
53 | QRESULT queryInterface( const QUuid& uuid, QUnknownInterface** iface ) | 62 | QRESULT queryInterface( const QUuid& uuid, QUnknownInterface** iface ) |
54 | { | 63 | { |
55 | qDebug( "OTaskbarAppletWrapper::queryInterface()" ); | 64 | qDebug( "OTaskbarAppletWrapper::queryInterface()" ); |
56 | *iface = 0; | 65 | *iface = 0; |
57 | if ( uuid == IID_QUnknown ) | 66 | if ( uuid == IID_QUnknown ) |
58 | *iface = this; | 67 | *iface = this; |
59 | else if ( uuid == IID_TaskbarApplet ) | 68 | else if ( uuid == IID_TaskbarApplet ) |
60 | *iface = this; | 69 | *iface = this; |
61 | else | 70 | else |
62 | return QS_FALSE; | 71 | return QS_FALSE; |
63 | 72 | ||
64 | if ( *iface ) (*iface)->addRef(); | 73 | if ( *iface ) (*iface)->addRef(); |
65 | return QS_OK; | 74 | return QS_OK; |
66 | } | 75 | } |
67 | 76 | ||
68 | Q_REFCOUNT | 77 | Q_REFCOUNT |
69 | 78 | ||
70 | virtual T* applet( QWidget* parent ) | 79 | virtual T* applet( QWidget* parent ) |
71 | { | 80 | { |
72 | if ( !_applet ) _applet = new T( parent ); | 81 | if ( !_applet ) _applet = new T( parent ); |
73 | return _applet; | 82 | return _applet; |
74 | } | 83 | } |
75 | 84 | ||
76 | virtual int position() const | 85 | virtual int position() const |
77 | { | 86 | { |
78 | return T::position(); | 87 | return T::position(); |
79 | } | 88 | } |
80 | 89 | ||
81 | private: | 90 | private: |
82 | T* _applet; | 91 | T* _applet; |
92 | OTaskbarAppletWrapperPrivate *d; | ||
83 | }; | 93 | }; |
84 | 94 | ||
85 | #include <qframe.h> | 95 | } |
86 | #include <qwidget.h> | ||
87 | #include <qpe/qpeapplication.h> | ||
88 | |||
89 | class QMouseEvent; | ||
90 | |||
91 | /*====================================================================================== | 96 | /*====================================================================================== |
92 | * OTaskbarApplet | 97 | * OTaskbarApplet |
93 | *======================================================================================*/ | 98 | *======================================================================================*/ |
94 | 99 | ||
95 | // Must be inline until after we shipped Opie 1.0 | 100 | // Must be inline until after we shipped Opie 1.0 |
96 | 101 | ||
97 | // Having OTaskBarApplet reside in libopieui2 is not possible | 102 | // Having OTaskBarApplet reside in libopieui2 is not possible |
98 | // until we link the launcher binary against libopieui2 - | 103 | // until we link the launcher binary against libopieui2 - |
99 | // otherwise the necessary symbols are not present, when | 104 | // otherwise the necessary symbols are not present, when |
100 | // the dynamic loader [dlopen] tries to resolve an applet which | 105 | // the dynamic loader [dlopen] tries to resolve an applet which |
101 | // inherits OTaskbarApplet | 106 | // inherits OTaskbarApplet |
102 | 107 | ||
103 | class OTaskbarApplet : public QWidget | 108 | class OTaskbarApplet : public QWidget |
104 | { | 109 | { |
105 | public: | 110 | public: |
106 | OTaskbarApplet( QWidget* parent, const char* name = 0 ):QWidget( parent, name ) | 111 | OTaskbarApplet( QWidget* parent, const char* name = 0 ); |
107 | { | 112 | virtual ~OTaskbarApplet(); |
108 | setFixedHeight( 18 ); | ||
109 | setFixedWidth( 14 ); | ||
110 | } | ||
111 | |||
112 | virtual ~OTaskbarApplet() | ||
113 | { | ||
114 | } | ||
115 | 113 | ||
116 | protected: | 114 | protected: |
117 | virtual void popup( QWidget* widget ) | 115 | virtual void popup( QWidget* widget ); |
118 | { | 116 | private: |
119 | QPoint curPos = mapToGlobal( QPoint( 0, 0 ) ); | 117 | class Private; |
120 | int w = widget->sizeHint().width(); | 118 | Private *d; |
121 | int x = curPos.x() - (w/2 ); | ||
122 | if ( (x+w) > QPEApplication::desktop()->width() ) | ||
123 | x = QPEApplication::desktop()->width()-w; | ||
124 | widget->move( x, curPos.y()-widget->sizeHint().height() ); | ||
125 | widget->show(); | ||
126 | } | ||
127 | }; | 119 | }; |
120 | } | ||
121 | } | ||
122 | |||
123 | #define EXPORT_OPIE_APPLET_v1( AppLet ) \ | ||
124 | Q_EXPORT_INTERFACE() { \ | ||
125 | Q_CREATE_INSTANCE( Opie::Ui::Private::OTaskbarAppletWrapper<AppLet> ) \ | ||
126 | } | ||
128 | 127 | ||
129 | #endif | 128 | #endif |
130 | 129 | ||