using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;
using C1.Silverlight.RichTextBox;

namespace Annotations
{
    /// <summary>
    /// An IRichTextPainter that paints sticky notes. Used by the AnnotationService.
    /// </summary>
    class StickyPainter : IRichTextPainter
    {
        List<StickyNote> _stickies;

        public StickyPainter(List<StickyNote> stickies)
        {
            _stickies = stickies;
        }

        public void Paint(C1PaintingContext context)
        {
            foreach (var sticky in _stickies)
            {
                var rect = context.ViewManager.GetRectFromPosition(sticky.Range.Start);
                context.Paint(Math.Round(rect.X), Math.Round(rect.Bottom), false, sticky);
            }
        }

        public void PaintInline(C1PaintingContext context, C1Line line)
        {
        }

        public event EventHandler<RichTextPainterChangeEventArgs> PainterChanged;
    }
}
