]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/button.cpp
Change State into a bitmask to allow more fine-grained control of styles
[libs/gltk.git] / source / button.cpp
index 3661c0148a0f56f61d35e85ad08de4074e3a4f4b..20e0ed9241d616a36c2a1f154358931f8d92acf3 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,17 @@ 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()
 {
-       state=NORMAL;
+       Widget::pointer_leave();
+       state&=~ACTIVE;
 }
 
 void Button::render_special(const Part &part) const