28
28
#region IDrawingService implementation
30
Pango.Layout GetThemedLayout ()
32
Pango.Layout layout = new Pango.Layout (DockWindow.Window.CreatePangoContext ());
33
layout.FontDescription = DockWindow.Window.Style.FontDescription;
30
public int CurrentDockWidth {
36
public int CurrentDockHeight {
37
42
public Gdk.Rectangle TextPathAtPoint (TextRenderContext context)
39
Cairo.Context cr = context.Context;
40
Gdk.Point point = context.LeftCenteredPoint;
42
Pango.Layout layout = GetThemedLayout ();
43
layout.Width = Pango.Units.FromPixels (context.MaximumWidth);
44
layout.SetMarkup (context.Text);
45
layout.Ellipsize = context.EllipsizeMode;
46
layout.Alignment = context.Alignment;
47
layout.Wrap = context.WrapMode;
49
if (context.FontSize != 0)
50
layout.FontDescription.Size = Pango.Units.FromPixels (context.FontSize);
52
Pango.Rectangle rect1, rect2;
53
layout.GetExtents (out rect1, out rect2);
55
int transY = point.Y - Pango.Units.ToPixels (rect2.Height) / 2;
56
cr.Translate (point.X, transY);
57
Pango.CairoHelper.LayoutPath (cr, layout);
58
cr.Translate (0 - point.X, 0 - transY);
60
Gdk.Rectangle textArea = new Gdk.Rectangle (Pango.Units.ToPixels (rect2.X),
61
Pango.Units.ToPixels (rect2.Y),
62
Pango.Units.ToPixels (rect2.Width),
63
Pango.Units.ToPixels (rect2.Height));
44
throw new Exception ("Default drawing service cannot render text");