зеркало из https://github.com/mozilla/pjs.git
[Manticore]
begin work implementing new toolbar widget, 'StripBar' NOT PART OF BUILD
This commit is contained in:
Родитель
b24141f1ac
Коммит
c046e22d72
|
@ -345,6 +345,26 @@
|
|||
SubType = "Component"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "toolkit\StripBar.cs"
|
||||
SubType = "UserControl"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "toolkit\TestForm.cs"
|
||||
SubType = "Form"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "toolkit\TestForm.resx"
|
||||
DependentUpon = "TestForm.cs"
|
||||
BuildAction = "EmbeddedResource"
|
||||
/>
|
||||
<File
|
||||
RelPath = "toolkit\ThemeStuff.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "toolkit\toolkit.menus.cs"
|
||||
SubType = "Component"
|
||||
|
|
|
@ -315,6 +315,10 @@ namespace Silverstone.Manticore.Browser
|
|||
case "file-save-as":
|
||||
SavePageAs();
|
||||
break;
|
||||
case "file-save-form":
|
||||
TestForm frm = new TestForm();
|
||||
frm.Show();
|
||||
break;
|
||||
case "file-exit":
|
||||
Quit();
|
||||
break;
|
||||
|
|
|
@ -88,7 +88,7 @@ namespace Silverstone.Manticore.Core
|
|||
ssfSYSTEM = 0x25,
|
||||
ssfPROGRAMFILES = 0x26,
|
||||
ssfMYPICTURES = 0x27,
|
||||
ssfPROFILE = 0x28,
|
||||
ssfPROFILE = 0x28
|
||||
}
|
||||
|
||||
public static String GetFolderPath(SpecialFolders aFolder)
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
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("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "Manticore Setup", "setup\setup.vdproj", "{4DF4B4EB-82EE-42E9-AB29-564908D0745A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
ConfigName.0 = Debug
|
||||
|
@ -15,10 +13,6 @@ 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
|
||||
{4DF4B4EB-82EE-42E9-AB29-564908D0745A}.Debug.ActiveCfg = Debug
|
||||
{4DF4B4EB-82EE-42E9-AB29-564908D0745A}.Debug.Build.0 = Debug
|
||||
{4DF4B4EB-82EE-42E9-AB29-564908D0745A}.Release.ActiveCfg = Release
|
||||
{4DF4B4EB-82EE-42E9-AB29-564908D0745A}.Release.Build.0 = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
|
|
|
@ -72,7 +72,6 @@ namespace Silverstone.Manticore.Toolkit
|
|||
return mRoot;
|
||||
}
|
||||
set {
|
||||
Console.WriteLine(value);
|
||||
mRoot = value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,360 @@
|
|||
|
||||
namespace Silverstone.Manticore.Toolkit
|
||||
{
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
/// <summary>
|
||||
/// Summary description for StripBar.
|
||||
/// </summary>
|
||||
public class StripBar : UserControl
|
||||
{
|
||||
public StripBar()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
uint count = Bands.Count;
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
if (e.ClipRectangle.IntersectsWith(Bands[i].Bounds))
|
||||
{
|
||||
Bands[i].PaintBand(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
mBandsList.Add(aBand);
|
||||
}
|
||||
|
||||
public void Remove (Band aBand)
|
||||
{
|
||||
mBandsList.Remove(aBand);
|
||||
aBand.Owner = null;
|
||||
}
|
||||
|
||||
public void Clear ()
|
||||
{
|
||||
mBandsList.Clear();
|
||||
}
|
||||
|
||||
public uint Count
|
||||
{
|
||||
get
|
||||
{
|
||||
return (uint) mBandsList.Count;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class Band
|
||||
{
|
||||
public Band()
|
||||
{
|
||||
}
|
||||
|
||||
protected StripBar mOwner;
|
||||
public StripBar Owner
|
||||
{
|
||||
get
|
||||
{
|
||||
return mOwner;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != mOwner)
|
||||
{
|
||||
mOwner = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected Rectangle mBounds;
|
||||
public Rectangle Bounds
|
||||
{
|
||||
get
|
||||
{
|
||||
return mBounds;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != mBounds)
|
||||
{
|
||||
mBounds = value;
|
||||
if (mOwner != null)
|
||||
mOwner.Invalidate(Bounds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected Color mForeColor = SystemColors.ControlText;
|
||||
public Color ForeColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return mForeColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != mForeColor)
|
||||
{
|
||||
mForeColor = value;
|
||||
// XXX improve this to invalidate only the label
|
||||
if (mOwner != null)
|
||||
mOwner.Invalidate(Bounds);
|
||||
}
|
||||
}
|
||||
}
|
||||
protected Color mBackColor = Color.Transparent;
|
||||
public Color BackColor
|
||||
{
|
||||
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";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected bool mNewRow = true;
|
||||
public bool NewRow
|
||||
{
|
||||
get
|
||||
{
|
||||
return mNewRow;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != mNewRow)
|
||||
{
|
||||
mNewRow = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected bool mVisible = true;
|
||||
public bool Visible
|
||||
{
|
||||
get
|
||||
{
|
||||
return mVisible;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != mVisible)
|
||||
{
|
||||
mVisible = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void PaintBand(PaintEventArgs e)
|
||||
{
|
||||
Graphics g = e.Graphics;
|
||||
SolidBrush br = new SolidBrush(mBackColor);
|
||||
g.FillRectangle(br, Bounds);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
using System;
|
||||
using System.Drawing;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Silverstone.Manticore.Toolkit
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for TestForm.
|
||||
/// </summary>
|
||||
public class TestForm : System.Windows.Forms.Form
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.Container components = null;
|
||||
|
||||
public TestForm()
|
||||
{
|
||||
//
|
||||
// Required for Windows Form Designer support
|
||||
//
|
||||
InitializeComponent();
|
||||
|
||||
StripBar bar = new StripBar();
|
||||
this.Controls.Add(bar);
|
||||
bar.Location = new Point(0, 0);
|
||||
bar.Size = new Size(200, 75);
|
||||
|
||||
Band bnd = new Band();
|
||||
bnd.Bounds = new Rectangle(0, 0, 200, 75);
|
||||
bnd.BackColor = SystemColors.ControlDarkDark;
|
||||
bar.Bands.Add(bnd);
|
||||
|
||||
|
||||
|
||||
//
|
||||
// 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.components = new System.ComponentModel.Container();
|
||||
this.Size = new System.Drawing.Size(300,300);
|
||||
this.Text = "TestForm";
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
<?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>
|
|
@ -0,0 +1,63 @@
|
|||
|
||||
namespace Silverstone.Manticore.Toolkit
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
public class ThemeStuff
|
||||
{
|
||||
[DllImport("uxtheme.dll")]
|
||||
public static extern IntPtr OpenThemeData(IntPtr aHWnd, string aClassList);
|
||||
|
||||
[DllImport("uxtheme.dll")]
|
||||
public static extern IntPtr CloseThemeData(IntPtr aHTheme);
|
||||
|
||||
public static int TS_NORMAL = 1;
|
||||
public static int TS_HOVER = 2;
|
||||
public static int TS_ACTIVE = 3;
|
||||
public static int TS_DISABLED = 4;
|
||||
public static int TS_FOCUSED = 5;
|
||||
|
||||
public static int BP_BUTTON = 1;
|
||||
public static int BP_RADIO = 2;
|
||||
public static int BP_CHECKBOX = 3;
|
||||
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public struct Rect
|
||||
{
|
||||
[FieldOffset(0)] public int left;
|
||||
[FieldOffset(4)] public int top;
|
||||
[FieldOffset(8)] public int right;
|
||||
[FieldOffset(12)] public int bottom;
|
||||
}
|
||||
|
||||
[DllImport("uxtheme.dll")]
|
||||
public static extern IntPtr DrawThemeBackground(IntPtr aHTheme, IntPtr aHDC,
|
||||
int aPartID, int aStateID,
|
||||
ref Rect aRect, ref Rect aClipRect);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
IntPtr hTheme = ThemeStuff.OpenThemeData(Handle, "Button");
|
||||
IntPtr hDC = e.Graphics.GetHdc();
|
||||
|
||||
ThemeStuff.Rect rect = new ThemeStuff.Rect();
|
||||
rect.left = ClientRectangle.Left;
|
||||
rect.top = ClientRectangle.Top;
|
||||
rect.bottom = ClientRectangle.Bottom;
|
||||
rect.right = ClientRectangle.Right;
|
||||
|
||||
Rectangle clipRectangle = e.ClipRectangle;
|
||||
ThemeStuff.Rect clipRect = new ThemeStuff.Rect();
|
||||
clipRect.left = clipRectangle.Left;
|
||||
clipRect.top = clipRectangle.Top;
|
||||
clipRect.bottom = clipRectangle.Bottom;
|
||||
clipRect.right = clipRectangle.Right;
|
||||
|
||||
ThemeStuff.DrawThemeBackground(hTheme, hDC, ThemeStuff.BP_BUTTON,
|
||||
ThemeStuff.TS_HOVER, ref rect, ref clipRect);
|
||||
|
||||
e.Graphics.ReleaseHdc(hDC);
|
||||
ThemeStuff.CloseThemeData(hTheme);
|
||||
*/
|
Загрузка…
Ссылка в новой задаче