4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
34 #include "timeentry.inc"
37 // 3 part entry widget.
38 // part 1: day of the week
39 // part 2: day tumbler
40 // part 3: time of day
41 // Used by the Record GUI, Batch Rendering.
46 TimeEntry(BC_WindowBase *gui, int x, int y,
47 int *output_day, double *output_time, int time_format,
48 int time_w=DEFAULT_TIMEW);
51 void create_objects();
52 void time_to_hours(char *result, double time);
53 void time_to_minutes(char *result, double time);
54 void time_to_seconds(char *result, double time);
55 virtual int handle_event();
56 static int day_to_int(const char *day);
57 void update(int *day, double *time);
58 void update_time(double time);
59 void update_day(int day);
60 void reposition_window(int x, int y);
65 double get_time() { return *output_time; }
66 int get_day() { return *output_day; }
73 DayTumbler *day_tumbler;
74 TimeTextBox *time_text;
75 static const char *day_table[TOTAL_DAYS];
81 class DayText : public BC_TextBox
84 DayText(TimeEntry *timeentry, int x, int y, int w,
85 const char **table, int table_items, const char *text);
94 class DayTumbler : public BC_Tumbler
97 DayTumbler(TimeEntry *timeentry, DayText *text, int x, int y);
99 int handle_up_event();
100 int handle_down_event();
102 TimeEntry *timeentry;
107 class TimeEntryTumbler : public TimeEntry
112 SecTumbler *sec_tumbler;
114 void create_objects();
115 void reposition_window(int x, int y);
116 virtual int handle_up_event();
117 virtual int handle_down_event();
120 int get_incr() { return incr; }
121 void update_incr(int i) { incr = i; }
123 TimeEntryTumbler(BC_WindowBase *gui, int x, int y,
124 int *output_day, double *output_time, int incr=1,
125 int time_format=TIME_MS2, int time_w=DEFAULT_TIMEW);
129 class SecTumbler : public BC_Tumbler
132 SecTumbler(TimeEntryTumbler *timetumbler, int x, int y);
134 int handle_up_event();
135 int handle_down_event();
137 TimeEntryTumbler *timetumbler;
141 class TimeTextBox : public BC_TextBox
144 TimeTextBox(TimeEntry *timeentry,
145 int x, int y, int w, char *default_text);
147 TimeEntry *timeentry;