Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / embedding / tests / MSDotNETCSEmbed / MSDotNETCSEmbedForm.cs
blobe265cdd5e7af9849f70fc80d7c8562b84ef21fbb
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: Mozilla-sample-code 1.0
5 * Copyright (c) 2002 Netscape Communications Corporation and
6 * other contributors
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this Mozilla sample software and associated documentation files
10 * (the "Software"), to deal in the Software without restriction, including
11 * without limitation the rights to use, copy, modify, merge, publish,
12 * distribute, sublicense, and/or sell copies of the Software, and to permit
13 * persons to whom the Software is furnished to do so, subject to the
14 * following conditions:
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 * DEALINGS IN THE SOFTWARE.
27 * Contributor(s):
28 * Roy Yokoyama <yokoyama@netscape.com> (original author)
30 * ***** END LICENSE BLOCK ***** */
32 using System;
33 using System.Drawing;
34 using System.Collections;
35 using System.ComponentModel;
36 using System.Windows.Forms;
37 using System.Data;
39 // Gecko namespace
40 using Mozilla.Embedding;
42 namespace MSDotNETCSEmbed
44 /// <summary>
45 /// Summary description for Form1.
46 /// </summary>
47 public class MSDotNETCSEmbedForm : System.Windows.Forms.Form
49 /// <summary>
50 /// Required designer variable.
51 /// </summary>
52 private System.ComponentModel.Container components = null;
53 private Mozilla.Embedding.Gecko gecko1;
54 private System.Windows.Forms.Button goButton;
55 private System.Windows.Forms.TextBox urlBar;
57 public MSDotNETCSEmbedForm()
60 // Required for Windows Form Designer support
62 InitializeComponent();
65 // TODO: Add any constructor code after InitializeComponent call
69 /// <summary>
70 /// Clean up any resources being used.
71 /// </summary>
72 protected override void Dispose( bool disposing )
74 if( disposing )
76 if (components != null)
78 components.Dispose();
81 base.Dispose( disposing );
84 #region Windows Form Designer generated code
85 /// <summary>
86 /// Required method for Designer support - do not modify
87 /// the contents of this method with the code editor.
88 /// </summary>
89 private void InitializeComponent()
91 this.gecko1 = new Mozilla.Embedding.Gecko();
92 this.goButton = new System.Windows.Forms.Button();
93 this.urlBar = new System.Windows.Forms.TextBox();
94 this.SuspendLayout();
95 //
96 // gecko1
97 //
98 this.gecko1.Location = new System.Drawing.Point(0, 40);
99 this.gecko1.Name = "gecko1";
100 this.gecko1.Size = new System.Drawing.Size(664, 392);
101 this.gecko1.TabIndex = 0;
103 // goButton
105 this.goButton.Location = new System.Drawing.Point(600, 8);
106 this.goButton.Name = "goButton";
107 this.goButton.Size = new System.Drawing.Size(56, 24);
108 this.goButton.TabIndex = 1;
109 this.goButton.Text = "Go";
110 this.goButton.Click += new System.EventHandler(this.goButton_Click);
112 // urlBar
114 this.urlBar.Location = new System.Drawing.Point(8, 10);
115 this.urlBar.Name = "urlBar";
116 this.urlBar.Size = new System.Drawing.Size(576, 20);
117 this.urlBar.TabIndex = 2;
118 this.urlBar.Text = "";
119 this.urlBar.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.urlBar_KeyPress);
121 // MSDotNETCSEmbedForm
123 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
124 this.ClientSize = new System.Drawing.Size(664, 429);
125 this.Controls.AddRange(new System.Windows.Forms.Control[] {
126 this.urlBar,
127 this.goButton,
128 this.gecko1});
129 this.Name = "MSDotNETCSEmbedForm";
130 this.Text = "MSDotNETCSEmbed [UNSUPPORTED]";
131 this.Resize += new System.EventHandler(this.MSDotNETCSEmbedForm_Resize);
132 this.Load += new System.EventHandler(this.MSDotNETCSEmbedForm_Load);
133 this.ResumeLayout(false);
136 #endregion
138 /// <summary>
139 /// The main entry point for the application.
140 /// </summary>
141 [STAThread]
142 static void Main()
144 Application.Run(new MSDotNETCSEmbedForm());
146 // terminate gecko
147 Gecko.TermEmbedding();
150 private void MSDotNETCSEmbedForm_Load(object sender, System.EventArgs e)
152 urlBar.Text = "http://www.mozilla.org";
153 gecko1.OpenURL(urlBar.Text);
154 this.Text = "MSDotNETCSEmbed [UNSUPPORTED] - " + urlBar.Text;
157 private void MSDotNETCSEmbedForm_Resize(object sender, System.EventArgs e)
159 gecko1.Size =
160 new Size(ClientSize.Width,
161 ClientSize.Height - gecko1.Location.Y);
164 private void urlBar_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
166 switch (e.KeyChar)
168 case '\r':
169 gecko1.OpenURL(urlBar.Text);
170 e.Handled = true;
171 break;
175 private void goButton_Click(object sender, System.EventArgs e)
177 gecko1.OpenURL(urlBar.Text);