tcp: Fix 64 bit build with debugging features enabled.
[haiku.git] / src / preferences / time / DateTimeEdit.h
blobb3ae28765c22bc255711036dca7b91068773ffd8
1 /*
2 * Copyright 2004-2011, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * McCall <mccall@@digitalparadise.co.uk>
7 * Mike Berg <mike@berg-net.us>
8 * Julun <host.haiku@gmx.de>
9 * Hamish Morrison <hamish@lavabit.com>
11 #ifndef _DATE_TIME_EDIT_H
12 #define _DATE_TIME_EDIT_H
15 #include <DateFormat.h>
16 #include <DateTime.h>
17 #include <Locale.h>
18 #include <String.h>
19 #include <TimeFormat.h>
21 #include "SectionEdit.h"
24 class TTimeEdit : public TSectionEdit {
25 public:
26 TTimeEdit(const char* name, uint32 sections);
27 virtual ~TTimeEdit();
29 virtual void KeyDown(const char* bytes, int32 numBytes);
31 virtual void InitView();
32 virtual void DrawSection(uint32 index, BRect bounds,
33 bool isfocus);
34 virtual void DrawSeparator(uint32 index, BRect bounds);
36 virtual void SectionFocus(uint32 index);
37 virtual float MinSectionWidth();
38 virtual float SeparatorWidth();
40 virtual float PreferredHeight();
41 virtual void DoUpPress();
42 virtual void DoDownPress();
44 virtual void BuildDispatch(BMessage* message);
46 void SetTime(int32 hour, int32 minute, int32 second);
48 private:
49 void _UpdateFields();
50 void _CheckRange();
51 bool _IsValidDoubleDigit(int32 value);
52 int32 _SectionValue(int32 index) const;
54 BDateTime fTime;
55 BTimeFormat fTimeFormat;
56 bigtime_t fLastKeyDownTime;
57 int32 fLastKeyDownInt;
59 BString fText;
61 // TODO: morph the following into a proper class
62 BDateElement* fFields;
63 int fFieldCount;
64 int* fFieldPositions;
65 int fFieldPosCount;
69 class TDateEdit : public TSectionEdit {
70 public:
71 TDateEdit(const char* name, uint32 sections);
72 virtual ~TDateEdit();
73 virtual void KeyDown(const char* bytes, int32 numBytes);
75 virtual void InitView();
76 virtual void DrawSection(uint32 index, BRect bounds,
77 bool isfocus);
78 virtual void DrawSeparator(uint32 index, BRect bounds);
80 virtual void SectionFocus(uint32 index);
81 virtual float MinSectionWidth();
82 virtual float SeparatorWidth();
84 virtual float PreferredHeight();
85 virtual void DoUpPress();
86 virtual void DoDownPress();
88 virtual void BuildDispatch(BMessage* message);
91 void SetDate(int32 year, int32 month, int32 day);
93 private:
94 void _UpdateFields();
95 void _CheckRange();
96 bool _IsValidDoubleDigit(int32 value);
97 int32 _SectionValue(int32 index) const;
99 BDate fDate;
100 BDateFormat fDateFormat;
101 bigtime_t fLastKeyDownTime;
102 int32 fLastKeyDownInt;
104 BString fText;
106 // TODO: morph the following into a proper class
107 BDateElement* fFields;
108 int fFieldCount;
109 int* fFieldPositions;
110 int fFieldPosCount;
114 #endif // _DATE_TIME_EDIT_H