]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/button.cpp
Add protected functions for manipulating widget state
[libs/gltk.git] / source / button.cpp
index fb052629d626c7eae2ae9f22cc93d4cc94f87311..5f9b18bfdf3290a830d4bc392b126d0be3649a19 100644 (file)
@@ -85,7 +85,7 @@ void Button::button_press(int, int, unsigned btn)
        if(btn==1)
        {
                pressed = true;
-               state |= ACTIVE;
+               set_state(ACTIVE);
        }
 }
 
@@ -93,7 +93,7 @@ void Button::button_release(int x, int y, unsigned btn)
 {
        if(pressed && btn==1)
        {
-               state &= ~ACTIVE;
+               clear_state(ACTIVE);
                pressed = false;
 
                if(geom.is_inside_relative(x, y))
@@ -106,9 +106,9 @@ void Button::pointer_motion(int x, int y)
        if(pressed)
        {
                if(!geom.is_inside_relative(x, y))
-                       state &= ~ACTIVE;
+                       clear_state(ACTIVE);
                else
-                       state |= ACTIVE;
+                       set_state(ACTIVE);
        }
 }