зеркало из https://github.com/mozilla/pjs.git
[Manticore]
Update toolbars (fancy toolbars on hold for now) add location bar for loading URLs NOT PART OF BUILD
This commit is contained in:
Родитель
2f2b09ec30
Коммит
806f3087d5
|
@ -196,6 +196,16 @@
|
|||
DependentUpon = "browserwindow.cs"
|
||||
BuildAction = "EmbeddedResource"
|
||||
/>
|
||||
<File
|
||||
RelPath = "browser\LocationBar.cs"
|
||||
SubType = "UserControl"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "browser\LocationBar.resx"
|
||||
DependentUpon = "LocationBar.cs"
|
||||
BuildAction = "EmbeddedResource"
|
||||
/>
|
||||
<File
|
||||
RelPath = "browser\OpenLocDialog.cs"
|
||||
SubType = "Form"
|
||||
|
|
|
@ -103,6 +103,12 @@ namespace Silverstone.Manticore.Bookmarks
|
|||
// Import a Netscape bookmarks file.
|
||||
}
|
||||
|
||||
public string ResolveKeyword(string aURL)
|
||||
{
|
||||
// XXX implement me
|
||||
return "";
|
||||
}
|
||||
|
||||
public String CreateBookmark(String aLabel, String aParentID, int aPosition)
|
||||
{
|
||||
XmlElement parentElt = GetElementById(aParentID);
|
||||
|
|
|
@ -0,0 +1,157 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Silverstone.Manticore.Browser
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for LocationBar.
|
||||
/// </summary>
|
||||
public class LocationBar : System.Windows.Forms.UserControl
|
||||
{
|
||||
private System.Windows.Forms.Label mAddressLabel;
|
||||
private System.Windows.Forms.TextBox mAddressBar;
|
||||
private System.Windows.Forms.Button mGoButton;
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.Container components = null;
|
||||
|
||||
public LocationBar()
|
||||
{
|
||||
// This call is required by the Windows.Forms Form Designer.
|
||||
InitializeComponent();
|
||||
|
||||
mAddressBar.KeyDown += new KeyEventHandler(OnKeyDown);
|
||||
mAddressBar.ModifiedChanged += new EventHandler(OnAddressBarModified);
|
||||
mGoButton.Click += new EventHandler(OnGoButtonClick);
|
||||
}
|
||||
|
||||
public string Text
|
||||
{
|
||||
get
|
||||
{
|
||||
return mAddressBar.Text;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != mAddressBar.Text)
|
||||
mAddressBar.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
public delegate void LocationBarEventHandler(Object sender, LocationBarEventArgs e);
|
||||
|
||||
public event LocationBarEventHandler LocationBarCommit;
|
||||
|
||||
protected void OnKeyDown(Object aSender, KeyEventArgs aKea)
|
||||
{
|
||||
if (aKea.KeyCode == Keys.Enter)
|
||||
FireLocationBarCommit();
|
||||
}
|
||||
|
||||
protected void OnGoButtonClick(Object aSender, EventArgs aEa)
|
||||
{
|
||||
FireLocationBarCommit();
|
||||
}
|
||||
|
||||
protected void FireLocationBarCommit()
|
||||
{
|
||||
if (LocationBarCommit != null)
|
||||
{
|
||||
LocationBarEventArgs lbea = new LocationBarEventArgs(mAddressBar.Text);
|
||||
LocationBarCommit(this, lbea);
|
||||
}
|
||||
}
|
||||
|
||||
public event LocationBarEventHandler LocationBarModified;
|
||||
protected void OnAddressBarModified(Object aSender, EventArgs aEa)
|
||||
{
|
||||
if (LocationBarModified != null)
|
||||
{
|
||||
LocationBarEventArgs lbea = new LocationBarEventArgs(mAddressBar.Text);
|
||||
LocationBarModified(this, lbea);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs aPea)
|
||||
{
|
||||
Graphics g = aPea.Graphics;
|
||||
g.DrawLine(SystemPens.ControlDark, 0, 0, ClientRectangle.Width, 0);
|
||||
g.DrawLine(SystemPens.ControlLight, 0, 1, ClientRectangle.Width, 1);
|
||||
}
|
||||
|
||||
#region Component 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.mAddressLabel = new System.Windows.Forms.Label();
|
||||
this.mAddressBar = new System.Windows.Forms.TextBox();
|
||||
this.mGoButton = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// mAddressLabel
|
||||
//
|
||||
this.mAddressLabel.AutoSize = true;
|
||||
this.mAddressLabel.Location = new System.Drawing.Point(8, 6);
|
||||
this.mAddressLabel.Name = "mAddressLabel";
|
||||
this.mAddressLabel.Size = new System.Drawing.Size(49, 13);
|
||||
this.mAddressLabel.TabIndex = 0;
|
||||
this.mAddressLabel.Text = "A&ddress:";
|
||||
//
|
||||
// mAddressBar
|
||||
//
|
||||
this.mAddressBar.Anchor = (System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right);
|
||||
this.mAddressBar.Location = new System.Drawing.Point(64, 3);
|
||||
this.mAddressBar.Name = "mAddressBar";
|
||||
this.mAddressBar.Size = new System.Drawing.Size(336, 20);
|
||||
this.mAddressBar.TabIndex = 1;
|
||||
this.mAddressBar.Text = "";
|
||||
//
|
||||
// mGoButton
|
||||
//
|
||||
this.mGoButton.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);
|
||||
this.mGoButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
|
||||
this.mGoButton.Location = new System.Drawing.Point(408, 2);
|
||||
this.mGoButton.Name = "mGoButton";
|
||||
this.mGoButton.Size = new System.Drawing.Size(32, 23);
|
||||
this.mGoButton.TabIndex = 2;
|
||||
this.mGoButton.Text = "Go";
|
||||
//
|
||||
// LocationBar
|
||||
//
|
||||
this.Controls.AddRange(new System.Windows.Forms.Control[] {
|
||||
this.mGoButton,
|
||||
this.mAddressBar,
|
||||
this.mAddressLabel});
|
||||
this.Name = "LocationBar";
|
||||
this.Size = new System.Drawing.Size(448, 25);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class LocationBarEventArgs : EventArgs
|
||||
{
|
||||
public LocationBarEventArgs(string aText)
|
||||
{
|
||||
mText = aText;
|
||||
}
|
||||
|
||||
protected string mText;
|
||||
public string Text
|
||||
{
|
||||
get
|
||||
{
|
||||
return mText;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,105 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 1.3
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">1.3</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1">this is my long string</data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
[base64 mime encoded serialized .NET Framework object]
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
[base64 mime encoded string representing a byte array form of the .NET Framework object]
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>1.3</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="$this.Name">
|
||||
<value>LocationBar</value>
|
||||
</data>
|
||||
<data name="$this.DrawGrid" type="System.Boolean, mscorlib, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
</root>
|
|
@ -12,11 +12,13 @@
|
|||
<toolbarbutton label="Home" command="view-go-home"/>
|
||||
</toolbar>
|
||||
</toolstrip>
|
||||
<!-- This awaits a decent toolbar implementation
|
||||
<toolstrip>
|
||||
<toolbar id="navigation-toolbar" label="Location:" visible="true" description="Navigation Toolbar">
|
||||
<locationbar/>
|
||||
<toolbarbutton label="Go" command="go-to-url"/>
|
||||
</toolbar>
|
||||
</toolstrip>
|
||||
-->
|
||||
</toolbox>
|
||||
|
||||
|
|
|
@ -51,7 +51,16 @@ namespace Silverstone.Manticore.Browser
|
|||
private MenuBuilder mMenuBuilder;
|
||||
private BrowserToolbarBuilder mToolbarBuilder;
|
||||
|
||||
private LocationBar mLocationBar;
|
||||
|
||||
private WebBrowser mWebBrowser;
|
||||
public WebBrowser WebBrowser
|
||||
{
|
||||
get
|
||||
{
|
||||
return mWebBrowser;
|
||||
}
|
||||
}
|
||||
|
||||
private StatusBar mStatusBar;
|
||||
private StatusBarPanel mProgressMeter;
|
||||
|
@ -118,21 +127,39 @@ namespace Silverstone.Manticore.Browser
|
|||
mStatusBar.Panels.AddRange(new StatusBarPanel[] {docStatePanel, mStatusPanel, mProgressMeter, zonePanel});
|
||||
mStatusBar.ShowPanels = true;
|
||||
|
||||
mWebBrowser = new WebBrowser(this);
|
||||
this.Controls.Add(mWebBrowser);
|
||||
|
||||
this.Controls.Add(mStatusBar);
|
||||
|
||||
mToolbarBuilder = new BrowserToolbarBuilder("browser\\browser-toolbar.xml", this);
|
||||
|
||||
mLocationBar = new LocationBar();
|
||||
mLocationBar.Top = mToolbarBuilder.Bounds.Top + mToolbarBuilder.Bounds.Height;
|
||||
mLocationBar.Left = 0;
|
||||
mLocationBar.Width = ClientRectangle.Width;
|
||||
mLocationBar.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
|
||||
mLocationBar.LocationBarCommit += new LocationBar.LocationBarEventHandler(OnLocationCommit);
|
||||
mLocationBar.LocationBarModified += new LocationBar.LocationBarEventHandler(OnLocationModified);
|
||||
this.Controls.Add(mLocationBar);
|
||||
|
||||
mWebBrowser = new WebBrowser(this);
|
||||
mWebBrowser.Dock = DockStyle.Bottom;
|
||||
mWebBrowser.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
mWebBrowser.Top = mLocationBar.Top + mLocationBar.Height;
|
||||
mWebBrowser.Width = ClientRectangle.Width;
|
||||
mWebBrowser.Height = ClientRectangle.Height - mWebBrowser.Top - mStatusBar.Height;
|
||||
this.Controls.Add(mWebBrowser);
|
||||
|
||||
// Start Page handler
|
||||
this.VisibleChanged += new EventHandler(LoadStartPage);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// URL Loading
|
||||
|
||||
/// <summary>
|
||||
/// The currently loaded document's URL.
|
||||
/// </summary>
|
||||
public String URL {
|
||||
public String URL
|
||||
{
|
||||
get {
|
||||
return mWebBrowser.URL;
|
||||
}
|
||||
|
@ -140,11 +167,29 @@ namespace Silverstone.Manticore.Browser
|
|||
|
||||
public void LoadURL(String aURL)
|
||||
{
|
||||
mUpdatedURLBar = false;
|
||||
mWebBrowser.LoadURL(aURL, false);
|
||||
}
|
||||
|
||||
protected bool mShouldLoadHomePage = true;
|
||||
public bool ShouldLoadHomePage
|
||||
{
|
||||
get
|
||||
{
|
||||
return mShouldLoadHomePage;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != mShouldLoadHomePage)
|
||||
mShouldLoadHomePage = value;
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadStartPage(object sender, EventArgs e)
|
||||
{
|
||||
if (!mShouldLoadHomePage)
|
||||
return;
|
||||
|
||||
int startMode = ServiceManager.Preferences.GetIntPref("browser.homepage.mode");
|
||||
switch (startMode) {
|
||||
case 0:
|
||||
|
@ -161,6 +206,25 @@ namespace Silverstone.Manticore.Browser
|
|||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Location Bar
|
||||
protected void OnLocationCommit(Object aSender, LocationBarEventArgs aLbea)
|
||||
{
|
||||
string url = ServiceManager.Bookmarks.ResolveKeyword(aLbea.Text);
|
||||
if (url == "")
|
||||
url = aLbea.Text;
|
||||
|
||||
mUserTyped = false;
|
||||
LoadURL(url);
|
||||
}
|
||||
|
||||
protected bool mUserTyped = false;
|
||||
protected bool mUpdatedURLBar = false;
|
||||
protected void OnLocationModified(Object aSender, LocationBarEventArgs aLbea)
|
||||
{
|
||||
mUserTyped = true;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Window Creation
|
||||
public static BrowserWindow OpenBrowser()
|
||||
|
@ -263,6 +327,21 @@ namespace Silverstone.Manticore.Browser
|
|||
String text = percentage + "% complete";
|
||||
mProgressMeter.Text = text;
|
||||
}
|
||||
// XXX we really would rather set this in BeforeNavigate2, but we
|
||||
// can't get that event to fire for some reason.
|
||||
if (mUpdatedURLBar)
|
||||
mUpdatedURLBar = false;
|
||||
}
|
||||
|
||||
// XXX we probably will need to extend this to take as a parameter
|
||||
// more data from the NavigateComplete event
|
||||
public void OnNavigateComplete2(string aURL)
|
||||
{
|
||||
if (!mUpdatedURLBar && !mUserTyped)
|
||||
{
|
||||
mLocationBar.Text = aURL;
|
||||
mUpdatedURLBar = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnTitleChange(String aTitle)
|
||||
|
@ -276,12 +355,6 @@ namespace Silverstone.Manticore.Browser
|
|||
mStatusPanel.Text = aStatusText;
|
||||
}
|
||||
|
||||
public Object OnNewWindow()
|
||||
{
|
||||
// XXX figure out what this does.
|
||||
return new Object();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fired when a |MenuItem| built by the |MenuBuilder| is selected.
|
||||
/// </summary>
|
||||
|
|
|
@ -53,8 +53,23 @@ namespace Silverstone.Manticore.Layout
|
|||
|
||||
public class WebBrowser : UserControl
|
||||
{
|
||||
private AxWebBrowser trident;
|
||||
private AxMozillaBrowser gecko;
|
||||
protected AxWebBrowser trident;
|
||||
public AxWebBrowser Trident
|
||||
{
|
||||
get
|
||||
{
|
||||
return trident;
|
||||
}
|
||||
}
|
||||
|
||||
protected AxMozillaBrowser gecko;
|
||||
public AxMozillaBrowser Gecko
|
||||
{
|
||||
get
|
||||
{
|
||||
return gecko;
|
||||
}
|
||||
}
|
||||
|
||||
private BrowserWindow mBrowserWindow;
|
||||
|
||||
|
@ -63,7 +78,6 @@ namespace Silverstone.Manticore.Layout
|
|||
public WebBrowser(BrowserWindow aBrowserWindow)
|
||||
{
|
||||
mBrowserWindow = aBrowserWindow;
|
||||
this.Dock = DockStyle.Fill;
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
|
@ -261,6 +275,7 @@ namespace Silverstone.Manticore.Layout
|
|||
private void AddListeners()
|
||||
{
|
||||
AddProgressListener();
|
||||
AddNavigateComplete2Listener();
|
||||
AddTitleChangeListener();
|
||||
AddStatusChangeListener();
|
||||
AddNewWindowListener();
|
||||
|
@ -288,6 +303,30 @@ namespace Silverstone.Manticore.Layout
|
|||
mBrowserWindow.OnProgress(e.progress, e.progressMax);
|
||||
}
|
||||
|
||||
private bool mNavigateComplete2Gecko = false;
|
||||
private bool mNavigateComplete2Trident = false;
|
||||
private void AddNavigateComplete2Listener()
|
||||
{
|
||||
if (gecko != null && !mNavigateComplete2Gecko)
|
||||
{
|
||||
gecko.NavigateComplete2 += new AxMOZILLACONTROLLib.DWebBrowserEvents2_NavigateComplete2EventHandler(OnNavigateComplete2Gecko);
|
||||
mNavigateComplete2Gecko = true;
|
||||
}
|
||||
else if (trident != null && !mNavigateComplete2Trident)
|
||||
{
|
||||
trident.NavigateComplete2 += new AxSHDocVw.DWebBrowserEvents2_NavigateComplete2EventHandler(OnNavigateComplete2Trident);
|
||||
mNavigateComplete2Trident = true;
|
||||
}
|
||||
}
|
||||
public void OnNavigateComplete2Gecko(Object sender, AxMOZILLACONTROLLib.DWebBrowserEvents2_NavigateComplete2Event e)
|
||||
{
|
||||
mBrowserWindow.OnNavigateComplete2(e.uRL as string);
|
||||
}
|
||||
public void OnNavigateComplete2Trident(Object sender, AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event e)
|
||||
{
|
||||
mBrowserWindow.OnNavigateComplete2(e.uRL as string);
|
||||
}
|
||||
|
||||
private bool mTitleChangeGecko = false;
|
||||
private bool mTitleChangeTrident = false;
|
||||
private void AddTitleChangeListener()
|
||||
|
@ -347,17 +386,30 @@ namespace Silverstone.Manticore.Layout
|
|||
}
|
||||
public void OnNewWindowGecko(Object sender, AxMOZILLACONTROLLib.DWebBrowserEvents2_NewWindow2Event e)
|
||||
{
|
||||
Object browser = mBrowserWindow.OnNewWindow();
|
||||
AxMozillaBrowser webBrowser = browser as AxMozillaBrowser;
|
||||
if (webBrowser != null)
|
||||
e.ppDisp = webBrowser;
|
||||
bool allowPopups = ServiceManager.Preferences.GetBoolPref("browser.allowpopups");
|
||||
if (allowPopups)
|
||||
{
|
||||
BrowserWindow window = new BrowserWindow();
|
||||
window.WebBrowser.RealizeLayoutEngine();
|
||||
window.Show();
|
||||
e.ppDisp = window.WebBrowser.Gecko;
|
||||
}
|
||||
else
|
||||
e.cancel = true;
|
||||
}
|
||||
public void OnNewWindowTrident(Object sender, AxSHDocVw.DWebBrowserEvents2_NewWindow2Event e)
|
||||
{
|
||||
Object browser = mBrowserWindow.OnNewWindow();
|
||||
AxWebBrowser webBrowser = browser as AxWebBrowser;
|
||||
if (webBrowser != null)
|
||||
e.ppDisp = webBrowser;
|
||||
bool allowPopups = ServiceManager.Preferences.GetBoolPref("browser.allowpopups");
|
||||
if (allowPopups)
|
||||
{
|
||||
BrowserWindow window = new BrowserWindow();
|
||||
// window.ShouldLoadHomePage = false;
|
||||
window.WebBrowser.RealizeLayoutEngine();
|
||||
window.Show();
|
||||
e.ppDisp = window.WebBrowser.Trident;
|
||||
}
|
||||
else
|
||||
e.cancel = true;
|
||||
}
|
||||
|
||||
private bool mFileDownloadGecko = false;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 7.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Manticore", "Manticore.csproj", "{B40F4C31-96AF-4E5F-A088-546389BC78C4}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test", "toolkit\test\test.csproj", "{ACDC3B19-EE63-455D-B491-083B0B276A8B}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
ConfigName.0 = Debug
|
||||
|
@ -13,6 +15,10 @@ Global
|
|||
{B40F4C31-96AF-4E5F-A088-546389BC78C4}.Debug.Build.0 = Debug|.NET
|
||||
{B40F4C31-96AF-4E5F-A088-546389BC78C4}.Release.ActiveCfg = Release|.NET
|
||||
{B40F4C31-96AF-4E5F-A088-546389BC78C4}.Release.Build.0 = Release|.NET
|
||||
{ACDC3B19-EE63-455D-B491-083B0B276A8B}.Debug.ActiveCfg = Debug|.NET
|
||||
{ACDC3B19-EE63-455D-B491-083B0B276A8B}.Debug.Build.0 = Debug|.NET
|
||||
{ACDC3B19-EE63-455D-B491-083B0B276A8B}.Release.ActiveCfg = Release|.NET
|
||||
{ACDC3B19-EE63-455D-B491-083B0B276A8B}.Release.Build.0 = Release|.NET
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
|
|
|
@ -41,369 +41,143 @@ namespace Silverstone.Manticore.Toolkit
|
|||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Summary description for StripBar.
|
||||
/// </summary>
|
||||
public class StripBar : UserControl
|
||||
{
|
||||
public StripBar()
|
||||
/// Summary description for StripBar.
|
||||
/// </summary>
|
||||
public class StripBar : UserControl
|
||||
{
|
||||
public StripBar()
|
||||
{
|
||||
}
|
||||
|
||||
public ArrayList Rows = new ArrayList();
|
||||
public ArrayList Bands = new ArrayList();
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IStripBar Implementation
|
||||
public void AddBand (StripBand aBand)
|
||||
{
|
||||
}
|
||||
Bands.Add(aBand);
|
||||
aBand.Bar = this;
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
// Paint Bands
|
||||
uint count = Bands.Count;
|
||||
for (int i = 0; i < count; ++i)
|
||||
if (aBand.NewRow)
|
||||
{
|
||||
if (e.ClipRectangle.IntersectsWith(Bands[i].Bounds))
|
||||
{
|
||||
Bands[i].PaintBand(e);
|
||||
}
|
||||
StripRow row = new StripRow(this);
|
||||
Rows.Add(row);
|
||||
aBand.Row = row;
|
||||
|
||||
row.Bands.Add(aBand);
|
||||
|
||||
// TODO: Trigger Height-Changed Event
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnPaintBackground(PaintEventArgs e)
|
||||
{
|
||||
// Paint Background
|
||||
if (BackImage != null)
|
||||
else
|
||||
{
|
||||
// Tile the Image
|
||||
TextureBrush tbrush = new TextureBrush(BackImage, WrapMode.Tile);
|
||||
e.Graphics.FillRectangle(tbrush, Bounds);
|
||||
}
|
||||
|
||||
SolidBrush sbr = new SolidBrush(BackColor);
|
||||
e.Graphics.FillRectangle(sbr, Bounds);
|
||||
}
|
||||
|
||||
protected Color mBackColor = SystemColors.Control;
|
||||
public Color BackColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return mBackColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != mBackColor)
|
||||
{
|
||||
mBackColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected Color mForeColor = SystemColors.ControlText;
|
||||
public Color ForeColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return mForeColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != mForeColor)
|
||||
{
|
||||
mForeColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected bool mLocked = false;
|
||||
public bool Locked
|
||||
{
|
||||
get
|
||||
{
|
||||
return mLocked;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != mLocked)
|
||||
{
|
||||
mLocked = value;
|
||||
// Invalidate to toggle grippers
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public enum BarOrientation : uint
|
||||
{
|
||||
Horizontal, Vertical
|
||||
}
|
||||
|
||||
protected BarOrientation mOrientation = BarOrientation.Horizontal;
|
||||
public BarOrientation Orientation
|
||||
{
|
||||
get
|
||||
{
|
||||
return mOrientation;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != mOrientation)
|
||||
{
|
||||
mOrientation = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected Image mBackImage = null;
|
||||
public Image BackImage
|
||||
{
|
||||
get
|
||||
{
|
||||
return mBackImage;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != mBackImage)
|
||||
{
|
||||
mBackImage = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected BandCollection mBands = null;
|
||||
public BandCollection Bands
|
||||
{
|
||||
get
|
||||
{
|
||||
if (mBands == null)
|
||||
mBands = new BandCollection(this);
|
||||
return mBands;
|
||||
}
|
||||
}
|
||||
|
||||
public class BandCollection
|
||||
{
|
||||
public BandCollection(StripBar aOwner)
|
||||
{
|
||||
mOwner = aOwner;
|
||||
}
|
||||
|
||||
protected StripBar mOwner;
|
||||
|
||||
// protected Hashtable mBands = null;
|
||||
protected ArrayList mBandsList = new ArrayList();
|
||||
|
||||
public Band this [int aIndex]
|
||||
{
|
||||
get
|
||||
{
|
||||
return mBandsList[aIndex] as Band;
|
||||
}
|
||||
set
|
||||
{
|
||||
value.Owner = mOwner;
|
||||
mBandsList[aIndex] = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Add (Band aBand)
|
||||
{
|
||||
aBand.Owner = mOwner;
|
||||
|
||||
Band lastBand = null;
|
||||
if (mBandsList.Count > 0)
|
||||
lastBand = mBandsList[mBandsList.Count-1] as Band;
|
||||
|
||||
int x, y, w, h;
|
||||
|
||||
if (aBand.NewRow)
|
||||
{
|
||||
// We're the first band on a new row
|
||||
x = mOwner.ClientRectangle.Left;
|
||||
if (lastBand != null)
|
||||
y = lastBand.Bounds.Top + lastBand.Bounds.Height + 1;
|
||||
else
|
||||
y = mOwner.ClientRectangle.Top;
|
||||
}
|
||||
StripRow row;
|
||||
if (Rows.Count >= 1)
|
||||
row = Rows[Rows.Count-1] as StripRow;
|
||||
else
|
||||
{
|
||||
// We're (possibly) on the same row as another band
|
||||
if (lastBand != null)
|
||||
x = lastBand.Bounds.Left + lastBand.Bounds.Width + 1;
|
||||
else
|
||||
x = mOwner.ClientRectangle.Left;
|
||||
if (lastBand != null)
|
||||
y = lastBand.Bounds.Top;
|
||||
else
|
||||
y = mOwner.ClientRectangle.Top;
|
||||
row = new StripRow(this);
|
||||
Rows.Add(row);
|
||||
}
|
||||
row.Bands.Add(aBand);
|
||||
aBand.Row = row;
|
||||
|
||||
w = mOwner.ClientRectangle.Width - x - 1;
|
||||
h = 24; // XXX (2)
|
||||
|
||||
aBand.Bounds = new Rectangle(x, y, w, h);
|
||||
|
||||
mBandsList.Add(aBand);
|
||||
|
||||
mOwner.Invalidate(); // XXX (1)
|
||||
// Invalidate Row
|
||||
Invalidate(row.Bounds);
|
||||
}
|
||||
}
|
||||
|
||||
public void Remove (Band aBand)
|
||||
{
|
||||
mBandsList.Remove(aBand);
|
||||
aBand.Owner = null;
|
||||
mOwner.Invalidate(); // XXX (1)
|
||||
}
|
||||
public void RemoveBand(StripBand aStripBand)
|
||||
{
|
||||
|
||||
public void Clear ()
|
||||
{
|
||||
mBandsList.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public uint Count
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Overriden Methods
|
||||
protected override void OnPaint(PaintEventArgs aPea)
|
||||
{
|
||||
int rowCount = Rows.Count;
|
||||
for (int i = 0; i < rowCount; ++i)
|
||||
{
|
||||
get
|
||||
{
|
||||
return (uint) mBandsList.Count;
|
||||
}
|
||||
StripRow currRow = Rows[i] as StripRow;
|
||||
if (currRow.Bounds.IntersectsWith(aPea.ClipRectangle))
|
||||
currRow.PaintRow(aPea);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class Band
|
||||
public class StripBand
|
||||
{
|
||||
public Band()
|
||||
public StripBand()
|
||||
{
|
||||
}
|
||||
|
||||
protected StripBar mOwner;
|
||||
public StripBar Owner
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IStripBand Implementation
|
||||
protected StripRow mRow;
|
||||
public StripRow Row
|
||||
{
|
||||
get
|
||||
{
|
||||
return mOwner;
|
||||
return mRow;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != mOwner)
|
||||
{
|
||||
mOwner = value;
|
||||
}
|
||||
if (value != mRow)
|
||||
mRow = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected Rectangle mBounds;
|
||||
public Rectangle Bounds
|
||||
protected StripBar mBar;
|
||||
public StripBar Bar
|
||||
{
|
||||
get
|
||||
{
|
||||
return mBounds;
|
||||
return mBar;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != mBounds)
|
||||
{
|
||||
mBounds = value;
|
||||
if (mOwner != null)
|
||||
mOwner.Invalidate(Bounds);
|
||||
}
|
||||
if (value != mBar)
|
||||
mBar = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected Color mForeColor = SystemColors.ControlText;
|
||||
public Color ForeColor
|
||||
protected int mWidth;
|
||||
public int Width
|
||||
{
|
||||
get
|
||||
{
|
||||
return mForeColor;
|
||||
return mWidth;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != mForeColor)
|
||||
{
|
||||
mForeColor = value;
|
||||
// XXX improve this to invalidate only the label
|
||||
if (mOwner != null)
|
||||
mOwner.Invalidate(Bounds);
|
||||
}
|
||||
if (value != mWidth)
|
||||
mWidth = value;
|
||||
}
|
||||
}
|
||||
protected Color mBackColor = Color.Transparent;
|
||||
public Color BackColor
|
||||
|
||||
|
||||
protected int mHeight = 24;
|
||||
public int Height
|
||||
{
|
||||
get
|
||||
{
|
||||
return mBackColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != mBackColor)
|
||||
{
|
||||
mBackColor = value;
|
||||
if (mOwner != null)
|
||||
mOwner.Invalidate(Bounds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected string mText;
|
||||
public string Text
|
||||
{
|
||||
get
|
||||
{
|
||||
return mText;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != mText)
|
||||
{
|
||||
mText = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected Image mBackImage = null;
|
||||
public Image BackImage
|
||||
{
|
||||
get
|
||||
{
|
||||
return mBackImage;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != mBackImage)
|
||||
{
|
||||
mBackImage = value;
|
||||
if (mOwner != null)
|
||||
mOwner.Invalidate(Bounds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public uint Index
|
||||
{
|
||||
get
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public string Key
|
||||
{
|
||||
get
|
||||
{
|
||||
return "fluffy_the_magic_goat";
|
||||
// Compute height:
|
||||
// height = the larger of - decoration area (icon/text)
|
||||
// - client area (control)
|
||||
// + nonclient, nondecoration area (borders)
|
||||
//
|
||||
return mHeight;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected bool mNewRow = true;
|
||||
protected bool mNewRow = false;
|
||||
public bool NewRow
|
||||
{
|
||||
get
|
||||
|
@ -420,36 +194,136 @@ namespace Silverstone.Manticore.Toolkit
|
|||
}
|
||||
|
||||
|
||||
protected bool mVisible = true;
|
||||
public bool Visible
|
||||
protected Control mControl = null;
|
||||
public Control Child
|
||||
{
|
||||
get
|
||||
get
|
||||
{
|
||||
return mVisible;
|
||||
return mControl;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != mVisible)
|
||||
if (value != mControl)
|
||||
{
|
||||
mVisible = value;
|
||||
mControl = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void PaintBand(PaintEventArgs e)
|
||||
{
|
||||
Graphics g = e.Graphics;
|
||||
SolidBrush br = new SolidBrush(mBackColor);
|
||||
g.FillRectangle(br, Bounds);
|
||||
|
||||
g.DrawLine(SystemPens.ControlLight, Bounds.Left, Bounds.Top,
|
||||
Bounds.Left + Bounds.Width, Bounds.Top);
|
||||
g.DrawLine(SystemPens.ControlLight, Bounds.Left, Bounds.Top,
|
||||
Bounds.Left, Bounds.Top + Bounds.Height);
|
||||
g.DrawLine(SystemPens.ControlDark, Bounds.Left + Bounds.Width,
|
||||
Bounds.Top, Bounds.Left + Bounds.Width, Bounds.Top + Bounds.Height);
|
||||
g.DrawLine(SystemPens.ControlDark, Bounds.Left, Bounds.Top + Bounds.Height,
|
||||
Bounds.Left + Bounds.Width, Bounds.Top + Bounds.Height);
|
||||
protected Color mBackColor = Color.Red;
|
||||
public Color BackColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return mBackColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != mBackColor)
|
||||
{
|
||||
mBackColor = value;
|
||||
StripBar bar = mBar as StripBar;
|
||||
bar.Invalidate(Bounds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Rectangle Bounds
|
||||
{
|
||||
get
|
||||
{
|
||||
int x, y, w, h, i;
|
||||
|
||||
int bandCount = mRow.Bands.Count;
|
||||
for (i = 0, x = 0; i < bandCount; ++i)
|
||||
{
|
||||
StripBand currBand = mRow.Bands[i] as StripBand;
|
||||
x += currBand.Bounds.Width;
|
||||
}
|
||||
y = mRow.Bounds.Y;
|
||||
|
||||
h = Height;
|
||||
|
||||
w = mBar.Width;
|
||||
int bandIndex = mRow.Bands.IndexOf(this);
|
||||
if (bandIndex == (mRow.Bands.Count - 1))
|
||||
w = mBar.ClientRectangle.Width - x;
|
||||
|
||||
return new Rectangle(x, y, w, h);
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
public void PaintBand(PaintEventArgs aPea)
|
||||
{
|
||||
SolidBrush sbr = new SolidBrush(BackColor);
|
||||
aPea.Graphics.FillRectangle(sbr, Bounds);
|
||||
}
|
||||
}
|
||||
|
||||
public class StripRow
|
||||
{
|
||||
public StripRow(StripBar aStripBar)
|
||||
{
|
||||
mStripBar = aStripBar;
|
||||
}
|
||||
|
||||
protected StripBar mStripBar;
|
||||
|
||||
public ArrayList Bands = new ArrayList();
|
||||
|
||||
public Rectangle Bounds
|
||||
{
|
||||
get
|
||||
{
|
||||
int x, y, w, h;
|
||||
w = mStripBar.ClientRectangle.Width;
|
||||
h = Height;
|
||||
|
||||
x = mStripBar.ClientRectangle.Left;
|
||||
|
||||
int rowCount = mStripBar.Rows.Count;
|
||||
StripRow currRow = mStripBar.Rows[0] as StripRow;
|
||||
int i = 0;
|
||||
for (y = 0; currRow != this; ++i)
|
||||
y += currRow.Height;
|
||||
|
||||
return new Rectangle(x, y, w, h);
|
||||
}
|
||||
}
|
||||
|
||||
protected int mHeight = 24;
|
||||
public int Height
|
||||
{
|
||||
get
|
||||
{
|
||||
return mHeight;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != mHeight)
|
||||
mHeight = value;
|
||||
}
|
||||
}
|
||||
|
||||
public void AddBand(StripBand aBand)
|
||||
{
|
||||
if (aBand.Height > mHeight)
|
||||
mHeight = aBand.Height;
|
||||
|
||||
Bands.Add(aBand);
|
||||
}
|
||||
|
||||
public void PaintRow(PaintEventArgs aPea)
|
||||
{
|
||||
int bandCount = Bands.Count;
|
||||
for (int i = 0; i < bandCount; ++i)
|
||||
{
|
||||
StripBand currBand = Bands[i] as StripBand;
|
||||
currBand.PaintBand(aPea);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,6 +45,10 @@ namespace Silverstone.Manticore.Toolkit
|
|||
/// </summary>
|
||||
public class TestForm : System.Windows.Forms.Form
|
||||
{
|
||||
private System.Windows.Forms.StatusBar statusBar1;
|
||||
private System.Windows.Forms.ToolBar toolBar1;
|
||||
private System.Windows.Forms.TreeView treeView1;
|
||||
private System.Windows.Forms.TextBox textBox1;
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
|
@ -57,26 +61,18 @@ namespace Silverstone.Manticore.Toolkit
|
|||
//
|
||||
InitializeComponent();
|
||||
|
||||
/*
|
||||
StripBar bar = new StripBar();
|
||||
// bar.BackImage = Image.FromFile("resources\\manticore.png");
|
||||
this.Controls.Add(bar);
|
||||
bar.Location = new Point(0, 0);
|
||||
bar.Size = new Size(500, 75);
|
||||
|
||||
bar.Dock = DockStyle.Top;
|
||||
// bar.BackImage = Image.FromFile("resources\\manticore.png");
|
||||
this.Controls.Add(bar);
|
||||
|
||||
Band bnd = new Band();
|
||||
// bnd.BackColor = SystemColors.ControlDarkDark;
|
||||
bar.Bands.Add(bnd);
|
||||
StripBand bnd = new StripBand();
|
||||
bar.AddBand(bnd);
|
||||
|
||||
bnd = new Band();
|
||||
// bnd.BackColor = SystemColors.ControlLight;
|
||||
bnd.NewRow = true;
|
||||
bar.Bands.Add(bnd);
|
||||
|
||||
|
||||
//
|
||||
// TODO: Add any constructor code after InitializeComponent call
|
||||
//
|
||||
bnd = new StripBand();
|
||||
bar.AddBand(bnd);
|
||||
*/
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -101,10 +97,69 @@ namespace Silverstone.Manticore.Toolkit
|
|||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.Size = new System.Drawing.Size(300,300);
|
||||
this.Text = "TestForm";
|
||||
}
|
||||
this.statusBar1 = new System.Windows.Forms.StatusBar();
|
||||
this.toolBar1 = new System.Windows.Forms.ToolBar();
|
||||
this.treeView1 = new System.Windows.Forms.TreeView();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// statusBar1
|
||||
//
|
||||
this.statusBar1.Location = new System.Drawing.Point(0, 312);
|
||||
this.statusBar1.Name = "statusBar1";
|
||||
this.statusBar1.Size = new System.Drawing.Size(416, 22);
|
||||
this.statusBar1.TabIndex = 0;
|
||||
this.statusBar1.Text = "statusBar1";
|
||||
//
|
||||
// toolBar1
|
||||
//
|
||||
this.toolBar1.DropDownArrows = true;
|
||||
this.toolBar1.Name = "toolBar1";
|
||||
this.toolBar1.ShowToolTips = true;
|
||||
this.toolBar1.Size = new System.Drawing.Size(416, 39);
|
||||
this.toolBar1.TabIndex = 1;
|
||||
//
|
||||
// treeView1
|
||||
//
|
||||
this.treeView1.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right);
|
||||
this.treeView1.ImageIndex = -1;
|
||||
this.treeView1.Location = new System.Drawing.Point(0, 64);
|
||||
this.treeView1.Name = "treeView1";
|
||||
this.treeView1.SelectedImageIndex = -1;
|
||||
this.treeView1.Size = new System.Drawing.Size(416, 248);
|
||||
this.treeView1.TabIndex = 3;
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.textBox1.Location = new System.Drawing.Point(0, 39);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(416, 20);
|
||||
this.textBox1.TabIndex = 4;
|
||||
this.textBox1.Text = "textBox1";
|
||||
//
|
||||
// TestForm
|
||||
//
|
||||
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
|
||||
this.ClientSize = new System.Drawing.Size(416, 334);
|
||||
this.Controls.AddRange(new System.Windows.Forms.Control[] {
|
||||
this.textBox1,
|
||||
this.treeView1,
|
||||
this.toolBar1,
|
||||
this.statusBar1});
|
||||
this.Name = "TestForm";
|
||||
this.Text = "TestForm";
|
||||
this.Load += new System.EventHandler(this.TestForm_Load);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void TestForm_Load(object sender, System.EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,42 +1,102 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="ResMimeType">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="Version">
|
||||
<value>1.0.0.0</value>
|
||||
</resheader>
|
||||
<resheader name="Reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3102.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="Writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3102.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 1.3
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">1.3</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1">this is my long string</data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
[base64 mime encoded serialized .NET Framework object]
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
[base64 mime encoded string representing a byte array form of the .NET Framework object]
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>1.3</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="$this.Name">
|
||||
<value>TestForm</value>
|
||||
</data>
|
||||
</root>
|
|
@ -64,6 +64,9 @@ namespace Silverstone.Manticore.Toolkit
|
|||
mForm = aForm;
|
||||
mItems = new Hashtable();
|
||||
mBuilders = new Hashtable();
|
||||
|
||||
mMainMenu = new MainMenu();
|
||||
mForm.Menu = mMainMenu;
|
||||
}
|
||||
|
||||
public void Build()
|
||||
|
@ -74,9 +77,7 @@ namespace Silverstone.Manticore.Toolkit
|
|||
reader.WhitespaceHandling = WhitespaceHandling.None;
|
||||
reader.MoveToContent();
|
||||
|
||||
mMainMenu = new MainMenu();
|
||||
Recurse(reader, mMainMenu);
|
||||
mForm.Menu = mMainMenu;
|
||||
}
|
||||
|
||||
protected MenuItem mCurrentMenuItem;
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
|
||||
namespace Silverstone.Manticore.Toolkit
|
||||
{
|
||||
using System;
|
||||
|
@ -54,6 +55,16 @@ namespace Silverstone.Manticore.Toolkit
|
|||
protected Form mForm;
|
||||
|
||||
public Hashtable mItems;
|
||||
|
||||
// XXX band-set hack
|
||||
protected ToolBar mToolBar;
|
||||
public Rectangle Bounds
|
||||
{
|
||||
get
|
||||
{
|
||||
return mToolBar.Bounds;
|
||||
}
|
||||
}
|
||||
|
||||
public ToolbarBuilder(String aToolbarFile, Form aForm)
|
||||
{
|
||||
|
@ -61,6 +72,12 @@ namespace Silverstone.Manticore.Toolkit
|
|||
mForm = aForm;
|
||||
mItems = new Hashtable();
|
||||
|
||||
|
||||
// XXX band-set hack
|
||||
mToolBar = new ToolBar();
|
||||
mForm.Controls.Add(mToolBar);
|
||||
|
||||
/*
|
||||
// Initialize CoolBar
|
||||
mCoolBar = new AxCoolBar();
|
||||
AxHost host = mCoolBar as AxHost;
|
||||
|
@ -68,6 +85,7 @@ namespace Silverstone.Manticore.Toolkit
|
|||
host.Dock = DockStyle.Top;
|
||||
host.EndInit();
|
||||
mForm.Controls.Add(host);
|
||||
*/
|
||||
|
||||
// We can't build the CoolBar until after the window is visible
|
||||
mForm.VisibleChanged += new EventHandler(Build);
|
||||
|
@ -82,8 +100,6 @@ namespace Silverstone.Manticore.Toolkit
|
|||
|
||||
bool shouldBuildNewRow = true;
|
||||
|
||||
ToolBar currToolbar = null;
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
if (reader.NodeType == XmlNodeType.Element)
|
||||
|
@ -110,28 +126,27 @@ namespace Silverstone.Manticore.Toolkit
|
|||
bool visible = tbvalues[3] == "true";
|
||||
|
||||
// Create and add a new toolbar.
|
||||
currToolbar = new ToolBar();
|
||||
currToolbar.Appearance = ToolBarAppearance.Flat;
|
||||
currToolbar.ButtonClick += new ToolBarButtonClickEventHandler(this.OnCommand);
|
||||
mForm.Controls.Add(currToolbar);
|
||||
mToolBar.Appearance = ToolBarAppearance.Flat;
|
||||
mToolBar.ButtonClick += new ToolBarButtonClickEventHandler(this.OnCommand);
|
||||
mForm.Controls.Add(mToolBar);
|
||||
|
||||
//mCoolBar.Bands.Add(-1, key, label, new Object(), true, currToolbar, true);
|
||||
//mCoolBar.Bands.Add(-1, key, label, new Object(), true, mToolBar, true);
|
||||
|
||||
shouldBuildNewRow = false;
|
||||
break;
|
||||
case "toolbarseparator":
|
||||
{
|
||||
if (currToolbar != null)
|
||||
if (mToolBar != null)
|
||||
{
|
||||
ToolBarButton button = new ToolBarButton();
|
||||
button.Style = ToolBarButtonStyle.Separator;
|
||||
currToolbar.Buttons.Add(button);
|
||||
mToolBar.Buttons.Add(button);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "toolbarbutton":
|
||||
{
|
||||
if (currToolbar != null)
|
||||
if (mToolBar != null)
|
||||
{
|
||||
String[] tbbvalues = new String[3] {"", "", ""};
|
||||
String[] tbbnames = new String[3] {"label", "icon", "command"};
|
||||
|
@ -145,7 +160,7 @@ namespace Silverstone.Manticore.Toolkit
|
|||
|
||||
ToolBarButton button = new CommandButtonItem(tbbvalues[1]);
|
||||
button.Text = tbbvalues[0];
|
||||
currToolbar.Buttons.Add(button);
|
||||
mToolBar.Buttons.Add(button);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче