| 1 |
/* |
| 2 |
* Copyright (c) 2017-2019 José Amuedo (https://github.com/spheras) |
| 3 |
* |
| 4 |
* This program is free software: you can redistribute it and/or modify |
| 5 |
* it under the terms of the GNU General Public License as published by |
| 6 |
* the Free Software Foundation, either version 3 of the License, or |
| 7 |
* (at your option) any later version. |
| 8 |
* |
| 9 |
* This program is distributed in the hope that it will be useful, |
| 10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
* GNU General Public License for more details. |
| 13 |
* |
| 14 |
* You should have received a copy of the GNU General Public License |
| 15 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 |
*/ |
| 17 |
|
| 18 |
private class DesktopFolder.MenuItemSeparator : Gtk.MenuItem { |
| 19 |
public MenuItemSeparator () { |
| 20 |
draw.connect (on_draw); |
| 21 |
} |
| 22 |
|
| 23 |
protected bool on_draw (Cairo.Context cr) { |
| 24 |
int padding = 10; |
| 25 |
Gtk.Allocation allocation; |
| 26 |
this.get_allocation (out allocation); |
| 27 |
int middle = allocation.height / 2; |
| 28 |
cr.new_path (); |
| 29 |
cr.set_line_width (1); |
| 30 |
// +0.5 to avoid fuzzy lines? |
| 31 |
// http://stevehanov.ca/blog/index.php?id=28 |
| 32 |
cr.move_to (padding + 0.5, middle + 0.5); |
| 33 |
cr.rel_line_to (allocation.width - padding * 2, 0); |
| 34 |
cr.set_source_rgba (0, 0, 0, 0.2); |
| 35 |
cr.stroke (); |
| 36 |
|
| 37 |
cr.close_path (); |
| 38 |
|
| 39 |
return true; |
| 40 |
} |
| 41 |
|
| 42 |
} |