Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

otaskbarapplet.h

Go to the documentation of this file.
00001 /*
00002                              This file is part of the Opie Project
00003 
00004                              Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
00005               =.
00006             .=l.
00007            .>+-=
00008  _;:,     .>    :=|.         This program is free software; you can
00009 .> <`_,   >  .   <=          redistribute it and/or  modify it under
00010 :`=1 )Y*s>-.--   :           the terms of the GNU Library General Public
00011 .="- .-=="i,     .._         License as published by the Free Software
00012  - .   .-<_>     .<>         Foundation; either version 2 of the License,
00013      ._= =}       :          or (at your option) any later version.
00014     .%`+i>       _;_.
00015     .i_,=:_.      -<s.       This program is distributed in the hope that
00016      +  .  -:.       =       it will be useful,  but WITHOUT ANY WARRANTY;
00017     : ..    .:,     . . .    without even the implied warranty of
00018     =_        +     =;=|`    MERCHANTABILITY or FITNESS FOR A
00019   _.=:.       :    :=>`:     PARTICULAR PURPOSE. See the GNU
00020 ..}^=.=       =       ;      Library General Public License for more
00021 ++=   -.     .`     .:       details.
00022  :     =  ...= . :.=-
00023  -.   .:....=;==+<;          You should have received a copy of the GNU
00024   -_. . .   )=.  =           Library General Public License along with
00025     --        :-=`           this library; see the file COPYING.LIB.
00026                              If not, write to the Free Software Foundation,
00027                              Inc., 59 Temple Place - Suite 330,
00028                              Boston, MA 02111-1307, USA.
00029 
00030 */
00031 
00032 #ifndef OTASKBARAPPLET_H
00033 #define OTASKBARAPPLET_H
00034 
00035 /* OPIE */
00036 #include <opie2/odebug.h>
00037 
00038 #include <qpe/taskbarappletinterface.h>
00039 #include <qpe/qcom.h>
00040 
00041 /* QT */
00042 #include <qwidget.h>
00043 
00044 class QMouseEvent;
00045 
00046 namespace Opie {
00047 namespace Ui   {
00048 namespace Internal {
00049 /*======================================================================================
00050  * OTaskbarAppletWrapper
00051  *======================================================================================*/
00052 
00053 class OTaskbarAppletWrapperPrivate;
00054 template<class T> class OTaskbarAppletWrapper : public TaskbarAppletInterface
00055 {
00056   public:
00057     OTaskbarAppletWrapper():_applet( 0 )
00058     {
00059     }
00060 
00061     virtual ~OTaskbarAppletWrapper()
00062     {
00063         delete _applet;
00064     }
00065 
00066     QRESULT queryInterface( const QUuid& uuid, QUnknownInterface** iface )
00067     {
00068         odebug << "OTaskbarAppletWrapper::queryInterface()" << oendl;
00069         *iface = 0;
00070         if ( uuid == IID_QUnknown )
00071             *iface = this;
00072         else if ( uuid == IID_TaskbarApplet )
00073             *iface = this;
00074     else
00075         return QS_FALSE;
00076 
00077         if ( *iface ) (*iface)->addRef();
00078         return QS_OK;
00079     }
00080 
00081     Q_REFCOUNT
00082 
00083     virtual T* applet( QWidget* parent )
00084     {
00085         if ( !_applet ) _applet = new T( parent );
00086         return _applet;
00087     }
00088 
00089     virtual int position() const
00090     {
00091         return T::position();
00092     }
00093 
00094   private:
00095     T* _applet;
00096     OTaskbarAppletWrapperPrivate *d;
00097 };
00098 
00099 }
00100 /*======================================================================================
00101  * OTaskbarApplet
00102  *======================================================================================*/
00103 
00104 // Must be inline until after we shipped Opie 1.0
00105 
00106 // Having OTaskBarApplet reside in libopieui2 is not possible
00107 // until we link the launcher binary against libopieui2 -
00108 // otherwise the necessary symbols are not present, when
00109 // the dynamic loader [dlopen] tries to resolve an applet which
00110 // inherits OTaskbarApplet
00111 
00112 class OTaskbarApplet : public QWidget
00113 {
00114   public:
00115     OTaskbarApplet( QWidget* parent, const char* name = 0 );
00116     virtual ~OTaskbarApplet();
00117 
00118 
00119   protected:
00120     virtual void popup( QWidget* widget );
00121 private:
00122     class Private;
00123     Private *d;
00124 };
00125 }
00126 }
00127 
00128 #define EXPORT_OPIE_APPLET_v1(  AppLet ) \
00129     Q_EXPORT_INTERFACE() { \
00130     Q_CREATE_INSTANCE(  Opie::Ui::Internal::OTaskbarAppletWrapper<AppLet> ) \
00131     }
00132 
00133 #endif
00134 

Generated on Sat Nov 5 16:16:28 2005 for OPIE by  doxygen 1.4.2