From 4dd58bba07b8bf3a52c3a0464675c39cc5153c85 Mon Sep 17 00:00:00 2001 From: kergoth Date: Tue, 13 May 2003 20:02:32 +0000 Subject: Add beginnings of a new plugin interface. --- (limited to 'core/apps/oapp') 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 +#include + +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 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 +#include +#include + +OAppPlugin::OAppPlugin(OAppPos pos) +{ + m_position = pos; +}; + +OAppPlugin::OAppPlugin(QWidget *widget, OAppPos pos) +{ + m_widgets.append( widget ); + m_position = pos; +}; + +OAppPlugin::~OAppPlugin() +{ +}; + +QList 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 +#include + +class QWidget; + +class OAppPlugin : public OAppInterface +{ +public: + OAppPlugin(OAppPos pos = midPos); + OAppPlugin(QWidget *widget, OAppPos pos = midPos); + virtual ~OAppPlugin(); + + QList widgets(); + OAppPos position() const; + +#ifndef QT_NO_COMPONENT + QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ); + Q_REFCOUNT +#endif + +private: + QList m_widgets; + OAppPos m_position; +}; + +#endif // __OAPPPLUGIN_H -- cgit v0.9.0.2