# Path: pyglet_gui/manager.py
# class Manager(ViewerManager, ControllerManager):
#     def __init__(self,
#                  content,
#                  theme,
#                  window=None,
#                  batch=None,
#                  group=None,
#                  is_movable=True,
#                  anchor=ANCHOR_CENTER,
#                  offset=(0, 0)):
#         ControllerManager.__init__(self)
#         ViewerManager.__init__(self, content, theme, window, batch, group, anchor, offset)
# 
#         self.is_movable = is_movable
#         self._is_dragging = False
# 
#     def hit_test(self, x, y):
#         return self.is_inside(x, y)
# 
#     def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
#         if not ControllerManager.on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
#             if self.is_movable and self._is_dragging:
#                 x, y = self._offset
#                 self._offset = (int(x + dx), int(y + dy))
#                 self.set_position(*self.get_position())
#                 return True
# 
#     def on_mouse_motion(self, x, y, dx, dy):
#         ControllerManager.on_mouse_motion(self, x, y, dx, dy)
#         if self.hit_test(x, y):
#             if not self._root_group.is_on_top():
#                 self.pop_to_top()
#             return True
# 
#     def on_mouse_press(self, x, y, button, modifiers):
#         retval = ControllerManager.on_mouse_press(self, x, y, button, modifiers)
#         if self.hit_test(x, y):
#             if not retval:
#                 self._is_dragging = True
#                 retval = True
#         return retval
# 
#     def on_mouse_release(self, x, y, button, modifiers):
#         self._is_dragging = False
#         return ControllerManager.on_mouse_release(self, x, y, button, modifiers)
# 
#     def on_resize(self, width, height):
#         """
#         Update our knowledge of the window's width and height.
#         """
#         if self.screen.width != width or self.screen.height != height:
#             self.screen.width, self.screen.height = width, height
#             self.set_position(*self.get_position())
# 
#     def delete(self):
#         ViewerManager.delete(self)
#         ControllerManager.delete(self)
# 
# Path: pyglet_gui/option_selectors.py
# class VerticalButtonSelector(VerticalContainer, Selector):
#     def __init__(self, options, labels=None, align=HALIGN_CENTER, padding=4, on_select=None):
#         Selector.__init__(self, options, labels, on_select)
#         VerticalContainer.__init__(self, list(self._options.values()), align=align, padding=padding)
# 
#     def _make_options(self, options, labels):
#         widget_options = []
#         for option, label in zip(options, labels):
#             widget_options.append(OptionButton(option, label, is_selected=(option == self._selected), parent=self))
#         return widget_options
# 
# Path: pyglet_gui/theme/theme.py
# class Theme(ScopedDict):
#     """
#     A theme is a scoped dictionary that
#     maps specific keys to specific templates.
#     It is initialized by a dictionary (json-like) and by a resource path.
#     It maps resources in the dictionary to resources in the path,
#     initializing the correct template accordingly.
#     """
#     def __init__(self, dictionary, resources_path):
#         ScopedDict.__init__(self, dictionary, None)
# 
#         self._parsers = [TextureParser(resources_path)]
# 
#         self.build(self, dictionary)
# 
#     def update(self, E=None, **F):
#         super(Theme, self).update(E, **F)
#         self.build(self, E)
# 
#     def build_element(self, key, value, target):
# 
#         for parser in self._parsers:
#             if parser.condition_fulfilled(key):
#                 target[key] = parser.parse_element(value)
#                 # we only parse one element by parser.
#                 # if it is parsed, we are done.
#                 return
# 
#         # if value is a non-parsed dict, we add a new depth
#         # and build against the new depth.
#         if isinstance(value, dict):
#             target[key] = ScopedDict(parent=target)
#             self.build(target[key], value)
#         else:
#             target[key] = value
# 
#     def build(self, target, input_dict):
#         """
#         The main function of theme. Called during initialization,
#         it crawls the input_dict and populates
#         'target' with templates built from the dict.
#         """
#         for key, value in input_dict.items():
#             self.build_element(key, value, target)


from setup import *
from pyglet_gui.manager import Manager
from pyglet_gui.option_selectors import VerticalButtonSelector
from pyglet_gui.theme import Theme


