Plasma
abstracttoolbox.h
Go to the documentation of this file.
00001 /* 00002 * Copyright 2008 by Marco Martin <notmart@gmail.com> 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU Library General Public License as 00006 * published by the Free Software Foundation; either version 2, or 00007 * (at your option) any later version. 00008 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details 00013 * 00014 * You should have received a copy of the GNU Library General Public 00015 * License along with this program; if not, write to the 00016 * Free Software Foundation, Inc., 00017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef PLASMA_ABSTRACTTOOLBOX_H 00021 #define PLASMA_ABSTRACTTOOLBOX_H 00022 00023 #include <QGraphicsWidget> 00024 #include <QGraphicsItem> 00025 00026 #include <kplugininfo.h> 00027 00028 #include "plasma/plasma_export.h" 00029 00030 class QAction; 00031 00032 class KConfigGroup; 00033 00034 namespace Plasma 00035 { 00036 00037 class AbstractToolBoxPrivate; 00038 class Containment; 00039 00040 class PLASMA_EXPORT AbstractToolBox : public QGraphicsWidget 00041 { 00042 Q_OBJECT 00043 Q_INTERFACES(QGraphicsItem) 00044 Q_PROPERTY(bool showing READ isShowing WRITE setShowing) 00045 00046 public: 00047 enum ToolType { 00048 AddTool = 0, 00049 ConfigureTool = 100, 00050 ControlTool = 200, 00051 MiscTool = 300, 00052 DestructiveTool = 400, 00053 UserToolType = DestructiveTool + 1000 00054 }; 00055 Q_ENUMS(ToolType) 00056 00057 explicit AbstractToolBox(Containment *parent); 00058 explicit AbstractToolBox(QObject *parent = 0, 00059 const QVariantList &args = QVariantList()); 00060 ~AbstractToolBox(); 00061 00069 static AbstractToolBox *load(const QString &name, const QVariantList &args=QVariantList(), Plasma::Containment *containment=0); 00070 00082 static KPluginInfo::List listToolBoxInfo(const QString 00083 &parentApp = QString()); 00084 00089 virtual void addTool(QAction *action) = 0; 00090 00094 virtual void removeTool(QAction *action) = 0; 00095 00099 virtual bool isShowing() const = 0; 00100 00104 virtual void setShowing(const bool show) = 0; 00105 00106 public Q_SLOTS: 00107 //FIXME for KDE5: those should become virtuals 00113 void restore(const KConfigGroup &group); 00114 00120 void save(const KConfigGroup &group); 00121 00127 void reposition(); 00128 00129 Q_SIGNALS: 00133 void toggled(); 00134 00139 void visibilityChanged(bool open); 00140 00141 protected: 00142 Containment *containment() const; 00143 00144 private: 00145 AbstractToolBoxPrivate * const d; 00146 00147 }; 00148 00149 } // Plasma namespace 00150 00154 #define K_EXPORT_PLASMA_TOOLBOX(libname, classname) \ 00155 K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \ 00156 K_EXPORT_PLUGIN(factory("plasma_toolbox_" #libname)) \ 00157 K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION) 00158 00159 #endif // multiple inclusion guard 00160
KDE 4.6 API Reference