//-----------------------------------------------------------------------------
// wx.NET/Utils - WxStatusBarObject.cs
//
// wx.NET "WxStatusBarObject".
//
// Written by Alexander Olk (xenomorph2@onlinehome.de)
// (C) 2004 Alexander Olk
// Licensed under the wxWidgets license, see LICENSE.txt for details.
//
// $Id: WxStatusBarObject.cs,v 1.2 2004/06/08 05:10:01 t9mike Exp $
//-----------------------------------------------------------------------------
using System;
using System.Xml;
using System.Collections;
using System.Collections.Specialized;
using System.Text;
namespace wx.ToWxNet{
public class WxStatusBarObject : WxObjectBase
{
public override void GenerateCSharpCode()
{
StringBuilder ctorline = new StringBuilder();
ctorline.Append( "\t\t\t" + name + " = CreateStatusBar( " );
ctorline.Append( objects.Count + ", " );
ctorline.Append( CorrectStyle( "0" ) );
ctorline.Append( " );" );
ctorlines.Add( ctorline.ToString() );
StringBuilder propertyline = new StringBuilder();
StringBuilder fields = new StringBuilder();
for ( int i = 0; i < objects.Count; i++ )
{
WxStatusBarFieldsObject wbf = (WxStatusBarFieldsObject)objects[i];
fields.Append( wbf.width );
if ( i < objects.Count - 1 )
{
fields.Append( ", " );
}
}
propertylines.Add( "\t\t\tint[] " + name + "_widths = { " + fields.ToString() + " };" );
propertyline.Append( "\t\t\t" + name + ".SetStatusWidths( " + objects.Count + ", " + name + "_widths );" );
propertylines.Add( propertyline.ToString() );
for ( int i = 0; i < objects.Count; i++ )
{
WxStatusBarFieldsObject wbf = (WxStatusBarFieldsObject)objects[i];
propertyline = new StringBuilder();
propertyline.Append( "\t\t\t" + name + ".SetStatusText( \"" + wbf.label + "\", " + i + " );" );
propertylines.Add( propertyline.ToString() );
}
}
//---------------------------------------------------------------------
public override void GenerateBasicCode()
{
StringBuilder ctorline = new StringBuilder();
ctorline.Append( "\t\t\t" + name + " = CreateStatusBar( " );
ctorline.Append( objects.Count + ", " );
ctorline.Append( CorrectStyle( "0" ) );
ctorline.Append( " )" );
ctorlines.Add( ctorline.ToString() );
StringBuilder propertyline = new StringBuilder();
StringBuilder fields = new StringBuilder();
for ( int i = 0; i < objects.Count; i++ )
{
WxStatusBarFieldsObject wbf = (WxStatusBarFieldsObject)objects[i];
fields.Append( wbf.width );
if ( i < objects.Count - 1 )
{
fields.Append( ", " );
}
}
propertylines.Add( "\t\t\tDim " + name + "_widths() As Integer = { " + fields.ToString() + " }" );
propertyline.Append( "\t\t\t" + name + ".SetStatusWidths( " + objects.Count + ", " + name + "_widths )" );
propertylines.Add( propertyline.ToString() );
for ( int i = 0; i < objects.Count; i++ )
{
WxStatusBarFieldsObject wbf = (WxStatusBarFieldsObject)objects[i];
propertyline = new StringBuilder();
propertyline.Append( "\t\t\t" + name + ".SetStatusText( \"" + wbf.label + "\", " + i + " )" );
propertylines.Add( propertyline.ToString() );
}
}
}
//---------------------------------------------------------------------
public class WxStatusBarFieldsObject : WxObjectBase
{
}
}
|