lib
eventaction.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "eventaction.h"
00021 #include "variant.h"
00022
00023
00024
00025
00026 using namespace Kross::Api;
00027
00028 EventAction::EventAction(const QString& name, Object::Ptr parent, KAction* action)
00029 : Event<EventAction>(name.isEmpty() ? action->name() : name, parent)
00030 , m_action(action)
00031 {
00032 addFunction("getText", &EventAction::getText);
00033 addFunction("setText", &EventAction::setText,
00034 Kross::Api::ArgumentList() << Kross::Api::Argument("Kross::Api::Variant::String"));
00035
00036 addFunction("isEnabled", &EventAction::isEnabled);
00037 addFunction("setEnabled", &EventAction::setEnabled,
00038 Kross::Api::ArgumentList() << Kross::Api::Argument("Kross::Api::Variant::Bool"));
00039
00040 addFunction("activate", &EventAction::activate);
00041 }
00042
00043 EventAction::~EventAction()
00044 {
00045 }
00046
00047 const QString EventAction::getClassName() const
00048 {
00049 return "Kross::Api::EventAction";
00050 }
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061 Object::Ptr EventAction::getText(List::Ptr)
00062 {
00063 return new Variant(m_action->text(), "Kross::Api::EventAction::getText::String");
00064 }
00065
00066 Object::Ptr EventAction::setText(List::Ptr args)
00067 {
00068 m_action->setText( Variant::toString(args->item(0)) );
00069 return 0;
00070 }
00071
00072 Object::Ptr EventAction::isEnabled(List::Ptr)
00073 {
00074 return new Variant(m_action->isEnabled(), "Kross::Api::EventAction::isEnabled::Bool");
00075 }
00076
00077 Object::Ptr EventAction::setEnabled(List::Ptr args)
00078 {
00079 m_action->setEnabled( Variant::toBool(args->item(0)) );
00080 return 0;
00081 }
00082
00083 Object::Ptr EventAction::activate(List::Ptr)
00084 {
00085 m_action->activate();
00086 return 0;
00087 }
00088
|