using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ImageBlockz.Operations;
using ImageBlockz.Operations.Filters;
using ImageBlockz.Operations.Edit;
using ImageBlockz.Api;
using ImageBlockz.Core;

namespace ImageBlockz.Operations.Controls
{
    public partial class TextToImageControl : OperationControl
    {
        private ImageBlockz.Operations.Edit.TextToImage textToImage;

        public TextToImageControl()
            : base(typeof(ImageBlockz.Operations.Edit.TextToImage).FullName)
        {
            IsPreview = false;

            InitializeComponent();
        }

        public override void SetOperation(IOperation operation)
        {
            base.SetOperation(operation);

            if (operation is ImageBlockz.Operations.Edit.TextToImage)
            {
                textToImage = (ImageBlockz.Operations.Edit.TextToImage)GetOperation();
            }
        }

        public override bool OnOK()
        {
            textToImage.Text = textBox1.Text;

            return true;
        }

        public override void ShowData()
        {

            if (IsNew)
            {
                textBox1.Text = "";
            }
            else
            {
                textBox1.Text = textToImage.Text;
            }
        }
    }
}
