Changeset 1529

Show
Ignore:
Timestamp:
06/28/07 11:51:55 (1 year ago)
Author:
wrobe..@pld-linux.org
Message:

- added dropzone support to indicate items, which can group other items

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • gaphas/trunk/gaphas/item.py

    r1520 r1529  
    203203 
    204204        - matrix_i2w: Item to World transformation matrix (no need to) 
    205         - cairo: the Cairo Context use this one to draw. 
     205        - cairo: the Cairo Context use this one to draw 
    206206        - view: the view that is to be rendered to 
    207         - selected, focused, hovered: view state of items. 
     207        - selected, focused, hovered, dropzone: view state of items 
    208208        """ 
    209209        pass 
  • gaphas/trunk/gaphas/painter.py

    r1518 r1529  
    106106                                  focused=(item is view.focused_item), 
    107107                                  hovered=(item is view.hovered_item), 
     108                                  dropzone=(item is view.dropzone_item), 
    108109                                  draw_all=self.draw_all)) 
    109110 
  • gaphas/trunk/gaphas/view.py

    r1518 r1529  
    3939        self._focused_item = None 
    4040        self._hovered_item = None 
     41        self._dropzone_item = None 
    4142 
    4243        self._matrix = Matrix() 
     
    151152                            _set_hovered_item, _del_hovered_item, 
    152153                            "The item directly under the mouse pointer") 
     154 
     155 
     156    def _set_dropzone_item(self, item): 
     157        """ 
     158        Set dropzone item. 
     159        """ 
     160        if item is not self._dropzone_item: 
     161            self.queue_draw_item(self._dropzone_item, item) 
     162            self._dropzone_item = item 
     163            self.emit('dropzone-changed', item) 
     164 
     165 
     166    def _del_dropzone_item(self): 
     167        """ 
     168        Unset dropzone item. 
     169        """ 
     170        self._dropzone_item = None 
     171 
     172 
     173    dropzone_item = property(lambda s: s._dropzone_item, 
     174            _set_dropzone_item, _del_dropzone_item, 
     175            'The item which can group other items') 
     176 
    153177 
    154178    def _set_painter(self, painter): 
     
    336360    # Signals: emited before the change takes effect. 
    337361    __gsignals__ = { 
     362        'dropzone-changed': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, 
     363                      (gobject.TYPE_PYOBJECT,)), 
    338364        'hover-changed': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, 
    339365                      (gobject.TYPE_PYOBJECT,)), 
     
    554580            if self.hovered_item in removed_items: 
    555581                self.hovered_item = None 
     582            if self.dropzone_item in removed_items: 
     583                self.dropzone_item = None 
    556584 
    557585            # Pseudo-draw