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 2013, Haiku, Inc. All rights reserved. 8 * Distributed under the terms of the MIT License. 9 * 10 * Revisions by Pete Goodeve 11 * 12 * Copyright 1999, Be Incorporated. All Rights Reserved. 13 * This file may be used under the terms of the Be Sample Code License. 14 */ 15#ifndef PATCHVIEW_H 16#define PATCHVIEW_H 17 18#include <Rect.h> 19#include <View.h> 20#include <list> 21 22#include "EndpointInfo.h" 23 24class PatchRow; 25class BBitmap; 26 27using namespace std; 28 29class PatchView : public BView 30{ 31public: 32 PatchView(BRect r); 33 ~PatchView(); 34 35 void AttachedToWindow(); 36 void MessageReceived(BMessage* msg); 37 void Draw(BRect updateRect); 38 39private: 40 typedef enum { 41 TRACK_COLUMN, 42 TRACK_ROW 43 } track_type; 44 45 BRect ColumnIconFrameAt(int32 index) const; 46 BRect RowIconFrameAt(int32 index) const; 47 virtual bool GetToolTipAt(BPoint point, BToolTip** tip); 48 49 void AddProducer(int32 id); 50 void AddConsumer(int32 id); 51 void RemoveProducer(int32 id); 52 void RemoveConsumer(int32 id); 53 void UpdateProducerProps(int32 id, const BMessage* props); 54 void UpdateConsumerProps(int32 id, const BMessage* props); 55 void Connect(int32 prod, int32 cons); 56 void Disconnect(int32 prod, int32 cons); 57 58 void HandleMidiEvent(BMessage* msg); 59 60 BPoint CalcRowOrigin(int32 rowIndex) const; 61 BPoint CalcRowSize() const; 62 63 typedef list<EndpointInfo>::iterator endpoint_itor; 64 typedef list<EndpointInfo>::const_iterator const_endpoint_itor; 65 typedef list<PatchRow*>::iterator row_itor; 66 67 list<EndpointInfo> fProducers; 68 list<EndpointInfo> fConsumers; 69 list<PatchRow*> fPatchRows; 70 BBitmap* fUnknownDeviceIcon; 71}; 72 73#endif /* PATCHVIEW_H */ 74