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