diff options
| author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-24 01:49:02 +0000 | 
|---|---|---|
| committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-24 01:49:02 +0000 | 
| commit | 5de3dd4762ca33a0f92e79ffa4fe2ff67069d531 (patch) | |
| tree | bad482b7afa4cdf47422d60a5dd2c61c7e333b09 /src/electronics/components/externalconnection.cpp | |
| download | ktechlab-5de3dd4762ca33a0f92e79ffa4fe2ff67069d531.tar.gz ktechlab-5de3dd4762ca33a0f92e79ffa4fe2ff67069d531.zip | |
Added KDE3 version of ktechlab
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/ktechlab@1095338 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/electronics/components/externalconnection.cpp')
| -rw-r--r-- | src/electronics/components/externalconnection.cpp | 78 | 
1 files changed, 78 insertions, 0 deletions
| diff --git a/src/electronics/components/externalconnection.cpp b/src/electronics/components/externalconnection.cpp new file mode 100644 index 0000000..596727a --- /dev/null +++ b/src/electronics/components/externalconnection.cpp @@ -0,0 +1,78 @@ +/*************************************************************************** + *   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 <klocale.h> +#include <qpainter.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", QRect( -24, 8, 3*width(), 16 ), "ExtCon" ); +} + +ExternalConnection::~ExternalConnection() +{ +} + + +void ExternalConnection::dataChanged() +{ +	QString name = dataString("name"); +	 +	QRect r( -width(), 16, 3*width(), 16 ); +	setDisplayText( "name", name ); +} + + +void ExternalConnection::drawShape( QPainter &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); +} + | 
