2 * A few useful widgets - a line graph, a knob, a VU meter - Panama!
4 * Copyright (C) 2008 Krzysztof Foltman
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (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 GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General
17 * Public License along with this program; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
19 * Boston, MA 02111-1307, USA.
21 #ifndef __CALF_CUSTOM_CTL
22 #define __CALF_CUSTOM_CTL
25 #include <calf/giface.h>
29 #define CALF_TYPE_LINE_GRAPH (calf_line_graph_get_type())
30 #define CALF_LINE_GRAPH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALF_TYPE_LINE_GRAPH, CalfLineGraph))
31 #define CALF_IS_LINE_GRAPH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALF_TYPE_LINE_GRAPH))
32 #define CALF_LINE_GRAPH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALF_TYPE_LINE_GRAPH, CalfLineGraphClass))
33 #define CALF_IS_LINE_GRAPH_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALF_TYPE_LINE_GRAPH))
34 #define CALF_LINE_GRAPH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALF_TYPE_LINE_GRAPH, CalfLineGraphClass))
38 GtkDrawingArea parent
;
39 calf_plugins::line_graph_iface
*source
;
42 cairo_surface_t
*cache_surface
;
43 //GdkPixmap *cache_pixmap;
47 struct CalfLineGraphClass
49 GtkDrawingAreaClass parent_class
;
52 extern GtkWidget
*calf_line_graph_new();
54 extern GType
calf_line_graph_get_type();
56 extern void calf_line_graph_set_square(CalfLineGraph
*graph
, bool is_square
);
58 extern int calf_line_graph_update_if(CalfLineGraph
*graph
, int generation
);
60 #define CALF_TYPE_VUMETER (calf_vumeter_get_type())
61 #define CALF_VUMETER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALF_TYPE_VUMETER, CalfVUMeter))
62 #define CALF_IS_VUMETER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALF_TYPE_VUMETER))
63 #define CALF_VUMETER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALF_TYPE_VUMETER, CalfVUMeterClass))
64 #define CALF_IS_VUMETER_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALF_TYPE_VUMETER))
65 #define CALF_VUMETER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALF_TYPE_VUMETER, CalfVUMeterClass))
76 GtkDrawingArea parent
;
79 cairo_surface_t
*cache_surface
;
82 struct CalfVUMeterClass
84 GtkDrawingAreaClass parent_class
;
87 extern GtkWidget
*calf_vumeter_new();
88 extern GType
calf_vumeter_get_type();
89 extern void calf_vumeter_set_value(CalfVUMeter
*meter
, float value
);
90 extern float calf_vumeter_get_value(CalfVUMeter
*meter
);
91 extern void calf_vumeter_set_mode(CalfVUMeter
*meter
, CalfVUMeterMode mode
);
92 extern CalfVUMeterMode
calf_vumeter_get_mode(CalfVUMeter
*meter
);
94 #define CALF_TYPE_KNOB (calf_knob_get_type())
95 #define CALF_KNOB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALF_TYPE_KNOB, CalfKnob))
96 #define CALF_IS_KNOB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALF_TYPE_KNOB))
97 #define CALF_KNOB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALF_TYPE_KNOB, CalfKnobClass))
98 #define CALF_IS_KNOB_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALF_TYPE_KNOB))
104 double start_x
, start_y
, start_value
, last_y
;
109 GtkRangeClass parent_class
;
110 GdkPixbuf
*knob_image
;
113 extern GtkWidget
*calf_knob_new();
114 extern GtkWidget
*calf_knob_new_with_adjustment(GtkAdjustment
*_adjustment
);
116 extern GType
calf_knob_get_type();
120 class cairo_impl
: public calf_plugins::cairo_iface
124 virtual void set_source_rgba(float r
, float g
, float b
, float a
= 1.f
) { cairo_set_source_rgba(context
, r
, g
, b
, a
); }
125 virtual void set_line_width(float width
) { cairo_set_line_width(context
, width
); }