# Path: pyglet_gui/controllers.py
# 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 Viewer(Rectangle, Managed):
#     def __init__(self, width=0, height=0):
#         super(Managed, self).__init__()
#         self._parent = None
#         self._is_loaded = False
# 
#         Rectangle.__init__(self, 0, 0, width, height)
# 
#     @property
#     def parent(self):
#         return self._parent
# 
#     @parent.setter
#     def parent(self, widget):
#         self._parent = widget
# 
#     @property
#     def is_loaded(self):
#         return self._is_loaded
# 
#     def is_expandable(self):
#         return False
# 
#     def set_position(self, x, y):
#         super(Viewer, self).set_position(x, y)
#         self.layout()
# 
#     def get_path(self):
#         raise NotImplementedError
# 
#     def load(self):
#         assert not self._is_loaded
#         self._is_loaded = True
#         self.load_graphics()
# 
#     def unload(self):
#         assert self._is_loaded
#         self._is_loaded = False
#         self.unload_graphics()
# 
#     def reload(self):
#         self.unload()
#         self.load()
# 
#     def load_graphics(self):
#         pass
# 
#     def unload_graphics(self):
#         pass
# 
#     def layout(self):
#         pass
# 
#     def compute_size(self):
#         return self.width, self.height
# 
#     def reset_size(self, reset_parent=True):
#         width, height = self.compute_size()
# 
#         # if out size changes
#         if self.width != width or self.height != height:
#             self.width, self.height = width, height
# 
#             # This will eventually call our layout
#             if reset_parent:
#                 self.parent.reset_size(reset_parent)
#         # else, the parent is never affected and thus we layout.
#         else:
#             self.layout()
# 
#     def delete(self):
#         if self.is_loaded:
#             self.unload()
#         self.parent = None
#         Managed.delete(self)


from pyglet_gui.controllers import ContinuousStateController
from pyglet_gui.core import Viewer


class Slider(ContinuousStateController, Viewer):
    PATH = 'slider'
    IMAGE_BAR = 'bar'
    IMAGE_KNOB = 'knob'
    IMAGE_STEP = 'step'

    def __init__(self, value=0.0, min_value=0.0, max_value=1.0, on_set=None, steps=None, width=0, height=0):
        ContinuousStateController.__init__(self, value=value,
                                           min_value=min_value,
                                           max_value=max_value,
                                           on_set=on_set)

# Path: pyglet_gui/controllers.py
# 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 Viewer(Rectangle, Managed):
#     def __init__(self, width=0, height=0):
#         super(Managed, self).__init__()
#         self._parent = None
#         self._is_loaded = False
# 
#         Rectangle.__init__(self, 0, 0, width, height)
# 
#     @property
#     def parent(self):
#         return self._parent
# 
#     @parent.setter
#     def parent(self, widget):
#         self._parent = widget
# 
#     @property
#     def is_loaded(self):
#         return self._is_loaded
# 
#     def is_expandable(self):
#         return False
# 
#     def set_position(self, x, y):
#         super(Viewer, self).set_position(x, y)
#         self.layout()
# 
#     def get_path(self):
#         raise NotImplementedError
# 
#     def load(self):
#         assert not self._is_loaded
#         self._is_loaded = True
#         self.load_graphics()
# 
#     def unload(self):
#         assert self._is_loaded
#         self._is_loaded = False
#         self.unload_graphics()
# 
#     def reload(self):
#         self.unload()
#         self.load()
# 
#     def load_graphics(self):
#         pass
# 
#     def unload_graphics(self):
#         pass
# 
#     def layout(self):
#         pass
# 
#     def compute_size(self):
#         return self.width, self.height
# 
#     def reset_size(self, reset_parent=True):
#         width, height = self.compute_size()
# 
#         # if out size changes
#         if self.width != width or self.height != height:
#             self.width, self.height = width, height
# 
#             # This will eventually call our layout
#             if reset_parent:
#                 self.parent.reset_size(reset_parent)
#         # else, the parent is never affected and thus we layout.
#         else:
#             self.layout()
# 
#     def delete(self):
#         if self.is_loaded:
#             self.unload()
#         self.parent = None
#         Managed.delete(self)


# Path: pyglet_gui/sliders.py
from pyglet_gui.controllers import ContinuousStateController
from pyglet_gui.core import Viewer



class Slider(ContinuousStateController, Viewer):
    PATH = 'slider'
    IMAGE_BAR = 'bar'
    IMAGE_KNOB = 'knob'
    IMAGE_STEP = 'step'

    def __init__(self, value=0.0, min_value=0.0, max_value=1.0, on_set=None, steps=None, width=0, height=0):
        ContinuousStateController.__init__(self, value=value,
                                           min_value=min_value,
                                           max_value=max_value,
                                           on_set=on_set)

        Viewer.__init__(self, width, height)