Fl_Blink_Button: Don't add a new timer if one already exists.

This commit is contained in:
Jonathan Moore Liles 2013-03-12 17:56:43 -07:00
parent b075c82dbd
commit 551ace4547
1 changed files with 11 additions and 5 deletions

View File

@ -118,25 +118,31 @@ public:
virtual void value ( float v )
{
if ( v != value() )
bool b = v;
if ( b != value() )
{
if ( v )
if ( b )
{
if ( _blinking )
{
/* just to be safe.. */
Fl::remove_timeout( update_cb, this );
Fl::add_timeout( blink_interval_as_fraction_of_seceond(), update_cb, this );
Fl_Button::value( v );
}
Fl_Button::value( b );
redraw();
}
else
{
Fl_Button::value( v );
Fl_Button::value( b );
Fl::remove_timeout( update_cb, this );
redraw();
}
}
}
virtual float value ( void ) { return Fl_Button::value(); }
virtual float value ( void ) { return (bool)Fl_Button::value(); }
virtual void
draw ( void )