X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbutton.cpp;h=f6cf56c1f07ecbd8b0fa41a7b49e13d269b50156;hb=3db68f2604b657e79f1b2b317c19c41c2d5a985b;hp=3661c0148a0f56f61d35e85ad08de4074e3a4f4b;hpb=95210598ff214bbc8d05657aeffc4ce7801f211a;p=libs%2Fgltk.git diff --git a/source/button.cpp b/source/button.cpp index 3661c01..f6cf56c 100644 --- a/source/button.cpp +++ b/source/button.cpp @@ -29,7 +29,7 @@ void Button::button_press(int, int, unsigned btn) if(btn==1) { pressed=true; - state=ACTIVE; + state|=ACTIVE; } } @@ -38,25 +38,22 @@ void Button::button_release(int x, int y, unsigned btn) if(pressed && btn==1) { if(geom.is_inside_relative(x, y)) - { - state=HOVER; signal_clicked.emit(); - } - else - state=NORMAL; + state&=~ACTIVE; pressed=false; } } -void Button::pointer_enter() -{ - state=HOVER; -} - -void Button::pointer_leave() +void Button::pointer_motion(int x, int y) { - state=NORMAL; + if(pressed) + { + if(!geom.is_inside_relative(x, y)) + state&=~ACTIVE; + else + state|=ACTIVE; + } } void Button::render_special(const Part &part) const