//-----------------------------------------------------------------------------
// wx.NET/Utils - WxSplitterWindowObject.cs
//
// wx.NET "WxSplitterWindowObject".
//
// Written by Alexander Olk (xenomorph2@onlinehome.de)
// (C) 2004 Alexander Olk
// Licensed under the wxWidgets license, see LICENSE.txt for details.
//
// $Id: WxSplitterWindowObject.cs,v 1.8 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 WxSplitterWindowObject : WxObjectBase
{
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() );
StringBuilder layoutline = new StringBuilder();
// xrc
if ( orientation.Length == 0 )
orientation = "wxSPLIT_VERTICAL";
else if ( orientation == "vertical" )
orientation = "wxSPLIT_VERTICAL";
else if ( orientation == "horizontal" )
orientation = "wxSPLIT_HORIZONTAL";
if ( window_1.Length == 0 )
{
if ( objects[0] != null )
{
WxObjectBase wob = (WxObjectBase)objects[0];
window_1 = wob.name;
}
}
if ( window_2.Length == 0 )
{
if ( objects[1] != null )
{
WxObjectBase wob = (WxObjectBase)objects[1];
window_2 = wob.name;
}
}
layoutline.Append( "\t\t\t" + name );
switch ( orientation )
{
case "wxSPLIT_VERTICAL":
layoutline.Append( ".SplitVertically( " );
layoutline.Append( window_1 + ", " + window_2 );
if ( sash_pos.Length > 0 )
{
layoutline.Append( ", " + sash_pos );
}
break;
case "wxSPLIT_HORIZONTAL":
layoutline.Append( ".SplitHorizontally( " );
layoutline.Append( window_1 + ", " + window_2 );
if ( sash_pos.Length > 0 )
{
layoutline.Append( ", " + sash_pos );
}
break;
}
layoutline.Append( " );" );
layoutlines.Add( layoutline.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() );
StringBuilder layoutline = new StringBuilder();
if ( orientation.Length == 0 )
orientation = "wxSPLIT_VERTICAL";
else if ( orientation == "vertical" )
orientation = "wxSPLIT_VERTICAL";
else if ( orientation == "horizontal" )
orientation = "wxSPLIT_HORIZONTAL";
if ( window_1.Length == 0 )
{
if ( objects[0] != null )
{
WxObjectBase wob = (WxObjectBase)objects[0];
window_1 = wob.name;
}
}
if ( window_2.Length == 0 )
{
if ( objects[1] != null )
{
WxObjectBase wob = (WxObjectBase)objects[1];
window_2 = wob.name;
}
}
layoutline.Append( "\t\t\t" + name );
switch ( orientation )
{
case "wxSPLIT_VERTICAL":
layoutline.Append( ".SplitVertically( " );
layoutline.Append( window_1 + ", " + window_2 );
if ( sash_pos.Length > 0 )
{
layoutline.Append( ", " + sash_pos );
}
break;
case "wxSPLIT_HORIZONTAL":
layoutline.Append( ".SplitHorizontally( " );
layoutline.Append( window_1 + ", " + window_2 );
if ( sash_pos.Length > 0 )
{
layoutline.Append( ", " + sash_pos );
}
break;
}
layoutline.Append( " )" );
layoutlines.Add( layoutline.ToString() );
}
}
}
|