#include "KSGSMausEreignis.h" #include "KSGSTyp.h" #include "../Error/Error.h" #include "KSGSInt.h" #include "KSGSBool.h" using namespace KSGScript; // Inhalt der KSGSMausEreignisKlasse Klasse aus KSGSMausEreignis.h // Konstruktor KSGSMausEreignisKlasse::KSGSMausEreignisKlasse( KSGScriptObj *zObj, MausEreignis std ) : KSGSKlasseInstanz( KSGS_MAUSEREIGNIS, 0, 0, zObj ) { val = std; } // Destruktor KSGSMausEreignisKlasse::~KSGSMausEreignisKlasse() { } // nicht constant KSGSVariable *KSGSMausEreignisKlasse::startFunktion( int id, bool access, RCArray< KSGSVariable > *parameter ) { KSGSVariable *ret = 0; switch( id ) { case 0: // void setId( int id ) if( parameter->getEintragAnzahl() < 1 ) error( 20, {}, obj ); val.id = parameter->z( 0 ) ? parameter->z( 0 )->getInt() : 0; break; case 1: // void setMx( int mx ) if( parameter->getEintragAnzahl() < 1 ) error( 20, {}, obj ); val.mx = parameter->z( 0 ) ? parameter->z( 0 )->getInt() : 0; break; case 2: // void setMy( int my ) if( parameter->getEintragAnzahl() < 1 ) error( 20, {}, obj ); val.my = parameter->z( 0 ) ? parameter->z( 0 )->getInt() : 0; break; case 3: // void setVerarbeitet( bool verarbeitet ) if( parameter->getEintragAnzahl() < 1 ) error( 20, {}, obj ); val.verarbeitet = parameter->z( 0 ) ? parameter->z( 0 )->getBool() : 0; break; case 4: // void setInsideParent( bool verarbeitet ) if( parameter->getEintragAnzahl() < 1 ) error( 20, {}, obj ); val.insideParent = parameter->z( 0 ) ? parameter->z( 0 )->getBool() : 0; break; default: // unbekannt error( 19, {}, obj ); break; } parameter->release(); return ret; } void KSGSMausEreignisKlasse::set( MausEreignis &me ) { val = me; } KSGSVariable *KSGSMausEreignisKlasse::doOperator( int id, KSGSVariable *rechts ) { if( !rechts ) { error( 3, {}, obj ); return 0; } KSGSVariable *ret = 0; switch( id ) { case KSGS_O_SET: if( 1 ) { val = rechts->getMausEreignis(); ret = getThis(); } break; } if( !ret ) error( 21, {}, obj ); if( rechts ) rechts->release(); return ret; } // constant KSGSVariable *KSGSMausEreignisKlasse::getVariable( int id, bool zugriff ) const { KSGSVariable *ret = 0; switch( id ) { case 0: // int id ret = new KSGSIntKlasse( obj, val.id ); break; case 1: // int mx ret = new KSGSIntKlasse( obj, val.mx ); break; case 2: // int my ret = new KSGSIntKlasse( obj, val.my ); break; case 3: // bool verarbeitet ret = new KSGSBoolKlasse( obj, val.verarbeitet ); break; case 4: // bool insideParent ret = new KSGSBoolKlasse( obj, val.insideParent ); break; case 5: // int originalX ret = new KSGSIntKlasse( obj, val.originalX ); break; case 6: // int originalY ret = new KSGSIntKlasse( obj, val.originalY ); break; } if( !ret ) error( 17, {}, obj ); return ret; } MausEreignis KSGSMausEreignisKlasse::getVal() const { return val; }