keypad.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 "keypad.h"
00012 
00013 #include "libraryitem.h"
00014 #include "flowcode.h"
00015 
00016 #include <klocale.h>
00017 
00018 Item* Keypad::construct( ItemDocument *itemDocument, bool newItem, const char *id )
00019 {
00020         return new Keypad( (ICNDocument*)itemDocument, newItem, id );
00021 }
00022 
00023 LibraryItem* Keypad::libraryItem()
00024 {
00025         return new LibraryItem(
00026                 "flow/keypad",
00027                 i18n("Keypad"),
00028                 i18n("Functions"),
00029                 "keypad.png",
00030                 LibraryItem::lit_flowpart,
00031                 Keypad::construct
00032                         );
00033 }
00034 
00035 Keypad::Keypad( ICNDocument *icnDocument, bool newItem, const char *id )
00036         : FlowPart( icnDocument, newItem, id ? id : "keypad" )
00037 {
00038         m_name = i18n("Keypad");
00039         m_desc = i18n("Gets a key from a keypad connected to the PIC.");
00040         initProcessSymbol();
00041         createStdInput();
00042         createStdOutput();
00043         
00044         createProperty( "variable", Variant::Type::VarName );
00045         property("variable")->setValue("x");
00046         property("variable")->setCaption( i18n("Variable") );
00047         
00048         Variant * v = createProperty( "keypad", Variant::Type::KeyPad );
00049         v->setCaption( i18n("Pin map") );
00050 }
00051 
00052 Keypad::~Keypad()
00053 {
00054 }
00055 
00056 void Keypad::dataChanged()
00057 {
00058         setCaption( i18n("Read %1 to %2").arg( dataString( "keypad" ) ).arg( dataString( "variable" ) ) );
00059 }
00060 
00061 void Keypad::generateMicrobe( FlowCode *code )
00062 {
00063         code->addCode( QString("%1 = %2").arg( dataString("variable") ).arg( dataString("keypad") ) );
00064         code->addCodeBranch( outputPart("stdoutput") );
00065 }
00066 
00067 

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