//-----------------------------------------------------------------------------
// wx.NET/Utils - WxRadioBoxObject.cs
//
// wx.NET "WxRadioBoxObject".
//
// Written by Alexander Olk (xenomorph2@onlinehome.de)
// (C) 2004 Alexander Olk
// Licensed under the wxWidgets license, see LICENSE.txt for details.
//
// $Id: WxRadioBoxObject.cs,v 1.4 2004/06/14 19:56:36 t9mike Exp $
//-----------------------------------------------------------------------------
using System;
using System.Xml;
using System.Collections;
using System.Collections.Specialized;
using System.Text;
namespace wx.ToWxNet{
public class WxRadioBoxObject : WxObjectBase
{
public override void GenerateCSharpCode()
{
StringBuilder ctorline = new StringBuilder();
ctorline.Append( "\t\t\tstring[] " + name + "_choices =" );
ctorlines.Add( ctorline.ToString() );
ctorline = new StringBuilder();
ctorline.Append( "\t\t\t{" );
ctorlines.Add( ctorline.ToString() );
for ( int i = 0; i < choices.Count; i++ )
{
ctorline = new StringBuilder();
ctorline.Append( "\t\t\t\t\"" + choices[i] + "\"" );
if ( i < choices.Count - 1 )
ctorline.Append( "," );
ctorlines.Add( ctorline.ToString() );
}
ctorline = new StringBuilder();
ctorline.Append( "\t\t\t};" );
ctorlines.Add( ctorline.ToString() );
ctorline = new StringBuilder();
ctorline.Append( "\t\t\t" + name + " = new " + classname + "( " + GetParent( parent ) + ", " );
ctorline.Append( id.Length > 0 ? "(int)Cmd." + id : "-1" );
ctorline.Append( ", \"" + label + "\", wxDefaultPosition, wxDefaultSize, " );
ctorline.Append( name + "_choices, " + dimension + ", " + CorrectStyle( "RadioBox.wxRA_SPECIFY_ROWS" ) + " );" );
ctorlines.Add( ctorline.ToString() );
AddProperties( propertylines );
StringBuilder propertyline = new StringBuilder();
propertyline.Append( "\t\t\t" + name + ".Selection = " + selection + ";" );
propertylines.Add( propertyline.ToString() );
}
//---------------------------------------------------------------------
public override void GenerateBasicCode()
{
StringBuilder ctorline = new StringBuilder();
ctorline.Append( "\t\t\tDim " + name + "_choices As String() = _" );
ctorlines.Add( ctorline.ToString() );
ctorline = new StringBuilder();
ctorline.Append( "\t\t\t{ _" );
ctorlines.Add( ctorline.ToString() );
for ( int i = 0; i < choices.Count; i++ )
{
ctorline = new StringBuilder();
ctorline.Append( "\t\t\t\t\"" + choices[i] + "\"" );
if ( i < choices.Count - 1 )
ctorline.Append( "," );
ctorline.Append(" _");
ctorlines.Add( ctorline.ToString() );
}
ctorline = new StringBuilder();
ctorline.Append( "\t\t\t}" );
ctorlines.Add( ctorline.ToString() );
// array end
ctorline = new StringBuilder();
ctorline.Append( "\t\t\t" + name + " = New " + classname + "( " + GetParent( parent ) + ", " );
ctorline.Append( id.Length > 0 ? "Cmd." + id : "-1" );
ctorline.Append( ", \"" + label + "\", wxDefaultPosition, wxDefaultSize, " );
ctorline.Append( name + "_choices, " + dimension + ", " + CorrectStyle( "RadioBox.wxRA_SPECIFY_ROWS" ) + " )" );
ctorlines.Add( ctorline.ToString() );
AddProperties( propertylines );
StringBuilder propertyline = new StringBuilder();
propertyline.Append( "\t\t\t" + name + ".Selection = " + selection );
propertylines.Add( propertyline.ToString() );
}
}
}
|