00001 /*************************************************************************** 00002 * eventaction.h 00003 * This file is part of the KDE project 00004 * copyright (C)2004-2005 by Sebastian Sauer (mail@dipe.org) 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Library General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2 of the License, or (at your option) any later version. 00010 * This program 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 * You should have received a copy of the GNU Library General Public License 00015 * along with this program; see the file COPYING. If not, write to 00016 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 * Boston, MA 02110-1301, USA. 00018 ***************************************************************************/ 00019 00020 #ifndef KROSS_API_EVENTACTION_H 00021 #define KROSS_API_EVENTACTION_H 00022 00023 #include <qstring.h> 00024 //#include <qobject.h> 00025 #include <kaction.h> 00026 #include <ksharedptr.h> 00027 00028 #include "event.h" 00029 00030 namespace Kross { namespace Api { 00031 00032 // Forward declarations. 00033 class ScriptContainer; 00034 00035 /** 00036 * The EventAction class is used to wrap KAction instances 00037 * into the Kross object hierachy and provide access to 00038 * them. 00039 */ 00040 class EventAction : public Event<EventAction> 00041 { 00042 00043 public: 00044 00045 /** 00046 * Shared pointer to implement reference-counting. 00047 */ 00048 typedef KSharedPtr<EventAction> Ptr; 00049 00050 /** 00051 * Constructor. 00052 */ 00053 EventAction(const QString& name, Object::Ptr parent, KAction* action); 00054 00055 /** 00056 * Destructor. 00057 */ 00058 virtual ~EventAction(); 00059 00060 /// \see Kross::Api::Object::getClassName() 00061 virtual const QString getClassName() const; 00062 00063 /// \see Kross::Api::Event::call() 00064 //virtual Object::Ptr call(const QString& name, KSharedPtr<List> arguments); 00065 00066 private: 00067 KAction* m_action; 00068 00069 /// \return the text associated with this action. 00070 Kross::Api::Object::Ptr getText(Kross::Api::List::Ptr); 00071 /// Sets the text associated with this action. 00072 Kross::Api::Object::Ptr setText(Kross::Api::List::Ptr); 00073 00074 /// \return true if this action is enabled else false. 00075 Kross::Api::Object::Ptr isEnabled(Kross::Api::List::Ptr); 00076 /// Enables or disables this action. 00077 Kross::Api::Object::Ptr setEnabled(Kross::Api::List::Ptr); 00078 00079 /// Activates the action. 00080 Kross::Api::Object::Ptr activate(Kross::Api::List::Ptr); 00081 }; 00082 00083 }} 00084 00085 #endif 00086
1.4.6