.
1 /*
2 Copyright (C) 2014 Johan Mattsson
3
4 This library is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 3 of the
7 License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful, but
10 WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13 */
14
15 using Cairo;
16 using Math;
17
18 namespace BirdFont {
19
20 class Headline : Widget {
21
22 Text label;
23
24 public Headline (string text) {
25 label = new Text ();
26 label.set_text (text);
27 }
28
29 public override void draw (Context cr) {
30 cr.save ();
31 Theme.color (cr, "Headline Background");
32 cr.rectangle (0, widget_y, allocation.width, 40 * MainWindow.units);
33 cr.fill ();
34 cr.restore ();
35
36 cr.save ();
37 label.set_source_rgba (1, 1, 1, 1);
38 label.set_font_size (20 * MainWindow.units);
39 label.draw_at_baseline (cr, 21 * MainWindow.units, widget_y + 25 * MainWindow.units);
40 cr.restore ();
41 }
42
43 public override double get_height () {
44 return 40 * MainWindow.units;
45 }
46
47 public override double get_width () {
48 return allocation.width;
49 }
50 }
51
52 }
53