Exemplo n.º 1
0
    def get_cursor_type(self, event):
        '''
        Get the cursor position.

        @param event: An event of type gtk.gdk.Event.
        @return: If the cursor is on the frame of the window, return the cursor position. Otherwise return None.
        '''
        # Get event coordinate.
        (ex, ey) = get_event_root_coords(event)
        
        # Get window allocation.
        rect = self.get_allocation()
        (wx, wy) = self.get_position()
        ww = rect.width
        wh = rect.height
        
        # Return cursor position. 
        return self.get_cursor_type_with_coordinate(ex, ey, wx, wy, ww, wh)
Exemplo n.º 2
0
    def get_cursor_type(self, event):
        '''
        Get the cursor position.

        @param event: An event of type gtk.gdk.Event.
        @return: If the cursor is on the frame of the window, return the cursor position. Otherwise return None.
        '''
        # Get event coordinate.
        (ex, ey) = get_event_root_coords(event)

        # Get window allocation.
        rect = self.get_allocation()
        (wx, wy) = self.get_position()
        ww = rect.width
        wh = rect.height

        # Return cursor position.
        return self.get_cursor_type_with_coordinate(ex, ey, wx, wy, ww, wh)
Exemplo n.º 3
0
 def get_cursor_type(self, event):
     '''Get cursor position.'''
     # Get event coordinate.
     (ex, ey) = get_event_root_coords(event)
     
     # Get window allocation.
     rect = self.window_shadow.get_allocation()
     (wx, wy) = self.window_shadow.get_position()
     ww = rect.width
     wh = rect.height
     
     # Return cursor position. 
     if wx <= ex <= wx + self.shadow_padding:
         if wy <= ey <= wy + self.shadow_padding * 2:
             return gtk.gdk.TOP_LEFT_CORNER
         elif wy + wh - (self.shadow_padding * 2) <= ey <= wy + wh:
             return gtk.gdk.BOTTOM_LEFT_CORNER
         elif wy + self.shadow_padding < ey < wy + wh - self.shadow_padding:
             return gtk.gdk.LEFT_SIDE
         else:
             return None
     elif wx + ww - self.shadow_padding <= ex <= wx + ww:
         if wy <= ey <= wy + self.shadow_padding * 2:
             return gtk.gdk.TOP_RIGHT_CORNER
         elif wy + wh - (self.shadow_padding * 2) <= ey <= wy + wh:
             return gtk.gdk.BOTTOM_RIGHT_CORNER
         elif wy + self.shadow_padding < ey < wy + wh - self.shadow_padding:
             return gtk.gdk.RIGHT_SIDE
         else:
             return None
     elif wx + self.shadow_padding < ex < wx + ww - self.shadow_padding:
         if wy <= ey <= wy + self.shadow_padding:
             return gtk.gdk.TOP_SIDE
         elif wy + wh - self.shadow_padding <= ey <= wy + wh:
             return gtk.gdk.BOTTOM_SIDE
         else: 
             return None
     else:
         return None