1 /* LIBGIW - The GIW Library
2    Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
3 
4    This library is free software: you can redistribute it and/or
5    modify it under the terms of the GNU Lesser General Public
6    License as published by the Free Software Foundation; either
7    version 3 of the License, or (at your option) any later version.
8 
9    This library 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 GNU
12    Lesser General Public License for more details.
13 
14    You should have received a copy of the GNU Lesser General Public
15    License along with this library.  If not, see
16    <http://www.gnu.org/licenses/>.
17 */
18 
19 // giwtimeline.h (c) 2013 - 2019 G. Finch salsaman@gmail.com
20 
21 #ifndef __GIW_TIMELINE_H__
22 #define __GIW_TIMELINE_H__
23 
24 #include <gdk/gdk.h>
25 #include <gtk/gtk.h>
26 
27 G_BEGIN_DECLS
28 
29 typedef enum {
30   GIW_TIME_UNIT_SECONDS,
31   GIW_TIME_UNIT_SMH
32 } GiwTimeUnit;
33 
34 #define GIW_TYPE_TIMELINE            (giw_timeline_get_type ())
35 #define GIW_TIMELINE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIW_TYPE_TIMELINE, GiwTimeline))
36 #define GIW_TIMELINE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GIW_TYPE_TIMELINE, GiwTimelineClass))
37 #define GIW_IS_TIMELINE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIW_TYPE_TIMELINE))
38 #define GIW_IS_TIMELINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIW_TYPE_TIMELINE))
39 #define GIW_TIMELINE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GIW_TYPE_TIMELINE, GiwTimelineClass))
40 
41 typedef enum {
42   GIW_TIMELINE_MOUSE_DISABLED,
43   GIW_TIMELINE_MOUSE_AUTOMATIC
44   //GIW_TIMELINE_MOUSE_DELAYED
45 } GiwTimelineMousePolicy;
46 
47 typedef struct _GiwTimeline   GiwTimeline;
48 typedef struct _GiwTimelineClass   GiwTimelineClass;
49 
50 struct _GiwTimeline {
51   GtkWidget parent_instance;
52   GtkWidget widget;
53 
54   GtkAdjustment *adjustment;
55   GtkOrientation   orientation;
56   GiwTimeUnit      unit;
57   gdouble          max_size;
58 
59   cairo_surface_t *backing_store;
60   PangoLayout     *layout;
61   gdouble          font_scale;
62 
63   gint             xsrc;
64   gint             ysrc;
65 
66   gint button;
67 
68   gulong chsig;
69   gulong tchsig;
70   gulong vchsig;
71 
72   // Policy of mouse (GIW_TIMELINE_MOUSE_DISABLED, GIW_TIMELINE_MOUSE_AUTOMATIC, GIW_TIMELINE_MOUSE_DELAYED)
73   gint mouse_policy;
74 
75   GList           *track_widgets;
76 };
77 
78 struct _GiwTimelineClass {
79   GtkScaleClass  parent_class;
80 };
81 
82 GType       giw_timeline_get_type(void) G_GNUC_CONST;
83 GtkWidget *giw_timeline_new(GtkOrientation  orientation, GtkAdjustment *adjustment);
84 GtkWidget *giw_timeline_new_with_adjustment(GtkOrientation orientation, gdouble value, gdouble lower, gdouble upper,
85     gdouble max_size);
86 void        giw_timeline_add_track_widget(GiwTimeline      *timeline,
87     GtkWidget      *widget);
88 void        giw_timeline_remove_track_widget(GiwTimeline      *timeline,
89     GtkWidget      *widget);
90 void        giw_timeline_set_max_size(GiwTimeline      *timeline,
91                                       gdouble         max_size);
92 gdouble     giw_timeline_get_max_size(GiwTimeline    *timeline);
93 void        giw_timeline_set_unit(GiwTimeline    *timeline,
94                                   GiwTimeUnit    unit);
95 GiwTimeUnit giw_timeline_get_unit(GiwTimeline    *timeline);
96 
97 void           giw_timeline_set_value(GiwTimeline *timeline, gdouble value);
98 gdouble        giw_timeline_get_value(GiwTimeline *timeline);
99 GtkAdjustment *giw_timeline_get_adjustment(GiwTimeline *timeline);
100 void           giw_timeline_set_adjustment(GiwTimeline *timeline, GtkAdjustment *adjustment);
101 void giw_timeline_set_range(GiwTimeline *timeline, gdouble lower, gdouble upper, gdouble max_size);
102 void           giw_timeline_set_mouse_policy(GiwTimeline *timeline, GiwTimelineMousePolicy policy);
103 
104 G_END_DECLS
105 
106 #endif /* __GIW_TIMELINE_H__ */
107