HtmlHelp.cs :  » GUI » wx-NET » wx » SampleHtmlHelp » 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 » SampleHtmlHelp » HtmlHelp.cs
//-----------------------------------------------------------------------------
// wx.NET/Samples - HtmlHelp.cs
//
// wx.NET "HtmlHelpController" sample.
//
// Written by Alexander Olk (xenomorph2@onlinehome.de)
// (C) 2004 by Alexander Olk
// Licensed under the wxWidgets license, see LICENSE.txt for details.
//
// $Id: HtmlHelp.cs,v 1.6 2007/12/08 23:10:41 harald_meyer Exp $
//-----------------------------------------------------------------------------

using System;
using System.Drawing;

/** Sample that demonstrates how to integrate a help browser into an application.
 * This demonstrates the use of \c wx.HtmlHelpController. please note, that with 0.8
 * \e wx.NET also has a wrapper for help data. This class is relevant to those people
 * that implement want to implement an integrated view of help files (not using its
 * own frame).
 */
namespace wx.SampleHtmlHelp{

  public class MyFrame : Frame
  {
    public enum Cmd 
    { 
      HtmlHelp_Quit,
      HtmlHelp_About,
      HtmlHelp_Help
    }
    
    private HtmlHelpController help;
    
    public MyFrame( Window parent, string title, Point pos, Size size ) 
      : base( parent, -1, title, pos, size )
    {
      Menu menuFile = new Menu();
      
      menuFile.AppendWL( (int)Cmd.HtmlHelp_Help, "&Help", "Test Help...", new EventListener( OnHelp ) );
      menuFile.AppendWL( (int)Cmd.HtmlHelp_About, "&About", "About the sample...", new EventListener( OnAbout ) );
      menuFile.AppendWL( (int)Cmd.HtmlHelp_Quit, "E&xit\tAlt-X", "Quit this program", new EventListener( OnQuit ) );
      
      MenuBar menuBar = new MenuBar();
      menuBar.Append( menuFile, "&File" );
      
      MenuBar = menuBar;
      
      help = new HtmlHelpController( HtmlHelpController.Style.DEFAULT_STYLE | HtmlHelpController.Style.OPEN_FILES);
      
      help.UseConfig( Config.Get() );
      
      help.TempDir = "." ;
      
      bool ret = help.AddBook( "../Samples/HtmlHelp/helpfiles/testing.hhp" );
      if ( !ret )
        MessageDialog.MessageBox( "Failed adding book ../Samples/HtmlHelp/helpfiles/testing.hhp" );
        
      ret = help.AddBook( "../Samples/HtmlHelp/helpfiles/another.hhp" );
      if ( !ret )
        MessageDialog.MessageBox( "Failed adding book ../Samples/HtmlHelp/helpfiles/another.hhp" );
        
      this.Closing += new EventListener(OnClosing);
    }
    
    //---------------------------------------------------------------------
    
    public void OnQuit( object sender, Event e )
    {
      Close();
    }
    
    //---------------------------------------------------------------------
    
    public void OnHelp( object sender, Event e )
    {
      help.Display( "Test HELPFILE" );
    }
    
    //---------------------------------------------------------------------
    
    public void OnClosing( object sender, Event e )
    {
      if ( help.Frame != null )
        help.Frame.Close();
      e.Skip();
    }
    
    //---------------------------------------------------------------------
    
    public void OnAbout( object sender, Event e )
    {
      MessageDialog.ShowModal( this, "HtmlHelpController class sample.\n" +
        "\n" +
        "Ported to wx.NET by Alexander Olk", "About HtmlHelpController", Dialog.wxOK | Dialog.wxICON_INFORMATION );
    }
  }
  
  //---------------------------------------------------------------------

  public class HtmlHelp : wx.App
  {
    public override bool OnInit()
    {
            // This simply adds the zip file handler in case you want to load hyper text books.
            wx.FileSystem.AddHandler(new ZipFSHandler());
      MyFrame frame = new MyFrame( null, "HtmlHelpController sample", Window.wxDefaultPosition, Window.wxDefaultSize );
      frame.Show( true );

      return true;
    }

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

    [STAThread]
    static void Main()
    {
      HtmlHelp app = new HtmlHelp();
      app.Run();
    }
  }    
}

www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.