# Path: pyglet_gui/core.py
# class Controller(Managed):
#     def __init__(self):
#         Managed.__init__(self)
# 
#     def set_manager(self, manager):
#         Managed.set_manager(self, manager)
#         manager.add_controller(self)
# 
#     def delete(self):
#         self._manager.remove_controller(self)
#         super(Controller, self).delete()


from collections import OrderedDict
from pyglet_gui.core import Controller
    def change_state(self):
        self._is_pressed = not self._is_pressed
        self._on_press(self._is_pressed)


class ContinuousStateController(Controller):
    def __init__(self, value=0.0, min_value=0.0, max_value=1.0, on_set=None):
        assert min_value <= value <= max_value
        Controller.__init__(self)

        self._min_value = min_value
        self._max_value = max_value
        self._value = value

        # a callback when the value is set.
        if on_set is None:
            self._on_set = lambda x: x
        else:
            self._on_set = on_set

    def set_value(self, value):
        assert self._min_value <= value <= self._max_value
        self._value = value
        self._on_set(value)

    @property
    def value(self):
        return self._value



# Path: pyglet_gui/core.py
# class Controller(Managed):
#     def __init__(self):
#         Managed.__init__(self)
# 
#     def set_manager(self, manager):
#         Managed.set_manager(self, manager)
#         manager.add_controller(self)
# 
#     def delete(self):
#         self._manager.remove_controller(self)
#         super(Controller, self).delete()


# Path: pyglet_gui/controllers.py
from collections import OrderedDict
from pyglet_gui.core import Controller

    def change_state(self):
        self._is_pressed = not self._is_pressed
        self._on_press(self._is_pressed)


class ContinuousStateController(Controller):
    def __init__(self, value=0.0, min_value=0.0, max_value=1.0, on_set=None):
        assert min_value <= value <= max_value
        Controller.__init__(self)

        self._min_value = min_value
        self._max_value = max_value
        self._value = value

        # a callback when the value is set.
        if on_set is None:
            self._on_set = lambda x: x
        else:
            self._on_set = on_set

    def set_value(self, value):
        assert self._min_value <= value <= self._max_value
        self._value = value
        self._on_set(value)

    @property
    def value(self):
        return self._value



class Option(Controller):