From 16f181704de1f9257ad585d8a01e90b932b51c91 Mon Sep 17 00:00:00 2001 From: "jst%netscape.com" Date: Sat, 24 May 2003 06:55:00 +0000 Subject: [PATCH] Use the new Gecko UI control class, and add a URL bar, and a Go button. Not part of the build. git-svn-id: svn://10.0.0.236/trunk@142890 18797224-902f-48f8-a5cc-f745e15eee43 --- .../MSDotNETCSEmbed/MSDotNETCSEmbedForm.cs | 71 ++++++++++++++----- .../MSDotNETCSEmbed/MSDotNETCSEmbedForm.resx | 2 +- 2 files changed, 53 insertions(+), 20 deletions(-) diff --git a/mozilla/embedding/tests/MSDotNETCSEmbed/MSDotNETCSEmbedForm.cs b/mozilla/embedding/tests/MSDotNETCSEmbed/MSDotNETCSEmbedForm.cs index 257c6c48f68..a6b87d21adc 100644 --- a/mozilla/embedding/tests/MSDotNETCSEmbed/MSDotNETCSEmbedForm.cs +++ b/mozilla/embedding/tests/MSDotNETCSEmbed/MSDotNETCSEmbedForm.cs @@ -58,8 +58,9 @@ namespace MSDotNETCSEmbed /// Required designer variable. /// private System.ComponentModel.Container components = null; - private Mozilla.Embedding.Gecko myGecko = null; - private String myURL = null; + private Mozilla.Embedding.Gecko gecko1; + private System.Windows.Forms.Button goButton; + private System.Windows.Forms.TextBox urlBar; public MSDotNETCSEmbedForm() { @@ -71,7 +72,6 @@ namespace MSDotNETCSEmbed // // TODO: Add any constructor code after InitializeComponent call // - myGecko = new Gecko(this); } /// @@ -96,16 +96,49 @@ namespace MSDotNETCSEmbed /// 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(744, 374); - this.Name = "MSDotNETCSEmbed"; + 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.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.MSDotNETCSEmbedForm_KeyPress); this.Load += new System.EventHandler(this.MSDotNETCSEmbedForm_Load); + this.ResumeLayout(false); } #endregion @@ -124,31 +157,31 @@ namespace MSDotNETCSEmbed private void MSDotNETCSEmbedForm_Load(object sender, System.EventArgs e) { - myURL = "www.mozilla.org"; - myGecko.OpenURL(myURL); - this.Text = "MSDotNETCSEmbed [UNSUPPORTED] - " + myURL; - myURL = ""; + 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) { - myGecko.Resize(); + gecko1.Size = + new Size(ClientSize.Width, + ClientSize.Height - gecko1.Location.Y); } - private void MSDotNETCSEmbedForm_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) + private void urlBar_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { switch (e.KeyChar) { case '\r': - myGecko.OpenURL(myURL); - myURL = ""; - break; - - default: - myURL += e.KeyChar; - this.Text = "MSDotNETCSEmbed [UNSUPPORTED] - " + myURL; + gecko1.OpenURL(urlBar.Text); break; } } + + private void goButton_Click(object sender, System.EventArgs e) + { + gecko1.OpenURL(urlBar.Text); + } } } diff --git a/mozilla/embedding/tests/MSDotNETCSEmbed/MSDotNETCSEmbedForm.resx b/mozilla/embedding/tests/MSDotNETCSEmbed/MSDotNETCSEmbedForm.resx index add6c98ec45..c7852b74064 100644 --- a/mozilla/embedding/tests/MSDotNETCSEmbed/MSDotNETCSEmbedForm.resx +++ b/mozilla/embedding/tests/MSDotNETCSEmbed/MSDotNETCSEmbedForm.resx @@ -97,6 +97,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - Form1 + MSDotNETCSEmbedForm \ No newline at end of file