aboutsummaryrefslogtreecommitdiff
path: root/checkbutton.c
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2007-11-24 17:39:44 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2007-11-24 17:39:44 +0000
commit4a31b8161144bfc677d950ed27f706a33211ef5b (patch)
tree8181fc0d2b921e33f15b81807faa525c9328a3aa /checkbutton.c
parentd334e8fd711b32194a4442b846a21fcffa046012 (diff)
added [set( and [options( methods, but still have to figure out how to deal with 'offvalue/onvalue' properly
svn path=/trunk/externals/tkwidgets/; revision=9035
Diffstat (limited to 'checkbutton.c')
-rw-r--r--checkbutton.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/checkbutton.c b/checkbutton.c
index 05487a7..52e437a 100644
--- a/checkbutton.c
+++ b/checkbutton.c
@@ -105,6 +105,7 @@ static char *checkbutton_tk_options[] = {
/* -------------------- function prototypes --------------------------------- */
static void checkbutton_query_callback(t_checkbutton *x, t_symbol *s, int argc, t_atom *argv);
+static void checkbutton_set(t_checkbutton* x, t_float f);
/* -------------------- widget helper functions------------------------------ */
@@ -286,14 +287,26 @@ static void checkbutton_bang_output(t_checkbutton* x)
* fuction above */
static void checkbutton_float_output(t_checkbutton* x, t_float f)
{
- /* TODO figure out which matches make sense, in terms of offvalue/onvalue */
- sys_vgui("if {%g != 0} {%s select} else {%s deselect}\n",
- f, x->widget_id->s_name, x->widget_id->s_name, x->widget_id->s_name);
+ checkbutton_set(x, f);
outlet_float(x->x_data_outlet, f);
}
/* --------------------------- methods for pd space ------------------------- */
+static void checkbutton_options(t_checkbutton *x)
+{
+ tkwidgets_list_options(x->x_status_outlet,
+ sizeof(checkbutton_tk_options)/sizeof(char *),
+ (char **)&checkbutton_tk_options);
+}
+
+static void checkbutton_set(t_checkbutton* x, t_float f)
+{
+ /* TODO figure out which matches make sense, in terms of offvalue/onvalue */
+ sys_vgui("if {%g != 0} {%s select} else {%s deselect}\n",
+ f, x->widget_id->s_name, x->widget_id->s_name, x->widget_id->s_name);
+}
+
static void checkbutton_size(t_checkbutton *x, t_float width, t_float height)
{
DEBUG(post("checkbutton_size"););
@@ -421,8 +434,12 @@ void checkbutton_setup(void)
class_addfloat(checkbutton_class, (t_method)checkbutton_float_output);
/* methods for pd space */
+ class_addmethod(checkbutton_class, (t_method)checkbutton_options,
+ gensym("options"), 0);
class_addmethod(checkbutton_class, (t_method)checkbutton_query,
gensym("query"), A_DEFSYMBOL, 0);
+ class_addmethod(checkbutton_class, (t_method)checkbutton_set,
+ gensym("set"), A_DEFFLOAT, 0);
class_addmethod(checkbutton_class, (t_method)checkbutton_size,
gensym("size"), A_DEFFLOAT, A_DEFFLOAT, 0);