2 * Copyright (c) 1999-2000, Eric Moon.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions, and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions, and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * 3. The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
27 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 #ifndef __MediaWire_H__
39 #define __MediaWire_H__
42 #include "DiagramWire.h"
44 #include "Connection.h"
46 #include "cortex_defs.h"
47 __BEGIN_CORTEX_NAMESPACE
53 typedef DiagramWire _inherited
;
55 public: // *** constans
57 // [e.moon 26oct99] moved definition to MediaWire.cpp
58 static const float M_WIRE_OFFSET
;
60 public: // *** ctor/dtor
62 // input and output jack are set connected by this constructor
63 // so be careful to only pass in valid pointers
65 Connection connection
,
66 MediaJack
*outputJack
,
67 MediaJack
*inputJack
);
69 // special constructor used only in drag&drop sessions for
70 // temporary visual indication of the connection process
71 // the isStartPoint specifies if the given EndPoint is
72 // supposed to be treated as start or end point
79 public: // *** accessors
81 Connection connection
;
83 public: // *** derived from DiagramWire/Item
85 // init the cached points and the frame rect
86 virtual void attachedToDiagram();
88 // make sure no tooltip is being displayed for this wire
89 // +++ DOES NOT WORK (yet)
90 virtual void detachedFromDiagram();
92 // calculates and returns the frame rectangle of the wire
93 virtual BRect
Frame() const;
95 // returns a value > 0.5 for points pretty much close to the
97 virtual float howCloseTo(
100 // does the actual drawing
101 virtual void drawWire();
103 // displays the context-menu for right-clicks
104 virtual void MouseDown(
109 // changes the mouse cursor and starts a tooltip
110 virtual void MouseOver(
114 // also selects and invalidates the jacks connected by
116 virtual void selected();
118 // also deselectes and invalidates the jacks connected
120 virtual void deselected();
122 // updates the cached start & end points and the frame rect
123 virtual void endPointMoved(
124 DiagramEndPoint
*which
= 0);
126 protected: // *** operations
128 // display a popup-menu at given point
129 void showContextMenu(
132 private: // *** data members
138 BPoint m_startOffset
;
145 __END_CORTEX_NAMESPACE
146 #endif /* __MediaWire_H__ */