author | kergoth <kergoth> | 2003-05-13 20:02:32 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2003-05-13 20:02:32 (UTC) |
commit | 4dd58bba07b8bf3a52c3a0464675c39cc5153c85 (patch) (side-by-side diff) | |
tree | a9031549d675f3c108f05b06d2fcdd62f2433c7e | |
parent | ad81c3ef20399c22663e67c5ac09aae4d0aeda21 (diff) | |
download | opie-4dd58bba07b8bf3a52c3a0464675c39cc5153c85.zip opie-4dd58bba07b8bf3a52c3a0464675c39cc5153c85.tar.gz opie-4dd58bba07b8bf3a52c3a0464675c39cc5153c85.tar.bz2 |
Add beginnings of a new plugin interface.
-rw-r--r-- | core/apps/oapp/.cvsignore | 1 | ||||
-rw-r--r-- | core/apps/oapp/config.in | 4 | ||||
-rw-r--r-- | core/apps/oapp/oapp.pro | 21 | ||||
-rw-r--r-- | core/apps/oapp/oappinterface.h | 24 | ||||
-rw-r--r-- | core/apps/oapp/oappplugin.cpp | 43 | ||||
-rw-r--r-- | core/apps/oapp/oappplugin.h | 30 |
6 files changed, 123 insertions, 0 deletions
diff --git a/core/apps/oapp/.cvsignore b/core/apps/oapp/.cvsignore new file mode 100644 index 0000000..24e5b0a --- a/dev/null +++ b/core/apps/oapp/.cvsignore @@ -0,0 +1 @@ +.build diff --git a/core/apps/oapp/config.in b/core/apps/oapp/config.in new file mode 100644 index 0000000..2ace6dd --- a/dev/null +++ b/core/apps/oapp/config.in @@ -0,0 +1,4 @@ + config OAPP + boolean "OApp Plugin" + default "n" + depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE diff --git a/core/apps/oapp/oapp.pro b/core/apps/oapp/oapp.pro new file mode 100644 index 0000000..4ef07af --- a/dev/null +++ b/core/apps/oapp/oapp.pro @@ -0,0 +1,21 @@ +TEMPLATE = lib +CONFIG = qt warn_on release + +TARGET = oapp +VERSION = 1.0.0 + +LIBS += -lqpe -lopie +HEADERS = \ + oappplugin.h \ + oappinterface.h +SOURCES = \ + oappplugin.cpp + +DESTDIR = $(OPIEDIR)/lib$(PROJMAK) +INCLUDEPATH += $(OPIEDIR)/include +DEPENDPATH += $(OPIEDIR)/include . +MOC_DIR = .build +OBJECTS_DIR = .build +UI_DIR = .build + +include ( $(OPIEDIR)/include.pro ) diff --git a/core/apps/oapp/oappinterface.h b/core/apps/oapp/oappinterface.h new file mode 100644 index 0000000..6474852 --- a/dev/null +++ b/core/apps/oapp/oappinterface.h @@ -0,0 +1,24 @@ +#ifndef __OPIEAPPINTERFACE_H +#define __OPIEAPPINTERFACE_H + +#include <qlist.h> +#include <qpe/qcom.h> + +class QWidget; + +#ifndef QT_NO_COMPONENT +// {16556BFC-891D-46A9-BE59-DBa158C3A266} +#ifndef IID_OAppInterface +#define IID_OAppInterface QUuid( 0x16556bfc, 0x891d, 0x46a9, 0xbe, 0x59, 0xdb, 0xa1, 0x58, 0xc3, 0xa2, 0x66) +#endif +#endif + +enum OAppPos { leftPos, midPos, rightPos }; + +struct OAppInterface : public QUnknownInterface +{ + virtual QList<QWidget> widgets() = 0; + virtual OAppPos position() const = 0; +}; + +#endif // __OPIEAPPINTERFACE_H diff --git a/core/apps/oapp/oappplugin.cpp b/core/apps/oapp/oappplugin.cpp new file mode 100644 index 0000000..934594f --- a/dev/null +++ b/core/apps/oapp/oappplugin.cpp @@ -0,0 +1,43 @@ +#include "oappinterface.h" +#include "oappplugin.h" +#include <qlist.h> +#include <qwidget.h> +#include <qpe/quuid.h> + +OAppPlugin::OAppPlugin(OAppPos pos) +{ + m_position = pos; +}; + +OAppPlugin::OAppPlugin(QWidget *widget, OAppPos pos) +{ + m_widgets.append( widget ); + m_position = pos; +}; + +OAppPlugin::~OAppPlugin() +{ +}; + +QList<QWidget> OAppPlugin::widgets() +{ + return m_widgets; +}; + +OAppPos OAppPlugin::position() const +{ + return m_position; +} + +QRESULT OAppPlugin::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) +{ + *iface = 0; + if ( uuid == IID_QUnknown ) + *iface = this; + else if ( uuid == IID_OAppInterface ) + *iface = this; + + if ( *iface ) + (*iface)->addRef(); + return QS_OK; +} diff --git a/core/apps/oapp/oappplugin.h b/core/apps/oapp/oappplugin.h new file mode 100644 index 0000000..698d171 --- a/dev/null +++ b/core/apps/oapp/oappplugin.h @@ -0,0 +1,30 @@ +#ifndef __OAPPPLUGIN_H +#define __OAPPPLUGIN_H + +#include "oappinterface.h" +#include <qlist.h> +#include <qpe/quuid.h> + +class QWidget; + +class OAppPlugin : public OAppInterface +{ +public: + OAppPlugin(OAppPos pos = midPos); + OAppPlugin(QWidget *widget, OAppPos pos = midPos); + virtual ~OAppPlugin(); + + QList<QWidget> widgets(); + OAppPos position() const; + +#ifndef QT_NO_COMPONENT + QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ); + Q_REFCOUNT +#endif + +private: + QList<QWidget> m_widgets; + OAppPos m_position; +}; + +#endif // __OAPPPLUGIN_H |