summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/otaskbarapplet.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/libopie2/opieui/otaskbarapplet.h b/libopie2/opieui/otaskbarapplet.h
index 773aba4..074367f 100644
--- a/libopie2/opieui/otaskbarapplet.h
+++ b/libopie2/opieui/otaskbarapplet.h
@@ -1,131 +1,130 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3 3
4              Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> 4              Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
5 =. 5 =.
6 .=l. 6 .=l.
7           .>+-= 7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can 8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under 9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software 11.="- .-=="i,     .._ License as published by the Free Software
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 36
37/*====================================================================================== 37/*======================================================================================
38 * OTaskbarAppletWrapper 38 * OTaskbarAppletWrapper
39 *======================================================================================*/ 39 *======================================================================================*/
40 40
41template<class T> class OTaskbarAppletWrapper : public TaskbarAppletInterface 41template<class T> class OTaskbarAppletWrapper : public TaskbarAppletInterface
42{ 42{
43 public: 43 public:
44 OTaskbarAppletWrapper():_applet( 0 ), ref( 0 ) 44 OTaskbarAppletWrapper():_applet( 0 )
45 { 45 {
46 } 46 }
47 47
48 virtual ~OTaskbarAppletWrapper() 48 virtual ~OTaskbarAppletWrapper()
49 { 49 {
50 delete _applet; 50 delete _applet;
51 } 51 }
52 52
53 QRESULT queryInterface( const QUuid& uuid, QUnknownInterface** iface ) 53 QRESULT queryInterface( const QUuid& uuid, QUnknownInterface** iface )
54 { 54 {
55 qDebug( "OTaskbarAppletWrapper::queryInterface()" ); 55 qDebug( "OTaskbarAppletWrapper::queryInterface()" );
56 *iface = 0; 56 *iface = 0;
57 if ( uuid == IID_QUnknown ) 57 if ( uuid == IID_QUnknown )
58 *iface = this; 58 *iface = this;
59 else if ( uuid == IID_TaskbarApplet ) 59 else if ( uuid == IID_TaskbarApplet )
60 *iface = this; 60 *iface = this;
61 else 61 else
62 return QS_FALSE; 62 return QS_FALSE;
63 63
64 if ( *iface ) (*iface)->addRef(); 64 if ( *iface ) (*iface)->addRef();
65 return QS_OK; 65 return QS_OK;
66 } 66 }
67 67
68 Q_REFCOUNT 68 Q_REFCOUNT
69 69
70 virtual T* applet( QWidget* parent ) 70 virtual T* applet( QWidget* parent )
71 { 71 {
72 if ( !_applet ) _applet = new T( parent ); 72 if ( !_applet ) _applet = new T( parent );
73 return _applet; 73 return _applet;
74 } 74 }
75 75
76 virtual int position() const 76 virtual int position() const
77 { 77 {
78 return T::position(); 78 return T::position();
79 } 79 }
80 80
81 private: 81 private:
82 T* _applet; 82 T* _applet;
83 ulong ref;
84}; 83};
85 84
86#include <qframe.h> 85#include <qframe.h>
87#include <qwidget.h> 86#include <qwidget.h>
88#include <qpe/qpeapplication.h> 87#include <qpe/qpeapplication.h>
89 88
90class QMouseEvent; 89class QMouseEvent;
91 90
92/*====================================================================================== 91/*======================================================================================
93 * OTaskbarApplet 92 * OTaskbarApplet
94 *======================================================================================*/ 93 *======================================================================================*/
95 94
96// Must be inline until after we shipped Opie 1.0 95// Must be inline until after we shipped Opie 1.0
97 96
98// Having OTaskBarApplet reside in libopieui2 is not possible 97// Having OTaskBarApplet reside in libopieui2 is not possible
99// until we link the launcher binary against libopieui2 - 98// until we link the launcher binary against libopieui2 -
100// otherwise the necessary symbols are not present, when 99// otherwise the necessary symbols are not present, when
101// the dynamic loader [dlopen] tries to resolve an applet which 100// the dynamic loader [dlopen] tries to resolve an applet which
102// inherits OTaskbarApplet 101// inherits OTaskbarApplet
103 102
104class OTaskbarApplet : public QWidget 103class OTaskbarApplet : public QWidget
105{ 104{
106 public: 105 public:
107 OTaskbarApplet( QWidget* parent, const char* name = 0 ):QWidget( parent, name ) 106 OTaskbarApplet( QWidget* parent, const char* name = 0 ):QWidget( parent, name )
108 { 107 {
109 setFixedHeight( 18 ); 108 setFixedHeight( 18 );
110 setFixedWidth( 14 ); 109 setFixedWidth( 14 );
111 } 110 }
112 111
113 virtual ~OTaskbarApplet() 112 virtual ~OTaskbarApplet()
114 { 113 {
115 } 114 }
116 115
117 protected: 116 protected:
118 virtual void popup( QWidget* widget ) 117 virtual void popup( QWidget* widget )
119 { 118 {
120 QPoint curPos = mapToGlobal( QPoint( 0, 0 ) ); 119 QPoint curPos = mapToGlobal( QPoint( 0, 0 ) );
121 int w = widget->sizeHint().width(); 120 int w = widget->sizeHint().width();
122 int x = curPos.x() - (w/2 ); 121 int x = curPos.x() - (w/2 );
123 if ( (x+w) > QPEApplication::desktop()->width() ) 122 if ( (x+w) > QPEApplication::desktop()->width() )
124 x = QPEApplication::desktop()->width()-w; 123 x = QPEApplication::desktop()->width()-w;
125 widget->move( x, curPos.y()-widget->sizeHint().height() ); 124 widget->move( x, curPos.y()-widget->sizeHint().height() );
126 widget->show(); 125 widget->show();
127 } 126 }
128}; 127};
129 128
130#endif 129#endif
131 130