//-----------------------------------------------------------------------------
// wx.NET/Utils - WxSizerObject.cs
//
// wx.NET "WxSizerObject".
//
// Written by Alexander Olk (xenomorph2@onlinehome.de)
// (C) 2004 Alexander Olk
// Licensed under the wxWidgets license, see LICENSE.txt for details.
//
// $Id: WxSizerObject.cs,v 1.5 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 WxBoxSizerObject : WxObjectBase
{
public override void GenerateCSharpCode()
{
StringBuilder layoutline = new StringBuilder();
layoutlines.Add( " " );
if ( ! hasReference )
{
layoutline.Append( "\t\t\t" + classname + " " + name + " = new " + classname + "( " );
}
else
{
layoutline.Append( "\t\t\t" + name + " = new " + classname + "( " );
}
layoutline.Append( "Orientation." + orientation );
layoutline.Append( " );" );
layoutlines.Add( layoutline.ToString() );
foreach ( WxSizerItemObject sio in objects )
{
if ( sio.objects[0] != null )
{
WxObjectBase ob = null;
layoutline = new StringBuilder();
layoutline.Append( "\t\t\t" + name + ".Add( " );
ob = (WxObjectBase)sio.objects[0];
// Notebook needs NoteBookSizer
if ( ob.GetType() == typeof( WxNotebookObject ) )
{
layoutline.Append( "new NotebookSizer( " + ob.name + " )" );
}
else
if ( ob.GetType() == typeof( WxSpacerObject ) )
{
layoutline.Append( ob.width + ", " + ob.height );
}
else
{
layoutline.Append( ob.name );
}
if ( sio.option.Length == 0 )
sio.option = "0";
layoutline.Append( ", " + sio.option + ", " );
layoutline.Append( ( sio.flag.Length > 0 ? CorrectStyleSizer( sio.flag, "0" ) : "0" ) );
if ( sio.border.Length == 0 )
sio.border = "0";
layoutline.Append( ", " + sio.border + " );" );
layoutlines.Add( layoutline.ToString() );
}
}
if ( parent.GetType() == typeof( WxPanelObject ) ||
parent.GetType() == typeof( WxFrameObject ) ||
parent.GetType() == typeof( WxTopLevelPanel ) ||
parent.GetType() == typeof( WxTopLevelScrolledWindow ) ||
parent.GetType() == typeof( WxDialogObject ) )
{
string pp = parent.name;
if ( parent.GetType() == typeof( WxFrameObject ) ||
parent.GetType() == typeof( WxTopLevelPanel ) ||
parent.GetType() == typeof( WxTopLevelScrolledWindow ) ||
parent.GetType() == typeof( WxDialogObject ) )
{
pp = "this";
}
layoutline = new StringBuilder();
layoutline.Append( "\t\t\t" + name + ".Fit( " + pp + " );" );
layoutlines.Add( layoutline.ToString() );
layoutline = new StringBuilder();
layoutline.Append( "\t\t\t" + name + ".SetSizeHints( " + pp + " );" );
layoutlines.Add( layoutline.ToString() );
}
}
//---------------------------------------------------------------------
public override void GenerateBasicCode()
{
StringBuilder layoutline = new StringBuilder();
layoutlines.Add( " " );
if ( ! hasReference )
{
layoutline.Append( "\t\t\tDim " + name + " As New " + classname + "( " );
}
else
{
layoutline.Append( "\t\t\t" + name + " = New " + classname + "( " );
}
layoutline.Append( "Orientation." + orientation );
layoutline.Append( " )" );
layoutlines.Add( layoutline.ToString() );
foreach ( WxSizerItemObject sio in objects )
{
if ( sio.objects[0] != null )
{
WxObjectBase ob = null;
layoutline = new StringBuilder();
layoutline.Append( "\t\t\t" + name + ".Add( " );
ob = (WxObjectBase)sio.objects[0];
// Notebook needs NoteBookSizer
if ( ob.GetType() == typeof( WxNotebookObject ) )
{
layoutline.Append( "New NotebookSizer( " + ob.name + " )" );
}
else
if ( ob.GetType() == typeof( WxSpacerObject ) )
{
layoutline.Append( ob.width + ", " + ob.height );
}
else
{
layoutline.Append( ob.name );
}
if ( sio.option.Length == 0 )
sio.option = "0";
layoutline.Append( ", " + sio.option + ", " );
layoutline.Append( ( sio.flag.Length > 0 ? CorrectStyleSizer( sio.flag, "0" ) : "0" ) );
if ( sio.border.Length == 0 )
sio.border = "0";
layoutline.Append( ", " + sio.border + " )" );
layoutlines.Add( layoutline.ToString() );
}
}
if ( parent.GetType() == typeof( WxPanelObject ) ||
parent.GetType() == typeof( WxFrameObject ) ||
parent.GetType() == typeof( WxTopLevelPanel ) ||
parent.GetType() == typeof( WxTopLevelScrolledWindow ) ||
parent.GetType() == typeof( WxDialogObject ) )
{
string pp = parent.name;
if ( parent.GetType() == typeof( WxFrameObject ) ||
parent.GetType() == typeof( WxTopLevelPanel ) ||
parent.GetType() == typeof( WxTopLevelScrolledWindow ) ||
parent.GetType() == typeof( WxDialogObject ) )
{
pp = "Me";
}
layoutline = new StringBuilder();
layoutline.Append( "\t\t\t" + name + ".Fit( " + pp + " )" );
layoutlines.Add( layoutline.ToString() );
layoutline = new StringBuilder();
layoutline.Append( "\t\t\t" + name + ".SetSizeHints( " + pp + " )" );
layoutlines.Add( layoutline.ToString() );
}
}
}
//---------------------------------------------------------------------
public class WxGridSizerObject : WxObjectBase
{
public override void GenerateCSharpCode()
{
StringBuilder layoutline = new StringBuilder();
layoutlines.Add( " " );
if ( ! hasReference )
{
layoutline.Append( "\t\t\t" + classname + " " + name + " = new " + classname + "( " );
}
else
{
layoutline.Append( "\t\t\t" + name + " = new " + classname + "( " );
}
layoutline.Append( rows + ", " + cols + ", " + vgap + ", " + hgap );
layoutline.Append( " );" );
layoutlines.Add( layoutline.ToString() );
foreach ( WxSizerItemObject sio in objects )
{
if ( sio.objects[0] != null )
{
WxObjectBase ob = null;
layoutline = new StringBuilder();
layoutline.Append( "\t\t\t" + name + ".Add( " );
ob = (WxObjectBase)sio.objects[0];
// Notebook needs NoteBookSizer
if ( ob.GetType() == typeof( WxNotebookObject ) )
{
layoutline.Append( "new NotebookSizer( " + ob.name + " )" );
}
else
if ( ob.GetType() == typeof( WxSpacerObject ) )
{
layoutline.Append( ob.width + ", " + ob.height );
}
else
{
layoutline.Append( ob.name );
}
if ( sio.option.Length == 0 )
sio.option = "0";
layoutline.Append( ", " + sio.option + ", " );
layoutline.Append( ( sio.flag.Length > 0 ? CorrectStyleSizer( sio.flag, "0" ) : "0" ) );
if ( sio.border.Length == 0 )
sio.border = "0";
layoutline.Append( ", " + sio.border + " );" );
layoutlines.Add( layoutline.ToString() );
}
}
if ( parent.GetType() == typeof( WxPanelObject ) ||
parent.GetType() == typeof( WxFrameObject ) ||
parent.GetType() == typeof( WxTopLevelPanel ) ||
parent.GetType() == typeof( WxTopLevelScrolledWindow ) ||
parent.GetType() == typeof( WxDialogObject ) )
{
string pp = parent.name;
if ( parent.GetType() == typeof( WxFrameObject ) ||
parent.GetType() == typeof( WxTopLevelPanel ) ||
parent.GetType() == typeof( WxTopLevelScrolledWindow ) ||
parent.GetType() == typeof( WxDialogObject ) )
{
pp = "this";
}
layoutline = new StringBuilder();
layoutline.Append( "\t\t\t" + name + ".Fit( " + pp + " );" );
layoutlines.Add( layoutline.ToString() );
layoutline = new StringBuilder();
layoutline.Append( "\t\t\t" + name + ".SetSizeHints( " + pp + " );" );
layoutlines.Add( layoutline.ToString() );
}
}
//---------------------------------------------------------------------
public override void GenerateBasicCode()
{
StringBuilder layoutline = new StringBuilder();
layoutlines.Add( " " );
if ( ! hasReference )
{
layoutline.Append( "\t\t\tDim " + name + " As New " + classname + "( " );
}
else
{
layoutline.Append( "\t\t\t" + name + " = New " + classname + "( " );
}
layoutline.Append( rows + ", " + cols + ", " + vgap + ", " + hgap );
layoutline.Append( " )" );
layoutlines.Add( layoutline.ToString() );
foreach ( WxSizerItemObject sio in objects )
{
if ( sio.objects[0] != null )
{
WxObjectBase ob = null;
layoutline = new StringBuilder();
layoutline.Append( "\t\t\t" + name + ".Add( " );
ob = (WxObjectBase)sio.objects[0];
// Notebook needs NoteBookSizer
if ( ob.GetType() == typeof( WxNotebookObject ) )
{
layoutline.Append( "new NotebookSizer( " + ob.name + " )" );
}
else
if ( ob.GetType() == typeof( WxSpacerObject ) )
{
layoutline.Append( ob.width + ", " + ob.height );
}
else
{
layoutline.Append( ob.name );
}
if ( sio.option.Length == 0 )
sio.option = "0";
layoutline.Append( ", " + sio.option + ", " );
layoutline.Append( ( sio.flag.Length > 0 ? CorrectStyleSizer( sio.flag, "0" ) : "0" ) );
if ( sio.border.Length == 0 )
sio.border = "0";
layoutline.Append( ", " + sio.border + " )" );
layoutlines.Add( layoutline.ToString() );
}
}
if ( parent.GetType() == typeof( WxPanelObject ) ||
parent.GetType() == typeof( WxFrameObject ) ||
parent.GetType() == typeof( WxTopLevelPanel ) ||
parent.GetType() == typeof( WxTopLevelScrolledWindow ) ||
parent.GetType() == typeof( WxDialogObject ) )
{
string pp = parent.name;
if ( parent.GetType() == typeof( WxFrameObject ) ||
parent.GetType() == typeof( WxTopLevelPanel ) ||
parent.GetType() == typeof( WxTopLevelScrolledWindow ) ||
parent.GetType() == typeof( WxDialogObject ) )
{
pp = "Me";
}
layoutline = new StringBuilder();
layoutline.Append( "\t\t\t" + name + ".Fit( " + pp + " )" );
layoutlines.Add( layoutline.ToString() );
layoutline = new StringBuilder();
layoutline.Append( "\t\t\t" + name + ".SetSizeHints( " + pp + " )" );
layoutlines.Add( layoutline.ToString() );
}
}
}
//---------------------------------------------------------------------
public class WxFlexGridSizerObject : WxObjectBase
{
public override void GenerateCSharpCode()
{
StringBuilder layoutline = new StringBuilder();
layoutlines.Add( " " );
if ( ! hasReference )
{
layoutline.Append( "\t\t\t" + classname + " " + name + " = new " + classname + "( " );
}
else
{
layoutline.Append( "\t\t\t" + name + " = new " + classname + "( " );
}
layoutline.Append( rows + ", " + cols + ", " + vgap + ", " + hgap );
layoutline.Append( " );" );
layoutlines.Add( layoutline.ToString() );
foreach ( WxSizerItemObject sio in objects )
{
if ( sio.objects[0] != null )
{
WxObjectBase ob = null;
layoutline = new StringBuilder();
layoutline.Append( "\t\t\t" + name + ".Add( " );
ob = (WxObjectBase)sio.objects[0];
// Notebook needs NoteBookSizer
if ( ob.GetType() == typeof( WxNotebookObject ) )
{
layoutline.Append( "new NotebookSizer( " + ob.name + " )" );
}
else
if ( ob.GetType() == typeof( WxSpacerObject ) )
{
layoutline.Append( ob.width + ", " + ob.height );
}
else
{
layoutline.Append( ob.name );
}
if ( sio.option.Length == 0 )
sio.option = "0";
layoutline.Append( ", " + sio.option + ", " );
layoutline.Append( ( sio.flag.Length > 0 ? CorrectStyleSizer( sio.flag, "0" ) : "0" ) );
if ( sio.border.Length == 0 )
sio.border = "0";
layoutline.Append( ", " + sio.border + " );" );
layoutlines.Add( layoutline.ToString() );
}
}
if ( parent.GetType() == typeof( WxPanelObject ) ||
parent.GetType() == typeof( WxFrameObject ) ||
parent.GetType() == typeof( WxTopLevelPanel ) ||
parent.GetType() == typeof( WxTopLevelScrolledWindow ) ||
parent.GetType() == typeof( WxDialogObject ) )
{
string pp = parent.name;
if ( parent.GetType() == typeof( WxFrameObject ) ||
parent.GetType() == typeof( WxTopLevelPanel ) ||
parent.GetType() == typeof( WxTopLevelScrolledWindow ) ||
parent.GetType() == typeof( WxDialogObject ) )
{
pp = "this";
}
layoutline = new StringBuilder();
layoutline.Append( "\t\t\t" + name + ".Fit( " + pp + " );" );
layoutlines.Add( layoutline.ToString() );
layoutline = new StringBuilder();
layoutline.Append( "\t\t\t" + name + ".SetSizeHints( " + pp + " );" );
layoutlines.Add( layoutline.ToString() );
}
foreach ( string s in grow_rows )
{
layoutline = new StringBuilder();
layoutline.Append( "\t\t\t" + name + ".AddGrowableRow( " + s + " );" );
layoutlines.Add( layoutline.ToString() );
}
foreach ( string s in grow_cols )
{
layoutline = new StringBuilder();
layoutline.Append( "\t\t\t" + name + ".AddGrowableCol( " + s + " );" );
layoutlines.Add( layoutline.ToString() );
}
}
//---------------------------------------------------------------------
public override void GenerateBasicCode()
{
StringBuilder layoutline = new StringBuilder();
layoutlines.Add( " " );
if ( ! hasReference )
{
layoutline.Append( "\t\t\tDim " + name + " As New " + classname + "( " );
}
else
{
layoutline.Append( "\t\t\t" + name + " = New " + classname + "( " );
}
layoutline.Append( rows + ", " + cols + ", " + vgap + ", " + hgap );
layoutline.Append( " )" );
layoutlines.Add( layoutline.ToString() );
foreach ( WxSizerItemObject sio in objects )
{
if ( sio.objects[0] != null )
{
WxObjectBase ob = null;
layoutline = new StringBuilder();
layoutline.Append( "\t\t\t" + name + ".Add( " );
ob = (WxObjectBase)sio.objects[0];
// Notebook needs NoteBookSizer
if ( ob.GetType() == typeof( WxNotebookObject ) )
{
layoutline.Append( "new NotebookSizer( " + ob.name + " )" );
}
else
if ( ob.GetType() == typeof( WxSpacerObject ) )
{
layoutline.Append( ob.width + ", " + ob.height );
}
else
{
layoutline.Append( ob.name );
}
if ( sio.option.Length == 0 )
sio.option = "0";
layoutline.Append( ", " + sio.option + ", " );
layoutline.Append( ( sio.flag.Length > 0 ? CorrectStyleSizer( sio.flag, "0" ) : "0" ) );
if ( sio.border.Length == 0 )
sio.border = "0";
layoutline.Append( ", " + sio.border + " )" );
layoutlines.Add( layoutline.ToString() );
}
}
if ( parent.GetType() == typeof( WxPanelObject ) ||
parent.GetType() == typeof( WxFrameObject ) ||
parent.GetType() == typeof( WxTopLevelPanel ) ||
parent.GetType() == typeof( WxTopLevelScrolledWindow ) ||
parent.GetType() == typeof( WxDialogObject ) )
{
string pp = parent.name;
if ( parent.GetType() == typeof( WxFrameObject ) ||
parent.GetType() == typeof( WxTopLevelPanel ) ||
parent.GetType() == typeof( WxTopLevelScrolledWindow ) ||
parent.GetType() == typeof( WxDialogObject ) )
{
pp = "Me";
}
layoutline = new StringBuilder();
layoutline.Append( "\t\t\t" + name + ".Fit( " + pp + " )" );
layoutlines.Add( layoutline.ToString() );
layoutline = new StringBuilder();
layoutline.Append( "\t\t\t" + name + ".SetSizeHints( " + pp + " )" );
layoutlines.Add( layoutline.ToString() );
}
foreach ( string s in grow_rows )
{
layoutline = new StringBuilder();
layoutline.Append( "\t\t\t" + name + ".AddGrowableRow( " + s + " )" );
layoutlines.Add( layoutline.ToString() );
}
foreach ( string s in grow_cols )
{
layoutline = new StringBuilder();
layoutline.Append( "\t\t\t" + name + ".AddGrowableCol( " + s + " )" );
layoutlines.Add( layoutline.ToString() );
}
}
}
//---------------------------------------------------------------------
public class WxGridBagSizerObject : WxObjectBase
{
public override void GenerateCSharpCode()
{
StringBuilder layoutline = new StringBuilder();
layoutlines.Add( " " );
if ( ! hasReference )
{
layoutline.Append( "\t\t\t" + classname + " " + name + " = new " + classname + "( " );
}
else
{
layoutline.Append( "\t\t\t" + name + " = new " + classname + "( " );
}
layoutline.Append( rows + ", " + cols + ", " + vgap + ", " + hgap );
layoutline.Append( " );" );
layoutlines.Add( layoutline.ToString() );
foreach ( WxSizerItemObject sio in objects )
{
if ( sio.objects[0] != null )
{
WxObjectBase ob = null;
layoutline = new StringBuilder();
layoutline.Append( "\t\t\t" + name + ".Add( " );
ob = (WxObjectBase)sio.objects[0];
// Notebook needs NoteBookSizer
if ( ob.GetType() == typeof( WxNotebookObject ) )
{
layoutline.Append( "new NotebookSizer( " + ob.name + " )" );
}
else
if ( ob.GetType() == typeof( WxSpacerObject ) )
{
layoutline.Append( ob.width + ", " + ob.height );
}
else
{
layoutline.Append( ob.name );
}
if ( sio.option.Length == 0 )
sio.option = "0";
layoutline.Append( ", " + sio.option + ", " );
layoutline.Append( ( sio.flag.Length > 0 ? CorrectStyleSizer( sio.flag, "0" ) : "0" ) );
if ( sio.border.Length == 0 )
sio.border = "0";
layoutline.Append( ", " + sio.border + " );" );
layoutlines.Add( layoutline.ToString() );
}
}
if ( parent.GetType() == typeof( WxPanelObject ) ||
parent.GetType() == typeof( WxFrameObject ) ||
parent.GetType() == typeof( WxTopLevelPanel ) ||
parent.GetType() == typeof( WxTopLevelScrolledWindow ) ||
parent.GetType() == typeof( WxDialogObject ) )
{
string pp = parent.name;
if ( parent.GetType() == typeof( WxFrameObject ) ||
parent.GetType() == typeof( WxTopLevelPanel ) ||
parent.GetType() == typeof( WxTopLevelScrolledWindow ) ||
parent.GetType() == typeof( WxDialogObject ) )
{
pp = "this";
}
layoutline = new StringBuilder();
layoutline.Append( "\t\t\t" + name + ".Fit( " + pp + " );" );
layoutlines.Add( layoutline.ToString() );
layoutline = new StringBuilder();
layoutline.Append( "\t\t\t" + name + ".SetSizeHints( " + pp + " );" );
layoutlines.Add( layoutline.ToString() );
}
foreach ( string s in grow_rows )
{
layoutline = new StringBuilder();
layoutline.Append( "\t\t\t" + name + ".AddGrowableRow( " + s + " );" );
layoutlines.Add( layoutline.ToString() );
}
foreach ( string s in grow_cols )
{
layoutline = new StringBuilder();
layoutline.Append( "\t\t\t" + name + ".AddGrowableCol( " + s + " );" );
layoutlines.Add( layoutline.ToString() );
}
}
//---------------------------------------------------------------------
public override void GenerateBasicCode()
{
StringBuilder layoutline = new StringBuilder();
layoutlines.Add( " " );
if ( ! hasReference )
{
layoutline.Append( "\t\t\tDim " + name + " As New " + classname + "( " );
}
else
{
layoutline.Append( "\t\t\t" + name + " = New " + classname + "( " );
}
layoutline.Append( rows + ", " + cols + ", " + vgap + ", " + hgap );
layoutline.Append( " )" );
layoutlines.Add( layoutline.ToString() );
foreach ( WxSizerItemObject sio in objects )
{
if ( sio.objects[0] != null )
{
WxObjectBase ob = null;
layoutline = new StringBuilder();
layoutline.Append( "\t\t\t" + name + ".Add( " );
ob = (WxObjectBase)sio.objects[0];
// Notebook needs NoteBookSizer
if ( ob.GetType() == typeof( WxNotebookObject ) )
{
layoutline.Append( "new NotebookSizer( " + ob.name + " )" );
}
else
if ( ob.GetType() == typeof( WxSpacerObject ) )
{
layoutline.Append( ob.width + ", " + ob.height );
}
else
{
layoutline.Append( ob.name );
}
if ( sio.option.Length == 0 )
sio.option = "0";
layoutline.Append( ", " + sio.option + ", " );
layoutline.Append( ( sio.flag.Length > 0 ? CorrectStyleSizer( sio.flag, "0" ) : "0" ) );
if ( sio.border.Length == 0 )
sio.border = "0";
layoutline.Append( ", " + sio.border + " )" );
layoutlines.Add( layoutline.ToString() );
}
}
if ( parent.GetType() == typeof( WxPanelObject ) ||
parent.GetType() == typeof( WxFrameObject ) ||
parent.GetType() == typeof( WxTopLevelPanel ) ||
parent.GetType() == typeof( WxTopLevelScrolledWindow ) ||
parent.GetType() == typeof( WxDialogObject ) )
{
string pp = parent.name;
if ( parent.GetType() == typeof( WxFrameObject ) ||
parent.GetType() == typeof( WxTopLevelPanel ) ||
parent.GetType() == typeof( WxTopLevelScrolledWindow ) ||
parent.GetType() == typeof( WxDialogObject ) )
{
pp = "Me";
}
layoutline = new StringBuilder();
layoutline.Append( "\t\t\t" + name + ".Fit( " + pp + " )" );
layoutlines.Add( layoutline.ToString() );
layoutline = new StringBuilder();
layoutline.Append( "\t\t\t" + name + ".SetSizeHints( " + pp + " )" );
layoutlines.Add( layoutline.ToString() );
}
foreach ( string s in grow_rows )
{
layoutline = new StringBuilder();
layoutline.Append( "\t\t\t" + name + ".AddGrowableRow( " + s + " )" );
layoutlines.Add( layoutline.ToString() );
}
foreach ( string s in grow_cols )
{
layoutline = new StringBuilder();
layoutline.Append( "\t\t\t" + name + ".AddGrowableCol( " + s + " )" );
layoutlines.Add( layoutline.ToString() );
}
}
}
//---------------------------------------------------------------------
public class WxStaticBoxSizerObject : WxObjectBase
{
public override void GenerateCSharpCode()
{
StringBuilder layoutline = new StringBuilder();
layoutlines.Add( " " );
if ( ! hasReference )
{
layoutline.Append( "\t\t\t" + classname + " " + name + " = new " + classname + "( " );
}
else
{
layoutline.Append( "\t\t\t" + name + " = new " + classname + "( " );
}
layoutline.Append( "new StaticBox( " + GetParent( parent ) + ", -1, \"" + label + "\" ), " );
layoutline.Append( "Orientation." + orientation );
layoutline.Append( " );" );
layoutlines.Add( layoutline.ToString() );
foreach ( WxSizerItemObject sio in objects )
{
if ( sio.objects[0] != null )
{
WxObjectBase ob = null;
layoutline = new StringBuilder();
layoutline.Append( "\t\t\t" + name + ".Add( " );
ob = (WxObjectBase)sio.objects[0];
// Notebook needs NoteBookSizer
if ( ob.GetType() == typeof( WxNotebookObject ) )
{
layoutline.Append( "new NotebookSizer( " + ob.name + " )" );
}
else
if ( ob.GetType() == typeof( WxSpacerObject ) )
{
layoutline.Append( ob.width + ", " + ob.height );
}
else
{
layoutline.Append( ob.name );
}
if ( sio.option.Length == 0 )
sio.option = "0";
layoutline.Append( ", " + sio.option + ", " );
layoutline.Append( ( sio.flag.Length > 0 ? CorrectStyleSizer( sio.flag, "0" ) : "0" ) );
if ( sio.border.Length == 0 )
sio.border = "0";
layoutline.Append( ", " + sio.border + " );" );
layoutlines.Add( layoutline.ToString() );
}
}
if ( parent.GetType() == typeof( WxPanelObject ) ||
parent.GetType() == typeof( WxFrameObject ) ||
parent.GetType() == typeof( WxTopLevelPanel ) ||
parent.GetType() == typeof( WxTopLevelScrolledWindow ) ||
parent.GetType() == typeof( WxDialogObject ) )
{
string pp = parent.name;
if ( parent.GetType() == typeof( WxFrameObject ) ||
parent.GetType() == typeof( WxTopLevelPanel ) ||
parent.GetType() == typeof( WxTopLevelScrolledWindow ) ||
parent.GetType() == typeof( WxDialogObject ) )
{
pp = "this";
}
layoutline = new StringBuilder();
layoutline.Append( "\t\t\t" + name + ".Fit( " + pp + " );" );
layoutlines.Add( layoutline.ToString() );
layoutline = new StringBuilder();
layoutline.Append( "\t\t\t" + name + ".SetSizeHints( " + pp + " );" );
layoutlines.Add( layoutline.ToString() );
}
}
//---------------------------------------------------------------------
public override void GenerateBasicCode()
{
StringBuilder layoutline = new StringBuilder();
layoutlines.Add( " " );
if ( ! hasReference )
{
layoutline.Append( "\t\t\tDim " + name + " As New " + classname + "( " );
}
else
{
layoutline.Append( "\t\t\t" + name + " = New " + classname + "( " );
}
layoutline.Append( "new StaticBox( " + GetParent( parent ) + ", -1, \"" + label + "\" ), " );
layoutline.Append( "Orientation." + orientation );
layoutline.Append( " )" );
layoutlines.Add( layoutline.ToString() );
foreach ( WxSizerItemObject sio in objects )
{
if ( sio.objects[0] != null )
{
WxObjectBase ob = null;
layoutline = new StringBuilder();
layoutline.Append( "\t\t\t" + name + ".Add( " );
ob = (WxObjectBase)sio.objects[0];
// Notebook needs NoteBookSizer
if ( ob.GetType() == typeof( WxNotebookObject ) )
{
layoutline.Append( "new NotebookSizer( " + ob.name + " )" );
}
else
if ( ob.GetType() == typeof( WxSpacerObject ) )
{
layoutline.Append( ob.width + ", " + ob.height );
}
else
{
layoutline.Append( ob.name );
}
if ( sio.option.Length == 0 )
sio.option = "0";
layoutline.Append( ", " + sio.option + ", " );
layoutline.Append( ( sio.flag.Length > 0 ? CorrectStyleSizer( sio.flag, "0" ) : "0" ) );
if ( sio.border.Length == 0 )
sio.border = "0";
layoutline.Append( ", " + sio.border + " )" );
layoutlines.Add( layoutline.ToString() );
}
}
if ( parent.GetType() == typeof( WxPanelObject ) ||
parent.GetType() == typeof( WxFrameObject ) ||
parent.GetType() == typeof( WxTopLevelPanel ) ||
parent.GetType() == typeof( WxTopLevelScrolledWindow ) ||
parent.GetType() == typeof( WxDialogObject ) )
{
string pp = parent.name;
if ( parent.GetType() == typeof( WxFrameObject ) ||
parent.GetType() == typeof( WxTopLevelPanel ) ||
parent.GetType() == typeof( WxTopLevelScrolledWindow ) ||
parent.GetType() == typeof( WxDialogObject ) )
{
pp = "Me";
}
layoutline = new StringBuilder();
layoutline.Append( "\t\t\t" + name + ".Fit( " + pp + " )" );
layoutlines.Add( layoutline.ToString() );
layoutline = new StringBuilder();
layoutline.Append( "\t\t\t" + name + ".SetSizeHints( " + pp + " )" );
layoutlines.Add( layoutline.ToString() );
}
}
}
//---------------------------------------------------------------------
public class WxSpacerObject : WxObjectBase
{
/*public override void GenerateCSharpCode()
{
StringBuilder layoutline = new StringBuilder();
layoutlines.Add( " " );
WxObjectBase ps = GetParentSizer( parent );
layoutline.Append( "\t\t\t" + ps.name + ".Add( " + width + ", " + height +", " );
layoutline.Append( parent.option + ", 0, " + parent.border + " );" );
layoutlines.Add( layoutline.ToString() );
}*/
}
//---------------------------------------------------------------------
public class WxSizerItemObject : WxObjectBase
{
}
}
|