KParts
event.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <kparts/event.h>
00021
00022 using namespace KParts;
00023
00024
00025 #define KPARTS_EVENT_MAGIC 42
00026
00027 Event::Event( const char *eventName )
00028 : QCustomEvent( (QEvent::Type)(QEvent::User + KPARTS_EVENT_MAGIC), (void *)eventName )
00029 {
00030 }
00031
00032 const char *Event::eventName() const
00033 {
00034 if ( !test( this ) )
00035 return 0L;
00036
00037 return (const char *)data();
00038 }
00039
00040 bool Event::test( const QEvent *event )
00041 {
00042 if ( !event )
00043 return false;
00044
00045 return ( event->type() == (QEvent::Type)(QEvent::User + KPARTS_EVENT_MAGIC ) );
00046 }
00047
00048 bool Event::test( const QEvent *event, const char *name )
00049 {
00050 if ( !test( event ) )
00051 return false;
00052
00053 return ( strcmp( name, (const char *)((QCustomEvent *)event)->data() ) == 0 );
00054 }
00055
00056 const char *GUIActivateEvent::s_strGUIActivateEvent = "KParts/GUIActivate";
00057 const char *PartActivateEvent::s_strPartActivateEvent = "KParts/PartActivateEvent";
00058 const char *PartSelectEvent::s_strPartSelectEvent = "KParts/PartSelectEvent";