| 263 | def get_rect(self): |
| 264 | win_x, win_y = self.get_origin() |
| 265 | rectangle = self.get_allocation() |
| 266 | |
| 267 | x = win_x + rectangle.x |
| 268 | y = win_y + rectangle.y |
| 269 | minimum, natural = self.get_preferred_size() |
| 270 | rect = Gdk.Rectangle() |
| 271 | rect.x = x |
| 272 | rect.y = y |
| 273 | rect.width = minimum.width |
| 274 | rect.height = natural.height |
| 275 | |
| 276 | return rect |
| 277 | |
| 278 | def do_draw(self, cr): |
| 279 | # FIXME: Gtk.Menu.do_draw already calls a render_frame: |
| 280 | # http://git.gnome.org/browse/gtk+/tree/gtk/gtkmenu.c#n3046 |
| 281 | Gtk.Menu.do_draw(self, cr) |
| 282 | |
| 283 | if self._invoker is not None and self._invoker.has_rectangle_gap(): |
| 284 | invoker = self._invoker.get_rect() |
| 285 | palette = self.get_rect() |
| 286 | gap = _calculate_gap(palette, invoker) |
| 287 | else: |
| 288 | gap = False |
| 289 | |
| 290 | allocation = self.get_allocation() |
| 291 | context = self.get_style_context() |
| 292 | context.add_class('toolitem') |
| 293 | if gap: |
| 294 | Gtk.render_frame_gap(context, cr, 0, 0, allocation.width, allocation.height, |
| 295 | gap[0], gap[1], gap[1] + gap[2]) |
| 296 | else: |
| 297 | Gtk.render_frame(context, cr, 0, 0, allocation.width, allocation.height) |
| 298 | return False |
| 299 | |