author | zecke <zecke> | 2004-03-14 20:08:59 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-03-14 20:08:59 (UTC) |
commit | 0d79c003839718ae70b3b997162044abd5c26bf6 (patch) (unidiff) | |
tree | 19708b041da3a09df8f3b571cd634a846f4ad6d7 /examples/applet/simpleimpl.h | |
parent | 05c8d999941989a97a581fb5822437034ec10fd7 (diff) | |
download | opie-0d79c003839718ae70b3b997162044abd5c26bf6.zip opie-0d79c003839718ae70b3b997162044abd5c26bf6.tar.gz opie-0d79c003839718ae70b3b997162044abd5c26bf6.tar.bz2 |
Update the Examples
-rw-r--r-- | examples/applet/simpleimpl.h | 23 |
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 | |||
@@ -1,77 +1,58 @@ | |||
1 | /* | 1 | /* |
2 | * You may use, modify and distribute without any limitation | 2 | * You may use, modify and distribute without any limitation |
3 | */ | 3 | */ |
4 | 4 | ||
5 | /** | 5 | /** |
6 | * Opie and Qtopia uses a component system called QCOM | 6 | * Opie and Qtopia uses a component system called QCOM |
7 | * which was first part of the Qt 3.0 API but was made | 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 | 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> |
32 | #include <qlist.h> | 33 | #include <qlist.h> |
33 | 34 | ||
34 | #include <qpe/taskbarappletinterface.h> | 35 | #include <qpe/taskbarappletinterface.h> |
35 | 36 | ||
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 | */ |
43 | class SimpleApplet : public QWidget { | 44 | class SimpleApplet : public QWidget { |
44 | Q_OBJECT | 45 | Q_OBJECT |
45 | public: | 46 | public: |
46 | SimpleApplet(QWidget *parent); | 47 | SimpleApplet(QWidget *parent); |
47 | ~SimpleApplet(); | 48 | ~SimpleApplet(); |
49 | static int position(); | ||
48 | private: | 50 | private: |
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 | ||
54 | class SimpleAppletImpl : public TaskbarAppletInterface { | ||
55 | public: | ||
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 | |||
72 | private: | ||
73 | QList<SimpleApplet> m_applets; | ||
74 | }; | ||
75 | 56 | ||
76 | 57 | ||
77 | #endif | 58 | #endif |