summaryrefslogtreecommitdiff
path: root/test/fast_slow.C
blob: 42fdff13514bc61af6512d7d669a64a95b04dfbd (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
// generated by Fast Light User Interface Designer (fluid) version 0.99

#include "fast_slow.H"

Fl_Slider *control;

static void cb_control(Fl_Slider* o, void*) {
  fast->value(o->value());
if (!Fl::pushed()) slow->value(o->value());
}

Fl_Slider *fast;

Fl_Slider *slow;

int main(int argc, char **argv) {
  Fl_Window *w;
  { Fl_Window* o = new Fl_Window(318, 443);
    w = o;
    Fl_Group::current()->resizable(o);
    { Fl_Slider* o = new Fl_Slider(90, 200, 30, 200, "move\nthis");
      control = o;
      o->callback((Fl_Callback*)cb_control);
      o->when(FL_WHEN_CHANGED|FL_WHEN_RELEASE|FL_WHEN_NOT_CHANGED);
    }
    { Fl_Slider* o = new Fl_Slider(140, 200, 30, 200, "fast\nredraw");
      fast = o;
      o->set_output();
    }
    { Fl_Slider* o = new Fl_Slider(190, 200, 30, 200, "slow\nredraw");
      slow = o;
      o->set_output();
    }
    { Fl_Box* o = new Fl_Box(10, 10, 300, 180, "The left slider has changed( FL_WHEN_CHANGED | FL_WHEN_RELEASE | FL_WHEN_N\
OT_CHANGED) so it produces a callback on both drag and release mouse events\
.\nThe middle slider (representing a widget with low overhead) is changed o\
n every mouse movement.\nThe right slider (representing a widget with high \
overhead) is only updated when the mouse is released, by checking if Fl::pu\
shed() is zero.");
      o->box(FL_DOWN_BOX);
      o->color(53);
      o->labelfont(4);
      o->labelsize(12);
      o->align(148);
    }
    w->end();
  }
  w->show(argc, argv);
  return Fl::run();
}