Commit | Line | Data |
---|---|---|
4172f013 YB |
1 | |
2 | /* This file is part of the Linux Trace Toolkit viewer | |
3 | * Copyright (C) 2010 Yannick Brosseau | |
4 | * | |
5 | * This program is free software; you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License Version 2 as | |
7 | * published by the Free Software Foundation; | |
8 | * | |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, | |
17 | * MA 02111-1307, USA. | |
18 | */ | |
19 | #ifndef _TIME_ENTRY_ | |
20 | #define _TIME_ENTRY_ | |
21 | ||
22 | ||
23 | #include <glib.h> | |
24 | #include <gtk/gtkhbox.h> | |
25 | #include <gtk/gtkspinbutton.h> | |
26 | #include <gtk/gtklabel.h> | |
27 | ||
28 | G_BEGIN_DECLS | |
29 | ||
30 | #define TIMEENTRY_TYPE (timeentry_get_type ()) | |
31 | #define TIMEENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TIMEENTRY_TYPE, Timeentry)) | |
32 | #define TIMEENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TIMEENTRY_TYPE, TimeentryClass)) | |
33 | #define IS_TIMEENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TIMEENTRY_TYPE)) | |
34 | #define IS_TIMEENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TIMEENTRY_TYPE)) | |
35 | ||
36 | typedef struct _Timeentry Timeentry; | |
37 | typedef struct _TimeentryClass TimeentryClass; | |
38 | ||
39 | struct _Timeentry { | |
40 | GtkHBox hbox; | |
41 | ||
42 | GtkWidget *main_label; | |
43 | GtkWidget *main_label_box; | |
44 | GtkWidget *main_label_context_menu; | |
45 | GtkWidget *seconds_spinner; | |
46 | GtkWidget *nanoseconds_spinner; | |
47 | GtkWidget *s_label; | |
48 | GtkWidget *ns_label; | |
49 | ||
50 | int seconds_changed_handler_id; | |
51 | int nanoseconds_changed_handler_id; | |
52 | ||
53 | unsigned long min_seconds; | |
54 | unsigned long min_nanoseconds; | |
55 | unsigned long max_seconds; | |
56 | unsigned long max_nanoseconds; | |
57 | }; | |
58 | ||
59 | struct _TimeentryClass { | |
60 | GtkHBoxClass parent_class; | |
61 | ||
62 | void (*timeentry) (Timeentry *timeentry); | |
63 | }; | |
64 | ||
65 | GType timeentry_get_type(void); | |
66 | GtkWidget *timeentry_new(const gchar *label); | |
67 | ||
68 | void timeentry_set_main_label(Timeentry *timeentry, | |
69 | const gchar *str); | |
70 | void timeentry_set_minmax_time(Timeentry *timeentry, | |
71 | unsigned long min_seconds, | |
72 | unsigned long min_nanoseconds, | |
73 | unsigned long max_seconds, | |
74 | unsigned long max_nanoseconds); | |
75 | ||
76 | void timeentry_set_time(Timeentry *timeentry, | |
77 | unsigned long seconds, | |
78 | unsigned long nanoseconds); | |
79 | ||
80 | void timeentry_get_time(Timeentry *timeentry, | |
81 | unsigned long *seconds, | |
82 | unsigned long *nanoseconds); | |
83 | G_END_DECLS | |
84 | ||
85 | #endif /* _TIME_ENTRY_ */ |