summaryrefslogtreecommitdiff
path: root/examples/applet/simpleimpl.h
Unidiff
Diffstat (limited to 'examples/applet/simpleimpl.h') (more/less context) (ignore whitespace changes)
-rw-r--r--examples/applet/simpleimpl.h72
1 files changed, 72 insertions, 0 deletions
diff --git a/examples/applet/simpleimpl.h b/examples/applet/simpleimpl.h
new file mode 100644
index 0000000..8459c96
--- a/dev/null
+++ b/examples/applet/simpleimpl.h
@@ -0,0 +1,72 @@
1/*
2 * You may use, modify and distribute without any limitation
3 */
4
5/**
6 * Opie and Qtopia uses a component system called QCOM
7 * which was first part of the Qt 3.0 API but was made
8 * prviate during the betas. Opie and Qtopia still use it
9 * and we're happy with it.
10 * Every starts with the QUnknownInterface. It supports functions
11 * for reference counting and the most important one
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
14 * a dynamic shared object ( dso / plugin )
15 * For tasks like loading Applications, InputMethods, Today, MenuButton,
16 * Taskbar, Style, Email Client there are specefic Interfaces you
17 * need to implement. The interfaces inherits from QUnknownInterface and
18 * you'll need inherit from the interface.
19 * As example we will use the Taskbar interface
20 */
21
22#ifndef SIMPLE_OPIE_EXAMPLE_APPLET_H
23#define SIMPLE_OPIE_EXAMPLE_APPLET_H
24
25/*
26 * The taskbar applet interfaces wants us to implement position() and applet()
27 * additionally we need to implement add(), release() and queryInterface for QUnknownInterface
28 * luckiy there is a macro for the reference counting
29 * We provide an Implementation of the interface.
30 */
31#include <qwidget.h>
32#include <qpe/taskbarappletinterface.h>
33
34
35/*
36 * Because we only draw an Icon in a fixed width and height
37 * we declare and define SimpleApplet here and you could use QLabel
38 * setPixmap or use QWidget and draw yourself.
39 * You might also want to reimplement mouse*Event to use some simple actions
40 */
41class SimpleApplet : public QWidget {
42 Q_OBJECT
43public:
44 SimpleApplet(QWidget *parent);
45 ~SimpleApplet();
46private:
47 void mousePressEvent( QMouseEvent* );
48 void paintEvent( QPaintEvent* );
49 QPixmap *m_pix;
50};
51
52class SimpleAppletImpl : public TaskbarAppletInterface {
53public:
54
55 SimpleAppletImpl();
56 virtual ~SimpleAppletImpl();
57
58 QRESULT queryInterface( const QUuid&, QUnknownInterface** );
59
60 QWidget *applet( QWidget* parent );
61 int position()const;
62
63 /*
64 * macro for reference countint
65 * if reference drops to zero
66 * delete this is called
67 */
68 Q_REFCOUNT
69};
70
71
72#endif