summaryrefslogtreecommitdiff
path: root/libopie2/opieui/otaskbarapplet.h
Unidiff
Diffstat (limited to 'libopie2/opieui/otaskbarapplet.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/otaskbarapplet.h49
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
@@ -30,17 +30,26 @@
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
40class QMouseEvent;
41
42namespace Opie {
43namespace Ui {
44namespace Private {
37/*====================================================================================== 45/*======================================================================================
38 * OTaskbarAppletWrapper 46 * OTaskbarAppletWrapper
39 *======================================================================================*/ 47 *======================================================================================*/
40 48
49class OTaskbarAppletWrapperPrivate;
41template<class T> class OTaskbarAppletWrapper : public TaskbarAppletInterface 50template<class T> class OTaskbarAppletWrapper : public TaskbarAppletInterface
42{ 51{
43 public: 52 public:
44 OTaskbarAppletWrapper():_applet( 0 ) 53 OTaskbarAppletWrapper():_applet( 0 )
45 { 54 {
46 } 55 }
@@ -77,20 +86,16 @@ template<class T> class OTaskbarAppletWrapper : public TaskbarAppletInterface
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
89class 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
@@ -100,31 +105,25 @@ class QMouseEvent;
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
103class OTaskbarApplet : public QWidget 108class 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 { 116private:
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