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