callsub.cpp

00001 /***************************************************************************
00002  *   Copyright (C) 2003 by David Saxton                                    *
00003  *   david@bluehaze.org                                                    *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  ***************************************************************************/
00010 
00011 #include "callsub.h"
00012 
00013 #include "libraryitem.h"
00014 #include "flowcode.h"
00015 
00016 #include <klocale.h>
00017 
00018 Item* CallSub::construct( ItemDocument *itemDocument, bool newItem, const char *id )
00019 {
00020         return new CallSub( (ICNDocument*)itemDocument, newItem, id );
00021 }
00022 
00023 LibraryItem* CallSub::libraryItem()
00024 {
00025         return new LibraryItem(
00026                 QString("flow/callsub"),
00027                 i18n("Sub Call"),
00028                 i18n("Common"),
00029                 "subcall.png",
00030                 LibraryItem::lit_flowpart,
00031                 CallSub::construct );
00032 }
00033 
00034 CallSub::CallSub( ICNDocument *icnDocument, bool newItem, const char *id )
00035         : FlowPart( icnDocument, newItem, (id) ? id : "callsub" )
00036 {
00037         m_name = i18n("Sub Call");
00038         m_desc = i18n("Call a subroutine. When the subroutine returns, the code will continue execution from this point.");
00039         initCallSymbol();
00040         createStdInput();
00041         createStdOutput();
00042         
00043         createProperty( "sub", Variant::Type::Combo );
00044         property("sub")->setCaption( i18n("Subroutine") );
00045         property("sub")->setValue("MySub");
00046 }
00047 
00048 CallSub::~CallSub()
00049 {
00050 }
00051 
00052 void CallSub::dataChanged()
00053 {
00054         setCaption( i18n("Call %1").arg(dataString("sub")) );
00055 }
00056 
00057 void CallSub::generateMicrobe( FlowCode *code )
00058 {
00059         code->addCode( "call " + dataString("sub") );
00060         code->addCodeBranch( outputPart("stdoutput" ) );
00061 }
00062 

Generated on Tue May 8 17:05:28 2007 for KTechLab by  doxygen 1.5.1