/***************************************************************************
musicman.h - description
-------------------
begin : Sun Jul 20 10:45:44 BRT 2003
copyright : (C) 2003 by Avi Alkalay
email : avi@unix.sh
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef __plugin_musicman_h
#define __plugin_musicman_h
#include
#include
class KURL;
class KInstance;
/**
* A plugin is the way to add actions to an existing @ref KParts application,
* or to a @ref Part.
*
* The XML of those plugins looks exactly like of the shell or parts,
* with one small difference: The document tag should have an additional
* attribute, named "library", and contain the name of the library implementing
* the plugin.
*
* If you want this plugin to be used by a part, you need to
* install the rc file under the directory
* "data" (KDEDIR/share/apps usually)+"/instancename/kpartplugins/"
* where instancename is the name of the part's instance.
**/
class MusicMan : public KParts::Plugin
{
Q_OBJECT
public:
/**
* Construct a new KParts plugin.
*/
MusicMan( QObject* parent = 0, const char* name = 0 );
/**
* Destructor.
*/
virtual ~MusicMan();
KURL musicmanURL( const KURL &url );
public slots:
void slotAction();
};
/**
* If you develop a library that is to be loaded dynamically at runtime, then
* you should provide a function that returns a pointer to your factory like this:
*
* extern "C"
* {
* void* init_libkspread()
* {
* return new KSpreadFactory;
* }
* };
*
* You should especially see that the function must follow the naming pattern
* "init_libname".
*
* In the constructor of your factory you should create an instance of @ref KInstance
* like this:
*
* s_global = new KInstance( "kspread" );
*
* This @ref KInstance is compareable to @ref KGlobal used by normal applications.
* It allows you to find ressource files (images, XML, sound etc.) belonging
* to the library.
*
* If you want to load a library, use @ref KLibLoader. You can query @ref KLibLoader
* directly for a pointer to the libraries factory by using the @ref KLibLoader::factory()
* function.
*
* The KLibFactory is used to create the components, the library has to offer.
* The factory of KSpread for example will create instances of KSpreadDoc,
* while the Konqueror factory will create KonqView widgets.
* All objects created by the factory must be derived from @ref QObject, since @ref QObject
* offers type safe casting.
*
* KLibFactory is an abstract class. Reimplement the @ref
* createObject() method to give it functionality.
*
* @author Torben Weis
*/
class KPluginFactory : public KLibFactory
{
Q_OBJECT
public:
/**
* Create a new factory.
*/
KPluginFactory( QObject *parent = 0, const char *name = 0 );
/**
* Destroy factory.
*/
~KPluginFactory() ;
/**
* Creates a new object. The returned object has to be derived from
* the requested classname.
*
* It is valid behavior to create different kinds of objects
* depending on the requested @p classname. For example a koffice
* library may usually return a pointer to @ref KoDocument. But
* if asked for a "QWidget", it could create a wrapper widget,
* that encapsulates the Koffice specific features.
*
* Never reimplement this function. Instead, reimplement @ref
* createObject().
*
* create() automatically emits a signal @ref objectCreated to tell
* the library about its newly created object. This is very
* important for reference counting, and allows unloading the
* library automatically once all its objects have been destroyed.
*
* This function is virtual for compatibility reasons only.
*/
virtual QObject* createObject( QObject* parent = 0, const char* pname = 0,
const char* name = "QObject",
const QStringList &args = QStringList() );
private:
static KInstance* s_instance;
};
#endif
Generated by: aviram on sampa.brasil.net on Sun Jul 20 10:47:57 2003, using kdoc 2.0a54. |