You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
2.3 KiB
79 lines
2.3 KiB
/***************************************************************************
|
|
* Copyright (C) 2004 by David Saxton *
|
|
* david@bluehaze.org *
|
|
* *
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
* it under the terms of the GNU General Public License as published by *
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
* (at your option) any later version. *
|
|
***************************************************************************/
|
|
|
|
#include "externalconnection.h"
|
|
#include "libraryitem.h"
|
|
|
|
#include <tdelocale.h>
|
|
#include <tqpainter.h>
|
|
|
|
Item* ExternalConnection::construct( ItemDocument *itemDocument, bool newItem, const char *id )
|
|
{
|
|
return new ExternalConnection( (ICNDocument*)itemDocument, newItem, id );
|
|
}
|
|
|
|
LibraryItem* ExternalConnection::libraryItem()
|
|
{
|
|
return new LibraryItem(
|
|
"ec/external_connection",
|
|
i18n("External Connection"),
|
|
i18n("Connections"),
|
|
"external_connection.png",
|
|
LibraryItem::lit_component,
|
|
ExternalConnection::construct );
|
|
}
|
|
|
|
ExternalConnection::ExternalConnection( ICNDocument *icnDocument, bool newItem, const char *id )
|
|
: Component( icnDocument, newItem, id ? id : "external_connection" )
|
|
{
|
|
m_name = i18n("External Connection");
|
|
m_desc = i18n("Point to connect the circuit to an external entity - e.g. a mechanical component or as part of a subcircuit.");
|
|
setSize( -8, -8, 16, 16 );
|
|
|
|
createProperty( "name", Variant::Type::Combo );
|
|
property("name")->setCaption( i18n("Name") );
|
|
property("name")->setValue("ExtCon");
|
|
|
|
init1PinLeft();
|
|
|
|
addDisplayText( "name", TQRect( -24, 8, 3*width(), 16 ), "ExtCon" );
|
|
}
|
|
|
|
ExternalConnection::~ExternalConnection()
|
|
{
|
|
}
|
|
|
|
|
|
void ExternalConnection::dataChanged()
|
|
{
|
|
TQString name = dataString("name");
|
|
|
|
TQRect r( -width(), 16, 3*width(), 16 );
|
|
setDisplayText( "name", name );
|
|
}
|
|
|
|
|
|
void ExternalConnection::drawShape( TQPainter &p )
|
|
{
|
|
initPainter(p);
|
|
int _x = (int)x()-8;
|
|
int _y = (int)y()-8;
|
|
p.drawEllipse( _x, _y, width(), height() );
|
|
|
|
p.drawLine( _x+3, _y+6, _x+12, _y+6 );
|
|
p.drawLine( _x+8, _y+3, _x+12, _y+6 );
|
|
|
|
p.drawLine( _x+3, _y+9, _x+12, _y+9 );
|
|
p.drawLine( _x+3, _y+9, _x+8, _y+12 );
|
|
|
|
deinitPainter(p);
|
|
}
|
|
|