home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kommanderplugin.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-02-13  |  3.9 KB  |  104 lines

  1. /****************************************************************************
  2.   ** kommanderplugin.h - KommanderPlugin class definition created from QWidgetPlugin
  3.   ** Copyright (C) 2001 Trolltech AS.  All rights reserved.
  4.   ** Copyright (C) 2003 Marc Britton
  5.   **
  6.   ** This file is part of the widgets module of the Qt GUI Toolkit.
  7.   **
  8.   ** This file may be distributed under the terms of the Q Public License
  9.   ** as defined by Trolltech AS of Norway and appearing in the file
  10.   ** LICENSE.QPL included in the packaging of this file.
  11.   **
  12.   ** This file may be distributed and/or modified under the terms of the
  13.   ** GNU General Public License version 2 as published by the Free Software
  14.   ** Foundation and appearing in the file LICENSE.GPL included in the
  15.   ** packaging of this file.
  16.   **
  17.   ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
  18.   ** licenses may use this file in accordance with the Qt Commercial License
  19.   ** Agreement provided with the Software.
  20.   **
  21.   ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  22.   ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  23.   **
  24.   ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
  25.   **   information about Qt Commercial License Agreements.
  26.   ** See http://www.trolltech.com/qpl/ for QPL licensing information.
  27.   ** See http://www.trolltech.com/gpl/ for GPL licensing information.
  28.   **
  29.   ** Contact info@trolltech.com if any conditions of this licensing are
  30.   ** not clear to you.
  31.   **
  32.   **********************************************************************/
  33.  
  34. #ifndef _HAVE_KOMMANDERPLUGIN_H_
  35. #define _HAVE_KOMMANDERPLUGIN_H_
  36.  
  37. #include <qobject.h>
  38. #include <qmap.h>
  39. #include <qstringlist.h>
  40. #include "kommander_export.h"
  41.  
  42. class QWidget;
  43. class QIconSet;
  44.  
  45. class KOMMANDER_EXPORT KommanderPlugin : public QObject 
  46. {
  47.     Q_OBJECT
  48.     public:
  49.     KommanderPlugin();
  50.     ~KommanderPlugin();
  51.  
  52.     virtual void addWidget( const QString &name, const QString &group, const QString &toolTip, QIconSet *iconSet, const QString &whatsThis = QString::null, bool isContainer = false);
  53.     virtual void removeWidget( const QString &name );
  54.     virtual QStringList widgets() const;
  55.  
  56.     virtual QWidget *create( const QString &key, QWidget *parent = 0, const char *name = 0 ) = 0;
  57.     virtual QString group( const QString &key ) const;
  58.     virtual QString toolTip( const QString &key ) const;
  59.     virtual QString whatsThis( const QString &key ) const;
  60.     virtual bool isContainer( const QString &key ) const;
  61.     virtual QIconSet *iconSet( const QString &key ) const;
  62.  
  63.     /**
  64.      * Sets the default group for functions. Must be called before registerFunction.
  65.      * @param group the groups ID
  66.      */
  67.     static void setDefaultGroup(int group);
  68.  
  69.     /**
  70.      * Register a function of the plugin.
  71.      * @param id Kommander wide unique ID
  72.      * @param function function signature
  73.      * @param description description of what the function does
  74.      * @param minArgs minimum number of accepted arguments
  75.      * @param maxArgs maximum number of accepted arguments
  76.      * @return true if registration was successful
  77.      */
  78.     static bool registerFunction(int id, const QString& function, const QString description = QString::null,
  79.     int minArgs = -1, int maxArgs = -1);
  80.  
  81.     
  82.  
  83. private:
  84.     struct WidgetInfo
  85.     {
  86.       WidgetInfo() { }
  87.       WidgetInfo( const QString &g, const QString &t, QIconSet *i, const QString &w = QString::null, bool c = false)
  88.           : group( g ), toolTip( t ), iconSet(i), whatsThis( w ), isContainer( c )
  89.       {}
  90.  
  91.       QString group;
  92.       QString toolTip;
  93.       QIconSet *iconSet;
  94.       QString whatsThis;
  95.       bool isContainer;
  96.     };
  97.     typedef QMap<QString, WidgetInfo> WidgetInfos;
  98.     WidgetInfos m_widgets;
  99. };
  100.  
  101. #define KOMMANDER_EXPORT_PLUGIN(plugin) extern "C" { KOMMANDER_EXPORT void *kommander_plugin() { return new plugin; } }
  102.  
  103. #endif // _HAVE_KOMMANDERPLUGIN_H_
  104.