WxToolBarObject.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 » WxToolBarObject.cs
//-----------------------------------------------------------------------------
// 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;
  }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.