aboutsummaryrefslogtreecommitdiff
path: root/gui/sliderh.c
blob: b83f9c794fbd55cf43b9456920d9a294f471dac4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <m_pd.h>
#include "g_canvas.h"
#include <ggee.h>

#ifdef NT
#pragma warning( disable : 4244 )
#pragma warning( disable : 4305 )
#endif

#include "fatom.h"

/* can we use the normal text save function ?? */

static t_class *sliderh_class;

static void sliderh_save(t_gobj *z, t_binbuf *b)
{

    t_fatom *x = (t_fatom *)z;

    binbuf_addv(b, "ssiisiii", gensym("#X"),gensym("obj"),
		x->x_obj.te_xpix, x->x_obj.te_ypix ,  
		gensym("sliderh"),x->x_max,x->x_min,x->x_width);
    binbuf_addv(b, ";");
}


static void *sliderh_new(t_floatarg max, t_floatarg min,t_floatarg h)
{
    t_fatom *x = (t_fatom *)pd_new(sliderh_class);
    x->x_type = gensym("hslider");
    return fatom_new(x,max,min,h);
}


t_widgetbehavior   sliderh_widgetbehavior = {
  w_getrectfn:  fatom_getrect,
  w_displacefn: fatom_displace,
  w_selectfn:   fatom_select,
  w_activatefn: fatom_activate,
  w_deletefn:   fatom_delete,
  w_visfn:      fatom_vis,
  w_savefn:    sliderh_save,
  w_clickfn:    NULL,
  w_propertiesfn: NULL,
}; 


void sliderh_setup() {
    sliderh_class = class_new(gensym("sliderh"), (t_newmethod)sliderh_new, 0,
				sizeof(t_fatom),0,A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0);

    fatom_setup_common(sliderh_class);
    class_setwidget(sliderh_class,&sliderh_widgetbehavior);
}