]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/button.cpp
Jump 10 steps when slider trough is clicked
[libs/gltk.git] / source / button.cpp
index 3661c0148a0f56f61d35e85ad08de4074e3a4f4b..f6cf56c1f07ecbd8b0fa41a7b49e13d269b50156 100644 (file)
@@ -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