3 * Copyright (C) 2007 Krzysztof Foltman
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General
16 * Public License along with this program; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02111-1307, USA.
20 #ifndef __CALF_GUI_CONTROLS_H
21 #define __CALF_GUI_CONTROLS_H
29 namespace calf_plugins
{
31 /////////////////////////////////////////////////////////////////////////////////////////////
34 struct table_container
: public control_container
36 virtual GtkWidget
*create(plugin_gui
*_gui
, const char *element
, xml_attribute_map
&attributes
);
37 virtual void add(GtkWidget
*w
, control_base
*base
);
40 struct alignment_container
: public control_container
42 virtual GtkWidget
*create(plugin_gui
*_gui
, const char *element
, xml_attribute_map
&attributes
);
45 struct frame_container
: public control_container
47 virtual GtkWidget
*create(plugin_gui
*_gui
, const char *element
, xml_attribute_map
&attributes
);
50 struct box_container
: public control_container
52 virtual void add(GtkWidget
*w
, control_base
*base
);
55 struct vbox_container
: public box_container
57 virtual GtkWidget
*create(plugin_gui
*_gui
, const char *element
, xml_attribute_map
&attributes
);
60 struct hbox_container
: public box_container
62 virtual GtkWidget
*create(plugin_gui
*_gui
, const char *element
, xml_attribute_map
&attributes
);
65 struct scrolled_container
: public control_container
67 virtual void add(GtkWidget
*w
, control_base
*base
);
68 virtual GtkWidget
*create(plugin_gui
*_gui
, const char *element
, xml_attribute_map
&attributes
);
71 ////////////////////////////////////////////////////////////////////////////////////////////////////
74 struct notebook_param_control
: public param_control
77 virtual bool is_container() { return true; };
78 virtual GtkWidget
*create(plugin_gui
*_gui
, int _param_no
);
79 virtual void created();
80 virtual void add(GtkWidget
*w
, control_base
*base
);
83 static void notebook_page_changed(GtkWidget
*widget
, GtkWidget
*page
, guint id
, gpointer user
);
86 /// Display-only control: static text
87 struct label_param_control
: public param_control
89 virtual GtkWidget
*create(plugin_gui
*_gui
, int _param_no
);
94 /// Display-only control: value text
95 struct value_param_control
: public param_control
, public send_updates_iface
97 std::string old_value
;
99 virtual GtkWidget
*create(plugin_gui
*_gui
, int _param_no
);
100 virtual void get() {}
102 virtual void send_status(const char *key
, const char *value
);
105 /// Display-only control: volume meter
106 struct vumeter_param_control
: public param_control
108 virtual GtkWidget
*create(plugin_gui
*_gui
, int _param_no
);
109 virtual void get() {}
113 /// Display-only control: LED
114 struct led_param_control
: public param_control
116 virtual GtkWidget
*create(plugin_gui
*_gui
, int _param_no
);
117 virtual void get() {}
121 /// Display-only control: tube
122 struct tube_param_control
: public param_control
124 virtual GtkWidget
*create(plugin_gui
*_gui
, int _param_no
);
125 virtual void get() {}
129 /// Horizontal slider
130 struct hscale_param_control
: public param_control
132 virtual GtkWidget
*create(plugin_gui
*_gui
, int _param_no
);
135 virtual void init_xml(const char *element
);
136 static void hscale_value_changed(GtkHScale
*widget
, gpointer value
);
137 static gchar
*hscale_format_value(GtkScale
*widget
, double arg1
, gpointer value
);
141 struct vscale_param_control
: public param_control
143 virtual GtkWidget
*create(plugin_gui
*_gui
, int _param_no
);
146 virtual void init_xml(const char *element
);
147 static void vscale_value_changed(GtkHScale
*widget
, gpointer value
);
151 struct spin_param_control
: public param_control
153 virtual GtkWidget
*create(plugin_gui
*_gui
, int _param_no
);
156 static void value_changed(GtkSpinButton
*widget
, gpointer value
);
159 /// Check box (Markus Schmidt)
160 struct check_param_control
: public param_control
162 virtual GtkWidget
*create(plugin_gui
*_gui
, int _param_no
);
166 static void check_value_changed(GtkCheckButton
*widget
, gpointer value
);
170 struct toggle_param_control
: public param_control
172 virtual GtkWidget
*create(plugin_gui
*_gui
, int _param_no
);
176 static void toggle_value_changed(GtkWidget
*widget
, gpointer value
);
180 struct tap_button_param_control
: public param_control
183 unsigned long init_time
;
184 float avg_value
, value
;
185 virtual GtkWidget
*create(plugin_gui
*_gui
, int _param_no
);
188 static gboolean
tap_button_released(GtkWidget
*widget
, gpointer value
);
189 static gboolean
tap_button_pressed(GtkWidget
*widget
, GdkEventButton
*event
, gpointer value
);
193 struct radio_param_control
: public param_control
197 virtual GtkWidget
*create(plugin_gui
*_gui
, int _param_no
);
201 static void radio_clicked(GtkRadioButton
*widget
, gpointer value
);
205 struct button_param_control
: public param_control
207 virtual GtkWidget
*create(plugin_gui
*_gui
, int _param_no
);
210 static void button_clicked(GtkButton
*widget
, gpointer value
);
211 static void button_press_event(GtkButton
*widget
, GdkEvent
*event
, gpointer value
);
215 struct combo_box_param_control
: public param_control
, public send_updates_iface
217 GtkListStore
*lstore
;
218 std::map
<std::string
, GtkTreeIter
> key2pos
;
219 std::string last_key
;
221 virtual GtkWidget
*create(plugin_gui
*_gui
, int _param_no
);
224 virtual void send_status(const char *key
, const char *value
);
225 void set_to_last_key();
226 static void combo_value_changed(GtkComboBox
*widget
, gpointer value
);
230 struct line_graph_param_control
: public param_control
232 virtual GtkWidget
*create(plugin_gui
*_gui
, int _param_no
);
235 static void freqhandle_value_changed(GtkWidget
*widget
, gpointer p
);
236 virtual void on_idle();
237 virtual ~line_graph_param_control();
241 struct phase_graph_param_control
: public param_control
243 virtual GtkWidget
*create(plugin_gui
*_gui
, int _param_no
);
244 virtual void get() {}
246 virtual void on_idle();
247 virtual ~phase_graph_param_control();
251 struct knob_param_control
: public param_control
253 virtual GtkWidget
*create(plugin_gui
*_gui
, int _param_no
);
256 static void knob_value_changed(GtkWidget
*widget
, gpointer value
);
259 /// Static keyboard image
260 struct keyboard_param_control
: public param_control
264 virtual GtkWidget
*create(plugin_gui
*_gui
, int _param_no
);
265 virtual void get() {}
266 virtual void set() {}
270 struct curve_param_control
: public param_control
, public send_configure_iface
274 virtual GtkWidget
*create(plugin_gui
*_gui
, int _param_no
);
275 virtual void get() {}
276 virtual void set() {}
277 virtual void send_configure(const char *key
, const char *value
);
281 struct entry_param_control
: public param_control
, public send_configure_iface
285 virtual GtkWidget
*create(plugin_gui
*_gui
, int _param_no
);
286 virtual void get() {}
287 virtual void set() {}
288 virtual void send_configure(const char *key
, const char *value
);
289 static void entry_value_changed(GtkWidget
*widget
, gpointer value
);
292 /// File chooser button
293 struct filechooser_param_control
: public param_control
, public send_configure_iface
295 GtkFileChooserButton
*filechooser
;
297 virtual GtkWidget
*create(plugin_gui
*_gui
, int _param_no
);
298 virtual void get() {}
299 virtual void set() {}
300 virtual void send_configure(const char *key
, const char *value
);
301 static void filechooser_value_changed(GtkWidget
*widget
, gpointer value
);
304 /// List view used for variable-length tabular data
305 struct listview_param_control
: public param_control
, public send_configure_iface
308 GtkListStore
*lstore
;
309 const calf_plugins::table_metadata_iface
*tmif
;
311 std::vector
<GtkTreeIter
> positions
;
313 virtual GtkWidget
*create(plugin_gui
*_gui
, int _param_no
);
314 virtual void get() {}
315 virtual void set() {}
316 virtual void send_configure(const char *key
, const char *value
);
318 void set_rows(unsigned int needed_rows
);
319 static void on_edited(GtkCellRenderer
*renderer
, gchar
*path
, gchar
*new_text
, listview_param_control
*pThis
);
320 static void on_editing_canceled(GtkCellRenderer
*renderer
, listview_param_control
*pThis
);