vfs: check userland buffers before reading them.
[haiku.git] / src / preferences / time / SectionEdit.h
blob53bf7323e3e7b75c1f503ae71dce4a4fe9457ea5
1 /*
2 * Copyright 2004-2011, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Mike Berg <mike@berg-net.us>
7 * Julun <host.haiku@gmx.de>
8 * Hamish Morrison <hamish@lavabit.com>
9 */
10 #ifndef _SECTION_EDIT_H
11 #define _SECTION_EDIT_H
14 #include <Control.h>
17 class BBitmap;
18 class BList;
21 class TSectionEdit : public BControl {
22 public:
23 TSectionEdit(const char* name,
24 uint32 sections);
25 virtual ~TSectionEdit();
27 virtual void AttachedToWindow();
28 virtual void Draw(BRect updateRect);
29 virtual void MouseDown(BPoint point);
30 virtual void MakeFocus(bool focused = true);
31 virtual void KeyDown(const char* bytes, int32 numBytes);
33 BSize MaxSize();
34 BSize MinSize();
35 BSize PreferredSize();
37 uint32 CountSections() const;
38 int32 FocusIndex() const;
39 BRect SectionArea() const;
41 protected:
42 virtual void DrawBorder(const BRect& updateRect);
43 virtual void DrawSection(uint32 index, BRect bounds,
44 bool isFocus) {}
45 virtual void DrawSeparator(uint32 index, BRect bounds) {}
47 BRect FrameForSection(uint32 index);
48 BRect FrameForSeparator(uint32 index);
50 virtual void SectionFocus(uint32 index) {}
51 virtual void SectionChange(uint32 index, uint32 value) {}
52 virtual void SetSections(BRect area) {}
54 virtual float SeparatorWidth() = 0;
55 virtual float MinSectionWidth() = 0;
56 virtual float PreferredHeight() = 0;
58 virtual void DoUpPress() {}
59 virtual void DoDownPress() {}
61 virtual void DispatchMessage();
62 virtual void BuildDispatch(BMessage* message) = 0;
64 BRect fUpRect;
65 BRect fDownRect;
67 int32 fFocus;
68 uint32 fSectionCount;
69 uint32 fHoldValue;
73 #endif // _SECTION_EDIT_H