]> 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 da2c433b9d24cfc2fb3110c2e567ec6950262470..5f9b18bfdf3290a830d4bc392b126d0be3649a19 100644 (file)
@@ -1,10 +1,3 @@
-/* $Id$
-
-This file is part of libmspgltk
-Copyright © 2007-2011  Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
 #include <msp/gl/immediate.h>
 #include "button.h"
 #include "part.h"
@@ -92,7 +85,7 @@ void Button::button_press(int, int, unsigned btn)
        if(btn==1)
        {
                pressed = true;
-               state |= ACTIVE;
+               set_state(ACTIVE);
        }
 }
 
@@ -100,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))
@@ -113,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);
        }
 }