theme = Theme({"font": "Lucida Grande",
               "font_size": 12,
               "text_color": [255, 255, 255, 255],
               "gui_color": [255, 0, 0, 255],
               "button": {
                   "down": {
                       "image": {
                           "source": "button-down.png",
                           "frame": [8, 6, 2, 2],
                           "padding": [18, 18, 8, 6]
                       },

# Path: pyglet_gui/manager.py
# class Manager(ViewerManager, ControllerManager):
#     def __init__(self,
#                  content,
#                  theme,
#                  window=None,
#                  batch=None,
#                  group=None,
#                  is_movable=True,
#                  anchor=ANCHOR_CENTER,
#                  offset=(0, 0)):
#         ControllerManager.__init__(self)
#         ViewerManager.__init__(self, content, theme, window, batch, group, anchor, offset)
# 
#         self.is_movable = is_movable
#         self._is_dragging = False
# 
#     def hit_test(self, x, y):
#         return self.is_inside(x, y)
# 
#     def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
#         if not ControllerManager.on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
#             if self.is_movable and self._is_dragging:
#                 x, y = self._offset
#                 self._offset = (int(x + dx), int(y + dy))
#                 self.set_position(*self.get_position())
#                 return True
# 
#     def on_mouse_motion(self, x, y, dx, dy):
#         ControllerManager.on_mouse_motion(self, x, y, dx, dy)
#         if self.hit_test(x, y):
#             if not self._root_group.is_on_top():
#                 self.pop_to_top()
#             return True
# 
#     def on_mouse_press(self, x, y, button, modifiers):
#         retval = ControllerManager.on_mouse_press(self, x, y, button, modifiers)
#         if self.hit_test(x, y):
#             if not retval:
#                 self._is_dragging = True
#                 retval = True
#         return retval
# 
#     def on_mouse_release(self, x, y, button, modifiers):
#         self._is_dragging = False
#         return ControllerManager.on_mouse_release(self, x, y, button, modifiers)
# 
#     def on_resize(self, width, height):
#         """
#         Update our knowledge of the window's width and height.
#         """
#         if self.screen.width != width or self.screen.height != height:
#             self.screen.width, self.screen.height = width, height
#             self.set_position(*self.get_position())
# 
#     def delete(self):
#         ViewerManager.delete(self)
#         ControllerManager.delete(self)
# 
# Path: pyglet_gui/option_selectors.py
# class VerticalButtonSelector(VerticalContainer, Selector):
#     def __init__(self, options, labels=None, align=HALIGN_CENTER, padding=4, on_select=None):
#         Selector.__init__(self, options, labels, on_select)
#         VerticalContainer.__init__(self, list(self._options.values()), align=align, padding=padding)
# 
#     def _make_options(self, options, labels):
#         widget_options = []
#         for option, label in zip(options, labels):
#             widget_options.append(OptionButton(option, label, is_selected=(option == self._selected), parent=self))
#         return widget_options
# 
# Path: pyglet_gui/theme/theme.py
# class Theme(ScopedDict):
#     """
#     A theme is a scoped dictionary that
#     maps specific keys to specific templates.
#     It is initialized by a dictionary (json-like) and by a resource path.
#     It maps resources in the dictionary to resources in the path,
#     initializing the correct template accordingly.
#     """
#     def __init__(self, dictionary, resources_path):
#         ScopedDict.__init__(self, dictionary, None)
# 
#         self._parsers = [TextureParser(resources_path)]
# 
#         self.build(self, dictionary)
# 
#     def update(self, E=None, **F):
#         super(Theme, self).update(E, **F)
#         self.build(self, E)
# 
#     def build_element(self, key, value, target):
# 
#         for parser in self._parsers:
#             if parser.condition_fulfilled(key):
#                 target[key] = parser.parse_element(value)
#                 # we only parse one element by parser.
#                 # if it is parsed, we are done.
#                 return
# 
#         # if value is a non-parsed dict, we add a new depth
#         # and build against the new depth.
#         if isinstance(value, dict):
#             target[key] = ScopedDict(parent=target)
#             self.build(target[key], value)
#         else:
#             target[key] = value
# 
#     def build(self, target, input_dict):
#         """
#         The main function of theme. Called during initialization,
#         it crawls the input_dict and populates
#         'target' with templates built from the dict.
#         """
#         for key, value in input_dict.items():
#             self.build_element(key, value, target)


# Path: examples/option_selector.py
from setup import *
from pyglet_gui.manager import Manager
from pyglet_gui.option_selectors import VerticalButtonSelector
from pyglet_gui.theme import Theme



theme = Theme({"font": "Lucida Grande",
               "font_size": 12,
               "text_color": [255, 255, 255, 255],
               "gui_color": [255, 0, 0, 255],
               "button": {
                   "down": {
                       "image": {
                           "source": "button-down.png",
                           "frame": [8, 6, 2, 2],
                           "padding": [18, 18, 8, 6]
                       },

                       "text_color": [0, 0, 0, 255]