예제 #1
0
 def __init__(self):
     #FIXME super doesnt appear to be working here!
     super(WindowManager, self).__init__()
     self.EventManager.attach(self)
     self.RenderManager.attach(self)
     RegisterComponent.__init__(self)
     #call the unbound method
     UIShared.set_window_manager(self)
     ## CombinedMouseKeyBoard.__init__(self)
     ## this is needed probably because
     ## I have some pretty crappy class design
     self.listeningEvents = EventTypes.mouse + EventTypes.kbd
     self.listeners = wrl() #else it will have its own object in the dict
예제 #2
0
    def on_mouse_button_down(self, event):
        #perfect
        #SharedUI.set_focused_window(False)
        ## NOTE: window focus is also set in window manager .__events_to_windows__

        self.window_attributes.CLICKED = True
        self.button_down( 1, event.pos, (-self.rect.x, -self.rect.y))

        scale =  SharedObjects.getScale()

        #window area
        if not self.window_attributes.SCROLLED:
            scale =  SharedObjects.getScale()
            # x = self.rect.x * scale
            # y = self.rect.y * scale
            x = self.widget_reference_coord[0] #* scale
            y = self.widget_reference_coord[1] #* scale
            width = self.rect.width
            height = self.rect.height
            #if __EventManager__.__getattr__('focused_window') == self:
            if x <= event.pos[0] <= x + width:# * scale:
                if y <= event.pos[1] <= y + height:# * scale:
                    #if not self.EventManager.eventBlocked and (self.focused_window is self):

                        #Listener.setBlocking(self)

                        print 'passing events to widgets'
                        self.window_attributes.DRAGGED = True

                        if UIShared.focused_window is self:
                            self.__event_to_widgets__(event)
                        else:


                            UIShared.set_focused_window(self)
                            self.window_manager.listeners.remove(self)

                            # this is a "push" because the window manager has reversed the window list
                            self.window_manager.listeners.push(self)