using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using QC.QTMInterface;

namespace QC.QTMApplication;

public class FindDialog : Form
{
	public delegate void FindNextHandler(FindInfo findInfo);

	private IContainer components;

	private Button buttonFindNext;

	private Label label1;

	private TextBox textBoxSearchText;

	private CheckBox checkBoxMatchWholeWord;

	private CheckBox checkBoxMatchCase;

	private Button buttonCancel;

	public event FindNextHandler FindNextEvent;

	private void buttonFindNext_Click(object sender, EventArgs e)
	{
		if (this.FindNextEvent != null)
		{
			FindInfo findInfo = default(FindInfo);
			findInfo.SearchText = textBoxSearchText.Text;
			findInfo.MatchCase = (checkBoxMatchCase.Checked ? true : false);
			findInfo.MatchWholeWordOnly = (checkBoxMatchWholeWord.Checked ? true : false);
			this.FindNextEvent(findInfo);
		}
	}

	public FindDialog(FindInfo findInfo)
	{
		InitializeComponent();
		textBoxSearchText.Text = findInfo.SearchText;
		checkBoxMatchCase.Checked = (findInfo.MatchCase ? true : false);
		checkBoxMatchWholeWord.Checked = (findInfo.MatchWholeWordOnly ? true : false);
	}

	private void buttonCancel_Click(object sender, EventArgs e)
	{
		Close();
	}

	protected override void Dispose(bool disposing)
	{
		if (disposing && components != null)
		{
			components.Dispose();
		}
		base.Dispose(disposing);
	}

	private void InitializeComponent()
	{
		this.buttonFindNext = new System.Windows.Forms.Button();
		this.label1 = new System.Windows.Forms.Label();
		this.textBoxSearchText = new System.Windows.Forms.TextBox();
		this.checkBoxMatchWholeWord = new System.Windows.Forms.CheckBox();
		this.checkBoxMatchCase = new System.Windows.Forms.CheckBox();
		this.buttonCancel = new System.Windows.Forms.Button();
		base.SuspendLayout();
		this.buttonFindNext.Location = new System.Drawing.Point(268, 10);
		this.buttonFindNext.Name = "buttonFindNext";
		this.buttonFindNext.Size = new System.Drawing.Size(75, 23);
		this.buttonFindNext.TabIndex = 3;
		this.buttonFindNext.Text = "Find Next";
		this.buttonFindNext.UseVisualStyleBackColor = true;
		this.buttonFindNext.Click += new System.EventHandler(buttonFindNext_Click);
		this.label1.AutoSize = true;
		this.label1.Location = new System.Drawing.Point(8, 15);
		this.label1.Name = "label1";
		this.label1.Size = new System.Drawing.Size(56, 13);
		this.label1.TabIndex = 5;
		this.label1.Text = "Find what:";
		this.textBoxSearchText.Location = new System.Drawing.Point(70, 12);
		this.textBoxSearchText.Name = "textBoxSearchText";
		this.textBoxSearchText.Size = new System.Drawing.Size(185, 20);
		this.textBoxSearchText.TabIndex = 0;
		this.checkBoxMatchWholeWord.AutoSize = true;
		this.checkBoxMatchWholeWord.Location = new System.Drawing.Point(21, 54);
		this.checkBoxMatchWholeWord.Name = "checkBoxMatchWholeWord";
		this.checkBoxMatchWholeWord.Size = new System.Drawing.Size(135, 17);
		this.checkBoxMatchWholeWord.TabIndex = 1;
		this.checkBoxMatchWholeWord.Text = "Match whole word only";
		this.checkBoxMatchWholeWord.UseVisualStyleBackColor = true;
		this.checkBoxMatchCase.AutoSize = true;
		this.checkBoxMatchCase.Location = new System.Drawing.Point(21, 80);
		this.checkBoxMatchCase.Name = "checkBoxMatchCase";
		this.checkBoxMatchCase.Size = new System.Drawing.Size(83, 17);
		this.checkBoxMatchCase.TabIndex = 2;
		this.checkBoxMatchCase.Text = "Match Case";
		this.checkBoxMatchCase.UseVisualStyleBackColor = true;
		this.buttonCancel.Location = new System.Drawing.Point(268, 42);
		this.buttonCancel.Name = "buttonCancel";
		this.buttonCancel.Size = new System.Drawing.Size(75, 23);
		this.buttonCancel.TabIndex = 4;
		this.buttonCancel.Text = "Cancel";
		this.buttonCancel.UseVisualStyleBackColor = true;
		this.buttonCancel.Click += new System.EventHandler(buttonCancel_Click);
		base.AcceptButton = this.buttonFindNext;
		base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
		base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
		base.ClientSize = new System.Drawing.Size(346, 108);
		base.Controls.Add(this.buttonCancel);
		base.Controls.Add(this.checkBoxMatchCase);
		base.Controls.Add(this.checkBoxMatchWholeWord);
		base.Controls.Add(this.textBoxSearchText);
		base.Controls.Add(this.label1);
		base.Controls.Add(this.buttonFindNext);
		base.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
		base.MaximizeBox = false;
		base.MinimizeBox = false;
		base.Name = "FindDialog";
		base.ShowIcon = false;
		base.ShowInTaskbar = false;
		base.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
		this.Text = "Find";
		base.ResumeLayout(false);
		base.PerformLayout();
	}
}
