//-----------------------------------------------------------------------------
// wx.NET/Utils - WxCheckListBoxObject.cs
//
// wx.NET "WxCheckListBoxObject".
//
// Written by Alexander Olk (xenomorph2@onlinehome.de)
// (C) 2004 Alexander Olk
// Licensed under the wxWidgets license, see LICENSE.txt for details.
//
// $Id: WxCheckListBoxObject.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 WxCheckListBoxObject : WxObjectBase
{
public ArrayList ischecked = new ArrayList();
public override void GenerateCSharpCode()
{
StringBuilder ctorline = new StringBuilder();
ctorline.Append( "\t\t\t" + name + " = new " + classname + "( " + GetParent( parent ) );
ctorline.Append( id.Length > 0 ? ", " + "(int)Cmd." + id : "-1" );
ctorline.Append( " );" );
ctorlines.Add( ctorline.ToString() );
if ( style.Length > 0 )
{
ctorline = new StringBuilder();
ctorline.Append( "\t\t\t" + name + ".StyleFlags = " + CorrectStyle( "0" ) + ";" );
ctorlines.Add( ctorline.ToString() );
}
int number = 0;
if ( checkListBoxItems.Count > 0 )
{
foreach ( string s in checkListBoxItems )
{
string tmp = s;
if ( tmp.StartsWith( "#" ) )
{
tmp = tmp.Remove( 0, 1 );
ischecked.Add( number );
}
ctorline.Append( "\t\t\t" + name + ".Append( \"" + tmp + "\" );" );
ctorlines.Add( ctorline.ToString() );
number++;
}
foreach ( int n in ischecked)
{
ctorline.Append( "\t\t\t" + name + ".Check( " + n.ToString() + ");" );
ctorlines.Add( ctorline.ToString() );
}
}
}
//---------------------------------------------------------------------
public override void GenerateBasicCode()
{
StringBuilder ctorline = new StringBuilder();
ctorline.Append( "\t\t\t" + name + " = New " + classname + "( " + GetParent( parent ) );
ctorline.Append( id.Length > 0 ? ", Cmd." + id : "-1" );
ctorline.Append( " )" );
ctorlines.Add( ctorline.ToString() );
if ( style.Length > 0 )
{
ctorline = new StringBuilder();
ctorline.Append( "\t\t\t" + name + ".StyleFlags = " + CorrectStyle( "0" ) );
ctorlines.Add( ctorline.ToString() );
}
int number = 0;
if ( checkListBoxItems.Count > 0 )
{
foreach ( string s in checkListBoxItems )
{
string tmp = s;
if ( tmp.StartsWith( "#" ) )
{
tmp = tmp.Remove( 0, 1 );
ischecked.Add( number );
}
ctorline = new StringBuilder();
ctorline.Append( "\t\t\t" + name + ".Append( \"" + tmp + "\" )" );
ctorlines.Add( ctorline.ToString() );
number++;
}
foreach ( int n in ischecked)
{
ctorline = new StringBuilder();
ctorline.Append( "\t\t\t" + name + ".Check( " + n.ToString() + ")" );
ctorlines.Add( ctorline.ToString() );
}
}
}
}
}
|