diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-29 16:05:55 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-29 16:05:55 +0000 |
commit | 87a016680e3677da3993f333561e79eb0cead7d5 (patch) | |
tree | cbda2b4df8b8ee0d8d1617e6c75bec1e3ee0ccba /src/canvasmanipulator.h | |
parent | 6ce3d1ad09c1096b5ed3db334e02859e45d5c32b (diff) | |
download | ktechlab-87a016680e3677da3993f333561e79eb0cead7d5.tar.gz ktechlab-87a016680e3677da3993f333561e79eb0cead7d5.zip |
TQt4 port ktechlab
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/ktechlab@1238801 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/canvasmanipulator.h')
-rw-r--r-- | src/canvasmanipulator.h | 115 |
1 files changed, 58 insertions, 57 deletions
diff --git a/src/canvasmanipulator.h b/src/canvasmanipulator.h index 06d463c..8ddc253 100644 --- a/src/canvasmanipulator.h +++ b/src/canvasmanipulator.h @@ -13,8 +13,8 @@ #include "eventinfo.h" -#include <qcanvas.h> -#include <qguardedptr.h> +#include <tqcanvas.h> +#include <tqguardedptr.h> class CanvasManipulator; class Connector; @@ -37,19 +37,19 @@ class Node; class NodeGroup; class ResizeHandle; -class QCanvas; -class QCanvasItem; -class QCanvasLine; -class QCanvasRectangle; -class QMouseEvent; -class QTimer; -class QWheelEvent; +class TQCanvas; +class TQCanvasItem; +class TQCanvasLine; +class TQCanvasRectangle; +class TQMouseEvent; +class TQTimer; +class TQWheelEvent; typedef CanvasManipulator*(*CreateManipulatorPtr)( ItemDocument *, CMManager * ); typedef bool(*AcceptManipulationPtr)( uint eventState, uint cmState, uint itemType, uint cnItemType ); -typedef QValueList<NodeGroup*> NodeGroupList; -typedef QValueList<QGuardedPtr<Connector> > ConnectorList; -typedef QValueList<QPoint> QPointList; +typedef TQValueList<NodeGroup*> NodeGroupList; +typedef TQValueList<TQGuardedPtr<Connector> > ConnectorList; +typedef TQValueList<TQPoint> TQPointList; class ManipulatorInfo @@ -59,16 +59,17 @@ public: AcceptManipulationPtr m_acceptManipulationPtr; CreateManipulatorPtr m_createManipulatorPtr; }; -typedef QValueList<ManipulatorInfo*> ManipulatorInfoList; +typedef TQValueList<ManipulatorInfo*> ManipulatorInfoList; /** Handles canvas manipulation, such as moving an item or resizing the canvas @author David Saxton */ -class CMManager : public QObject +class CMManager : public TQObject { Q_OBJECT + TQ_OBJECT public: enum EventState { @@ -127,10 +128,10 @@ public: */ void cancelCurrentManipulation(); CanvasManipulator * currentManipulator() const { return m_canvasManipulator; } - void setRepeatedAddId( const QString & repeatedId = QString::null ); + void setRepeatedAddId( const TQString & repeatedId = TQString() ); uint cmState() const { return m_cmState; } void addManipulatorInfo( ManipulatorInfo *info ); - QString repeatedItemId() const { return m_repeatedItemId; } + TQString repeatedItemId() const { return m_repeatedItemId; } void setDrawAction( int drawAction ); int drawAction() const { return m_drawAction; } @@ -149,13 +150,13 @@ protected: void updateCurrentResizeHandle( ResizeHandle * mouseOver ); CanvasManipulator *m_canvasManipulator; uint m_cmState; - QString m_repeatedItemId; + TQString m_repeatedItemId; ItemDocument *p_itemDocument; ManipulatorInfoList m_manipulatorInfoList; - QGuardedPtr<Item> p_lastMouseOverItem; // Pointer to the item where the mouse was last over - this is used to determine when mouse - QGuardedPtr<ResizeHandle> p_lastMouseOverResizeHandle; - QGuardedPtr<Item> p_lastItemClicked; - QTimer *m_allowItemScrollTmr; // When a user scrolls on the canvas, we don't want to stop scrolling when the user gets to (e.g.) a scrollable widget. So this timer prevents scrolling a widget for a few hundred milliseconds after a scroll event if it was initiated over the canvas + TQGuardedPtr<Item> p_lastMouseOverItem; // Pointer to the item where the mouse was last over - this is used to determine when mouse + TQGuardedPtr<ResizeHandle> p_lastMouseOverResizeHandle; + TQGuardedPtr<Item> p_lastItemClicked; + TQTimer *m_allowItemScrollTmr; // When a user scrolls on the canvas, we don't want to stop scrolling when the user gets to (e.g.) a scrollable widget. So this timer prevents scrolling a widget for a few hundred milliseconds after a scroll event if it was initiated over the canvas bool b_allowItemScroll; // See above. int m_drawAction; @@ -213,11 +214,11 @@ public: protected: Type m_type; EventInfo m_eventInfo; - QPoint m_prevPos; + TQPoint m_prevPos; ItemDocument *p_itemDocument; ICNDocument *p_icnDocument; MechanicsDocument *p_mechanicsDocument; - QCanvas *p_canvas; + TQCanvas *p_canvas; ItemGroup *p_selectList; CNItemGroup *p_cnItemSelectList; MechanicsGroup *p_mechItemSelectList; @@ -286,7 +287,7 @@ class ConnectorDraw : public CanvasManipulator * Returns the colour used to indicate that the current connection * being drawn is valid. Invalid colour is black. */ - static QColor validConnectionColor(); + static TQColor validConnectionColor(); protected: /** @@ -301,18 +302,18 @@ class ConnectorDraw : public CanvasManipulator * with pos (i.e. auto-connector will call this with posIsExact = false, * and manual-connector will call this with posIsExact = true). */ - void grabEndStuff( QCanvasItem * endItem, const QPoint & pos, bool posIsExact ); + void grabEndStuff( TQCanvasItem * endItem, const TQPoint & pos, bool posIsExact ); /** * Returns the closest point to the clickPos that is on the given * connector. */ - QPoint toValidPos( const QPoint & clickPos, Connector * clickedConnector ) const; + TQPoint toValidPos( const TQPoint & clickPos, Connector * clickedConnector ) const; - QGuardedPtr<Node> p_startNode; - QGuardedPtr<Connector> p_startConnector; + TQGuardedPtr<Node> p_startNode; + TQGuardedPtr<Connector> p_startConnector; Node * p_endNode; Connector * p_endConnector; - QPoint startConnectorPoint; + TQPoint startConnectorPoint; }; @@ -335,7 +336,7 @@ public: virtual bool mouseReleased( const EventInfo &info ); protected: - QCanvasLine *m_connectorLine; + TQCanvasLine *m_connectorLine; }; @@ -443,24 +444,24 @@ protected: class SelectRectangle { public: - SelectRectangle( int x, int y, int w, int h, QCanvas *qcanvas ); + SelectRectangle( int x, int y, int w, int h, TQCanvas *qcanvas ); ~SelectRectangle(); void setSize( int w, int h ); - QCanvasItemList collisions(); + TQCanvasItemList collisions(); protected: - QCanvasLine *m_topLine; - QCanvasLine *m_rightLine; - QCanvasLine *m_bottomLine; - QCanvasLine *m_leftLine; + TQCanvasLine *m_topLine; + TQCanvasLine *m_rightLine; + TQCanvasLine *m_bottomLine; + TQCanvasLine *m_leftLine; const int m_x; const int m_y; int m_w; int m_h; int m_prevCollisions_w; int m_prevCollisions_h; - QCanvasItemList m_prevCollisions; + TQCanvasItemList m_prevCollisions; }; @@ -513,15 +514,15 @@ protected: /** @author David Saxton -A QCanvasEllipse that uses a pen (not a brush) to paint +A TQCanvasEllipse that uses a pen (not a brush) to paint */ -class CanvasEllipseDraw : public QCanvasEllipse +class CanvasEllipseDraw : public TQCanvasEllipse { public: - CanvasEllipseDraw( int x, int y, QCanvas * canvas ); + CanvasEllipseDraw( int x, int y, TQCanvas * canvas ); protected: - virtual void drawShape( QPainter & p ); + virtual void drawShape( TQPainter & p ); }; @@ -544,9 +545,9 @@ class CMDraw : public CanvasManipulator virtual bool mouseReleased( const EventInfo &info ); protected: - QCanvasRectangle * m_pDrawRectangle; + TQCanvasRectangle * m_pDrawRectangle; CanvasEllipseDraw * m_pDrawEllipse; - QCanvasLine * m_pDrawLine; + TQCanvasLine * m_pDrawLine; }; @@ -556,49 +557,49 @@ class CMDraw : public CanvasManipulator class ManualConnectorDraw { public: - ManualConnectorDraw( ICNDocument *_icnDocument, const QPoint &initialPos ); + ManualConnectorDraw( ICNDocument *_icnDocument, const TQPoint &initialPos ); virtual ~ManualConnectorDraw(); /** * Called when the mouse is moved. * Normally will do something like updating the connector route */ - void mouseMoved( const QPoint &pos ); + void mouseMoved( const TQPoint &pos ); /** * Called when the user clicks the mouse. If the connector finishes on a - * valid QCanvasItem (Node or Connetor), then this is returned. Otherwise, + * valid TQCanvasItem (Node or Connetor), then this is returned. Otherwise, * null is returned. */ - QCanvasItem * mouseClicked( const QPoint &pos ); + TQCanvasItem * mouseClicked( const TQPoint &pos ); /** * Returns the list of points that define the manual connection route */ - QPointList pointList(); + TQPointList pointList(); /** * Sets the colour used to draw the connection lines. */ - void setColor( const QColor & color ); + void setColor( const TQColor & color ); protected: void updateConnectorEnds(); - QValueList<QCanvasLine*> m_connectorLines; + TQValueList<TQCanvasLine*> m_connectorLines; ICNDocument *icnDocument; bool b_currentVertical; bool b_orientationDefined; - QPoint m_initialPos; - QPoint m_previousPos; - QPoint m_currentPos; + TQPoint m_initialPos; + TQPoint m_previousPos; + TQPoint m_currentPos; - QCanvasLine *m_currentCon; - QCanvasLine *m_previousCon; + TQCanvasLine *m_currentCon; + TQCanvasLine *m_previousCon; // The first item that we clicked on - QCanvasItem *p_initialItem; + TQCanvasItem *p_initialItem; - QColor m_color; + TQColor m_color; }; |