//-----------------------------------------------------------------------------
// wx.NET/Utils - WxComboBoxObject.cs
//
// wx.NET "WxComboBoxObject".
//
// Written by Alexander Olk (xenomorph2@onlinehome.de)
// (C) 2004 Alexander Olk
// Licensed under the wxWidgets license, see LICENSE.txt for details.
//
// $Id: WxComboBoxObject.cs,v 1.5 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 WxComboBoxObject : 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( ", \"" + value + "\", wxDefaultPosition, wxDefaultSize, " );
ctorline.Append( name + "_choices, " );
ctorline.Append( CorrectStyle( "ComboBox.wxCB_DROPDOWN" ) );
ctorline.Append( " );" );
ctorlines.Add( ctorline.ToString() );
AddProperties( propertylines );
if ( selection.Length > 0 )
{
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( ", \"" + value + "\", wxDefaultPosition, wxDefaultSize, " );
ctorline.Append( name + "_choices, " );
ctorline.Append( CorrectStyle( "ComboBox.wxCB_DROPDOWN" ) );
ctorline.Append( " )" );
ctorlines.Add( ctorline.ToString() );
AddProperties( propertylines );
if ( selection.Length > 0 )
{
StringBuilder propertyline = new StringBuilder();
propertyline.Append( "\t\t\t" + name + ".Selection = " + selection + "" );
propertylines.Add( propertyline.ToString() );
}
}
}
}
|