WxRootObjectBase.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 » WxRootObjectBase.cs
//-----------------------------------------------------------------------------
// wx.NET/Utils - WxRootObjectBase.cs
//
// wx.NET "WxRootObjectBase".
//
// Written by Alexander Olk (xenomorph2@onlinehome.de)
// (C) 2004 Alexander Olk
// Licensed under the wxWidgets license, see LICENSE.txt for details.
//
// $Id: WxRootObjectBase.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 WxRootObjectBase : WxObjectBase
  {
    public StringCollection linesout = new StringCollection();
    
    public StringCollection regionIDS = new StringCollection();
    public StringCollection regionObjects = new StringCollection();
    public StringCollection regionCTOR = new StringCollection();
    public StringCollection regionPROPERTIES = new StringCollection();
    public StringCollection regionLAYOUT = new StringCollection();
  
    public WxStatusBarObject wxStatusBarObject = null;
    public WxToolBarObject wxToolBarObject = null;
    public WxMenuBarObject wxMenuBarObject = null;    
    
    public string stringDoNotChangeCode = "Do not change the code between region and endregion ( incl. region and endregion )...";
    
    //---------------------------------------------------------------------
    
    public override void Start()
    {
      XmlTextReader xtr = WxObjectBase.xtr;  
      
      WxObjectBase.baseptr = this;
      
      topsizer = null;
    
      while ( xtr.Read() ) 
      {
        switch ( xtr.NodeType )
        {
          case XmlNodeType.Element:
            switch ( xtr.Name )
            {
              case "object":
                ReadObjectAttributes();
                
                if ( !CheckCommonObjects() )
                {
                  switch ( objectBase )
                  {
                    case "EditMenuBar":
                      wxMenuBarObject = new WxMenuBarObject();
                      wxMenuBarObject.parent = this;
                      wxMenuBarObject.name = objectName;
                      wxMenuBarObject.classname = objectClassName;
                      wxMenuBarObject.basename = objectBase;
                      wxMenuBarObject.id = AddObj( objectClassName, objectName );
                      wxMenuBarObject.Start();    
                    break;
                  
                    case "EditStatusBar":
                      wxStatusBarObject = new WxStatusBarObject();
                      wxStatusBarObject.parent = this;
                      wxStatusBarObject.name = objectName;
                      wxStatusBarObject.classname = objectClassName;
                      wxStatusBarObject.basename = objectBase;
                      wxStatusBarObject.id = AddObj( objectClassName, objectName );
                      wxStatusBarObject.Start();
                    break;
                  
                    case "EditToolBar":
                      wxToolBarObject = new WxToolBarObject();
                      wxToolBarObject.parent = this;
                      wxToolBarObject.name = objectName;
                      wxToolBarObject.classname = objectClassName;
                      wxToolBarObject.basename = objectBase;
                      wxToolBarObject.id = AddObj( objectClassName, objectName );
                      wxToolBarObject.Start();
                    break;
                  }
                }
              break;
              
              case "style":
                style = Next;
              break;
              
              case "title":
                title = Next;
              break;
              
              case "menubar":
                menubar = Next;
              break;
              
              case "statusbar":
                statusbar = Next;
              break;
              
              case "toolbar":
                toolbar = Next;
              break;
              
              case "size":
                AddSize( Next );
              break;
              
              case "tooltip":
                tooltip = Next;
              break;
              
              case "foreground":
                foreground = Next;
              break;
              
              case "background":
                background = Next;
              break;
              
              case "id":
                AddID( Next );
              break;
              
              case "focused":
                focused = Next;
              break;
              
              case "font":
                fontObject = new WxFontObject();
                fontObject.parent = this;
                fontObject.Start();
              break;
              
              case "hidden":
                hidden = Next;
              break;
              
              case "disabled":
                disabled = Next;
              break;
              
              case "default":
                sdefault = Next;
              break;
              
              case "icon":
                icon = Next;
              break;
              
              case "centered":
                centered = Next;
              break;
            }
          break;
          
          case XmlNodeType.EndElement:
            if ( xtr.Name == "object" )
            {
              GenerateCode();
              return;
            }
          break;
        }
      }
    }
    
    //---------------------------------------------------------------------
    // recursive method, adds ctorlines of all child objects
    
    public void AddCtorLines( ArrayList objects, StringCollection alinesout )
    {
      foreach( WxObjectBase wob in objects )
      {
        if ( wob.ctorlines.Count > 0 )
        {
          for ( int i = 0; i < wob.ctorlines.Count; i++ )
            alinesout.Add( wob.ctorlines[i] );
        }
        AddCtorLines( wob.objects, alinesout );
      }
    }
    
    //---------------------------------------------------------------------
    // recursive method, adds propertylines of all child objects
    
    public void AddPropertyLines( ArrayList objects, StringCollection alinesout )
    {
      foreach( WxObjectBase wob in objects )
      {
        if ( wob.propertylines.Count > 0 )
        {
          for ( int i = 0; i < wob.propertylines.Count; i++ )
            alinesout.Add( wob.propertylines[i] );
        }
        AddPropertyLines( wob.objects, alinesout );
      }
    }
    
    //---------------------------------------------------------------------
    // only for the four main objects, adds properties
    
    public void AddPropertyLinesSelf( StringCollection alinesout )
    {
      if ( propertylines.Count > 0 )
      {
        for ( int i = 0; i < propertylines.Count; i++ )
        {
          alinesout.Add( propertylines[i] );
        }
      }
    }
    
    //---------------------------------------------------------------------
    // recursive method, adds layoutlines of all child objects
    
    public void AddLayoutLines( ArrayList objects, StringCollection alinesout )
    {
      foreach( WxObjectBase wob in objects )  
      {
        AddLayoutLines( wob.objects, alinesout );
        if ( wob.layoutlines.Count > 0 )
        {
          for ( int i = 0; i < wob.layoutlines.Count; i++ )
          {
            alinesout.Add( wob.layoutlines[i] );
          }
        }
        
      }
    }
    
    //---------------------------------------------------------------------
    // returns stringDoNotChangeCode
    
    public string doNotChangeCode
    {
      get {
        string retval = "";
      
        switch ( outputCodeType )
        {
          case 1:
            retval =  "// " + stringDoNotChangeCode;
          break;
          
          case 2:
            retval =  "' " + stringDoNotChangeCode;
          break;
        }
        
        return retval;
      }
    }

    //---------------------------------------------------------------------

    public string BetweenLine( int numberTabs )
    {
      StringBuilder sb = new StringBuilder();

      for ( int i = 0; i < numberTabs; ++i )
        sb.Append( "\t" );

      switch ( outputCodeType )
      {
        case 1:
          sb.Append( "//" );
          break;
          
        case 2:
          sb.Append( "'" );
          break;
      }

      sb.Append( "---------------------------------------------------------------------" );

      return sb.ToString();
    }
  }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.