[Pkg-sugar-commit] [sugar-toolkit] 26/118: Implement prelighting of cell renderer icons
Jonas Smedegaard
dr at jones.dk
Thu Apr 16 18:49:36 UTC 2015
This is an automated email from the git hooks/post-receive script.
js pushed a commit to annotated tag debian/0.84.10-1
in repository sugar-toolkit.
commit a070fcda7285c9fc943002c0a99ee60b38203dd8
Author: Tomeu Vizoso <tomeu at sugarlabs.org>
Date: Sat Jun 13 20:57:21 2009 +0200
Implement prelighting of cell renderer icons
---
src/sugar/graphics/icon.py | 59 +++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 53 insertions(+), 6 deletions(-)
diff --git a/src/sugar/graphics/icon.py b/src/sugar/graphics/icon.py
index 1f2d3af..fe6cc5e 100644
--- a/src/sugar/graphics/icon.py
+++ b/src/sugar/graphics/icon.py
@@ -930,6 +930,10 @@ class CellRendererIcon(gtk.CellRendererPixbuf):
from sugar.graphics.palette import CellRendererInvoker
self._buffer = _IconBuffer()
+ self._fill_color = None
+ self._stroke_color = None
+ self._prelit_fill_color = None
+ self._prelit_stroke_color = None
self._palette_invoker = CellRendererInvoker()
gobject.GObject.__init__(self)
@@ -962,23 +966,37 @@ class CellRendererIcon(gtk.CellRendererPixbuf):
icon_name = gobject.property(type=object, setter=set_icon_name)
def set_xo_color(self, value):
- if self._buffer.xo_color != value:
- self._buffer.xo_color = value
+ self._stroke_color = value.get_stroke_color()
+ self._fill_color = value.get_fill_color()
xo_color = gobject.property(type=object, setter=set_xo_color)
def set_fill_color(self, value):
- if self._buffer.fill_color != value:
- self._buffer.fill_color = value
+ if self._fill_color != value:
+ self._fill_color = value
fill_color = gobject.property(type=object, setter=set_fill_color)
def set_stroke_color(self, value):
- if self._buffer.stroke_color != value:
- self._buffer.stroke_color = value
+ if self._stroke_color != value:
+ self._stroke_color = value
stroke_color = gobject.property(type=object, setter=set_stroke_color)
+ def set_prelit_fill_color(self, value):
+ if self._prelit_fill_color != value:
+ self._prelit_fill_color = value
+
+ prelit_fill_color = gobject.property(type=object,
+ setter=set_prelit_fill_color)
+
+ def set_prelit_stroke_color(self, value):
+ if self._prelit_stroke_color != value:
+ self._prelit_stroke_color = value
+
+ prelit_stroke_color = gobject.property(type=object,
+ setter=set_prelit_stroke_color)
+
def set_background_color(self, value):
if self._buffer.background_color != value:
self._buffer.background_color = value
@@ -992,7 +1010,36 @@ class CellRendererIcon(gtk.CellRendererPixbuf):
size = gobject.property(type=object, setter=set_size)
+ def _is_prelit(self, tree_view):
+ x, y = tree_view.get_pointer()
+ x, y = tree_view.convert_widget_to_bin_window_coords(x, y)
+ pos = tree_view.get_path_at_pos(x, y)
+ if pos is None:
+ return False
+
+ path, column, x, y = pos
+
+ for cell_renderer in column.get_cell_renderers():
+ if cell_renderer == self:
+ cell_x, cell_width = column.cell_get_position(cell_renderer)
+ if x > cell_x and x < (cell_x + cell_width):
+ return True
+ return False
+
+ return False
+
def do_render(self, window, widget, background_area, cell_area, expose_area, flags):
+ has_prelit_colors = None not in [self._prelit_fill_color,
+ self._prelit_stroke_color]
+ if flags & gtk.CELL_RENDERER_PRELIT and has_prelit_colors and \
+ self._is_prelit(widget):
+
+ self._buffer.fill_color = self._prelit_fill_color
+ self._buffer.stroke_color = self._prelit_stroke_color
+ else:
+ self._buffer.fill_color = self._fill_color
+ self._buffer.stroke_color = self._stroke_color
+
surface = self._buffer.get_surface()
if surface is None:
self.props.pixbuf = None
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-sugar/sugar-toolkit.git
More information about the pkg-sugar-commit
mailing list