From 5de3dd4762ca33a0f92e79ffa4fe2ff67069d531 Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 24 Feb 2010 01:49:02 +0000 Subject: Added KDE3 version of ktechlab git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/ktechlab@1095338 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- src/iteminterface.h | 131 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 src/iteminterface.h (limited to 'src/iteminterface.h') diff --git a/src/iteminterface.h b/src/iteminterface.h new file mode 100644 index 0000000..22a4a04 --- /dev/null +++ b/src/iteminterface.h @@ -0,0 +1,131 @@ +/*************************************************************************** + * Copyright (C) 2004-2005 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. * + ***************************************************************************/ + +#ifndef ITEMINTERFACE_H +#define ITEMINTERFACE_H + +#include + +class CNItemGroup; +class DoubleSpinBox; +class Item; +class ItemDocument; +class ItemGroup; +class ItemInterface; +class KTechlab; +class MechanicsGroup; +class Variant; + +class ColorCombo; +class KComboBox; +class KToolBar; +class KURLRequester; +class QCheckBox; +class KLineEdit; +class KIntSpinBox; + + +typedef QMap VariantDataMap; +typedef QMap KComboBoxMap; +typedef QMap KLineEditMap; +typedef QMap DoubleSpinBoxMap; +typedef QMap IntSpinBoxMap; +typedef QMap ColorComboMap; +typedef QMap KURLReqMap; +typedef QMap QCheckBoxMap; + +/** +This acts as an interface between the ItemDocument's and the associated +Items's, and the various objects that like to know about them +(e.g. ContextHelp, ItemEditor, ItemEditTB) +@author David Saxton +*/ +class ItemInterface : public QObject +{ + Q_OBJECT + public: + ~ItemInterface(); + static ItemInterface * self( KTechlab * ktechlab = 0l ); + + /** + * Sets the orientation of all flowparts in the group. + */ + void setFlowPartOrientation( unsigned orientation ); + /** + * Sets the orientation of all components in the group. + */ + void setComponentOrientation( int angleDegrees, bool flipped ); + /** + * Updates actions based on the items currently selected (e.g. rotate, + * flip, etc) + */ + void updateItemActions(); + /** + * Returns a configuration widget for the component for insertion into te + * ItemEditTB. + * @param showAdvanced Whether advanced data should be shown + */ + virtual QWidget * configWidget(); + + public slots: + /** + * If cnItemsAreSameType() returns true, then set the + * data with the given id for all the CNItems in the group. + * Else, it only sets the data for the activeCNItem() + */ + void slotSetData( const QString &id, QVariant value ); + /** + * Called when the ItemEditTB is cleared. This clears all widget maps. + */ + void itemEditTBCleared(); + void tbDataChanged(); + void slotItemDocumentChanged( ItemDocument *view ); + void slotUpdateItemInterface(); + void slotClearAll(); + void slotMultipleSelected(); + void clearItemEditorToolBar(); + + protected: + /** + * Connects the specified widget to either tbDataChanged or advDataChanged + * as specified by mi. + */ + void connectMapWidget( QWidget *widget, const char *_signal); + + KTechlab * const p_ktechlab; + + // Widget maps. + KLineEditMap m_stringLineEditMap; + KComboBoxMap m_stringComboBoxMap; + KURLReqMap m_stringURLReqMap; + DoubleSpinBoxMap m_doubleSpinBoxMap; + IntSpinBoxMap m_intSpinBoxMap; + ColorComboMap m_colorComboMap; + QCheckBoxMap m_boolCheckMap; + + // Use by item editor toolbar + QGuardedPtr m_pActiveItemEditorToolBar; + int m_toolBarWidgetID; + + + protected slots: + void slotGetActionTicket(); + + private: + ItemInterface( KTechlab * ktechlab ); + static ItemInterface * m_pSelf; + + QGuardedPtr p_cvb; + QGuardedPtr p_itemGroup; + QGuardedPtr p_lastItem; + int m_currentActionTicket; +}; + +#endif -- cgit v1.2.3