summaryrefslogtreecommitdiff
path: root/examples/applet/simpleimpl.h
authorzecke <zecke>2004-03-14 20:08:59 (UTC)
committer zecke <zecke>2004-03-14 20:08:59 (UTC)
commit0d79c003839718ae70b3b997162044abd5c26bf6 (patch) (unidiff)
tree19708b041da3a09df8f3b571cd634a846f4ad6d7 /examples/applet/simpleimpl.h
parent05c8d999941989a97a581fb5822437034ec10fd7 (diff)
downloadopie-0d79c003839718ae70b3b997162044abd5c26bf6.zip
opie-0d79c003839718ae70b3b997162044abd5c26bf6.tar.gz
opie-0d79c003839718ae70b3b997162044abd5c26bf6.tar.bz2
Update the Examples
Diffstat (limited to 'examples/applet/simpleimpl.h') (more/less context) (ignore whitespace changes)
-rw-r--r--examples/applet/simpleimpl.h23
1 files changed, 2 insertions, 21 deletions
diff --git a/examples/applet/simpleimpl.h b/examples/applet/simpleimpl.h
index f58e2af..90c632f 100644
--- a/examples/applet/simpleimpl.h
+++ b/examples/applet/simpleimpl.h
@@ -8,24 +8,25 @@
8 * prviate during the betas. Opie and Qtopia still use it 8 * prviate during the betas. Opie and Qtopia still use it
9 * and we're happy with it. 9 * and we're happy with it.
10 * Every starts with the QUnknownInterface. It supports functions 10 * Every starts with the QUnknownInterface. It supports functions
11 * for reference counting and the most important one 11 * for reference counting and the most important one
12 * is for a query. Every QCOM interface got a global unique id ( GUID,UUID ) 12 * is for a query. Every QCOM interface got a global unique id ( GUID,UUID )
13 * query is used to see if a interface is supported by 13 * query is used to see if a interface is supported by
14 * a dynamic shared object ( dso / plugin ) 14 * a dynamic shared object ( dso / plugin )
15 * For tasks like loading Applications, InputMethods, Today, MenuButton, 15 * For tasks like loading Applications, InputMethods, Today, MenuButton,
16 * Taskbar, Style, Email Client there are specefic Interfaces you 16 * Taskbar, Style, Email Client there are specefic Interfaces you
17 * need to implement. The interfaces inherits from QUnknownInterface and 17 * need to implement. The interfaces inherits from QUnknownInterface and
18 * you'll need inherit from the interface. 18 * you'll need inherit from the interface.
19 * As example we will use the Taskbar interface 19 * As example we will use the Taskbar interface
20 * the OTaskBarAppletWrapper implements the factory for us
20 */ 21 */
21 22
22#ifndef SIMPLE_OPIE_EXAMPLE_APPLET_H 23#ifndef SIMPLE_OPIE_EXAMPLE_APPLET_H
23#define SIMPLE_OPIE_EXAMPLE_APPLET_H 24#define SIMPLE_OPIE_EXAMPLE_APPLET_H
24 25
25/* 26/*
26 * The taskbar applet interfaces wants us to implement position() and applet() 27 * The taskbar applet interfaces wants us to implement position() and applet()
27 * additionally we need to implement add(), release() and queryInterface for QUnknownInterface 28 * additionally we need to implement add(), release() and queryInterface for QUnknownInterface
28 * luckiy there is a macro for the reference counting 29 * luckiy there is a macro for the reference counting
29 * We provide an Implementation of the interface. 30 * We provide an Implementation of the interface.
30 */ 31 */
31#include <qwidget.h> 32#include <qwidget.h>
@@ -36,42 +37,22 @@
36 37
37/* 38/*
38 * Because we only draw an Icon in a fixed width and height 39 * Because we only draw an Icon in a fixed width and height
39 * we declare and define SimpleApplet here and you could use QLabel 40 * we declare and define SimpleApplet here and you could use QLabel
40 * setPixmap or use QWidget and draw yourself. 41 * setPixmap or use QWidget and draw yourself.
41 * You might also want to reimplement mouse*Event to use some simple actions 42 * You might also want to reimplement mouse*Event to use some simple actions
42 */ 43 */
43class SimpleApplet : public QWidget { 44class SimpleApplet : public QWidget {
44 Q_OBJECT 45 Q_OBJECT
45public: 46public:
46 SimpleApplet(QWidget *parent); 47 SimpleApplet(QWidget *parent);
47 ~SimpleApplet(); 48 ~SimpleApplet();
49 static int position();
48private: 50private:
49 void mousePressEvent( QMouseEvent* ); 51 void mousePressEvent( QMouseEvent* );
50 void paintEvent( QPaintEvent* ); 52 void paintEvent( QPaintEvent* );
51 QPixmap *m_pix; 53 QPixmap *m_pix;
52}; 54};
53 55
54class SimpleAppletImpl : public TaskbarAppletInterface {
55public:
56
57 SimpleAppletImpl();
58 virtual ~SimpleAppletImpl();
59
60 QRESULT queryInterface( const QUuid&, QUnknownInterface** );
61
62 QWidget *applet( QWidget* parent );
63 int position()const;
64
65 /*
66 * macro for reference countint
67 * if reference drops to zero
68 * delete this is called
69 */
70 Q_REFCOUNT
71
72private:
73 QList<SimpleApplet> m_applets;
74};
75 56
76 57
77#endif 58#endif