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 void calf_line_graph_update_if(CalfLineGraph
*graph
);
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))
75 GtkDrawingArea parent
;
80 struct CalfVUMeterClass
82 GtkDrawingAreaClass parent_class
;
85 extern GtkWidget
*calf_vumeter_new();
86 extern GType
calf_vumeter_get_type();
87 extern void calf_vumeter_set_value(CalfVUMeter
*meter
, float value
);
88 extern float calf_vumeter_get_value(CalfVUMeter
*meter
);
89 extern void calf_vumeter_set_mode(CalfVUMeter
*meter
, CalfVUMeterMode mode
);
90 extern CalfVUMeterMode
calf_vumeter_get_mode(CalfVUMeter
*meter
);
92 #define CALF_TYPE_KNOB (calf_knob_get_type())
93 #define CALF_KNOB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALF_TYPE_KNOB, CalfKnob))
94 #define CALF_IS_KNOB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALF_TYPE_KNOB))
95 #define CALF_KNOB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALF_TYPE_KNOB, CalfKnobClass))
96 #define CALF_IS_KNOB_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALF_TYPE_KNOB))
102 double start_x
, start_y
, start_value
, last_y
;
107 GtkRangeClass parent_class
;
108 GdkPixbuf
*knob_image
;
111 extern GtkWidget
*calf_knob_new();
112 extern GtkWidget
*calf_knob_new_with_adjustment(GtkAdjustment
*_adjustment
);
114 extern GType
calf_knob_get_type();
118 class cairo_impl
: public calf_plugins::cairo_iface
122 virtual void set_source_rgba(float r
, float g
, float b
, float a
= 1.f
) { cairo_set_source_rgba(context
, r
, g
, b
, a
); }
123 virtual void set_line_width(float width
) { cairo_set_line_width(context
, width
); }