51 lines
1.5 KiB
C++
51 lines
1.5 KiB
C++
|
// 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();
|
||
|
}
|