DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Untracked file

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
 * Version: Mozilla-sample-code 1.0
 *
 * Copyright (c) 2002 Netscape Communications Corporation and
 * other contributors
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this Mozilla sample software and associated documentation files
 * (the "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to permit
 * persons to whom the Software is furnished to do so, subject to the
 * following conditions:
 *
 * The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 *
 * Contributor(s):
 *   Roy Yokoyama <yokoyama@netscape.com> (original author)
 *
 * ***** END LICENSE BLOCK ***** */

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

// Gecko namespace
using Mozilla.Embedding;

namespace MSDotNETCSEmbed
{
	/// <summary>
	/// Summary description for Form1.
	/// </summary>
	public class MSDotNETCSEmbedForm : System.Windows.Forms.Form
	{
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;
		private Mozilla.Embedding.Gecko gecko1;
		private System.Windows.Forms.Button goButton;
		private System.Windows.Forms.TextBox urlBar;

		public MSDotNETCSEmbedForm()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.gecko1 = new Mozilla.Embedding.Gecko();
			this.goButton = new System.Windows.Forms.Button();
			this.urlBar = new System.Windows.Forms.TextBox();
			this.SuspendLayout();
			// 
			// gecko1
			// 
			this.gecko1.Location = new System.Drawing.Point(0, 40);
			this.gecko1.Name = "gecko1";
			this.gecko1.Size = new System.Drawing.Size(664, 392);
			this.gecko1.TabIndex = 0;
			// 
			// goButton
			// 
			this.goButton.Location = new System.Drawing.Point(600, 8);
			this.goButton.Name = "goButton";
			this.goButton.Size = new System.Drawing.Size(56, 24);
			this.goButton.TabIndex = 1;
			this.goButton.Text = "Go";
			this.goButton.Click += new System.EventHandler(this.goButton_Click);
			// 
			// urlBar
			// 
			this.urlBar.Location = new System.Drawing.Point(8, 10);
			this.urlBar.Name = "urlBar";
			this.urlBar.Size = new System.Drawing.Size(576, 20);
			this.urlBar.TabIndex = 2;
			this.urlBar.Text = "";
			this.urlBar.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.urlBar_KeyPress);
			// 
			// MSDotNETCSEmbedForm
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(664, 429);
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.urlBar,
																		  this.goButton,
																		  this.gecko1});
			this.Name = "MSDotNETCSEmbedForm";
			this.Text = "MSDotNETCSEmbed [UNSUPPORTED]";
			this.Resize += new System.EventHandler(this.MSDotNETCSEmbedForm_Resize);
			this.Load += new System.EventHandler(this.MSDotNETCSEmbedForm_Load);
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new MSDotNETCSEmbedForm());

			// terminate gecko
			Gecko.TermEmbedding();
		}

		private void MSDotNETCSEmbedForm_Load(object sender, System.EventArgs e)
		{
			urlBar.Text = "http://www.mozilla.org";
			gecko1.OpenURL(urlBar.Text);
			this.Text = "MSDotNETCSEmbed [UNSUPPORTED] - " + urlBar.Text;
		}

		private void MSDotNETCSEmbedForm_Resize(object sender, System.EventArgs e)
		{
			gecko1.Size =
				new Size(ClientSize.Width,
						 ClientSize.Height - gecko1.Location.Y);
		}

		private void urlBar_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
		{
			switch (e.KeyChar)
			{
				case '\r':
					gecko1.OpenURL(urlBar.Text);
					e.Handled = true;
					break;
			}
		}

		private void goButton_Click(object sender, System.EventArgs e)
		{
			gecko1.OpenURL(urlBar.Text);
		}
	}
}