Diffstat (limited to 'libopie2/opieui/otaskbarapplet.h') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opieui/otaskbarapplet.h | 47 |
1 files changed, 23 insertions, 24 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 | |||
@@ -24,29 +24,38 @@ | |||
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 | ||
@@ -71,60 +80,50 @@ template<class T> class OTaskbarAppletWrapper : public TaskbarAppletInterface | |||
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 | 113 | ||
112 | virtual ~OTaskbarApplet() | 114 | protected: |
113 | { | 115 | virtual void popup( QWidget* widget ); |
116 | private: | ||
117 | class Private; | ||
118 | Private *d; | ||
119 | }; | ||
120 | } | ||
114 | } | 121 | } |
115 | 122 | ||
116 | protected: | 123 | #define EXPORT_OPIE_APPLET_v1( AppLet ) \ |
117 | virtual void popup( QWidget* widget ) | 124 | Q_EXPORT_INTERFACE() { \ |
118 | { | 125 | Q_CREATE_INSTANCE( Opie::Ui::Private::OTaskbarAppletWrapper<AppLet> ) \ |
119 | QPoint curPos = mapToGlobal( QPoint( 0, 0 ) ); | ||
120 | int w = widget->sizeHint().width(); | ||
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 | } | 126 | } |
127 | }; | ||
128 | 127 | ||
129 | #endif | 128 | #endif |
130 | 129 | ||