diff options
Diffstat (limited to 'thoughtview.py')
-rw-r--r-- | thoughtview.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/thoughtview.py b/thoughtview.py index 5d02365..cd79682 100644 --- a/thoughtview.py +++ b/thoughtview.py @@ -45,6 +45,7 @@ class ThoughtView(CanvasElement): self._last_height = -1 self._dragging = False self._selected = False + self._add_control_rect = gtk.gdk.Rectangle(0, 0, 0, 0) def set_dragging(self, dragging): if self._dragging != dragging: @@ -84,6 +85,9 @@ class ThoughtView(CanvasElement): width, height = self._draw_text(context) self._draw_bounding_box(context, width, height) + if self.hovering: + self._draw_controls(context, width, height) + self._last_width = width self._last_height = height @@ -139,6 +143,26 @@ class ThoughtView(CanvasElement): context.stroke() context.restore() + def _draw_controls(self, context, width, height): + context.save() + + context.set_source_rgb(0.0, 0.0, 0.0) + + layout = context.create_layout() + layout.set_text('+') + + label_width, label_height = layout.get_pixel_size() + + x = self.x + width - label_width + y = self.y + context.translate(x, y) + context.show_layout(layout) + + context.restore() + + self._add_control_rect = gtk.gdk.Rectangle(x, y, label_width, + label_height) + def get_rect(self): if -1 in (self._last_width, self._last_height): layout = self._get_name_layout() |