| 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., 51 Franklin Street, Fifth Floor, Boston, |
| 16 | * MA 02110-1301, USA. |
| 17 | */ |
| 18 | #ifndef _TIMEBAR_ |
| 19 | #define _TIMEBAR_ |
| 20 | |
| 21 | #include <glib.h> |
| 22 | #include <gtk/gtkhbox.h> |
| 23 | #include <gtk/gtktooltips.h> |
| 24 | #include <gtk/gtkwidget.h> |
| 25 | #include <lttv/time.h> |
| 26 | |
| 27 | G_BEGIN_DECLS |
| 28 | |
| 29 | #define TIMEBAR_TYPE (timebar_get_type ()) |
| 30 | #define TIMEBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TIMEBAR_TYPE, Timebar)) |
| 31 | #define TIMEBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TIMEBAR_TYPE, TimebarClass)) |
| 32 | #define IS_TIMEBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TIMEBAR_TYPE)) |
| 33 | #define IS_TIMEBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TIMEBAR_TYPE)) |
| 34 | |
| 35 | typedef struct _Timebar Timebar; |
| 36 | typedef struct _TimebarClass TimebarClass; |
| 37 | |
| 38 | struct _Timebar { |
| 39 | GtkHBox parent_hbox; |
| 40 | |
| 41 | GtkWidget *title_label; |
| 42 | GtkWidget *title_eventbox; |
| 43 | GtkWidget *start_timeentry; |
| 44 | GtkWidget *end_timeentry; |
| 45 | GtkWidget *interval_timeentry; |
| 46 | GtkWidget *current_timeentry; |
| 47 | |
| 48 | int interval_handler_id; |
| 49 | |
| 50 | /* Time management */ |
| 51 | LttTime min_time; |
| 52 | LttTime max_time; |
| 53 | }; |
| 54 | |
| 55 | struct _TimebarClass { |
| 56 | GtkHBoxClass parent_class; |
| 57 | |
| 58 | void (*timebar) (Timebar *timebar); |
| 59 | }; |
| 60 | |
| 61 | |
| 62 | GType timebar_get_type(void); |
| 63 | GtkWidget *timebar_new(void); |
| 64 | |
| 65 | void timebar_set_current_time(Timebar *timeebar, const LttTime *time); |
| 66 | void timebar_set_start_time(Timebar *timebar, const LttTime *time); |
| 67 | void timebar_set_end_time(Timebar *timebar, const LttTime *time); |
| 68 | void timebar_set_minmax_time(Timebar *timebar, |
| 69 | const LttTime *min_time, |
| 70 | const LttTime *max_time); |
| 71 | |
| 72 | LttTime timebar_get_current_time(Timebar *timeebar); |
| 73 | LttTime timebar_get_start_time(Timebar *timebar); |
| 74 | LttTime timebar_get_end_time(Timebar *timebar); |
| 75 | |
| 76 | G_END_DECLS |
| 77 | |
| 78 | #endif /* _TIMEBAR_ */ |