1 // ObjectView.h 2 3 #ifndef OBJECT_VIEW_H 4 #define OBJECT_VIEW_H 5 6 #include <List.h> 7 #include <View.h> 8 9 class State; 10 11 enum { 12 MSG_OBJECT_COUNT_CHANGED = 'obcc', 13 MSG_OBJECT_ADDED = 'obad', 14 }; 15 16 class ObjectView : public BView { 17 public: 18 ObjectView(BRect frame, const char* name, 19 uint32 resizeFlags, uint32 flags); 20 21 // BView 22 virtual void AttachedToWindow(); 23 24 virtual void Draw(BRect updateRect); 25 26 virtual void MouseDown(BPoint where); 27 virtual void MouseUp(BPoint where); 28 virtual void MouseMoved(BPoint where, uint32 transit, 29 const BMessage* dragMessage); 30 31 virtual void MessageReceived(BMessage* message); 32 33 // ObjectView 34 void SetState(State* state); 35 36 void SetObjectType(int32 type); 37 int32 ObjectType() const 38 { return fObjectType; } 39 40 void AddObject(State* state); 41 void RemoveObject(State* state); 42 int32 CountObjects() const; 43 void MakeEmpty(); 44 45 void SetStateColor(rgb_color color); 46 rgb_color StateColor() const 47 { return fColor; } 48 49 void SetStateDrawingMode(drawing_mode mode); 50 drawing_mode StateDrawingMode() const 51 { return fDrawingMode; } 52 53 void SetStateFill(bool fill); 54 bool StateFill() const 55 { return fFill; } 56 57 void SetStatePenSize(float penSize); 58 float StatePenSize() const 59 { return fPenSize; } 60 61 private: 62 State* fState; 63 int32 fObjectType; 64 65 BList fStateList; 66 67 rgb_color fColor; 68 drawing_mode fDrawingMode; 69 bool fFill; 70 float fPenSize; 71 72 bool fScrolling; 73 bool fInitiatingDrag; 74 BPoint fLastMousePos; 75 }; 76 77 #endif // OBJECT_VIEW_H 78