ctkPluginEvent.h

Go to the documentation of this file.
00001 /*=============================================================================
00002 
00003   Library: CTK
00004 
00005   Copyright (c) 2010 German Cancer Research Center,
00006     Division of Medical and Biological Informatics
00007 
00008   Licensed under the Apache License, Version 2.0 (the "License");
00009   you may not use this file except in compliance with the License.
00010   You may obtain a copy of the License at
00011 
00012     http://www.apache.org/licenses/LICENSE-2.0
00013 
00014   Unless required by applicable law or agreed to in writing, software
00015   distributed under the License is distributed on an "AS IS" BASIS,
00016   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00017   See the License for the specific language governing permissions and
00018   limitations under the License.
00019 
00020 =============================================================================*/
00021 
00022 #ifndef CTKPLUGINEVENT_H
00023 #define CTKPLUGINEVENT_H
00024 
00025 #include <QObject>
00026 #include <QSharedDataPointer>
00027 
00028 #include "CTKPluginFrameworkExport.h"
00029 
00030 
00031   class ctkPlugin;
00032   class ctkPluginEventData;
00033 
00046   class CTK_PLUGINFW_EXPORT ctkPluginEvent : public QObject
00047   {
00048     Q_OBJECT
00049     Q_PROPERTY(Type type READ getType CONSTANT)
00050     Q_PROPERTY(ctkPlugin* plugin READ getPlugin CONSTANT)
00051     Q_ENUMS(Type)
00052 
00053     QSharedDataPointer<ctkPluginEventData> d;
00054 
00055   public:
00056 
00057     enum Type {
00058       INSTALLED,
00059       STARTED,
00060       STOPPED,
00061       UPDATED,
00062       UNINSTALLED,
00063       RESOLVED,
00064       UNRESOLVED,
00065       STARTING,
00066       STOPPING,
00067       LAZY_ACTIVATION
00068     };
00069 
00076     ctkPluginEvent(Type type, ctkPlugin* plugin);
00077 
00078     ctkPluginEvent(const ctkPluginEvent& other);
00079 
00085     ctkPlugin* getPlugin() const;
00086 
00104     Type getType() const;
00105 
00106 
00107   };
00108 
00109   class ctkPluginEventData : public QSharedData
00110   {
00111   public:
00112 
00113     ctkPluginEventData(ctkPluginEvent::Type type, ctkPlugin* plugin)
00114       : type(type), plugin(plugin)
00115     {
00116 
00117     }
00118 
00119     ctkPluginEventData(const ctkPluginEventData& other)
00120       : QSharedData(other), type(other.type), plugin(other.plugin)
00121     {
00122 
00123     }
00124 
00125     const ctkPluginEvent::Type type;
00126     ctkPlugin* const plugin;
00127   };
00128 
00129 
00130 #endif // CTKPLUGINEVENT_H
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines