SectionEdit.h revision a10cf76e
1#ifndef SECTIONEDIT_H
2#define SECTIONEDIT_H
3
4#include <Control.h>
5#include <List.h>
6
7class TSection {
8	public:
9		TSection(BRect frame);
10
11		void SetBounds(BRect frame);
12
13		 BRect Bounds() const;
14		BRect Frame() const;
15	private:
16		BRect f_frame;
17};
18
19
20class TSectionEdit: public BControl {
21	public:
22		TSectionEdit(BRect frame, const char *name, uint32 sections);
23		~TSectionEdit();
24
25		virtual void AttachedToWindow();
26		virtual void Draw(BRect);
27		virtual void MouseDown(BPoint);
28		virtual void KeyDown(const char *bytes, int32 numbytes);
29
30		uint32 CountSections() const;
31		int32 FocusIndex() const;
32		BRect SectionArea() const;
33	protected:
34		virtual void InitView();
35		//hooks
36		virtual void DrawBorder();
37		virtual void DrawSection(uint32 index, bool isfocus);
38		virtual void DrawSeperator(uint32 index);
39		virtual void Draw3DFrame(BRect frame, bool inset);
40
41		virtual void SectionFocus(uint32 index);
42		virtual void SectionChange(uint32 index, uint32 value);
43		virtual void SetSections(BRect area);
44		virtual void GetSeperatorWidth(uint32 *width);
45
46		virtual void DoUpPress();
47		virtual void DoDownPress();
48
49		virtual void DispatchMessage();
50		virtual void BuildDispatch(BMessage *) = 0;
51
52		BBitmap *f_up;
53		BBitmap *f_down;
54		BList *f_sections;
55
56		BRect f_uprect;
57		BRect f_downrect;
58		BRect f_sectionsarea;
59
60		int32 f_focus;
61		uint32 f_sectioncount;
62		uint32 f_holdvalue;
63
64		bool f_showfocus;
65};
66
67#endif
68