Esempio n. 1
0
        public void DrawTick(Rectangle area, int item)
        {
            Rectangle tick = TickBounds(item);

            Pango.Layout layout = null;

            if (item < tick_layouts.Length)
            {
                layout = tick_layouts [item];

                if (layout != null)
                {
                    int width, height;
                    layout.GetPixelSize(out width, out height);

                    Style.PaintLayout(Style, GdkWindow, State, true, area, this,
                                      "GroupSelector:Tick", tick.X + 3, tick.Y + tick.Height, layout);
                }
            }

            if (layout == null)
            {
                tick.Height /= 2;
            }

            if (tick.Intersect(area, out area))
            {
                GdkWindow.DrawRectangle(Style.ForegroundGC(State), true, area);
            }
        }
Esempio n. 2
0
        private DistanceTextInfo MakeDistanceLayout(GMapRoute route)
        {
            var layout = new Pango.Layout(this.PangoContext)
            {
                Alignment = Pango.Alignment.Right
            };
            var colTXT = System.Drawing.ColorTranslator.ToHtml(route.Stroke.Color);

            layout.SetMarkup(String.Format("<span foreground=\"{1}\"><span font=\"Segoe UI Symbol\">⛽</span> {0:N1} км.</span>", route.Distance, colTXT));

            return(new DistanceTextInfo {
                PangoLayout = layout
            });
        }
Esempio n. 3
0
        private Layout MakeLayout(string text, bool bold = false)
        {
            // http://developer.gnome.org/pangomm/unstable/classPango_1_1FontDescription.html
            Pango.FontDescription font = new Pango.FontDescription();

            font.Family = "Arial";
            font.Size   = Convert.ToInt32(11 * Pango.Scale.PangoScale);

            if (bold)
            {
                font.Weight = Weight.Semibold;
            }

            // http://developer.gnome.org/pangomm/unstable/classPango_1_1Layout.html
            Pango.Layout layout = CreatePangoLayout(text);

            layout.FontDescription = font;
            return(layout);
        }