Browse Source

Python forms designer now generating AnchorStyles properties.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@4746 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Matt Ward 16 years ago
parent
commit
96098e5761
  1. 25
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCodeDomSerializer.cs
  2. 2
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GeneratePanelFormTestFixture.cs

25
src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonCodeDomSerializer.cs

@ -155,6 +155,8 @@ namespace ICSharpCode.PythonBinding @@ -155,6 +155,8 @@ namespace ICSharpCode.PythonBinding
AppendDelegateCreateExpression((CodeDelegateCreateExpression)expression);
} else if (expression is CodeCastExpression) {
AppendCastExpression((CodeCastExpression)expression);
} else if (expression is CodeBinaryOperatorExpression) {
AppendBinaryOperatorExpression((CodeBinaryOperatorExpression)expression);
} else {
Console.WriteLine("AppendExpression: " + expression.GetType().Name);
}
@ -371,6 +373,27 @@ namespace ICSharpCode.PythonBinding @@ -371,6 +373,27 @@ namespace ICSharpCode.PythonBinding
return attributes[typeof(InheritanceAttribute)] as InheritanceAttribute;
}
return null;
}
}
/// <summary>
/// Appends expressions like "AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top"
/// </summary>
void AppendBinaryOperatorExpression(CodeBinaryOperatorExpression expression)
{
AppendExpression(expression.Left);
AppendBinaryOperator(expression.Operator);
AppendExpression(expression.Right);
}
void AppendBinaryOperator(CodeBinaryOperatorType operatorType)
{
codeBuilder.Append(" ");
switch (operatorType) {
case CodeBinaryOperatorType.BitwiseOr:
codeBuilder.Append("|");
break;
}
codeBuilder.Append(" ");
}
}
}

2
src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GeneratePanelFormTestFixture.cs

@ -39,6 +39,7 @@ namespace PythonBinding.Tests.Designer @@ -39,6 +39,7 @@ namespace PythonBinding.Tests.Designer
Panel panel = (Panel)host.CreateComponent(typeof(Panel), "panel1");
panel.Location = new Point(10, 15);
panel.Anchor = AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
panel.TabIndex = 0;
panel.Size = new Size(100, 120);
TextBox textBox = (TextBox)host.CreateComponent(typeof(TextBox), "textBox1");
@ -74,6 +75,7 @@ namespace PythonBinding.Tests.Designer @@ -74,6 +75,7 @@ namespace PythonBinding.Tests.Designer
" # \r\n" +
" # panel1\r\n" +
" # \r\n" +
" self._panel1.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right\r\n" +
" self._panel1.Controls.Add(self._textBox1)\r\n" +
" self._panel1.Location = System.Drawing.Point(10, 15)\r\n" +
" self._panel1.Name = \"panel1\"\r\n" +

Loading…
Cancel
Save