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 int32 CountObjects() const; 42 void MakeEmpty(); 43 44 void SetStateColor(rgb_color color); 45 rgb_color StateColor() const 46 { return fColor; } 47 48 void SetStateDrawingMode(drawing_mode mode); 49 drawing_mode StateDrawingMode() const 50 { return fDrawingMode; } 51 52 void SetStateFill(bool fill); 53 bool StateFill() const 54 { return fFill; } 55 56 void SetStatePenSize(float penSize); 57 float StatePenSize() const 58 { return fPenSize; } 59 60 private: 61 State* fState; 62 int32 fObjectType; 63 64 BList fStateList; 65 66 rgb_color fColor; 67 drawing_mode fDrawingMode; 68 bool fFill; 69 float fPenSize; 70 71 bool fScrolling; 72 bool fInitiatingDrag; 73 BPoint fLastMousePos; 74 }; 75 76 #endif // OBJECT_VIEW_H 77