# Path: pyglet_gui/scrollbars.py
# class VScrollbar(ScrollBar):
#     PATH = 'vscrollbar'
# 
#     def __init__(self, height):
#         ScrollBar.__init__(self, width=0, height=height)
# 
#     def _get_knob_region(self):
#         top = self.y + self.height
#         return (self.x, int(top - (self._knob_pos() + self._knob_size/2) * self.height),
#                 self.width, int(self._knob_size * self.height))
# 
#     def get_knob_pos(self):
#         # we remove half the knob size to pick the center of the knob.
#         # height/_knob_size = max_height by "set_knob_size()".
#         return int((self._knob_pos() - self._knob_size/2) * self.height/self._knob_size)
# 
#     def load_graphics(self):
#         super(VScrollbar, self).load_graphics()
#         self.width = self._bar.width
# 
#     def on_mouse_drag(self, x, y, dx, dy, button, modifiers):
#         bar_x, bar_y, bar_width, bar_height = self._bar.get_content_region()
# 
#         absolute_distance = float(y - bar_y)
#         relative_distance = absolute_distance/bar_height
#         self.set_knob_pos(1 - relative_distance)
#         self._scrolled = 10
#         self.re_layout()
#         return True
# 
#     def on_mouse_scroll(self, x, y, scroll_x, scroll_y):
#         self._scrolled += abs(scroll_y)
#         self.set_knob_pos(self._knob_pos() + float(scroll_y) / self.height)
#         self.re_layout()
#         return True
# 
#     def set_knob_size(self, height, max_height):
#         self._knob_size = float(height)/max_height
# 
#         # update the knob position given the new knob size.
#         self.set_knob_pos(self._knob_pos())
# 
#     def compute_size(self):
#         return self._bar.width, self.height
# 
# 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)
# 
# class Rectangle(object):
#     def __init__(self, x=0, y=0, width=0, height=0):
#         self._x = x
#         self._y = y
#         self.width = width
#         self.height = height
# 
#     @property
#     def x(self):
#         return self._x
# 
#     @property
#     def y(self):
#         return self._y
# 
#     @x.setter
#     def x(self, value):
#         self._x = value
# 
#     @y.setter
#     def y(self, value):
#         self._y = value
# 
#     def set_position(self, x, y):
#         self._x = x
#         self._y = y
# 
#     def is_inside(self, x, y):
#         return self.x <= x < self.x + self.width and self.y <= y < self.y + self.height
# 
# Path: pyglet_gui/controllers.py
# class TwoStateController(Controller):
# class ContinuousStateController(Controller):
# class Option(Controller):
# class Selector:
#     def __init__(self, is_pressed=False, on_press=None):
#     def is_pressed(self):
#     def change_state(self):
#     def __init__(self, value=0.0, min_value=0.0, max_value=1.0, on_set=None):
#     def set_value(self, value):
#     def value(self):
#     def __init__(self, name, parent):
#     def select(self):
#     def __init__(self, options, labels=None, on_select=None, selected=None):
#     def _make_options(self, options, labels):
#     def select(self, option_name):
#     def deselect(self):


import pyglet
from pyglet_gui.scrollbars import VScrollbar
from pyglet_gui.core import Viewer, Rectangle
from pyglet_gui.controllers import Controller



class Document(Controller, Viewer):
    """
    Allows you to embed a document within the GUI, which includes a
    vertical scrollbar.
    """
    def __init__(self, document, width=0, height=0, is_fixed_size=False):
        Viewer.__init__(self, width, height)

# Path: pyglet_gui/scrollbars.py
# class VScrollbar(ScrollBar):
#     PATH = 'vscrollbar'
# 
#     def __init__(self, height):
#         ScrollBar.__init__(self, width=0, height=height)
# 
#     def _get_knob_region(self):
#         top = self.y + self.height
#         return (self.x, int(top - (self._knob_pos() + self._knob_size/2) * self.height),
#                 self.width, int(self._knob_size * self.height))
# 
#     def get_knob_pos(self):
#         # we remove half the knob size to pick the center of the knob.
#         # height/_knob_size = max_height by "set_knob_size()".
#         return int((self._knob_pos() - self._knob_size/2) * self.height/self._knob_size)
# 
#     def load_graphics(self):
#         super(VScrollbar, self).load_graphics()
#         self.width = self._bar.width
# 
#     def on_mouse_drag(self, x, y, dx, dy, button, modifiers):
#         bar_x, bar_y, bar_width, bar_height = self._bar.get_content_region()
# 
#         absolute_distance = float(y - bar_y)
#         relative_distance = absolute_distance/bar_height
#         self.set_knob_pos(1 - relative_distance)
#         self._scrolled = 10
#         self.re_layout()
#         return True
# 
#     def on_mouse_scroll(self, x, y, scroll_x, scroll_y):
#         self._scrolled += abs(scroll_y)
#         self.set_knob_pos(self._knob_pos() + float(scroll_y) / self.height)
#         self.re_layout()
#         return True
# 
#     def set_knob_size(self, height, max_height):
#         self._knob_size = float(height)/max_height
# 
#         # update the knob position given the new knob size.
#         self.set_knob_pos(self._knob_pos())
# 
#     def compute_size(self):
#         return self._bar.width, self.height
# 
# 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)
# 
# class Rectangle(object):
#     def __init__(self, x=0, y=0, width=0, height=0):
#         self._x = x
#         self._y = y
#         self.width = width
#         self.height = height
# 
#     @property
#     def x(self):
#         return self._x
# 
#     @property
#     def y(self):
#         return self._y
# 
#     @x.setter
#     def x(self, value):
#         self._x = value
# 
#     @y.setter
#     def y(self, value):
#         self._y = value
# 
#     def set_position(self, x, y):
#         self._x = x
#         self._y = y
# 
#     def is_inside(self, x, y):
#         return self.x <= x < self.x + self.width and self.y <= y < self.y + self.height
# 
# Path: pyglet_gui/controllers.py
# class TwoStateController(Controller):
# class ContinuousStateController(Controller):
# class Option(Controller):
# class Selector:
#     def __init__(self, is_pressed=False, on_press=None):
#     def is_pressed(self):
#     def change_state(self):
#     def __init__(self, value=0.0, min_value=0.0, max_value=1.0, on_set=None):
#     def set_value(self, value):
#     def value(self):
#     def __init__(self, name, parent):
#     def select(self):
#     def __init__(self, options, labels=None, on_select=None, selected=None):
#     def _make_options(self, options, labels):
#     def select(self, option_name):
#     def deselect(self):


# Path: pyglet_gui/document.py
import pyglet
from pyglet_gui.scrollbars import VScrollbar
from pyglet_gui.core import Viewer, Rectangle
from pyglet_gui.controllers import Controller




class Document(Controller, Viewer):
    """
    Allows you to embed a document within the GUI, which includes a
    vertical scrollbar.
    """
    def __init__(self, document, width=0, height=0, is_fixed_size=False):
        Viewer.__init__(self, width, height)

        Controller.__init__(self)