//-----------------------------------------------------------------------------
// wx.NET/Utils - WxToolBarObject.cs
//
// wx.NET "WxToolBarObject".
//
// Written by Alexander Olk (xenomorph2@onlinehome.de)
// (C) 2004 Alexander Olk
// Licensed under the wxWidgets license, see LICENSE.txt for details.
//
// $Id: WxToolBarObject.cs,v 1.3 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 WxToolBarObject : WxObjectBase
{
public override void GenerateCSharpCode()
{
StringBuilder ctorline = new StringBuilder();
ctorline.Append( "\t\t\t" + name + " = CreateToolBar( " + CorrectStyle( "0" ) + " );" );
ctorlines.Add( ctorline.ToString() );
foreach ( WxToolBarToolObject tbt in objects )
{
ctorline = new StringBuilder();
if ( ! tbt.isSeparator )
{
// xrc name of the first bitmap is bitmap and not bitmap1
if ( tbt.bitmap1.Length == 0 )
tbt.bitmap1 = tbt.bitmap;
ctorline.Append( "\t\t\t" + name + ".AddTool( " );
ctorline.Append( tbt.id.Length > 0 ? "(int)Cmd." + tbt.id : "-1" );
ctorline.Append( ", \"" + tbt.label +"\", " );
ctorline.Append( tbt.bitmap1.Length > 0 ? "new wx.Bitmap( \"" + tbt.bitmap1 + "\", BitmapType.wxBITMAP_TYPE_ANY )" : "NullObjects.wxNullBitmap" );
ctorline.Append( ", " );
ctorline.Append( tbt.bitmap2.Length > 0 ? "new wx.Bitmap( \"" + tbt.bitmap2 + "\", BitmapType.wxBITMAP_TYPE_ANY )" : "NullObjects.wxNullBitmap" );
ctorline.Append( ", " );
ctorline.Append( tbt.style.Length > 0 ? tbt.style : "ItemKind.wxITEM_NORMAL" );
ctorline.Append( ", \"" + tbt.short_help + "\", \"" + tbt.long_help + "\", null );" );
}
else
{
ctorline.Append( "\t\t\t" + name + ".AddSeparator();" );
}
ctorlines.Add( ctorline.ToString() );
}
ctorline = new StringBuilder();
ctorline.Append( "\t\t\t" + name + ".Realize();" );
ctorlines.Add( ctorline.ToString() );
}
//---------------------------------------------------------------------
public override void GenerateBasicCode()
{
StringBuilder ctorline = new StringBuilder();
ctorline.Append( "\t\t\t" + name + " = CreateToolBar( " + CorrectStyle( "0" ) + " )" );
ctorlines.Add( ctorline.ToString() );
foreach ( WxToolBarToolObject tbt in objects )
{
ctorline = new StringBuilder();
if ( ! tbt.isSeparator )
{
// xrc name of the first bitmap is bitmap and not bitmap1
if ( tbt.bitmap1.Length == 0 )
tbt.bitmap1 = tbt.bitmap;
ctorline.Append( "\t\t\t" + name + ".AddTool( " );
ctorline.Append( tbt.id.Length > 0 ? tbt.id : "-1" );
ctorline.Append( ", \"" + tbt.label +"\", " );
ctorline.Append( tbt.bitmap1.Length > 0 ? "new wx.Bitmap( \"" + tbt.bitmap1 + "\", BitmapType.wxBITMAP_TYPE_ANY )" : "NullObjects.wxNullBitmap" );
ctorline.Append( ", " );
ctorline.Append( tbt.bitmap2.Length > 0 ? "new wx.Bitmap( \"" + tbt.bitmap2 + "\", BitmapType.wxBITMAP_TYPE_ANY )" : "NullObjects.wxNullBitmap" );
ctorline.Append( ", " );
ctorline.Append( tbt.style.Length > 0 ? tbt.style : "ItemKind.wxITEM_NORMAL" );
ctorline.Append( ", \"" + tbt.short_help + "\", \"" + tbt.long_help + "\", Nothing )" );
}
else
{
ctorline.Append( "\t\t\t" + name + ".AddSeparator()" );
}
ctorlines.Add( ctorline.ToString() );
}
ctorline = new StringBuilder();
ctorline.Append( "\t\t\t" + name + ".Realize()" );
ctorlines.Add( ctorline.ToString() );
}
}
//---------------------------------------------------------------------
public class WxToolBarToolObject : WxObjectBase
{
public bool isSeparator = false;
}
}
|