event.h
00001 /* This file is part of the KDE project 00002 Copyright (C) 1999 Simon Hausmann <hausmann@kde.org> 00003 (C) 1999 David Faure <faure@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 #ifndef __tdeparts_event_h__ 00021 #define __tdeparts_event_h__ 00022 00023 #include <tqevent.h> 00024 00025 #include <tdelibs_export.h> 00026 00027 class TQWidget; 00028 00029 namespace KParts 00030 { 00031 class Part; 00032 00036 class TDEPARTS_EXPORT Event : public TQCustomEvent 00037 { 00038 public: 00039 Event( const char *eventName ); 00040 00041 virtual const char *eventName() const; 00042 00043 static bool test( const TQEvent *event ); 00044 static bool test( const TQEvent *event, const char *name ); 00045 }; 00046 00054 class TDEPARTS_EXPORT GUIActivateEvent : public Event 00055 { 00056 public: 00057 GUIActivateEvent( bool activated ) : Event( s_strGUIActivateEvent ), m_bActivated( activated ) {} 00058 00059 bool activated() const { return m_bActivated; } 00060 00061 static bool test( const TQEvent *event ) { return Event::test( event, s_strGUIActivateEvent ); } 00062 00063 private: 00064 static const char *s_strGUIActivateEvent; 00065 bool m_bActivated; 00066 }; 00067 00076 class TDEPARTS_EXPORT PartActivateEvent : public Event 00077 { 00078 public: 00079 PartActivateEvent( bool activated, Part *part, TQWidget *widget ) : Event( s_strPartActivateEvent ), m_bActivated( activated ), m_part( part ), m_widget( widget ) {} 00080 00081 bool activated() const { return m_bActivated; } 00082 00083 Part *part() const { return m_part; } 00084 TQWidget *widget() const { return m_widget; } 00085 00086 static bool test( const TQEvent *event ) { return Event::test( event, s_strPartActivateEvent ); } 00087 00088 private: 00089 static const char *s_strPartActivateEvent; 00090 bool m_bActivated; 00091 Part *m_part; 00092 TQWidget *m_widget; 00093 }; 00094 00099 class TDEPARTS_EXPORT PartSelectEvent : public Event 00100 { 00101 public: 00102 PartSelectEvent( bool selected, Part *part, TQWidget *widget ) : Event( s_strPartSelectEvent ), m_bSelected( selected ), m_part( part ), m_widget( widget ) {} 00103 00104 bool selected() const { return m_bSelected; } 00105 00106 Part *part() const { return m_part; } 00107 TQWidget *widget() const { return m_widget; } 00108 00109 static bool test( const TQEvent *event ) { return Event::test( event, s_strPartSelectEvent ); } 00110 00111 private: 00112 static const char *s_strPartSelectEvent; 00113 bool m_bSelected; 00114 Part *m_part; 00115 TQWidget *m_widget; 00116 }; 00117 00118 } // namespace 00119 00120 #endif