Clone in a terminal:
Commit 4469348
Johan Mattsson - 2012-12-07T14:07:22+00:00
4469348bac845715d36868c6529d96f19916ce9ejohan.mattsson.m@gmail.com

menu action in separate file

Changed files (2)

Diff

diff --git a/layout/index.html b/layout/index.htmlnew file mode 100644index 0000000..0f2a2fc--- /dev/null+++ b/layout/index.html@@ -0,0 +1,9 @@+<html>+<head>+	<script type="text/javascript" src="supplement.js"></script>+	<style type="text/css">@import url("style.css");</style>+</head>+<body>+<h1>Supplement index</h1>+</body>+</html>diff --git a/src/MenuAction.vala b/src/MenuAction.valanew file mode 100644index 0000000..d44e7c4--- /dev/null+++ b/src/MenuAction.vala@@ -0,0 +1,62 @@+/*+    Copyright (C) 2012 Johan Mattsson++    This program is free software: you can redistribute it and/or modify+    it under the terms of the GNU General Public License as published by+    the Free Software Foundation, either version 3 of the License, or+    (at your option) any later version.++    This program is distributed in the hope that it will be useful,+    but WITHOUT ANY WARRANTY; without even the implied warranty of+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+    GNU General Public License for more details.++    You should have received a copy of the GNU General Public License+    along with this program.  If not, see <http://www.gnu.org/licenses/>.+*/++using Cairo;++namespace Supplement {++public class MenuAction : GLib.Object {+	public string label;+	public DropMenu.Selected action;+	public DropMenu? parent = null;+	public int index = -1;+	bool selected = false;+	+	public MenuAction (string label) {+		this.label = label;+	}+	+	public void set_selected (bool s) {+		selected = s;+	}+	+	public virtual void draw (double x, double y, Context cr) {+		if (selected) {+			cr.save ();+			cr.set_line_join (LineJoin.ROUND);+			cr.set_line_width (12);+			cr.set_source_rgba (102/255.0, 120/255.0, 149/255.0, 1);+			cr.rectangle (x - 2, y - 9, 88, 8);+			cr.fill_preserve ();+			cr.stroke ();+			cr.restore ();			+		}+		+		cr.save ();+		cr.set_source_rgba (1, 1, 1, 1);+		+		cr.set_font_size (12);+		cr.select_font_face ("Cantarell", FontSlant.NORMAL, FontWeight.NORMAL);+		+		cr.move_to (x, y);++		cr.show_text (label);+		cr.restore ();+	}+}++}

Contact

Email: johan.mattsson.m@gmail.com
Mastodon: typo.social/@birdfont
GitHub: johanmattssonm
LinkedIn: johan-mattsson-2ab324112