# 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/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.core import Controller
from pyglet_gui.core import Viewer
        HighlightMixin.layout(self)

    def on_lose_highlight(self):
        self._highlight_flag = False
        HighlightMixin.unload_graphics(self)

    def is_highlighted(self):
        return self._highlight_flag

    def load_graphics(self):
        theme = self.theme[self.get_path()]
        if self._highlight is None and self._highlight_flag:
            self._highlight = theme['highlight']['image'].generate(theme['highlight_color'],
                                                                   **self.get_batch('highlight'))

    def unload_graphics(self):
        if self._highlight is not None:
            self._highlight.unload()
            self._highlight = None

    def layout(self):
        if self._highlight is not None:
            self._highlight.update(self.x, self.y, self.width, self.height)

    def delete(self):
        HighlightMixin.unload_graphics(self)


class FocusMixin(Controller, Viewer):
    def __init__(self):

# 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/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/mixins.py
from pyglet_gui.core import Controller
from pyglet_gui.core import Viewer

        HighlightMixin.layout(self)

    def on_lose_highlight(self):
        self._highlight_flag = False
        HighlightMixin.unload_graphics(self)

    def is_highlighted(self):
        return self._highlight_flag

    def load_graphics(self):
        theme = self.theme[self.get_path()]
        if self._highlight is None and self._highlight_flag:
            self._highlight = theme['highlight']['image'].generate(theme['highlight_color'],
                                                                   **self.get_batch('highlight'))

    def unload_graphics(self):
        if self._highlight is not None:
            self._highlight.unload()
            self._highlight = None

    def layout(self):
        if self._highlight is not None:
            self._highlight.update(self.x, self.y, self.width, self.height)

    def delete(self):
        HighlightMixin.unload_graphics(self)


class FocusMixin(Controller, Viewer):
    def __init__(self):

        Controller.__init__(self)