sub.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 "sub.h"
00012 
00013 #include "libraryitem.h"
00014 #include "flowcode.h"
00015 
00016 #include <klocale.h>
00017 
00018 Item* Sub::construct( ItemDocument *itemDocument, bool newItem, const char *id )
00019 {
00020         return new Sub( (ICNDocument*)itemDocument, newItem, id );
00021 }
00022 
00023 LibraryItem* Sub::libraryItem()
00024 {
00025         return new LibraryItem(
00026                 QString("flow/sub"),
00027                 i18n("Subroutine"),
00028                 i18n("Common"),
00029                 "sub.png",
00030                 LibraryItem::lit_flowpart,
00031                 Sub::construct );
00032 }
00033 
00034 Sub::Sub( ICNDocument *icnDocument, bool newItem, const char *id )
00035         : FlowContainer( icnDocument, newItem, (id) ? id : "sub" )
00036 {
00037         m_name = i18n("Sub");
00038         m_desc = i18n("Defines the starting point of a subroutine. Call this subroutine using \"Call Sub\"");
00039         
00040         createProperty( "sub", Variant::Type::Combo );
00041         property("sub")->setCaption( i18n("Subroutine") );
00042         property("sub")->setValue("MySub");
00043 }
00044 
00045 Sub::~Sub()
00046 {
00047 }
00048 
00049 void Sub::dataChanged()
00050 {
00051         setCaption( "Sub " + dataString("sub") );
00052 }
00053 
00054 void Sub::generateMicrobe( FlowCode *code )
00055 {
00056         code->addCode( "\nsub "+dataString("sub")+"\n{" );
00057         code->addCodeBranch( outputPart("int_in") );
00058         code->addCode("}");
00059 }
00060 
00061 
00062 // #include "sub.moc"

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