Browse Source

Python forms designer can now load a SplitContainer containing child controls.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@4610 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Matt Ward 16 years ago
parent
commit
1f138f6e87
  1. 4
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonControlFieldExpression.cs
  2. 86
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadSplitContainerTestFixture.cs
  3. 1
      src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonBinding.Tests.csproj

4
src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonControlFieldExpression.cs

@ -340,14 +340,12 @@ namespace ICSharpCode.PythonBinding @@ -340,14 +340,12 @@ namespace ICSharpCode.PythonBinding
/// <summary>
/// Gets the member that matches the last item in the memberNames array.
/// </summary>
/// <param name="obj"></param>
/// <param name="memberNames"></param>
/// <param name="startIndex">The point at which to start looking in the memberNames.</param>
/// <param name="endIndex">The last memberNames item to look at.</param>
static object GetMember(object obj, string[] memberNames, int startIndex, int endIndex)
{
Type type = obj.GetType();
for (int i = startIndex; i <= endIndex; ++i) {
Type type = obj.GetType();
string name = memberNames[i];
BindingFlags propertyBindingFlags = BindingFlags.Public | BindingFlags.GetField | BindingFlags.Static | BindingFlags.Instance;
PropertyInfo property = type.GetProperty(name, propertyBindingFlags);

86
src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadSplitContainerTestFixture.cs

@ -0,0 +1,86 @@ @@ -0,0 +1,86 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using ICSharpCode.PythonBinding;
using NUnit.Framework;
using PythonBinding.Tests.Utils;
namespace PythonBinding.Tests.Designer
{
[TestFixture]
public class LoadSplitContainerTestFixture : LoadFormTestFixtureBase
{
public override string PythonCode {
get {
return "class MainForm(System.Windows.Forms.Form):\r\n" +
" def InitializeComponent(self):\r\n" +
" self._splitContainer1 = System.Windows.Forms.SplitContainer()\r\n" +
" self._treeView1 = System.Windows.Forms.TreeView()\r\n" +
" self._propertyGrid1 = System.Windows.Forms.PropertyGrid()\r\n" +
" self.SuspendLayout()\r\n" +
" # \r\n" +
" # splitContainer1\r\n" +
" # \r\n" +
" self._splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill\r\n" +
" self._splitContainer1.Location = System.Drawing.Point(0, 0)\r\n" +
" self._splitContainer1.Name = \"splitContainer1\"\r\n" +
" self._splitContainer1.Panel1.Controls.Add(self._treeView1)\r\n" +
" self._splitContainer1.Panel2.Controls.Add(self._propertyGrid1)\r\n" +
" self._splitContainer1.Size = System.Drawing.Size(284, 264)\r\n" +
" self._splitContainer1.SplitterDistance = 94\r\n" +
" self._splitContainer1.TabIndex = 0\r\n" +
" # \r\n" +
" # treeView1\r\n" +
" # \r\n" +
" self._treeView1.Dock = System.Windows.Forms.DockStyle.Fill\r\n" +
" self._treeView1.Location = System.Drawing.Point(0, 0)\r\n" +
" self._treeView1.Name = \"treeView1\"\r\n" +
" self._treeView1.Size = System.Drawing.Size(94, 264)\r\n" +
" self._treeView1.TabIndex = 0\r\n" +
" # \r\n" +
" # propertyGrid1\r\n" +
" # \r\n" +
" self._propertyGrid1.Dock = System.Windows.Forms.DockStyle.Fill\r\n" +
" self._propertyGrid1.Location = System.Drawing.Point(0, 0)\r\n" +
" self._propertyGrid1.Name = \"propertyGrid1\"\r\n" +
" self._propertyGrid1.Size = System.Drawing.Size(186, 264)\r\n" +
" self._propertyGrid1.TabIndex = 0\r\n" +
" # \r\n" +
" # MainForm\r\n" +
" # \r\n" +
" self.ClientSize = System.Drawing.Size(284, 264)\r\n" +
" self.Controls.Add(self._splitContainer1)\r\n" +
" self.Name = \"MainForm\"\r\n" +
" self.ResumeLayout(False)\r\n" +
" self.PerformLayout()\r\n";
}
}
SplitContainer SplitContainer {
get { return Form.Controls[0] as SplitContainer; }
}
[Test]
public void TreeViewAddedToSplitContainer()
{
Assert.IsInstanceOf(typeof(TreeView), SplitContainer.Panel1.Controls[0]);
}
[Test]
public void PropertyGridAddedToSplitContainer()
{
Assert.IsInstanceOf(typeof(PropertyGrid), SplitContainer.Panel2.Controls[0]);
}
}
}

1
src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonBinding.Tests.csproj

@ -251,6 +251,7 @@ @@ -251,6 +251,7 @@
<Compile Include="Designer\LoadMonthCalendarTestFixture.cs" />
<Compile Include="Designer\LoadSimpleFormTestFixture.cs" />
<Compile Include="Designer\LoadSimpleUserControlTestFixture.cs" />
<Compile Include="Designer\LoadSplitContainerTestFixture.cs" />
<Compile Include="Designer\LoadTextBoxOnPanelTestFixture.cs" />
<Compile Include="Designer\LoadTextBoxTestFixture.cs" />
<Compile Include="Designer\LoadTimerTestFixture.cs" />

Loading…
Cancel
Save