1// PatchView.h 2// ----------- 3// The main PatchBay view contains a row of icons along the top and 4// left sides representing available consumers and producers, and 5// a set of PatchRows which build the matrix of connections. 6// 7// Copyright 1999, Be Incorporated. All Rights Reserved. 8// This file may be used under the terms of the Be Sample Code License. 9 10#ifndef _PatchView_h 11#define _PatchView_h 12 13#include <Rect.h> 14#include <View.h> 15#include <list> 16#include "EndpointInfo.h" 17 18class PatchRow; 19class BBitmap; 20class TToolTip; 21 22using namespace std; 23 24class PatchView : public BView 25{ 26public: 27 PatchView(BRect r); 28 ~PatchView(); 29 30 void AttachedToWindow(); 31 void MessageReceived(BMessage* msg); 32 void Draw(BRect updateRect); 33 void MouseMoved(BPoint point, uint32 transit, const BMessage* dragMsg); 34 35private: 36 typedef enum { 37 TRACK_COLUMN, 38 TRACK_ROW 39 } track_type; 40 41 BRect ColumnIconFrameAt(int32 index) const; 42 BRect RowIconFrameAt(int32 index) const; 43 void StartTipTracking(BPoint pt, BRect rect, int32 index, track_type type=TRACK_COLUMN); 44 void StopTipTracking(); 45 void StartTip(BPoint pt, BRect rect, const char* str); 46 void StopTip(); 47 48 void AddProducer(int32 id); 49 void AddConsumer(int32 id); 50 void RemoveProducer(int32 id); 51 void RemoveConsumer(int32 id); 52 void UpdateProducerProps(int32 id, const BMessage* props); 53 void UpdateConsumerProps(int32 id, const BMessage* props); 54 void Connect(int32 prod, int32 cons); 55 void Disconnect(int32 prod, int32 cons); 56 57 void HandleMidiEvent(BMessage* msg); 58 59 BPoint CalcRowOrigin(int32 rowIndex) const; 60 BPoint CalcRowSize() const; 61 62 typedef list<EndpointInfo>::iterator endpoint_itor; 63 typedef list<EndpointInfo>::const_iterator const_endpoint_itor; 64 typedef list<PatchRow*>::iterator row_itor; 65 66 list<EndpointInfo> m_producers; 67 list<EndpointInfo> m_consumers; 68 list<PatchRow*> m_patchRows; 69 BBitmap* m_unknownDeviceIcon; 70 int32 m_trackIndex; 71 track_type m_trackType; 72 TToolTip* m_toolTip; 73}; 74 75#endif /* _PatchView_h */ 76