tuikit/core/widget.py
changeset 97 0c2e0c09ba5c
parent 94 e50dae408fe9
child 104 742e504ec053
child 109 105b1affc3c2
equal deleted inserted replaced
96:68c562e0eb1f 97:0c2e0c09ba5c
    36         #: Minimal size of widget. Widget will never be sized smaller than this.
    36         #: Minimal size of widget. Widget will never be sized smaller than this.
    37         self.sizemin = Size(1, 1)
    37         self.sizemin = Size(1, 1)
    38         #: Maximum size of widget. Widget will never be sized bigger than this.
    38         #: Maximum size of widget. Widget will never be sized bigger than this.
    39         #: None means no maximum size (infinite).
    39         #: None means no maximum size (infinite).
    40         self.sizemax = Size(None, None)
    40         self.sizemax = Size(None, None)
       
    41 
       
    42         #: Cursor is position where text input will occur.
       
    43         #: It is displayed on screen if widget is active.
       
    44         #: None means no cursor (hidden).
       
    45         self._cursor = None
    41 
    46 
    42     ## position and size ##
    47     ## position and size ##
    43 
    48 
    44     @property
    49     @property
    45     def x(self):
    50     def x(self):
    84         where 0,0 is left top corner of widget to be drawn.
    89         where 0,0 is left top corner of widget to be drawn.
    85 
    90 
    86         """
    91         """
    87         return buffer.clip_rect.moved(-buffer.origin.x, -buffer.origin.y)
    92         return buffer.clip_rect.moved(-buffer.origin.x, -buffer.origin.y)
    88 
    93 
       
    94     @property
       
    95     def cursor(self):
       
    96         if self._cursor is not None:
       
    97             return Point(self._cursor)
       
    98 
       
    99     ## input events ##
       
   100 
       
   101     def keypress(self, keyname, char, mod):
       
   102         self._log.debug('%s keypress(%r, %r, %r)',
       
   103                         self.name, keyname, char, mod)
       
   104 
    89     ## timeouts ##
   105     ## timeouts ##
    90 
   106 
    91     def add_timeout(self, delay, callback, *args):
   107     def add_timeout(self, delay, callback, *args):
    92         """Register `callback` to be called after `delay` seconds."""
   108         """Register `callback` to be called after `delay` seconds."""
    93         self.parent.add_timeout(self, delay, callback, *args)
   109         self.parent.add_timeout(self, delay, callback, *args)