File: Fl_Osc_Button.cpp

package info (click to toggle)
zynaddsubfx 3.0.6-7.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 65,848 kB
  • sloc: cpp: 124,436; ansic: 39,936; objc: 2,496; makefile: 1,369; python: 567; sh: 566; ruby: 178; javascript: 50
file content (43 lines) | stat: -rw-r--r-- 880 bytes parent folder | download | duplicates (6)
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
#include "Fl_Osc_Button.H"
#include "Fl_Osc_Interface.H"
#include "Fl_Osc_Pane.H"
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <sstream>

Fl_Osc_Button::Fl_Osc_Button(int X, int Y, int W, int H, const char *n,
        const char *m)
    :Fl_Button(X,Y,W,H), Fl_Osc_Widget(n,m)
{
    label(n);
    callback(Fl_Osc_Button::_cb);

    Fl_Osc_Pane *pane = dynamic_cast<Fl_Osc_Pane*>(parent());
    assert(pane);
    osc = pane->osc;
    assert(osc);
    osc->createLink(full_path, this);
    osc->requestValue(full_path);
}

Fl_Osc_Button::~Fl_Osc_Button(void)
{
    osc->removeLink(full_path, this);
}

void Fl_Osc_Button::OSC_value(bool v)
{
    Fl_Button::value(v);
}

void Fl_Osc_Button::cb(void)
{
    osc->writeValue(full_path, (bool) value());
}

void Fl_Osc_Button::_cb(Fl_Widget *w, void *)
{
    static_cast<Fl_Osc_Button*>(w)->cb();
}