WxTopLevelPanel.cs :  » GUI » wx-NET » wx » ToWxNet » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » GUI » wx NET 
wx NET » wx » ToWxNet » WxTopLevelPanel.cs
//-----------------------------------------------------------------------------
// wx.NET/Utils - WxTopLevelPanel.cs
//
// wx.NET "WxTopLevelPanel".
//
// Written by Alexander Olk (xenomorph2@onlinehome.de)
// (C) 2004 Alexander Olk
// Licensed under the wxWidgets license, see LICENSE.txt for details.
//
// $Id: WxTopLevelPanel.cs,v 1.5 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 WxTopLevelPanel : WxRootObjectBase
  {
    public override void GenerateCSharpCode()
    {
      string baseclass = "Panel";
      
      linesout.Add( BetweenLine( 1 ) );
      linesout.Add( " " );
      
      // fix for XRC      
      if ( WxObjectBase.generateFromSource == 2 )
      {
        classname = name;
      }      
      
      linesout.Add( "\tpublic class " + classname + " : " + baseclass );
      linesout.Add( "\t{" );
      
      // add IDs
      if ( allIDs.Count > 0 )
      {
        
        regionIDS.Add( "\t\tpublic enum Cmd {" );
        for ( int i = 0; i < allIDs.Count; i++ )
        {
          if ( i < ( allIDs.Count - 1 ) )
            regionIDS.Add( "\t\t\t" + allIDs[i] + "," );
          else
            regionIDS.Add( "\t\t\t" + allIDs[i] );
        }
        regionIDS.Add( "\t\t}" );
      }
      
      // now add it to linesout...
      linesout.Add( "\t\t" + doNotChangeCode );
      linesout.Add( "\t\t#region \"TowxNET IDS: " + classname + "\"" );
      foreach( string str in regionIDS )
      {
        linesout.Add( str );
      }
      linesout.Add( "\t\t#endregion" );
      
      linesout.Add( " ");
      linesout.Add( BetweenLine( 2 ) );
      linesout.Add( " " );
      
      
      // add wxObjects
      if ( allObjs.Count > 0 )
      {
        
        for ( int i = 0; i < allObjs.Count; i++ )
        {
          regionObjects.Add( "\t\tprotected " + allObjs[i] + ";" );
        }
      }
      
      // now add it to linesout...
      linesout.Add( "\t\t" + doNotChangeCode );
      linesout.Add( "\t\t#region \"TowxNET Objects: " + classname +"\"" );
      foreach( string str in regionObjects )
      {
        linesout.Add( str );
      }
      linesout.Add( "\t\t#endregion" );
      
      linesout.Add( " " );
      linesout.Add( BetweenLine( 2 ) );
      linesout.Add( " " );
      
      // ctor
      linesout.Add( "\t\tpublic " + classname + "( Window parent, int id, string title )" );
      
      StringBuilder basestring = new StringBuilder();
      basestring.Append( "\t\t\t: base( parent, id , wxDefaultPosition, " );
      basestring.Append( size.Length > 0 ? "new Size( " + size  + " )" : "wxDefaultSize" );
      basestring.Append( ", " );
      basestring.Append( style.Length > 0 ? style : "wxTAB_TRAVERSAL" );
      basestring.Append( " , \"" + title + "\" )" );
      
      linesout.Add( basestring.ToString() );
      linesout.Add( "\t\t{" );
      
      linesout.Add( "\t\t\tInitializeComponent();" );

      linesout.Add( "\t\t}" );
      linesout.Add( " " );

      linesout.Add( BetweenLine( 2 ) );
      linesout.Add( " " );
      
      linesout.Add( "\t\t" + doNotChangeCode );
      linesout.Add( "\t\t#region \"TowxNET CTOR: " + classname + "\"");
      
      // InitializeComponent()
      regionCTOR.Add( "\t\tpublic void InitializeComponent()" );
      regionCTOR.Add( "\t\t{" );
      regionCTOR.Add( "\t\t\t//common" );      
      
      // add code from all objects to the common
      AddCtorLines( objects, regionCTOR );
      
      regionCTOR.Add( " " );
      regionCTOR.Add( "\t\t\t//Properties" );

      AddPropertiesSelf( regionCTOR );
      AddPropertyLinesSelf( regionCTOR );
      
      AddPropertyLines( objects, regionCTOR );
      
      regionCTOR.Add( " " );
      regionCTOR.Add( "\t\t\t//Layout" );
      
      AddLayoutLines( objects, regionCTOR );
      
      // normally there should be at least one sizer
      if ( WxObjectBase.topsizer != null )
      {
        regionCTOR.Add( "\t\t\tAutoLayout = true;" );
        regionCTOR.Add( "\t\t\tSetSizer( " + WxObjectBase.topsizer.name + " );" );
        regionCTOR.Add( "\t\t\tLayout();" );
      }
      
      if ( centered.Length > 0 )
      {
        regionCTOR.Add( "\t\t\tCentre();" );
      }
      
      regionCTOR.Add( "\t\t}" );

      // now add it to linesout...
      foreach ( string str in regionCTOR )
      {
        linesout.Add( str );
      }

      linesout.Add( "\t\t#endregion" );
      
      linesout.Add( "\t}" );
      linesout.Add( " " );
    }
    
    //---------------------------------------------------------------------
    
    public override void GenerateBasicCode()
    {
      string baseclass = "Panel";
      
      linesout.Add( BetweenLine( 1 ) );
      linesout.Add( " " );
      
      // fix for XRC      
      if ( WxObjectBase.generateFromSource == 2 )
      {
        classname = name;
      }      
      
      linesout.Add( "\tPublic Class " + classname );
      linesout.Add( "\t\tInherits" + baseclass );
      linesout.Add( " " );
            
      // add IDs
      if ( allIDs.Count > 0 )
      {
        regionIDS.Add( "\t\tPublic Enum Cmd" );
        for ( int i = 0; i < allIDs.Count; i++ )
        {
          regionIDS.Add( "\t\t\t" + allIDs[i] );
        }
        regionIDS.Add( "\t\tEnd Enum" );
      }
            
      // now add it to linesout...
      linesout.Add( "\t\t" + doNotChangeCode );
      linesout.Add( "\t\t#region \"TowxNET IDS: " + classname + "\"");
      foreach( string str in regionIDS )
      {
        linesout.Add( str );
      }
      linesout.Add( "\t\t#end region" );
      
      linesout.Add( " ");
      linesout.Add( BetweenLine( 2 ) );
      linesout.Add( " " );
      
      
      // add wxObjects
      if ( allObjsBasic.Count > 0 )
      {
        
        for ( int i = 0; i < allObjsBasic.Count; i++ )
        {
          regionObjects.Add( "\t\tProtected WithEvents " + allObjsBasic[i] );
        }
      }
      
      // now add it to linesout...
      linesout.Add( "\t\t" + doNotChangeCode );
      linesout.Add( "\t\t#region \"TowxNET Objects: " + classname + "\"");
      foreach( string str in regionObjects )
      {
        linesout.Add( str );
      }
      linesout.Add( "\t\t#end region" );
      
      linesout.Add( " " );
      linesout.Add( BetweenLine( 2 ) );
      linesout.Add( " " );
      
      // ctor
      linesout.Add( "\t\tPublic Sub New( ByVal parent As Window, ByVal id As Integer, ByVal title As String )" );
      
      StringBuilder basestring = new StringBuilder();
      basestring.Append( "\t\t\tMyBase.New( parent, id , \"" + title + "\", wxDefaultPosition, " );
      basestring.Append( size.Length > 0 ? "New Size( " + size  + " )" : "wxDefaultSize" );
      basestring.Append( ", " );
      basestring.Append( style.Length > 0 ? VBCorrectStyle(style) : "wxTAB_TRAVERSAL" );
      basestring.Append( " , \"" + title + "\" )" );
      
      linesout.Add( basestring.ToString() );
      
      linesout.Add( " " );
      linesout.Add( "\t\t\tInitializeComponent" );
      linesout.Add( "\t\tEnd Sub" );
      linesout.Add( " " );

      linesout.Add( BetweenLine( 2 ) );
      linesout.Add( " " );

      linesout.Add( "\t\t" + doNotChangeCode );
      linesout.Add( "\t\t#region \"TowxNET CTOR: " + classname + "\"");
      regionCTOR.Add( "\t\tPublic Sub InitializeComponent()" );
      regionCTOR.Add( " " );
      regionCTOR.Add( "\t\t\t'common" );
      
      // add code from all objects to the ctor
      AddCtorLines( objects, regionCTOR );
      
      regionCTOR.Add( " " );
      regionCTOR.Add( "\t\t\t'Properties" );      
      
      AddPropertiesSelf( regionCTOR );
      AddPropertyLinesSelf( regionCTOR );
      
      AddPropertyLines( objects, regionCTOR );
      
      regionCTOR.Add( " " );
      regionCTOR.Add( "\t\t\t'Layout" );
      
      AddLayoutLines( objects, regionCTOR );
      
      // normally there should be at least one sizer
      if ( WxObjectBase.topsizer != null )
      {
        regionCTOR.Add( "\t\t\tAutoLayout = True" );
        regionCTOR.Add( "\t\t\tSetSizer( " + WxObjectBase.topsizer.name + " )" );
        regionCTOR.Add( "\t\t\tLayout()" );
      }
      
      if ( centered.Length > 0 )
      {
        regionCTOR.Add( "\t\t\tCentre()" );
      }
      
      regionCTOR.Add( "\t\tEnd Sub" );
      
      // now add it to linesout...
      foreach ( string str in regionCTOR )
      {
        linesout.Add( str );
      }
      
      linesout.Add( "\t\t#end region" );
      linesout.Add( " " );
      linesout.Add( "\tEnd Class" );
      linesout.Add( " " );
    }    
  }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.