HTML.cs :  » GUI » wx-NET » wx » 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 » HTML.cs
//-----------------------------------------------------------------------------
// wx.NET - HTML.cs
// 
// The wxHTML wrapper classes.
//
// Written by Bryan Bulten (bryan@bulten.ca)
// (C) 2003 Bryan Bulten
// Licensed under the wxWidgets license, see LICENSE.txt for details.
//
// $Id: HTML.cs,v 1.30 2007/11/24 17:55:45 harald_meyer Exp $
//-----------------------------------------------------------------------------

using System;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Collections;

namespace wx{
  public enum HtmlURLType
  {
    wxHTML_URL_PAGE,
    wxHTML_URL_IMAGE,
    wxHTML_URL_OTHER
  }
  
  //-----------------------------------------------------------------------------
  
  public enum HtmlOpeningStatus
  {
    wxHTML_OPEN,
    wxHTML_BLOCK,
    wxHTML_REDIRECT
  }
  
  //-----------------------------------------------------------------------------

  public class HtmlWindow : ScrolledWindow
  {
    public const int wxHW_SCROLLBAR_NEVER   = 0x0002;
    public const int wxHW_SCROLLBAR_AUTO    = 0x0004;
    public const int wxHW_NO_SELECTION      = 0x0008;

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

    private delegate void Virtual_OnLinkClicked(IntPtr link);
    private delegate void Virtual_OnSetTitle(IntPtr title);
    private delegate void Virtual_OnCellMouseHover(IntPtr cell, int x, int y);
    private delegate void Virtual_OnCellClicked(IntPtr cell, int x, int y, IntPtr mouseevent);
    private delegate int Virtual_OnOpeningURL(int type, IntPtr url, IntPtr redirect);
        private delegate int Virtual_LoadFile(IntPtr wxStringFilenameNativeMode);
        private delegate int Virtual_LoadPage(IntPtr wxStringLocation);

    private Virtual_OnLinkClicked virtual_OnLinkClicked;
    private Virtual_OnSetTitle virtual_OnSetTitle;
    private Virtual_OnCellMouseHover virtual_OnCellMouseHover;
    private Virtual_OnCellClicked virtual_OnCellClicked;
    private Virtual_OnOpeningURL virtual_OnOpeningUrl;
        private Virtual_LoadFile virtual_LoadFile;
        private Virtual_LoadPage virtual_LoadPage;
    
    //-----------------------------------------------------------------------------

    [DllImport("wx-c")] static extern IntPtr wxHtmlWindow_ctor();
    [DllImport("wx-c")] static extern void   wxHtmlWindow_RegisterVirtual(IntPtr self, 
      Virtual_OnLinkClicked onLinkClicked,
      Virtual_OnSetTitle onSetTitle,
      Virtual_OnCellMouseHover onCellMouseHover,
      Virtual_OnCellClicked onCellClicked,
      Virtual_OnOpeningURL onOpeningURL,
            Virtual_LoadFile loadFile,
            Virtual_LoadPage loadPage);
    [DllImport("wx-c")] [return: MarshalAs(UnmanagedType.U1)] static extern bool wxHtmlWindow_Create(IntPtr self, IntPtr parent, int id, ref Point pos, ref Size size, uint style, IntPtr name);
    [DllImport("wx-c")] [return: MarshalAs(UnmanagedType.U1)] static extern bool wxHtmlWindow_SetPage(IntPtr self, IntPtr source);
        [DllImport("wx-c")] [return: MarshalAs(UnmanagedType.U1)] static extern bool wxHtmlWindow_AppendToPage(IntPtr self, IntPtr source);
    [DllImport("wx-c")] [return: MarshalAs(UnmanagedType.U1)] static extern bool wxHtmlWindow_LoadPage(IntPtr self, IntPtr location);
    [DllImport("wx-c")] [return: MarshalAs(UnmanagedType.U1)] static extern bool wxHtmlWindow_LoadFile(IntPtr self, IntPtr filename);
    [DllImport("wx-c")] static extern IntPtr wxHtmlWindow_GetOpenedPage(IntPtr self);
    [DllImport("wx-c")] static extern IntPtr wxHtmlWindow_GetOpenedAnchor(IntPtr self);
    [DllImport("wx-c")] static extern IntPtr wxHtmlWindow_GetOpenedPageTitle(IntPtr self);
    [DllImport("wx-c")] static extern void   wxHtmlWindow_SetRelatedFrame(IntPtr self, IntPtr frame, IntPtr format);
    [DllImport("wx-c")] static extern IntPtr wxHtmlWindow_GetRelatedFrame(IntPtr self);
    [DllImport("wx-c")] static extern void   wxHtmlWindow_SetRelatedStatusBar(IntPtr self, int bar);
        [DllImport("wx-c")] static extern void wxHtmlWindow_SetFonts(IntPtr self, IntPtr normal_face, IntPtr fixed_face, int[] sizes);
    [DllImport("wx-c")] static extern void   wxHtmlWindow_SetBorders(IntPtr self, int b);
    [DllImport("wx-c")] static extern void   wxHtmlWindow_ReadCustomization(IntPtr self, IntPtr cfg, IntPtr path);
    [DllImport("wx-c")] static extern void   wxHtmlWindow_WriteCustomization(IntPtr self, IntPtr cfg, IntPtr path);
    [DllImport("wx-c")] [return: MarshalAs(UnmanagedType.U1)] static extern bool   wxHtmlWindow_HistoryBack(IntPtr self);
    [DllImport("wx-c")] [return: MarshalAs(UnmanagedType.U1)] static extern bool   wxHtmlWindow_HistoryForward(IntPtr self);
    [DllImport("wx-c")] [return: MarshalAs(UnmanagedType.U1)] static extern bool   wxHtmlWindow_HistoryCanBack(IntPtr self);
    [DllImport("wx-c")] [return: MarshalAs(UnmanagedType.U1)] static extern bool   wxHtmlWindow_HistoryCanForward(IntPtr self);
    [DllImport("wx-c")] static extern void   wxHtmlWindow_HistoryClear(IntPtr self);
    [DllImport("wx-c")] static extern IntPtr wxHtmlWindow_GetInternalRepresentation(IntPtr self);
    [DllImport("wx-c")] static extern void   wxHtmlWindow_AddFilter(IntPtr filter);
    [DllImport("wx-c")] static extern IntPtr wxHtmlWindow_GetParser(IntPtr self);
    [DllImport("wx-c")] static extern void   wxHtmlWindow_AddProcessor(IntPtr self, IntPtr processor);
    [DllImport("wx-c")] static extern void   wxHtmlWindow_AddGlobalProcessor(IntPtr processor);
        [DllImport("wx-c")] [return: MarshalAs(UnmanagedType.U1)] static extern bool wxHtmlWindow_AcceptsFocusFromKeyboard(IntPtr self);
    [DllImport("wx-c")] static extern void   wxHtmlWindow_OnSetTitle(IntPtr self, IntPtr title);
    [DllImport("wx-c")] static extern void   wxHtmlWindow_OnCellClicked(IntPtr self, IntPtr cell, int x, int y, IntPtr evt);
    [DllImport("wx-c")] static extern void   wxHtmlWindow_OnLinkClicked(IntPtr self, IntPtr link);
    [DllImport("wx-c")] static extern int    wxHtmlWindow_OnOpeningURL(IntPtr self, int type, IntPtr url, IntPtr redirect);
    
    [DllImport("wx-c")] static extern void   wxHtmlWindow_SelectAll(IntPtr self);
    [DllImport("wx-c")] static extern void   wxHtmlWindow_SelectWord(IntPtr self, ref Point pos);
    [DllImport("wx-c")] static extern void   wxHtmlWindow_SelectLine(IntPtr self, ref Point pos);
    
    [DllImport("wx-c")] static extern IntPtr wxHtmlWindow_ToText(IntPtr self);
    
    [DllImport("wx-c")] static extern IntPtr wxHtmlWindow_SelectionToText(IntPtr self);
    
    //-----------------------------------------------------------------------------

    public HtmlWindow(IntPtr  wxObject)
      : base(wxObject) { }

    public HtmlWindow()
      : base(wxHtmlWindow_ctor()) { }
    
    public HtmlWindow(Window parent, int id)
      : this(parent, id, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO, "HtmlWindow") { }
    
    public HtmlWindow(Window parent, int id, Point pos)
      : this(parent, id, pos, wxDefaultSize, wxHW_SCROLLBAR_AUTO, "HtmlWindow") { }
    
    public HtmlWindow(Window parent, int id, Point pos, Size size)
      : this(parent, id, pos, size, wxHW_SCROLLBAR_AUTO, "HtmlWindow") { }
    
    public HtmlWindow(Window parent, int id, Point pos, Size size, uint style)
      : this(parent, id, pos, size, style, "HtmlWindow") { }
    
    public HtmlWindow(Window parent, int id, Point pos, Size size, uint style, string name)
      : base(wxHtmlWindow_ctor())
    {
      virtual_OnLinkClicked = new Virtual_OnLinkClicked( DoOnLinkClicked );
      virtual_OnSetTitle = new Virtual_OnSetTitle( DoOnSetTitle );
      virtual_OnCellMouseHover = new Virtual_OnCellMouseHover( DoOnCellMouseHover );
      virtual_OnCellClicked = new Virtual_OnCellClicked( DoOnCellClicked );
      virtual_OnOpeningUrl = new Virtual_OnOpeningURL( DoOnOpeningURL);
            virtual_LoadFile = new Virtual_LoadFile(DoLoadFile);
            virtual_LoadPage = new Virtual_LoadPage(DoLoadPage);

      wxHtmlWindow_RegisterVirtual(wxObject, 
        virtual_OnLinkClicked,
        virtual_OnSetTitle,
        virtual_OnCellMouseHover,
        virtual_OnCellClicked,
        virtual_OnOpeningUrl,
                virtual_LoadFile,
                virtual_LoadPage
        );

      if (!Create(parent, id, pos, size, style, name)) 
      {
        throw new InvalidOperationException("Failed to create HtmlWindow");
      }

            this.AddCommandListener(wx.Event.wxEVT_LOAD_HTML_PAGE, -1, new EventListener(this.OnLoadPageEvent));
    }
    
    //---------------------------------------------------------------------
    // ctors with self created id
    
    public HtmlWindow(Window parent)
      : this(parent, Window.UniqueID, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO, "HtmlWindow") { }
    
    public HtmlWindow(Window parent, Point pos)
      : this(parent, Window.UniqueID, pos, wxDefaultSize, wxHW_SCROLLBAR_AUTO, "HtmlWindow") { }
    
    public HtmlWindow(Window parent, Point pos, Size size)
      : this(parent, Window.UniqueID, pos, size, wxHW_SCROLLBAR_AUTO, "HtmlWindow") { }
    
    public HtmlWindow(Window parent, Point pos, Size size, uint style)
      : this(parent, Window.UniqueID, pos, size, style, "HtmlWindow") { }
    
    public HtmlWindow(Window parent, Point pos, Size size, uint style, string name)
      : this(parent, Window.UniqueID, pos, size, style, name) {}

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

        public new bool Create(Window parent, int id, Point pos, Size size, uint style, string name)
        {
            return this.Create(parent, id, pos, size, style, wxString.SafeNew(name));
        }
    new public bool Create(Window parent, int id, Point pos, Size size, uint style, wxString name)
    {
      return wxHtmlWindow_Create(wxObject, Object.SafePtr(parent), id, ref pos, ref size, (uint)style, name.wxObject);
    }

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

        IList _widgetCells=new ArrayList();
        /** A .NET wx.HtmlWidgetCell will register itself here.
         * Reason: ClearWidgetCells().
         * */
        internal void RegisterWidgetCell(HtmlWidgetCell cell)
        {
            this._widgetCells.Add(cell);
        }

        /** This will make all widgets in cells invisible and clear the list of registered cells.
         * This is a work around a bug in the HTML framework: If we load an existing wx.HtmlWindow
         * with a new page with new instances of wx.HtmlWidgetCell, all the old instances of
         * wx.HtmlWidgetCell not be destroyed immediately. This usually disturbs the event chain.
         * So, the \e wx.NET system will make widget cells invisible as soon as they will be
         * replaced.
         */
        internal void SetInvisibleWidgetCells()
        {
            foreach (HtmlWidgetCell cell in this._widgetCells)
            {
                if (!cell.disposed) // this ca happen if the previous page containing controls has never been shown
                    cell.Window.Show(false);
            }
            this._widgetCells.Clear();
        }

        public bool SetPage(string source)
        {
            return this.SetPage(new wxString(source));
        }
    public bool SetPage(wxString source)
    {
            this.SetInvisibleWidgetCells();
            return wxHtmlWindow_SetPage(wxObject, source.wxObject);
    }

        public bool AppendToPage(string source)
        {
            return this.AppendToPage(new wxString(source));
        }
    public bool AppendToPage(wxString source)
    {
      return wxHtmlWindow_AppendToPage(wxObject, source.wxObject);
    }

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

        /** Call this only on wx.CommandEvent().
         * This will load the page URL retrieved from the client string wx.CommandEvent.String.
         * */
        internal void OnLoadPageEvent(object sender, Event evt)
        {
            if (evt is CommandEvent)
            {
                CommandEvent cevt = (CommandEvent)evt;
                if (!LoadPage(cevt.String)) cevt.Skip(true);
            }
            else
                evt.Skip(true);
        }

        /** Overload this to change the behaviour on loading a page from the designated location.
         * Refer to FSFile and FileSystemHandler for remarks on available locations.
         * */
    public virtual bool LoadPage(string location)
    {
            wxString wxLocation = new wxString(location);
            return this.LoadPage(wxLocation);
    }

        public virtual bool LoadPage(wxString location)
        {
            this.SetInvisibleWidgetCells();
            return wxHtmlWindow_LoadPage(wxObject, location.wxObject);
        }

        private int DoLoadPage(IntPtr clocation)
        {
            wxString location = new wxString(clocation, false);
            return this.LoadPage(location) ? 1 : 0;
        }
    
        /** Overload this to change the behaviour on loading a file.
         * The argument is a file name in native style.
         * */
    virtual public bool LoadFile(string filename)
    {
            return this.LoadFile(new wxString(filename));
    }

        virtual public bool LoadFile(wxString filename)
        {
            return wxHtmlWindow_LoadFile(wxObject, filename.wxObject);
        }

        private int DoLoadFile(IntPtr cfilename)
        {
            wxString filename = new wxString(cfilename);
            return this.LoadFile(filename) ? 1 : 0;
        }

    //-----------------------------------------------------------------------------
    
    public string OpenedPage
    {
      get { return new wxString(wxHtmlWindow_GetOpenedPage(wxObject), true); } 
    }
    
    public string OpenedAnchor
    {
      get { return new wxString(wxHtmlWindow_GetOpenedAnchor(wxObject), true); }
    }
    
    public string OpenedPageTitle
    {
      get { return new wxString(wxHtmlWindow_GetOpenedPageTitle(wxObject), true); }
    }
    
    //-----------------------------------------------------------------------------

        public void SetRelatedFrame(Frame frame, string format)
        {
            this.SetRelatedFrame(frame, new wxString(format));
        }
    public void SetRelatedFrame(Frame frame, wxString format)
    {
      wxHtmlWindow_SetRelatedFrame(wxObject, Object.SafePtr(frame), format.wxObject);
    }
    
    public Frame RelatedFrame
    {
      get { return (Frame)FindObject(wxHtmlWindow_GetRelatedFrame(wxObject), typeof(Frame)); }
    }
    
    //-----------------------------------------------------------------------------
    
    public int RelatedStatusBar
    {
      set { wxHtmlWindow_SetRelatedStatusBar(wxObject, value); }
    }
    
    //-----------------------------------------------------------------------------

        public void SetFonts(string normal_face, string fixed_face, int[] sizes)
        {
            this.SetFonts(new wxString(normal_face), new wxString(fixed_face), sizes);
        }
    public void SetFonts(wxString normal_face, wxString fixed_face, int[] sizes)
    {
      wxHtmlWindow_SetFonts(wxObject, normal_face.wxObject, fixed_face.wxObject, sizes);
    }
    
    //-----------------------------------------------------------------------------
    
    public int Borders
    {
      set { wxHtmlWindow_SetBorders(wxObject, value); }
    }
    
    //-----------------------------------------------------------------------------

        public virtual void ReadCustomization(Config cfg)
        {
            this.ReadCustomization(cfg, "");
        }
        public virtual void ReadCustomization(Config cfg, string path)
        {
            this.ReadCustomization(cfg, new wxString(path));
        }
    void ReadCustomization(Config cfg, wxString path)
    {
      wxHtmlWindow_ReadCustomization(wxObject, Object.SafePtr(cfg), path.wxObject);
    }
    
    //-----------------------------------------------------------------------------

        public void WriteCustomization(Config cfg)
        {
            WriteCustomization(cfg, "");
        }
        public virtual void WriteCustomization(Config cfg, string path)
        {
            WriteCustomization(cfg, new wxString(path));
        }
    void WriteCustomization(Config cfg, wxString path)
    {
      wxHtmlWindow_WriteCustomization(wxObject, Object.SafePtr(cfg), path.wxObject);
    }
    
    //-----------------------------------------------------------------------------
    
    public bool HistoryBack()
    {
      return wxHtmlWindow_HistoryBack(wxObject);
    }
    
    public bool HistoryForward()
    {
      return wxHtmlWindow_HistoryForward(wxObject);
    }
    
    public bool HistoryCanBack()
    {
      return wxHtmlWindow_HistoryCanBack(wxObject);
    }
    
    public bool HistoryCanForward()
    {
      return wxHtmlWindow_HistoryCanForward(wxObject);
    }
    
    public void HistoryClear()
    {
      wxHtmlWindow_HistoryClear(wxObject);
    }
    
    //-----------------------------------------------------------------------------
    
    public HtmlContainerCell InternalRepresentation
    {
      get { return (HtmlContainerCell)FindObject(wxHtmlWindow_GetInternalRepresentation(wxObject), typeof(HtmlContainerCell)); }
    }
    
    //-----------------------------------------------------------------------------
    
    public static void AddFilter(HtmlFilter filter)
    {
      wxHtmlWindow_AddFilter(Object.SafePtr(filter));
    }
    
    //-----------------------------------------------------------------------------
    
    public HtmlWinParser Parser
    {
      get { return (HtmlWinParser)FindObject(wxHtmlWindow_GetParser(wxObject), typeof(HtmlWinParser)); }
    }
    
    //-----------------------------------------------------------------------------
    
    public void AddProcessor(HtmlProcessor processor)
    {
      wxHtmlWindow_AddProcessor(wxObject, Object.SafePtr(processor));
    }
    
    public static void AddGlobalProcessor(HtmlProcessor processor)
    {
      wxHtmlWindow_AddGlobalProcessor(Object.SafePtr(processor));
    }
    
    //-----------------------------------------------------------------------------
    
    public override bool AcceptsFocusFromKeyboard()
    {
      return wxHtmlWindow_AcceptsFocusFromKeyboard(wxObject);
    }
    
    //-----------------------------------------------------------------------------
    
    private void DoOnSetTitle(IntPtr title)
    {      
      OnSetTitle((string)new wxString(title, false));
    }

        public virtual void OnSetTitle(string title)
        {
            this.OnSetTitle(new wxString(title));
        }
      void OnSetTitle(wxString title)
    {
      wxHtmlWindow_OnSetTitle(wxObject, title.wxObject);
    }
    
    //-----------------------------------------------------------------------------
    
    private void DoOnCellMouseHover(IntPtr cell, int x, int y)
    {
      OnCellMouseHover(new HtmlCell(cell), x, y);
    }
    
    public virtual void OnCellMouseHover(HtmlCell cell, int x, int y)
    {
      // Do nothing here
    }
    
    //-----------------------------------------------------------------------------
    
    private void DoOnCellClicked(IntPtr cell, int x, int y, IntPtr mouseevent)
    {
      OnCellClicked(new HtmlCell(cell), x, y, new MouseEvent(mouseevent));
    }
    
    public virtual void OnCellClicked(HtmlCell cell, int x, int y, MouseEvent evt)
    {
      wxHtmlWindow_OnCellClicked(wxObject, Object.SafePtr(cell), x, y, Object.SafePtr(evt));
    }
    
    //-----------------------------------------------------------------------------
    
    private void DoOnLinkClicked(IntPtr link)
    {
      OnLinkClicked(new HtmlLinkInfo(link));
    }
    
    public virtual void OnLinkClicked(HtmlLinkInfo link)
    {
      wxHtmlWindow_OnLinkClicked(wxObject, Object.SafePtr(link));
    }
    
    //-----------------------------------------------------------------------------
    
    private int DoOnOpeningURL(int type, IntPtr url, IntPtr redirect)
    {
      return (int)OnOpeningURL((HtmlURLType) type, (string)new wxString(url, true), (string)new wxString(redirect, false));
    }

        public virtual HtmlOpeningStatus OnOpeningURL(HtmlURLType type, string url, string redirect)
        {
            wxString wxRedirect = new wxString(redirect);
            HtmlOpeningStatus result = this.OnOpeningURL(type, new wxString(url), wxRedirect);
            redirect = wxRedirect;
            return result;
        }

      HtmlOpeningStatus OnOpeningURL(HtmlURLType type, wxString url, wxString redirect)
    {
      return (HtmlOpeningStatus)wxHtmlWindow_OnOpeningURL(wxObject, (int)type, url.wxObject, redirect.wxObject);
    }
    
    //-----------------------------------------------------------------------------
    
    public void SelectAll()
    {
      wxHtmlWindow_SelectAll(wxObject);
    }
    
    //-----------------------------------------------------------------------------
    
    public void SelectLine(Point pos)
    {
      wxHtmlWindow_SelectLine(wxObject, ref pos);
    }
    
    //-----------------------------------------------------------------------------
    
    public void SelectWord(Point pos)
    {
      wxHtmlWindow_SelectWord(wxObject, ref pos);
    }
    
    //-----------------------------------------------------------------------------
    
    public string Text
    {
      get { return new wxString(wxHtmlWindow_ToText(wxObject), true); }
    }
    
    //-----------------------------------------------------------------------------
    
    public string SelectionText
    {
      get { return new wxString(wxHtmlWindow_SelectionToText(wxObject), true); }
    }
  }
    
  //-----------------------------------------------------------------------------

  public class HtmlFontCell : HtmlCell
  {
    [DllImport("wx-c")] static extern IntPtr wxHtmlFontCell_ctor(IntPtr font);
    [DllImport("wx-c")] static extern void   wxHtmlFontCell_Draw(IntPtr self, IntPtr dc, int x, int y, int view_y1, int view_y2, IntPtr info);
    [DllImport("wx-c")] static extern void   wxHtmlFontCell_DrawInvisible(IntPtr self, IntPtr dc, int x, int y, IntPtr info);

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

    public HtmlFontCell(IntPtr wxObject)
      : base(wxObject) {}

    public HtmlFontCell(Font font)
      : this(wxHtmlFontCell_ctor(Object.SafePtr(font))) { }

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

    public override void Draw(DC dc, int x, int y, int view_y1, int view_y2, HtmlRenderingInfo info)
    {
      wxHtmlFontCell_Draw(wxObject, Object.SafePtr(dc), x, y, view_y1, view_y2, Object.SafePtr(info));
    }
    
    //-----------------------------------------------------------------------------
    
    public override void DrawInvisible(DC dc, int x, int y, HtmlRenderingInfo info)
    {
      wxHtmlFontCell_DrawInvisible(wxObject, Object.SafePtr(dc), x, y, Object.SafePtr(info));
    }
  }

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

  public class HtmlColourCell : HtmlCell
  {
    [DllImport("wx-c")] static extern IntPtr wxHtmlColourCell_ctor(IntPtr clr, int flags);
    [DllImport("wx-c")] static extern void   wxHtmlColourCell_Draw(IntPtr self, IntPtr dc, int x, int y, int view_y1, int view_y2, IntPtr info);
    [DllImport("wx-c")] static extern void   wxHtmlColourCell_DrawInvisible(IntPtr self, IntPtr dc, int x, int y, IntPtr info);

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

    public HtmlColourCell(IntPtr wxObject)
      : base(wxObject) {}

    public  HtmlColourCell(Colour clr, int flags)
      : this(wxHtmlColourCell_ctor(Object.SafePtr(clr), flags)) { }

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

    public override void Draw(DC dc, int x, int y, int view_y1, int view_y2, HtmlRenderingInfo info)
    {
      wxHtmlColourCell_Draw(wxObject, Object.SafePtr(dc), x, y, view_y1, view_y2, Object.SafePtr(info));
    }

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

    public override void DrawInvisible(DC dc, int x, int y, HtmlRenderingInfo info)
    {
      wxHtmlColourCell_DrawInvisible(wxObject, Object.SafePtr(dc), x, y, Object.SafePtr(info));
    }
  }

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

  public class HtmlLinkInfo : Object
  {
    [DllImport("wx-c")] static extern IntPtr wxHtmlLinkInfo_ctor();
    [DllImport("wx-c")] static extern IntPtr wxHtmlLinkInfo_ctor(string href, string target);
    [DllImport("wx-c")] static extern IntPtr wxHtmlLinkInfo_ctor(IntPtr l);
    [DllImport("wx-c")] static extern void   wxHtmlLinkInfo_SetEvent(IntPtr self, IntPtr e);
    [DllImport("wx-c")] static extern void   wxHtmlLinkInfo_SetHtmlCell(IntPtr self, IntPtr e);
    [DllImport("wx-c")] static extern IntPtr wxHtmlLinkInfo_GetHref(IntPtr self);
    [DllImport("wx-c")] static extern IntPtr wxHtmlLinkInfo_GetTarget(IntPtr self);
    [DllImport("wx-c")] static extern IntPtr wxHtmlLinkInfo_GetEvent(IntPtr self);
    [DllImport("wx-c")] static extern IntPtr wxHtmlLinkInfo_GetHtmlCell(IntPtr self);
    
    //-----------------------------------------------------------------------------
    
    public HtmlLinkInfo(IntPtr wxObject)
      : base(wxObject) {}
    
    public  HtmlLinkInfo()
      : base(wxHtmlLinkInfo_ctor()) { }
    
    //-----------------------------------------------------------------------------
    
    public  HtmlLinkInfo(string href, string target)
      : base(wxHtmlLinkInfo_ctor(href, target)) { }
    
    //-----------------------------------------------------------------------------
    
    /*public  HtmlLinkInfo(HtmlLinkInfo l)
      : base(wxHtmlLinkInfo_ctor(Object.SafePtr(l))) { }*/
    
    //-----------------------------------------------------------------------------
    
    public MouseEvent Event
    {
      set { wxHtmlLinkInfo_SetEvent(wxObject, Object.SafePtr(value)); }
      get { return (MouseEvent)FindObject(wxHtmlLinkInfo_GetEvent(wxObject), typeof(MouseEvent)); }
    }
    
    //-----------------------------------------------------------------------------
    
    public string Href
    {
      get { return new wxString(wxHtmlLinkInfo_GetHref(wxObject), true); }
    }
    
    //-----------------------------------------------------------------------------
    
    public string Target
    {
      get { return new wxString(wxHtmlLinkInfo_GetTarget(wxObject), true); }
    }
    
    //-----------------------------------------------------------------------------
    
    public HtmlCell HtmlCell
    {
      get { return (HtmlCell)FindObject(wxHtmlLinkInfo_GetHtmlCell(wxObject), typeof(HtmlCell)); }
      set { wxHtmlLinkInfo_SetHtmlCell(wxObject, Object.SafePtr(value)); }
    }
  }

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

    /** The wrapper for the \c wxHtmlWidgetCell of \e wxWidgets.
     * Please note, that the \e wx.NET system uses a specialization of \c wxHtmlWidgetCell
     * that contains some fixes. 
     */
    public class HtmlWidgetCell : HtmlCell
    {
        [DllImport("wx-c")] static extern IntPtr wxHtmlWidgetCell_ctor(IntPtr wnd, int w);
        [DllImport("wx-c")] static extern void wxHtmlWidgetCell_RegisterDispose(IntPtr self, Virtual_Dispose onDispose);
        [DllImport("wx-c")] static extern void wxHtmlWidgetCell_Draw(IntPtr self, IntPtr dc, int x, int y, int view_y1, int view_y2, IntPtr info);
        [DllImport("wx-c")] static extern void   wxHtmlWidgetCell_DrawInvisible(IntPtr self, IntPtr dc, int x, int y, IntPtr info);
        [DllImport("wx-c")] static extern void   wxHtmlWidgetCell_Layout(IntPtr self, int w);
        [DllImport("wx-c")] static extern IntPtr wxHtmlWidgetCell_GetWindow(IntPtr self);
        //-----------------------------------------------------------------------------

    public HtmlWidgetCell(IntPtr wxObject)
      : base(wxObject) {}

        public HtmlWidgetCell(Window wnd)
            : this(wnd, 0)
        {
        }

        public HtmlWidgetCell(Window wnd, int w)
            : this(wxHtmlWidgetCell_ctor(Object.SafePtr(wnd), w))
        {
            this.virtual_Dispose=new Virtual_Dispose(this.VirtualDispose);
            wxHtmlWidgetCell_RegisterDispose(this.wxObject, this.virtual_Dispose);
            if (wnd.Parent is HtmlWindow)
                ((HtmlWindow)wnd.Parent).RegisterWidgetCell(this);
        }

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

        internal Window Window
        {
            get { return (Window)Object.FindObject(wxHtmlWidgetCell_GetWindow(this.wxObject), typeof(Window)); }
        }

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

        public override void Draw(DC dc, int x, int y, int view_y1, int view_y2, HtmlRenderingInfo info)
        {
            wxHtmlWidgetCell_Draw(wxObject, Object.SafePtr(dc), x, y, view_y1, view_y2, Object.SafePtr(info));
        }

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

        public override void DrawInvisible(DC dc, int x, int y, HtmlRenderingInfo info)
        {
            wxHtmlWidgetCell_DrawInvisible(wxObject, Object.SafePtr(dc), x, y, Object.SafePtr(info));
        }

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

        public override void Layout(int w)
        {
            wxHtmlWidgetCell_Layout(wxObject, w);
        }
    }

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

    public class HtmlCell : Object
    {
        [DllImport("wx-c")] static extern IntPtr wxHtmlCell_ctor();
        [DllImport("wx-c")] static extern void   wxHtmlCell_SetParent(IntPtr self, IntPtr p);
        [DllImport("wx-c")] static extern IntPtr wxHtmlCell_GetParent(IntPtr self);
        [DllImport("wx-c")] static extern int    wxHtmlCell_GetPosX(IntPtr self);
        [DllImport("wx-c")] static extern int    wxHtmlCell_GetPosY(IntPtr self);
        [DllImport("wx-c")] static extern int    wxHtmlCell_GetWidth(IntPtr self);
        [DllImport("wx-c")] static extern int    wxHtmlCell_GetHeight(IntPtr self);
        [DllImport("wx-c")] static extern int    wxHtmlCell_GetDescent(IntPtr self);
        [DllImport("wx-c")] static extern IntPtr wxHtmlCell_GetId(IntPtr self);
        [DllImport("wx-c")] static extern void   wxHtmlCell_SetId(IntPtr self, IntPtr id);
        [DllImport("wx-c")] static extern IntPtr wxHtmlCell_GetNext(IntPtr self);
        [DllImport("wx-c")] static extern void   wxHtmlCell_SetPos(IntPtr self, int x, int y);
        [DllImport("wx-c")] static extern void   wxHtmlCell_SetLink(IntPtr self, IntPtr link);
        [DllImport("wx-c")] static extern void   wxHtmlCell_SetNext(IntPtr self, IntPtr cell);
        [DllImport("wx-c")] static extern void   wxHtmlCell_Layout(IntPtr self, int w);
        [DllImport("wx-c")] static extern void   wxHtmlCell_Draw(IntPtr self, IntPtr dc, int x, int y, int view_y1, int view_y2, IntPtr info);
        [DllImport("wx-c")] static extern void   wxHtmlCell_DrawInvisible(IntPtr self, IntPtr dc, int x, int y, IntPtr info);
        [DllImport("wx-c")] static extern IntPtr wxHtmlCell_Find(IntPtr self, int condition, IntPtr param);
        [DllImport("wx-c")] static extern void   wxHtmlCell_OnMouseClick(IntPtr self, IntPtr parent, int x, int y, IntPtr evt);
        [DllImport("wx-c")] static extern bool   wxHtmlCell_AdjustPagebreak(IntPtr self, ref int pagebreak);
        [DllImport("wx-c")] static extern void   wxHtmlCell_SetCanLiveOnPagebreak(IntPtr self, bool can);
        [DllImport("wx-c")] static extern void   wxHtmlCell_GetHorizontalConstraints(IntPtr self, ref int left, ref int right);
        [DllImport("wx-c")] static extern bool   wxHtmlCell_IsTerminalCell(IntPtr self);
        [DllImport("wx-c")] static extern IntPtr wxHtmlCell_FindCellByPos(IntPtr self, int x, int y);

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

        public HtmlCell(IntPtr wxObject) 
            : base(wxObject) { }

        public HtmlCell()
            : base(wxHtmlCell_ctor())
        {
        }

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

        public HtmlContainerCell Parent
        {
            set { wxHtmlCell_SetParent(wxObject, Object.SafePtr(value)); }
            get { return (HtmlContainerCell)FindObject(wxHtmlCell_GetParent(wxObject), typeof(HtmlContainerCell)); }
        }

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

        public int PosX
        {
            get { return wxHtmlCell_GetPosX(wxObject); }
        }

        public int PosY
        {
            get { return wxHtmlCell_GetPosY(wxObject); }
        }

        public int Width
        {
            get { return wxHtmlCell_GetWidth(wxObject); }
        }

        public int Height
        {
            get { return wxHtmlCell_GetHeight(wxObject); }
        }

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

        public int Descent
        {
            get { return wxHtmlCell_GetDescent(wxObject); }
        }

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

        public virtual string Id
        {
            get { return new wxString(wxHtmlCell_GetId(wxObject), true); }
            set
            {
                wxString wxvalue = new wxString(value);
                wxHtmlCell_SetId(wxObject, wxvalue.wxObject);
            }
        }

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

        public HtmlCell Next
        {
            get { return (HtmlCell)FindObject(wxHtmlCell_GetNext(wxObject), typeof(HtmlCell)); }
            set { wxHtmlCell_SetNext(wxObject, Object.SafePtr(value)); }
        }

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

        public void SetPos(int x, int y)
        {
            wxHtmlCell_SetPos(wxObject, x, y);
        }

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

        public HtmlLinkInfo Link
        {
            set { wxHtmlCell_SetLink(wxObject, Object.SafePtr(value)); }
        }

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

        public virtual void Layout(int w)
        {
            wxHtmlCell_Layout(wxObject, w);
        }

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

        public virtual void Draw(DC dc, int x, int y, int view_y1, int view_y2, HtmlRenderingInfo info)
        {
            wxHtmlCell_Draw(wxObject, Object.SafePtr(dc), x, y, view_y1, view_y2, Object.SafePtr(info));
        }

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

        public virtual void DrawInvisible(DC dc, int x, int y, HtmlRenderingInfo info)
        {
            wxHtmlCell_DrawInvisible(wxObject, Object.SafePtr(dc), x, y, Object.SafePtr(info));
        }

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

        public virtual HtmlCell Find(int condition, Object param)
        {
            return (HtmlCell)FindObject(wxHtmlCell_Find(wxObject, condition, Object.SafePtr(param)), typeof(HtmlCell));
        }

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

        public virtual void OnMouseClick(Window parent, int x, int y, MouseEvent evt)
        {
            wxHtmlCell_OnMouseClick(wxObject, Object.SafePtr(parent), x, y, Object.SafePtr(evt));
        }

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

        public virtual bool AdjustPagebreak(ref int pagebreak)
        {
            return wxHtmlCell_AdjustPagebreak(wxObject, ref pagebreak);
        }

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

        public bool CanLiveOnPagebreak
        {
            set { wxHtmlCell_SetCanLiveOnPagebreak(wxObject, value); }
        }

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

        public void GetHorizontalConstraints(out int left, out int right)
        {
            left = right = 0;
            wxHtmlCell_GetHorizontalConstraints(wxObject, ref left, ref right);
        }

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

        public virtual bool IsTerminalCell
        {
            get { return wxHtmlCell_IsTerminalCell(wxObject); }
        }

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

        public HtmlCell FindCellByPos(int x, int y)
        {
            return (HtmlCell)FindObject(wxHtmlCell_FindCellByPos(wxObject, x, y), typeof(HtmlCell));
        }

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

        public static implicit operator HtmlCell (IntPtr obj) 
        {
            return (HtmlCell)FindObject(obj, typeof(HtmlCell));
        }
    }

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

    public class HtmlWordCell : HtmlCell
    {
        [DllImport("wx-c")] static extern IntPtr wxHtmlWordCell_ctor(IntPtr word, IntPtr dc);
        [DllImport("wx-c")] static extern void   wxHtmlWordCell_Draw(IntPtr self, IntPtr dc, int x, int y, int view_y1, int view_y2, IntPtr info);

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

    public HtmlWordCell(IntPtr wxObject)
      : base(wxObject) {}

        public  HtmlWordCell(string word, DC dc)
            : this(new wxString(word), dc) { }

        public HtmlWordCell(wxString word, DC dc)
            : this(wxHtmlWordCell_ctor(word.wxObject, Object.SafePtr(dc))) { }

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

        public override void Draw(DC dc, int x, int y, int view_y1, int view_y2, HtmlRenderingInfo info)
        {
            wxHtmlWordCell_Draw(wxObject, Object.SafePtr(dc), x, y, view_y1, view_y2, Object.SafePtr(info));
        }
    }

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

    public class HtmlContainerCell : HtmlCell
    {
        [DllImport("wx-c")] static extern IntPtr wxHtmlContainerCell_ctor(IntPtr parent);
        [DllImport("wx-c")] static extern void   wxHtmlContainerCell_Layout(IntPtr self, int w);
        [DllImport("wx-c")] static extern void   wxHtmlContainerCell_Draw(IntPtr self, IntPtr dc, int x, int y, int view_y1, int view_y2, IntPtr info);
        [DllImport("wx-c")] static extern void   wxHtmlContainerCell_DrawInvisible(IntPtr self, IntPtr dc, int x, int y, IntPtr info);
        [DllImport("wx-c")] static extern bool   wxHtmlContainerCell_AdjustPagebreak(IntPtr self, ref int pagebreak);
        [DllImport("wx-c")] static extern void   wxHtmlContainerCell_InsertCell(IntPtr self, IntPtr cell);
        [DllImport("wx-c")] static extern void   wxHtmlContainerCell_SetAlignHor(IntPtr self, int al);
        [DllImport("wx-c")] static extern int    wxHtmlContainerCell_GetAlignHor(IntPtr self);
        [DllImport("wx-c")] static extern void   wxHtmlContainerCell_SetAlignVer(IntPtr self, int al);
        [DllImport("wx-c")] static extern int    wxHtmlContainerCell_GetAlignVer(IntPtr self);
        [DllImport("wx-c")] static extern void   wxHtmlContainerCell_SetIndent(IntPtr self, int i, int what, int units);
        [DllImport("wx-c")] static extern int    wxHtmlContainerCell_GetIndent(IntPtr self, int ind);
        [DllImport("wx-c")] static extern int    wxHtmlContainerCell_GetIndentUnits(IntPtr self, int ind);
        [DllImport("wx-c")] static extern void   wxHtmlContainerCell_SetAlign(IntPtr self, IntPtr tag);
        [DllImport("wx-c")] static extern void   wxHtmlContainerCell_SetWidthFloat(IntPtr self, int w, int units);
        [DllImport("wx-c")] static extern void   wxHtmlContainerCell_SetWidthFloatTag(IntPtr self, IntPtr tag, double pixel_scale);
        [DllImport("wx-c")] static extern void   wxHtmlContainerCell_SetMinHeight(IntPtr self, int h, int align);
        [DllImport("wx-c")] static extern void   wxHtmlContainerCell_SetBackgroundColour(IntPtr self, IntPtr clr);
        [DllImport("wx-c")] static extern IntPtr wxHtmlContainerCell_GetBackgroundColour(IntPtr self);
        [DllImport("wx-c")] static extern void   wxHtmlContainerCell_SetBorder(IntPtr self, IntPtr clr1, IntPtr clr2);
        [DllImport("wx-c")] static extern IntPtr wxHtmlContainerCell_GetLink(IntPtr self, int x, int y);
        [DllImport("wx-c")] static extern IntPtr wxHtmlContainerCell_Find(IntPtr self, int condition, IntPtr param);
        [DllImport("wx-c")] static extern void   wxHtmlContainerCell_OnMouseClick(IntPtr self, IntPtr parent, int x, int y, IntPtr evt);
        [DllImport("wx-c")] static extern void   wxHtmlContainerCell_GetHorizontalConstraints(IntPtr self, ref int left, ref int right);
        [DllImport("wx-c")] static extern IntPtr wxHtmlContainerCell_GetFirstCell(IntPtr self);
        [DllImport("wx-c")] static extern bool   wxHtmlContainerCell_IsTerminalCell(IntPtr self);
        [DllImport("wx-c")] static extern IntPtr wxHtmlContainerCell_FindCellByPos(IntPtr self, int x, int y);

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

        public HtmlContainerCell(IntPtr wxObject)
            : base(wxObject) { }

        public HtmlContainerCell(HtmlContainerCell parent)
            : this(wxHtmlContainerCell_ctor(Object.SafePtr(parent))) { }

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

        public override void Layout(int w)
        {
            wxHtmlContainerCell_Layout(wxObject, w);
        }

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

        public override void Draw(DC dc, int x, int y, int view_y1, int view_y2, HtmlRenderingInfo info)
        {
            wxHtmlContainerCell_Draw(wxObject, Object.SafePtr(dc), x, y, view_y1, view_y2, Object.SafePtr(info));
        }

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

        public override void DrawInvisible(DC dc, int x, int y, HtmlRenderingInfo info)
        {
            wxHtmlContainerCell_DrawInvisible(wxObject, Object.SafePtr(dc), x, y, Object.SafePtr(info));
        }

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

        public override bool AdjustPagebreak(ref int pagebreak)
        {
            return wxHtmlContainerCell_AdjustPagebreak(wxObject, ref pagebreak);
        }

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

        public void InsertCell(HtmlCell cell)
        {
            wxHtmlContainerCell_InsertCell(wxObject, Object.SafePtr(cell));
        }

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

        public int AlignHor
        {
            set { wxHtmlContainerCell_SetAlignHor(wxObject, value); }
            get { return wxHtmlContainerCell_GetAlignHor(wxObject); }
        }

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

        public int AlignVer
        {
            set { wxHtmlContainerCell_SetAlignVer(wxObject, value); }
            get { return wxHtmlContainerCell_GetAlignVer(wxObject); }
        }

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

        public void SetIndent(int i, int what, int units)
        {
            wxHtmlContainerCell_SetIndent(wxObject, i, what, units);
        }

        public int GetIndent(int ind)
        {
            return wxHtmlContainerCell_GetIndent(wxObject, ind);
        }

        public int GetIndentUnits(int ind)
        {
            return wxHtmlContainerCell_GetIndentUnits(wxObject, ind);
        }

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

        public HtmlTag Align
        {
            set { wxHtmlContainerCell_SetAlign(wxObject, Object.SafePtr(value)); }
        }

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

        public void SetWidthFloat(int w, int units)
        {
            wxHtmlContainerCell_SetWidthFloat(wxObject, w, units);
        }

        public void SetWidthFloat(HtmlTag tag, double pixel_scale)
        {
            wxHtmlContainerCell_SetWidthFloatTag(wxObject, Object.SafePtr(tag), pixel_scale);
        }

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

        public void SetMinHeight(int h, int align)
        {
            wxHtmlContainerCell_SetMinHeight(wxObject, h, align);
        }

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

        public Colour BackgroundColour
        {
            set { wxHtmlContainerCell_SetBackgroundColour(wxObject, Object.SafePtr(value)); }
            get { return new Colour(wxHtmlContainerCell_GetBackgroundColour(wxObject), true); }
        }

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

        public void SetBorder(Colour clr1, Colour clr2)
        {
            wxHtmlContainerCell_SetBorder(wxObject, Object.SafePtr(clr1), Object.SafePtr(clr2));
        }

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

        public virtual HtmlLinkInfo GetLink(int x, int y)
        {
            return (HtmlLinkInfo)FindObject(wxHtmlContainerCell_GetLink(wxObject, x, y), typeof(HtmlLinkInfo));
        }

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

        public override HtmlCell Find(int condition, Object param)
        {
            return (HtmlCell)FindObject(wxHtmlContainerCell_Find(wxObject, condition, Object.SafePtr(param)), typeof(HtmlCell));
        }

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

        public override void OnMouseClick(Window parent, int x, int y, MouseEvent evt)
        {
            wxHtmlContainerCell_OnMouseClick(wxObject, Object.SafePtr(parent), x, y, Object.SafePtr(evt));
        }

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

        public new void GetHorizontalConstraints(out int left, out int right)
        {
            left = right = 0;
            wxHtmlContainerCell_GetHorizontalConstraints(wxObject, ref left, ref right);
        }

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

        public HtmlCell FirstCell
        {
            get { return wxHtmlContainerCell_GetFirstCell(wxObject); }
        }

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

        public override bool IsTerminalCell
        {
            get { return wxHtmlContainerCell_IsTerminalCell(wxObject); }
        }

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

        public new HtmlCell FindCellByPos(int x, int y)
        {
            return wxHtmlContainerCell_FindCellByPos(wxObject, x, y);
        }
    }

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

    public class HtmlTag : Object
    {
        [DllImport("wx-c")] static extern IntPtr wxHtmlTag_GetParent(IntPtr self);
        [DllImport("wx-c")] static extern IntPtr wxHtmlTag_GetFirstSibling(IntPtr self);
        [DllImport("wx-c")] static extern IntPtr wxHtmlTag_GetLastSibling(IntPtr self);
        [DllImport("wx-c")] static extern IntPtr wxHtmlTag_GetChildren(IntPtr self);
        [DllImport("wx-c")] static extern IntPtr wxHtmlTag_GetPreviousSibling(IntPtr self);
        [DllImport("wx-c")] static extern IntPtr wxHtmlTag_GetNextSibling(IntPtr self);
        [DllImport("wx-c")] static extern IntPtr wxHtmlTag_GetNextTag(IntPtr self);
        [DllImport("wx-c")] static extern IntPtr wxHtmlTag_GetName(IntPtr self);
        [DllImport("wx-c")] static extern bool   wxHtmlTag_HasParam(IntPtr self, IntPtr par);
        [DllImport("wx-c")] static extern IntPtr wxHtmlTag_GetParam(IntPtr self, IntPtr par, bool with_commas);
        [DllImport("wx-c")] static extern bool   wxHtmlTag_GetParamAsColour(IntPtr self, IntPtr par, IntPtr clr);
        [DllImport("wx-c")] static extern bool   wxHtmlTag_GetParamAsInt(IntPtr self, IntPtr par, ref int clr);
        [DllImport("wx-c")] static extern int    wxHtmlTag_ScanParam(IntPtr self, IntPtr par, IntPtr format, IntPtr param);
        [DllImport("wx-c")] static extern IntPtr wxHtmlTag_GetAllParams(IntPtr self);
        [DllImport("wx-c")] static extern bool   wxHtmlTag_IsEnding(IntPtr self);
        [DllImport("wx-c")] static extern bool   wxHtmlTag_HasEnding(IntPtr self);
        [DllImport("wx-c")] static extern int    wxHtmlTag_GetBeginPos(IntPtr self);
        [DllImport("wx-c")] static extern int    wxHtmlTag_GetEndPos1(IntPtr self);
        [DllImport("wx-c")] static extern int    wxHtmlTag_GetEndPos2(IntPtr self);
        [DllImport("wx-c")] static extern void   wxHtmlTag_dtor(IntPtr self);

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

        #region CTor / DTor
        public HtmlTag(IntPtr wxObject) 
            : base(wxObject) { }

        protected override void Dispose(bool disposing)
        {
            bool still_there = RemoveObject(wxObject);
            if (!disposed)
            {
                lock (typeof(Object))
                {
                    if (wxObject != IntPtr.Zero && memOwn && still_there)
                    {
                        wxHtmlTag_dtor(wxObject);
                    }
                }

                virtual_Dispose = null;
                wxObject = IntPtr.Zero;
                memOwn = false;
                --validInstancesCount;
            }

            disposed = true;
        }
        #endregion

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

        public HtmlTag Parent
        {
            get { return wxHtmlTag_GetParent(wxObject); }
        }

        public HtmlTag FirstSibling
        {
            get { return wxHtmlTag_GetFirstSibling(wxObject); }
        }

        public HtmlTag LastSibling
        {
            get { return wxHtmlTag_GetLastSibling(wxObject); }
        }

        public HtmlTag Children
        {
            get { return wxHtmlTag_GetChildren(wxObject); }
        }

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

        public HtmlTag PreviousSibling
        {
            get { return wxHtmlTag_GetPreviousSibling(wxObject); }
        }

        public HtmlTag NextSibling
        {
            get { return wxHtmlTag_GetNextSibling(wxObject); }
        }

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

        public HtmlTag NextTag
        {
            get { return wxHtmlTag_GetNextTag(wxObject); }
        }

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

        public string Name
        {
            get { return new wxString(wxHtmlTag_GetName(wxObject), true); }
        }

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

        public bool HasParam(string par)
        {
            wxString wxpar = new wxString(par);
            return wxHtmlTag_HasParam(wxObject, wxpar.wxObject);
        }

        public string GetParam(string par)
        {
            return this.GetParam(par, false);
        }

        public string GetParam(string par, bool with_commas)
        {
            wxString wxpar = new wxString(par);
            return new wxString(wxHtmlTag_GetParam(wxObject, wxpar.wxObject, with_commas), true);
        }

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

        public bool GetParamAsColour(string par, Colour clr)
        {
            wxString wxpar = new wxString(par);
            return wxHtmlTag_GetParamAsColour(wxObject, wxpar.wxObject, Object.SafePtr(clr));
        }

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

        public bool GetParamAsInt(string par, out int clr)
        {
            clr = 0;
            wxString wxpar = new wxString(par);
            return wxHtmlTag_GetParamAsInt(wxObject, wxpar.wxObject, ref clr);
        }

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

        public string AllParams
        {
            get { return new wxString(wxHtmlTag_GetAllParams(wxObject), true); }
        }

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

        public bool IsEnding
        {
            get { return wxHtmlTag_IsEnding(wxObject); }
        }

        public bool HasEnding
        {
            get { return wxHtmlTag_HasEnding(wxObject); }
        }

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

        public int BeginPos
        {
            get { return wxHtmlTag_GetBeginPos(wxObject); }
        }

        public int EndPos1
        {
            get { return wxHtmlTag_GetEndPos1(wxObject); }
        }

        public int EndPos2
        {
            get { return wxHtmlTag_GetEndPos2(wxObject); }
        }

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

        public static implicit operator HtmlTag (IntPtr obj) 
        {
            return (HtmlTag)FindObject(obj, typeof(HtmlTag));
        }

        public override string ToString()
        {
            if (this.HasEnding)
                return string.Format("<{0} {1}>..</{0}>", this.Name, this.AllParams);
            return string.Format("<{0} {1}>", this.Name, this.AllParams);
        }
    }

    public abstract class HtmlFilter : Object
    {
        // TODO

        public HtmlFilter(IntPtr wxObject) 
            : base(wxObject) { }

        /*public abstract bool CanRead(FSFile file);
        public abstract string ReadFile(FSFile file);*/
    }

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

    public class HtmlFilterPlainText : HtmlFilter
    {
        [DllImport("wx-c")] static extern bool   wxHtmlFilterPlainText_CanRead(IntPtr self, IntPtr file);
        [DllImport("wx-c")] static extern IntPtr wxHtmlFilterPlainText_ReadFile(IntPtr self, IntPtr file);

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

        public HtmlFilterPlainText(IntPtr wxObject) 
            : base(wxObject) { }

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

        /*public override bool CanRead(FSFile file)
        {
            return wxHtmlFilterPlainText_CanRead(wxObject, Object.SafePtr(file));
        }

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

        public override string ReadFile(FSFile file)
        {
            return new wxString(wxHtmlFilterPlainText_ReadFile(wxObject, Object.SafePtr(file)));
        }*/
    }

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

    public class HtmlFilterHTML : HtmlFilter
    {
        [DllImport("wx-c")] static extern bool   wxHtmlFilterHTML_CanRead(IntPtr self, IntPtr file);
        [DllImport("wx-c")] static extern IntPtr wxHtmlFilterHTML_ReadFile(IntPtr self, IntPtr file);

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

        public HtmlFilterHTML(IntPtr wxObject) 
            : base(wxObject) { }

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

        /*public override bool CanRead(FSFile file)
        {
            return wxHtmlFilterHTML_CanRead(wxObject, Object.SafePtr(file));
        }

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

        public override string ReadFile(FSFile file)
        {
            return new wxString(wxHtmlFilterHTML_ReadFile(wxObject, Object.SafePtr(file)));
        }*/
    }

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

    public class HtmlTagsModule : Object // TODO: Module
    {
        [DllImport("wx-c")] static extern IntPtr wxHtmlTagsModule_ctor();
        [DllImport("wx-c")] static extern bool   wxHtmlTagsModule_OnInit(IntPtr self);
        [DllImport("wx-c")] static extern void   wxHtmlTagsModule_OnExit(IntPtr self);
        [DllImport("wx-c")] static extern void   wxHtmlTagsModule_FillHandlersTable(IntPtr self, IntPtr parser);

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

    public HtmlTagsModule(IntPtr wxObject)
      : base(wxObject) {}

        public HtmlTagsModule()
            : base(wxHtmlTagsModule_ctor()) { }

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

        public bool OnInit()
        {
            return wxHtmlTagsModule_OnInit(wxObject);
        }

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

        public void OnExit()
        {
            wxHtmlTagsModule_OnExit(wxObject);
        }

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

        public void FillHandlersTable(HtmlWinParser  parser)
        {
            wxHtmlTagsModule_FillHandlersTable(wxObject, Object.SafePtr(parser));
        }
    }

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

    public class HtmlWinParser : HtmlParser
    {
        [DllImport("wx-c")] static extern IntPtr wxHtmlWinParser_ctor(IntPtr wnd);
        [DllImport("wx-c")] static extern void   wxHtmlWinParser_InitParser(IntPtr self, IntPtr source);
        [DllImport("wx-c")] static extern void   wxHtmlWinParser_DoneParser(IntPtr self);
        [DllImport("wx-c")] static extern IntPtr wxHtmlWinParser_GetProduct(IntPtr self);
        [DllImport("wx-c")] static extern IntPtr wxHtmlWinParser_OpenURL(IntPtr self, int type, IntPtr url);
        [DllImport("wx-c")] static extern void   wxHtmlWinParser_SetDC(IntPtr self, IntPtr dc, double pixel_scale);
        [DllImport("wx-c")] static extern IntPtr wxHtmlWinParser_GetDC(IntPtr self);
        [DllImport("wx-c")] static extern double wxHtmlWinParser_GetPixelScale(IntPtr self);
        [DllImport("wx-c")] static extern int    wxHtmlWinParser_GetCharHeight(IntPtr self);
        [DllImport("wx-c")] static extern int    wxHtmlWinParser_GetCharWidth(IntPtr self);
        [DllImport("wx-c")] static extern IntPtr wxHtmlWinParser_GetWindow(IntPtr self);
        [DllImport("wx-c")] static extern void   wxHtmlWinParser_SetFonts(IntPtr self, IntPtr normal_face, IntPtr fixed_face, int[] sizes);
        [DllImport("wx-c")] static extern void   wxHtmlWinParser_AddModule(IntPtr self, IntPtr module);
        [DllImport("wx-c")] static extern void   wxHtmlWinParser_RemoveModule(IntPtr self, IntPtr module);
        [DllImport("wx-c")] static extern IntPtr wxHtmlWinParser_GetContainer(IntPtr self);
        [DllImport("wx-c")] static extern IntPtr wxHtmlWinParser_OpenContainer(IntPtr self);
        [DllImport("wx-c")] static extern IntPtr wxHtmlWinParser_SetContainer(IntPtr self, IntPtr c);
        [DllImport("wx-c")] static extern IntPtr wxHtmlWinParser_CloseContainer(IntPtr self);
        [DllImport("wx-c")] static extern int    wxHtmlWinParser_GetFontSize(IntPtr self);
        [DllImport("wx-c")] static extern void   wxHtmlWinParser_SetFontSize(IntPtr self, int s);
        [DllImport("wx-c")] static extern int    wxHtmlWinParser_GetFontBold(IntPtr self);
        [DllImport("wx-c")] static extern void   wxHtmlWinParser_SetFontBold(IntPtr self, int x);
        [DllImport("wx-c")] static extern int    wxHtmlWinParser_GetFontItalic(IntPtr self);
        [DllImport("wx-c")] static extern void   wxHtmlWinParser_SetFontItalic(IntPtr self, int x);
        [DllImport("wx-c")] static extern int    wxHtmlWinParser_GetFontUnderlined(IntPtr self);
        [DllImport("wx-c")] static extern void   wxHtmlWinParser_SetFontUnderlined(IntPtr self, int x);
        [DllImport("wx-c")] static extern int    wxHtmlWinParser_GetFontFixed(IntPtr self);
        [DllImport("wx-c")] static extern void   wxHtmlWinParser_SetFontFixed(IntPtr self, int x);
        [DllImport("wx-c")] static extern IntPtr wxHtmlWinParser_GetFontFace(IntPtr self);
        [DllImport("wx-c")] static extern void   wxHtmlWinParser_SetFontFace(IntPtr self, IntPtr face);
        [DllImport("wx-c")] static extern int    wxHtmlWinParser_GetAlign(IntPtr self);
        [DllImport("wx-c")] static extern void   wxHtmlWinParser_SetAlign(IntPtr self, int a);
        [DllImport("wx-c")] static extern IntPtr wxHtmlWinParser_GetLinkColor(IntPtr self);
        [DllImport("wx-c")] static extern void   wxHtmlWinParser_SetLinkColor(IntPtr self, IntPtr clr);
        [DllImport("wx-c")] static extern IntPtr wxHtmlWinParser_GetActualColor(IntPtr self);
        [DllImport("wx-c")] static extern void   wxHtmlWinParser_SetActualColor(IntPtr self, IntPtr clr);
        [DllImport("wx-c")] static extern IntPtr wxHtmlWinParser_GetLink(IntPtr self);
        [DllImport("wx-c")] static extern void   wxHtmlWinParser_SetLink(IntPtr self, IntPtr link);
        [DllImport("wx-c")] static extern IntPtr wxHtmlWinParser_CreateCurrentFont(IntPtr self);

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

    public HtmlWinParser(IntPtr wxObject)
      : base(wxObject)
        {
        }

        public HtmlWinParser(HtmlWindow wnd)
            : base(wxHtmlWinParser_ctor(Object.SafePtr(wnd))) { }

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

        public override void InitParser(string source)
        {
            wxString wxsource = new wxString(source);
            wxHtmlWinParser_InitParser(wxObject, wxsource.wxObject);
        }

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

        public override void DoneParser()
        {
            wxHtmlWinParser_DoneParser(wxObject);
        }

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

        public override Object Product
        {
            get { return FindObject(wxHtmlWinParser_GetProduct(wxObject), typeof(Object)); }
        }

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

        /*public FSFile OpenURL(HtmlURLType type, string url)
        {
            return wxHtmlWinParser_OpenURL(wxObject, Object.SafePtr(type), url);
        }*/

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

        public void SetDC(DC dc, double pixel_scale)
        {
            wxHtmlWinParser_SetDC(wxObject, Object.SafePtr(dc), pixel_scale);
        }

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

        public DC DC
        {
            get { return (DC)FindObject(wxHtmlWinParser_GetDC(wxObject), typeof(DC)); }
        }

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

        public double PixelScale
        {
            get { return wxHtmlWinParser_GetPixelScale(wxObject); }
        }

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

        public int CharHeight
        {
            get { return wxHtmlWinParser_GetCharHeight(wxObject); }
        }

        public int CharWidth
        {
            get { return wxHtmlWinParser_GetCharWidth(wxObject); }
        }

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

        public HtmlWindow Window
        {
            get { return (HtmlWindow)FindObject(wxHtmlWinParser_GetWindow(wxObject), typeof(HtmlWindow)); }
        }

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

        public void SetFonts(string normal_face, string fixed_face, int[] sizes)
        {
            wxString wx_normal_face = new wxString(normal_face);
            wxString wx_fixed_face = new wxString(fixed_face);
            wxHtmlWinParser_SetFonts(wxObject, wx_normal_face.wxObject, wx_fixed_face.wxObject, sizes);
        }

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

        public void AddModule(HtmlTagsModule module)
        {
            wxHtmlWinParser_AddModule(wxObject, Object.SafePtr(module));
        }

        public void RemoveModule(HtmlTagsModule module)
        {
            wxHtmlWinParser_RemoveModule(wxObject, Object.SafePtr(module));
        }

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

        public HtmlContainerCell Container
        {
            get { return (HtmlContainerCell)FindObject(wxHtmlWinParser_GetContainer(wxObject), typeof(HtmlContainerCell)); }
        }

        public HtmlContainerCell SetContainter(HtmlContainerCell cont)
        {
            return (HtmlContainerCell)FindObject(wxHtmlWinParser_SetContainer(wxObject, Object.SafePtr(cont)), typeof(HtmlContainerCell));
        }

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

        public HtmlContainerCell OpenContainer()
        {
            return (HtmlContainerCell)FindObject(wxHtmlWinParser_OpenContainer(wxObject), typeof(HtmlContainerCell));
        }

        public HtmlContainerCell CloseContainer()
        {
            return (HtmlContainerCell)FindObject(wxHtmlWinParser_CloseContainer(wxObject), typeof(HtmlContainerCell));
        }

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

        public int FontSize
        {
            get { return wxHtmlWinParser_GetFontSize(wxObject); }
            set { wxHtmlWinParser_SetFontSize(wxObject, value); }
        }

        public int FontBold
        {
            get { return wxHtmlWinParser_GetFontBold(wxObject); }
            set { wxHtmlWinParser_SetFontBold(wxObject, value); }
        }

        public int FontItalic
        {
            get { return wxHtmlWinParser_GetFontItalic(wxObject); }
            set { wxHtmlWinParser_SetFontItalic(wxObject, value); }
        }

        public int FontUnderlined
        {
            get { return wxHtmlWinParser_GetFontUnderlined(wxObject); }
            set { wxHtmlWinParser_SetFontUnderlined(wxObject, value); }
        }

        public int FontFixed
        {
            get { return wxHtmlWinParser_GetFontFixed(wxObject); }
            set { wxHtmlWinParser_SetFontFixed(wxObject, value); }
        }

        public string FontFace
        {
            get { return new wxString(wxHtmlWinParser_GetFontFace(wxObject), true); }
            set
            {
                wxString wxvalue = new wxString(value);
                wxHtmlWinParser_SetFontFace(wxObject, wxvalue.wxObject);
            }
        }

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

        public int Align
        {
            get { return wxHtmlWinParser_GetAlign(wxObject); }
            set { wxHtmlWinParser_SetAlign(wxObject, value); }
        }

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

        public Colour LinkColor
        {
            get { return new Colour(wxHtmlWinParser_GetLinkColor(wxObject), true); }
            set { wxHtmlWinParser_SetLinkColor(wxObject, Object.SafePtr(value)); }
        }

        public Colour ActualColor
        {
            get { return new Colour(wxHtmlWinParser_GetActualColor(wxObject), true); }
            set { wxHtmlWinParser_SetActualColor(wxObject, Object.SafePtr(value)); }
        }

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

        public HtmlLinkInfo Link
        {
            get { return (HtmlLinkInfo)FindObject(wxHtmlWinParser_GetLink(wxObject), typeof(HtmlLinkInfo)); }
            set { wxHtmlWinParser_SetLink(wxObject, Object.SafePtr(value)); }
        }

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

        public Font CreateCurrentFont()
        {
            return new Font(wxHtmlWinParser_CreateCurrentFont(wxObject));
        }
    }

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

    /** Overload this and add this to an HtmlParser to define new tags.
     * The typical use of tag handlers is the definition of new tags that designate
     * forms which have been implemented as \e wxWidgets panels. Refer to wx.HtmlHelpFrame.OnAboutBox()
     * for a simple example.
     * 
     * Refer to HtmlButtonTagHandler for a tag presenting a button that raises a CommandEvent.
     */
    public abstract class HtmlTagHandler : Object
    {
        #region Delegates, Types
        delegate IntPtr Virtual_GetSupportedTags();
        delegate int Virtual_HandleTag(IntPtr varib);
        #endregion
        #region C API
        [DllImport("wx-c")]
        static extern IntPtr wxHtmlTagHandler_CTor();
        [DllImport("wx-c")]
        static extern void  wxHtmlTagHandler_SetParser(IntPtr self, IntPtr parser);
        [DllImport("wx-c")]
        static extern void wxHtmlTagHandler_RegisterVirtual(IntPtr self, Virtual_Dispose onDispose, Virtual_GetSupportedTags callbackSupportedTags, Virtual_HandleTag callbackHandleTag);
        [DllImport("wx-c")]
        static extern IntPtr wxHtmlTagHandler_GetParser(IntPtr self);
        [DllImport("wx-c")]
        static extern IntPtr wxHtmlTagHandler_GetWParser(IntPtr self);
        [DllImport("wx-c")]
        static extern void wxHtmlTagHandler_ParseInner(IntPtr self, IntPtr tag);
        #endregion

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

        IntPtr DoGetSupportedTags()
        {
            string result = this.GetSupportedTags();
            result = result.ToUpper();
            DisposableStringBox boxedResult = new DisposableStringBox(new wxString(result));
            return boxedResult.wxObject;
        }

        int DoHandleTag(IntPtr varib)
        {
            HtmlTag tag = new HtmlTag(varib);
            tag.memOwn = false;
            if (this.HandleTag(tag))
                return 1;
            else
                return 0;
        }

        #region State
        Virtual_GetSupportedTags _doGetSupportedTags=null;
        Virtual_HandleTag        _doHandleTag=null;
        #endregion

        #region CTor
        public HtmlTagHandler(IntPtr wxObject) 
            : base(wxObject)
        {
        }

        public HtmlTagHandler()
            : this(wxHtmlTagHandler_CTor())
        {
            _doGetSupportedTags = new Virtual_GetSupportedTags(DoGetSupportedTags);
            _doHandleTag = new Virtual_HandleTag(DoHandleTag);
            virtual_Dispose = new Virtual_Dispose(VirtualDispose);
            wxHtmlTagHandler_RegisterVirtual(this.wxObject, virtual_Dispose, _doGetSupportedTags, _doHandleTag);
        }
        #endregion

        #region public Properties
        public HtmlParser Parser
        {
            set
            {
                wxHtmlTagHandler_SetParser(wxObject, Object.SafePtr(value));
            }
            get
            {
                return HtmlParser.FindObject(wxHtmlTagHandler_GetParser(this.wxObject));
            }
        }

        public HtmlWinParser WParser
        {
            get
            {
                return (HtmlWinParser)HtmlParser.FindObject(wxHtmlTagHandler_GetWParser(this.wxObject));
            }
        }
        #endregion

        #region Abstract Methods
        /** Use this to define the tags that this handler implements.
         * Return a comma-separated list of tag names like "I,B,FONT,P".
         * 
         * Please note, that in contrast to modern XML-compatible conventions \e wxWidgets 
         * uses upper case letters as standard form for tag names. For this reason, \e wx.NET
         * will convert th result of this method automatically into upper case form. However,
         * analogous code in C++ will probably not run with the original \e wxWidgets in C++ if
         * this result contains lower case letters.
         */
        public abstract string GetSupportedTags();
        /** Implement the tags as defined by GetSupportedTags().
         */
        public abstract bool HandleTag(HtmlTag tag);
        #endregion

        #region Protected Helpers
        protected void ParseInner(HtmlTag tag)
        {
            wxHtmlTagHandler_ParseInner(this.wxObject, tag.wxObject);
        }
        #endregion
    }

    /** A handler for tag \c wxbutton that defines a button on an HTML page raising a command event.
     * Use attributes \c label to provide a string to be displayed as a label and \c cmd to provide
     * an integer command ID for the event. Additionally in case of specifying a \c cmd, you might also
     * use \c eventstring. If an event string is specified, the command event caused by the button will
     * also hold the event string in the appropriate member variable.
     * Sample
     * \verbatim
     <wxbutton label="Label" cmd="100">
     \endverbatim
     * You might use \c labelart to specify a label bitmap instead of a label string.
     \code
     string.Format("<wxbutton labelart=\"{0}\" cmd=\"{1}\" eventstring=\"This can be read from the event.\">", (int)ArtID.wxART_QUESTION, (int)MenuIDs.wxID_ABOUT);
     \endcode
     */
    public class HtmlButtonTagHandler : HtmlTagHandler
    {
        public HtmlButtonTagHandler()
        {
        }

        /** "WXBUTTON"
         * Please note, that in contrast to modern XML-compatible conventions \e wxWidgets 
         * uses upper case letters as standard form for tag names. So, use upper class letters
         * here exclusively.
         */
        public override string GetSupportedTags()
        {
            return "wxbutton";
        }

        /** This contains the \c eventstr if one is specified and this implements the addition of the event string to the event.
         */
        internal class CmdClosure
        {
            string _eventstr;
            internal CmdClosure(string eventstr)
            {
                this._eventstr = eventstr;
            }

            /** This will complete the button event if an event string has been specified by the hyperlink.
             */
            internal void OnButtonSelect(object sender, Event evt)
            {
                ((CommandEvent)evt).String = this._eventstr;
                evt.Skip();
            }
        }

        /** This generates a window with a single button to be placed into the HTML page.
         * Return value is false to enable inner parsing.
         */
        public override bool HandleTag(HtmlTag tag)
        {
            int cmd = Window.wxID_ANY;
            tag.GetParamAsInt("cmd", out cmd);
            int artProviderBitmap = -1;
            if (!tag.GetParamAsInt("labelart", out artProviderBitmap))
                artProviderBitmap = -1;
            string label = tag.GetParam("label", false);
            string eventstr = tag.GetParam("eventstring", false);

            Window wnd = null;
            if (artProviderBitmap >= 0)
            {
                wnd = new BitmapButton(this.WParser.Window, cmd, ArtProvider.GetBitmap((ArtID)artProviderBitmap, ArtClient.wxART_BUTTON), new Point(0, 0), Window.wxDefaultSize, 0,  null, "Test");
            }
            else
            {
                // this is a hack to make the button initially invisible
                wnd = new Button(this.WParser.Window, cmd, label, new Point(0, 0), Window.wxDefaultSize, 0);
            }
                
            wnd.Show(false);
            if (eventstr != null && eventstr.Length > 0)
            {
                CmdClosure cmdClosure = new CmdClosure(eventstr);
                wnd.AddCommandListener(Event.wxEVT_COMMAND_BUTTON_CLICKED, cmd, new EventListener(cmdClosure.OnButtonSelect), cmdClosure);
            }
            this.WParser.Container.InsertCell(new HtmlWidgetCell(wnd));

            return false;
        }
    }

    /** This is a tag handler that offers you a choice among hyper links or actions.
     * Choices may be specified by constructors or tags. Actions may be action events or
     * hyper links. You may choose between the styles "Choice" and "List".
     * Example:
     * \code
     HtmlChoiceTagHandler tagHandler = new HtmlChoiceTagHandler(HtmlChoiceTagHandler.Style.List, "mychoice");
     tagHandler.Append("First choice: Command event", 23);
     tagHandler.Append("Second choice: Hyperlink", "http://testserver/page#section");
     \endcode
     * This handler will interpret tags like:
     *\verbatim
     <mychoice style="choice">
     <mychoice_choice cmd=24 name="Third choice"></choice>
     <mychoice_choice href="http://testserver/page#section2" name="Forth choice"></choice>
     <!-- the following three selections all have the same effect: Selecting item 0. !-->
     <mychoice_select cmd=23>
     <mychoice_select name="First choice: Command event">
     <mychoice_select pos=0>
     </mychoice>
     \endverbatim
     * Appending labels to the tag handler is useful for reusing a handler in several documents
     * while specifying choices in HTML is appropriate if the choice is exclusively relevant to the 
     * current document.
     * 
     * Items may be identified in contained tags like ".._SELECT" by the attributes \c name="Name" by their
     * name or the associated command: \c href="info.html" for an item
     * representing a certain page to be loaded and \c cmd=24 for items issueing a command event of the 
     * provided ID. The third option is to identify items by their position on the list: \c pos=0.
     * 
     * Please note that method Append() shall run before processing the tag. So, this method can be
     * considered as a part of the contructor.
     * 
     * This class relies on the fixes in the \e wx.NET implementation of wx.HtmlWidgetCell. So,
     * analogously implementations will probably not work with the original \e wxWidgets system in C++.
     * 
     * <b>Please note that because of a bug in \e wxWidgets this handler currently does not use
     * wx.HtmlParser.PushTagHandler and wx.HtmlParser.PopTagHandler but implements tags with suffix
     * "_CHOICE" and "_SELECT" as presented in the example.</b>
     */
    public class HtmlChoiceTagHandler : HtmlTagHandler
    {
        #region Types
        public enum Style
        {
            List,
            Choice
        }
        #endregion
        #region State
        string _tag;
        Style _style;
        IList _options = new ArrayList();
        IList _localOptions = new ArrayList();
        int _selection = -1;
        int _localSelection = -1;
        #endregion
        #region CTor
        public HtmlChoiceTagHandler(Style style, string tag)
            : base()
        {
            this._style = style;
            this._tag = tag.ToUpper();
        }

        /** Adds an item to the control without any command associated.
         */
        public void Append(string item)
        {
            object[] pair = new object[2];
            pair[0] = item;
            this._options.Add(pair);
        }

        /** Add an item to the control.
         * Selecting the item will cause a command event that may be processed in surrounding
         * windows.
         * */
        public void Append(string item, int cmd)
        {
            object[] pair = new object[2];
            pair[0] = item;
            pair[1] = cmd;
            this._options.Add(pair);
        }

        /** Add an item to the control loading a URL on selection.
         */
        public void Append(string item, string hyperref)
        {
            object[] pair = new object[2];
            pair[0] = item;
            pair[1] = hyperref;
            this._options.Add(pair);
        }

        /** Returns or sets the label of the selected item.
         * This is an empty string if nothing is selected.
         * Please refer to SelectCmd() and SelectHyperref() for alternative methods
         * of selecting items.
         * 
         * Assignments trying to select an unknown item will be ignored silently.
         * Refer to SelectItem() for an alternative method.
         */
        public string SelectionString
        {
            get
            {
                if (this._selection < 0)
                    return "";
                else if (this._selection < this._options.Count)
                    return (string)((object[])this._options[this._selection])[0];
                else
                    return (string)((object[])this._localOptions[this._selection - this._options.Count])[0];
            }
            set
            {
                this.Selection=this.FindItem(value);
            }
        }

        public int Selection
        {
            get { return this._selection; }
            set { if (value >= 0 && value < this._options.Count+this._localOptions.Count) this._selection = value; }
        }

        /** Find the provided item string and return its index on success or -1 otherwise.
         */
        public int FindItem(string item)
        {
            int index = 0;
            foreach (object[] pair in this._options)
            {
                if (item == ((string)pair[0]))
                    return index;
                ++index;
            }
            foreach (object[] pair in this._localOptions)
            {
                if (item == ((string)pair[0]))
                    return index;
                ++index;
            }
            return -1;
        }

        /** Find the first item of the provided command ID and return its index on success or -1 otherwise.
         * Items are often subject of localization/translation. A neutral designator for
         * selecting item is a representation of the action issued by the item. Therefore,
         * this method enables a user to select an item issueing a certain command.
         */
        public int FindCmd(int cmd)
        {
            int index = 0;
            foreach (object[] pair in this._options)
            {
                if (pair[1] is int && cmd == ((int)pair[1]))
                    return index;
                ++index;
            }
            foreach (object[] pair in this._localOptions)
            {
                if (pair[1] is int && cmd == ((int)pair[1]))
                    return index;
                ++index;
            }
            return -1;
        }

        /** Find the first item of the provided hyperref and return its index on success or -1 otherwise.
         * Items are often subject of localization/translation. A neutral designator for
         * selecting item is a representation of the action issued by the item. Therefore,
         * this method enables a user to select an item issueing a new page to be displayed.
         */
        public int FindHyperref(string hyperref)
        {
            int index = 0;
            foreach (object[] pair in this._options)
            {
                if (pair[1] is string && hyperref == ((string)pair[1]))
                    return index;
                ++index;
            }
            foreach (object[] pair in this._localOptions)
            {
                if (pair[1] is string && hyperref == ((string)pair[1]))
                    return index;
                ++index;
            }
            return -1;
        }
        #endregion

        #region Public Virtual
        public override string GetSupportedTags()
        {
            return this._tag + "," + this._tag + "_CHOICE," + this._tag + "_SELECT";
        }
        public override bool HandleTag(HtmlTag tag)
        {
            if (tag.Name == this._tag + "_CHOICE")
            {
                if (tag.HasParam("name"))
                {
                    if (tag.HasParam("cmd"))
                    {
                        int cmd = -1;
                        if (tag.GetParamAsInt("cmd", out cmd))
                        {
                            object[] pair = new object[2];
                            pair[0] = tag.GetParam("name");
                            pair[1] = cmd;
                            this._localOptions.Add(pair);
                        }
                    }
                    else if (tag.HasParam("href"))
                    {
                        object[] pair = new object[2];
                        pair[0] = tag.GetParam("name");
                        pair[1] = tag.GetParam("href");
                        this._localOptions.Add(pair);
                    }
                    else
                    {
                        object[] pair = new object[2];
                        pair[0] = tag.GetParam("name");
                        this._localOptions.Add(pair);
                    }
                }
            }
            else if (tag.Name == this._tag + "_SELECT")
            {
                if (tag.HasParam("cmd"))
                {
                    string cmdString = tag.GetParam("cmd", false);
                    try
                    {
                        int cmd = Int32.Parse(cmdString);
                        this._localSelection=this.FindCmd(cmd);
                    }
                    catch (Exception)
                    {
                    }
                }
                else if (tag.HasParam("href"))
                {
                    string hyperref = tag.GetParam("href", false);
                    this._localSelection = this.FindHyperref(hyperref);
                }
                else if (tag.HasParam("pos"))
                {
                    tag.GetParamAsInt("pos", out this._localSelection);
                }
            }
            else
            {
                this._localOptions.Clear();
                this._localSelection = this._selection;

                if (tag.HasEnding)
                {
                    HtmlParser parser = this.WParser;
                    this.ParseInner(tag);
                }

                ControlWithItems wnd = null;

                Style style = this._style;
                string stylestring = tag.GetParam("style", false);
                stylestring = stylestring.ToLower();
                if (stylestring == "choice")
                    style = Style.Choice;
                else if (stylestring == "list")
                    style = Style.List;

                switch (style)
                {
                    case Style.List:
                        wnd = new ListBox(this.WParser.Window, -1);
                        wnd.EVT_LISTBOX(-1, new EventListener(OnSelectChoice));
                        break;
                    case Style.Choice:
                        wnd = new Choice(this.WParser.Window, -1);
                        wnd.EVT_CHOICE(-1, new EventListener(OnSelectChoice));
                        break;
                }
                foreach (object[] pair in this._options)
                {
                    wnd.Append((string)pair[0], new SystemObjectClientData(pair[1]));
                }
                foreach (object[] pair in this._localOptions)
                {
                    wnd.Append((string)pair[0], new SystemObjectClientData(pair[1]));
                }
                if (this._options.Count + this._localOptions.Count > 0)
                {
                    if (this._localSelection < 0) this._localSelection = 0;
                    wnd.Selection = this._localSelection;
                }
                this._localOptions.Clear();
                this._localSelection = -1;

                this.WParser.Container.InsertCell(new HtmlWidgetCell(wnd));
            }
            return false;
        }
        #endregion
        #region Helper Functions
        internal void OnSelectChoice(object sender, Event evt)
        {
            SystemObjectClientData clientData = (SystemObjectClientData)((ControlWithItems)sender).GetClientObject(((CommandEvent)evt).Int);
            if (clientData == null || clientData.Data==null)
                return; // no client data defined
            else if (clientData.Data is int)
                evt.Skip(true);
            else if (clientData.Data is string)
            {
                CommandEvent loadPageEvent=new CommandEvent(Event.wxEVT_LOAD_HTML_PAGE);
                loadPageEvent.String=(string)clientData.Data;
                this.WParser.Window.AddPendingEvent(loadPageEvent);
            }
            else
                Log.LogError("Cannot identify {0}.", clientData.Data);
        }
        #endregion
    }

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

    public class HtmlEntitiesParser : Object
    {
        [DllImport("wx-c")] static extern IntPtr wxHtmlEntitiesParser_ctor();
        [DllImport("wx-c")] static extern void   wxHtmlEntitiesParser_SetEncoding(IntPtr self, int encoding);
        [DllImport("wx-c")] static extern IntPtr wxHtmlEntitiesParser_Parse(IntPtr self, IntPtr input);
        [DllImport("wx-c")] static extern char   wxHtmlEntitiesParser_GetEntityChar(IntPtr self, IntPtr entity);
        [DllImport("wx-c")] static extern char   wxHtmlEntitiesParser_GetCharForCode(IntPtr self, uint code);

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

    public HtmlEntitiesParser(IntPtr wxObject)
      : base(wxObject) {}

        public  HtmlEntitiesParser()
            : base(wxHtmlEntitiesParser_ctor()) { }

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

        public FontEncoding Encoding
        {
            set { wxHtmlEntitiesParser_SetEncoding(wxObject, (int)value); }
        }

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

        public string Parse(string input)
        {
            wxString wxInput = new wxString(input);
            return new wxString(wxHtmlEntitiesParser_Parse(wxObject, wxInput.wxObject), true);
        }

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

        public char GetEntityChar(string entity)
        {
            wxString wxentity = new wxString(entity);
            return wxHtmlEntitiesParser_GetEntityChar(wxObject, wxentity.wxObject);
        }

        public char GetCharForCode(uint code)
        {
            return wxHtmlEntitiesParser_GetCharForCode(wxObject, code);
        }
    }

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

    public abstract class HtmlParser : Object
    {
        [DllImport("wx-c")] static extern void   wxHtmlParser_SetFS(IntPtr self, IntPtr fs);
        [DllImport("wx-c")] static extern IntPtr wxHtmlParser_GetFS(IntPtr self);
        [DllImport("wx-c")] static extern IntPtr wxHtmlParser_OpenURL(IntPtr self, int type, IntPtr url);
        [DllImport("wx-c")] static extern IntPtr wxHtmlParser_Parse(IntPtr self, IntPtr source);
        [DllImport("wx-c")] static extern void   wxHtmlParser_InitParser(IntPtr self, IntPtr source);
        [DllImport("wx-c")] static extern void   wxHtmlParser_DoneParser(IntPtr self);
        [DllImport("wx-c")] static extern void   wxHtmlParser_StopParsing(IntPtr self);
        [DllImport("wx-c")] static extern void   wxHtmlParser_DoParsing(IntPtr self, int begin_pos, int end_pos);
        [DllImport("wx-c")] static extern void   wxHtmlParser_DoParsingAll(IntPtr self);
        [DllImport("wx-c")] static extern IntPtr wxHtmlParser_GetCurrentTag(IntPtr self);
        [DllImport("wx-c")] static extern void   wxHtmlParser_AddTagHandler(IntPtr self, IntPtr handler);
        [DllImport("wx-c")] static extern void   wxHtmlParser_PushTagHandler(IntPtr self, IntPtr handler, IntPtr tags);
        [DllImport("wx-c")] static extern void   wxHtmlParser_PopTagHandler(IntPtr self);
        [DllImport("wx-c")] static extern IntPtr wxHtmlParser_GetSource(IntPtr self);
        [DllImport("wx-c")] static extern void   wxHtmlParser_SetSource(IntPtr self, IntPtr src);
        [DllImport("wx-c")] static extern void   wxHtmlParser_SetSourceAndSaveState(IntPtr self, IntPtr src);
        [DllImport("wx-c")] static extern bool   wxHtmlParser_RestoreState(IntPtr self);
        [DllImport("wx-c")] static extern IntPtr wxHtmlParser_ExtractCharsetInformation(IntPtr self, IntPtr markup);
        [DllImport("wx-c")] [return: MarshalAs(UnmanagedType.U1)] static extern bool wxHtmlParser_IsWinParser(IntPtr self);

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

        public HtmlParser(IntPtr wxObject) 
            : base(wxObject) { }


        /** A virtual construction of a \e wx.NET parser object from a pointer to a \e wxWidgets parser object.
         * Use this method to ensure existance of an appropriate wrapper for a HTML parser object.
         * Problem: \e wxWidgets knows 2 classes: The general \c wxHtmlParser and the \c wxHtmlWinParser.
         * This will return (and create of not existing) an instance of wx.HtmlWinParser iff the
         * argument is a pointer to a \c wxHtmlWinParser instance. This method will use the internal
         * run time type information built into \e wxWidgets.
         * 
         * Consider this as a specialization of method wx.Object.FindObject().
         * 
         * \c IntPtr.Zero will always result into \c null.
         */
        new static public HtmlParser FindObject(IntPtr aWxObject)
        {
            if (aWxObject == IntPtr.Zero) return null;

            Type parserType = typeof(HtmlParser);
            if (wxHtmlParser_IsWinParser(aWxObject))
            {
                parserType = typeof(HtmlWinParser);
            }
            return (HtmlParser)Object.FindObject(aWxObject, parserType);
        }

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

        /** .NET form of \c wxHtmlParser::GetFS() and \c wxHtmlParser::SetFS().
         */
        public FileSystem FS
        {
            get
            {
                FileSystem fs=(FileSystem) Object.FindObject(wxHtmlParser_GetFS(wxObject), typeof(FileSystem));
                fs.memOwn = false; // this will be deallocated by the C++ instance of the parser.
                return fs;
            }
            set
            {
                wxHtmlParser_SetFS(value.wxObject, value.wxObject);
            }
        }

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

        public FSFile OpenURL(HtmlURLType type, string url)
        {
            wxString wxUrl = new wxString(url);
            return new FSFile(wxHtmlParser_OpenURL(this.wxObject, (int)type, wxUrl.wxObject));
        }

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

        public Object Parse(string source)
        {
            wxString wxSource = new wxString(source);
            return new Object(wxHtmlParser_Parse(this.wxObject, wxSource.wxObject));
        }

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

        public virtual void InitParser(string source)
        {
            wxString wxSource = new wxString(source);
            wxHtmlParser_InitParser(this.wxObject, wxSource.wxObject);
        }

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

        public virtual void DoneParser()
        {
            wxHtmlParser_DoneParser(wxObject);
        }

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

        public void StopParsing()
        {
            wxHtmlParser_StopParsing(wxObject);
        }

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

        public void DoParsing(int begin_pos, int end_pos)
        {
            wxHtmlParser_DoParsing(wxObject, begin_pos, end_pos);
        }

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

        public void DoParsing()
        {
            wxHtmlParser_DoParsingAll(wxObject);
        }

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

        public HtmlTag GetCurrentTag()
        {
            return wxHtmlParser_GetCurrentTag(wxObject);
        }

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

        public abstract Object Product { get; }

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

        public void AddTagHandler(HtmlTagHandler handler)
        {
            wxHtmlParser_AddTagHandler(wxObject, Object.SafePtr(handler));
        }

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

        public void PushTagHandler(HtmlTagHandler handler, string tags)
        {
            wxString wxTags = new wxString(tags);
            wxHtmlParser_PushTagHandler(this.wxObject, Object.SafePtr(handler), wxTags.wxObject);
        }

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

        public void PopTagHandler()
        {
            wxHtmlParser_PopTagHandler(this.wxObject);
        }

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

        public string Source
        {
            get { return new wxString(wxHtmlParser_GetSource(wxObject), true); }
            set
            {
                wxString wxSource = new wxString(value);
                wxHtmlParser_SetSource(this.wxObject, wxSource.wxObject); }
        }

        public string SourceAndSaveState
        {
            set
            {
                wxString wxValue = new wxString(value);
                wxHtmlParser_SetSourceAndSaveState(this.wxObject, wxValue.wxObject);
            }
        }

        public bool RestoreState()
        {
            return wxHtmlParser_RestoreState(wxObject);
        }

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

        public string ExtractCharsetInformation(string markup)
        {
            wxString wxMarkup = new wxString(markup);
            return new wxString(wxHtmlParser_ExtractCharsetInformation(this.wxObject, wxMarkup.wxObject), true);
        }
    }

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

    public abstract class HtmlProcessor : Object
    {
        [DllImport("wx-c")] static extern int    wxHtmlProcessor_GetPriority(IntPtr self);
        [DllImport("wx-c")] static extern void   wxHtmlProcessor_Enable(IntPtr self, bool enable);
        [DllImport("wx-c")] static extern bool   wxHtmlProcessor_IsEnabled(IntPtr self);

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

        public HtmlProcessor(IntPtr wxObject) 
            : base(wxObject) { }

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

        public abstract string Process(string text);

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

        public int Priority
        {
            get { return wxHtmlProcessor_GetPriority(wxObject); }
        }

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

        public bool Enabled
        {
            set { wxHtmlProcessor_Enable(wxObject, value); }
            get { return wxHtmlProcessor_IsEnabled(wxObject); }
        }
    }
    
  //-----------------------------------------------------------------------------
    
  public class HtmlRenderingInfo : Object
  {
    [DllImport("wx-c")] static extern IntPtr wxHtmlRenderingInfo_ctor();
    [DllImport("wx-c")] static extern void wxHtmlRenderingInfo_dtor(IntPtr self);
    [DllImport("wx-c")] static extern void wxHtmlRenderingInfo_SetSelection(IntPtr self, IntPtr s);
    [DllImport("wx-c")] static extern IntPtr wxHtmlRenderingInfo_GetSelection(IntPtr self);
    
    //-----------------------------------------------------------------------------
    
    public HtmlRenderingInfo(IntPtr wxObject)
      : base(wxObject) 
    {  
      this.wxObject = wxObject;
    }
    
    internal HtmlRenderingInfo(IntPtr wxObject, bool memOwn)
      : base(wxObject)
    { 
      this.memOwn = memOwn;
      this.wxObject = wxObject;
    }
      
    public HtmlRenderingInfo()
      : this(wxHtmlRenderingInfo_ctor(), true) {}
      
    //---------------------------------------------------------------------
        
    public override void Dispose()
    {
      if (!disposed)
      {
                if (wxObject != IntPtr.Zero)
        {
          if (memOwn)
          {
            wxHtmlRenderingInfo_dtor(wxObject);
            memOwn = false;
          }
        }
        RemoveObject(wxObject);
        wxObject = IntPtr.Zero;
                --validInstancesCount;
                disposed = true;
      }
      
      base.Dispose();
      GC.SuppressFinalize(this);
    }
    
    //---------------------------------------------------------------------
    
    ~HtmlRenderingInfo() 
    {
      Dispose();
    }
      
    //-----------------------------------------------------------------------------
    
    public HtmlSelection Selection
    {
      get { return (HtmlSelection)FindObject(wxHtmlRenderingInfo_GetSelection(wxObject), typeof(HtmlSelection)); }
      set { wxHtmlRenderingInfo_SetSelection(wxObject, Object.SafePtr(value)); }
    }
  }
  
  //-----------------------------------------------------------------------------
  
  public class HtmlSelection : Object
  {
    [DllImport("wx-c")] static extern IntPtr wxHtmlSelection_ctor();
    [DllImport("wx-c")] static extern void wxHtmlSelection_dtor(IntPtr self);
    [DllImport("wx-c")] static extern void wxHtmlSelection_Set(IntPtr self, ref Point fromPos, IntPtr fromCell, ref Point toPos, IntPtr toCell);
    [DllImport("wx-c")] static extern void wxHtmlSelection_Set2(IntPtr self, IntPtr fromCell, IntPtr toCell);
    [DllImport("wx-c")] static extern IntPtr wxHtmlSelection_GetFromCell(IntPtr self);
    [DllImport("wx-c")] static extern IntPtr wxHtmlSelection_GetToCell(IntPtr self);
    [DllImport("wx-c")] static extern void wxHtmlSelection_GetFromPos(IntPtr self, out Point fromPos);
    [DllImport("wx-c")] static extern void wxHtmlSelection_GetToPos(IntPtr self, out Point toPos);
    [DllImport("wx-c")] static extern void wxHtmlSelection_GetFromPrivPos(IntPtr self, out Point fromPrivPos);
    [DllImport("wx-c")] static extern void wxHtmlSelection_GetToPrivPos(IntPtr self, out Point toPrivPos);
    [DllImport("wx-c")] static extern void wxHtmlSelection_SetFromPrivPos(IntPtr self, ref Point pos);
    [DllImport("wx-c")] static extern void wxHtmlSelection_SetToPrivPos(IntPtr self, ref Point pos);
    [DllImport("wx-c")] static extern void wxHtmlSelection_ClearPrivPos(IntPtr self);
    [DllImport("wx-c")] static extern bool wxHtmlSelection_IsEmpty(IntPtr self);
    
    //-----------------------------------------------------------------------------

    public HtmlSelection(IntPtr wxObject)
      : base(wxObject) 
    {
      this.wxObject = wxObject;
    }
    
    internal HtmlSelection(IntPtr wxObject, bool memOwn)
      : base(wxObject)
    { 
      this.memOwn = memOwn;
      this.wxObject = wxObject;
    }
      
    public HtmlSelection()
      : this(wxHtmlSelection_ctor(), true) {}
      
    //---------------------------------------------------------------------
        
    public override void Dispose()
    {
      if (!disposed)
      {
                if (wxObject != IntPtr.Zero)
        {
          if (memOwn)
          {
            wxHtmlSelection_dtor(wxObject);
            memOwn = false;
          }
        }
        RemoveObject(wxObject);
        wxObject = IntPtr.Zero;
                --validInstancesCount;
                disposed = true;
      }
      
      base.Dispose();
      GC.SuppressFinalize(this);
    }
    
    //---------------------------------------------------------------------
    
    ~HtmlSelection() 
    {
      Dispose();
    }
      
    //-----------------------------------------------------------------------------
    
    public void Set(Point fromPos, HtmlCell fromCell, Point toPos, HtmlCell toCell)
    {
      wxHtmlSelection_Set(wxObject, ref fromPos, Object.SafePtr(fromCell), ref toPos, Object.SafePtr(toCell));
    }
    
    public void Set(HtmlCell fromCell, HtmlCell toCell)
    {
      wxHtmlSelection_Set2(wxObject, Object.SafePtr(fromCell), Object.SafePtr(toCell));
    }
    
    //-----------------------------------------------------------------------------
    
    public HtmlCell FromCell
    {
      get { return (HtmlCell)Object.FindObject(wxHtmlSelection_GetFromCell(wxObject), typeof(HtmlCell)); }
    }
    
    public HtmlCell ToCell
    {
      get { return (HtmlCell)Object.FindObject(wxHtmlSelection_GetToCell(wxObject), typeof(HtmlCell)); }
    }
    
    //-----------------------------------------------------------------------------
    
    public Point FromPos
    {
      get { 
        Point tpoint = new Point();
        wxHtmlSelection_GetFromPos(wxObject, out tpoint);
        return tpoint;
      }
    }
    
    public Point ToPos
    {
      get {
        Point tpoint = new Point();
        wxHtmlSelection_GetToPos(wxObject, out tpoint);
        return tpoint;
      }
    }
    
    //-----------------------------------------------------------------------------
    
    public Point FromPrivPos
    {
      get { 
        Point tpoint = new Point();
        wxHtmlSelection_GetFromPrivPos(wxObject, out tpoint);
        return tpoint;
      }
      
      set { wxHtmlSelection_SetFromPrivPos(wxObject, ref value); }
    }
    
    public Point ToPrivPos
    {
      get {
        Point tpoint = new Point();
        wxHtmlSelection_GetToPrivPos(wxObject, out tpoint);
        return tpoint;
      }
      
      set { wxHtmlSelection_SetToPrivPos(wxObject, ref value); }
    }
    
    //-----------------------------------------------------------------------------
    
    public void ClearPrivPos()
    {
      wxHtmlSelection_ClearPrivPos(wxObject);
    }
    
    //-----------------------------------------------------------------------------
    
    public bool Empty
    {
      get { return wxHtmlSelection_IsEmpty(wxObject); }
    }
  }
  
  //-----------------------------------------------------------------------------
  
  public class HtmlEasyPrinting : Object
  {
    public const int wxPAGE_ODD  = 0;
    public const int wxPAGE_EVEN  = 1;
    public const int wxPAGE_ALL  = 2;
    
    //-----------------------------------------------------------------------------
  
    [DllImport("wx-c")] static extern IntPtr wxHtmlEasyPrinting_ctor(IntPtr name, IntPtr parent);
    [DllImport("wx-c")] static extern bool   wxHtmlEasyPrinting_PreviewFile(IntPtr self, IntPtr htmlfile);
        [DllImport("wx-c")] static extern bool wxHtmlEasyPrinting_PreviewText(IntPtr self, IntPtr htmltext, IntPtr basepath);
        [DllImport("wx-c")] static extern bool wxHtmlEasyPrinting_PrintFile(IntPtr self, IntPtr htmlfile);
        [DllImport("wx-c")] static extern bool wxHtmlEasyPrinting_PrintText(IntPtr self, IntPtr htmltext, IntPtr basepath);
    [DllImport("wx-c")] static extern void   wxHtmlEasyPrinting_PageSetup(IntPtr self);
        [DllImport("wx-c")] static extern void wxHtmlEasyPrinting_SetHeader(IntPtr self, IntPtr header, int pg);
        [DllImport("wx-c")] static extern void wxHtmlEasyPrinting_SetFooter(IntPtr self, IntPtr footer, int pg);
    [DllImport("wx-c")] static extern void   wxHtmlEasyPrinting_SetFonts(IntPtr self, IntPtr normal_face, IntPtr fixed_face, int[] sizes);
    [DllImport("wx-c")] static extern void   wxHtmlEasyPrinting_SetStandardFonts(IntPtr self, int size, IntPtr normal_face, IntPtr fixed_face);
    [DllImport("wx-c")] static extern IntPtr wxHtmlEasyPrinting_GetPrintData(IntPtr self);
    [DllImport("wx-c")] static extern IntPtr wxHtmlEasyPrinting_GetPageSetupData(IntPtr self);
    
    //-----------------------------------------------------------------------------
    
    public HtmlEasyPrinting(IntPtr wxObject)
      : base(wxObject) {}
      
    public HtmlEasyPrinting()
      : this("Printing", null) {}
      
    public HtmlEasyPrinting(string name)
      : this(name, null) {}
      
    public HtmlEasyPrinting(string name, Window parentWindow)
      : this(new wxString(name), parentWindow) {}

        public HtmlEasyPrinting(wxString name, Window parentWindow)
            : base(wxHtmlEasyPrinting_ctor(name.wxObject, Object.SafePtr(parentWindow))) { }
        
        //-----------------------------------------------------------------------------
    
    public bool PreviewFile(string htmlfile)
    {
            wxString wxhtmlfile = new wxString(htmlfile);
      return wxHtmlEasyPrinting_PreviewFile(wxObject, wxhtmlfile.wxObject);
    }
    
    //-----------------------------------------------------------------------------
    
    public bool PreviewText(string htmltext)
    {
      return PreviewText(htmltext, "");
    }
    
    public bool PreviewText(string htmltext, string basepath)
    {
            wxString wxhtmltext = new wxString(htmltext);
            wxString wxbasepath = new wxString(basepath);
      return wxHtmlEasyPrinting_PreviewText(wxObject, wxhtmltext.wxObject, wxbasepath.wxObject);
    }
    
    //-----------------------------------------------------------------------------
    
    public bool PrintFile(string htmlfile)
    {
            wxString wxHtmlfile = new wxString(htmlfile);
      return wxHtmlEasyPrinting_PrintFile(wxObject, wxHtmlfile.wxObject);
    }
    
    //-----------------------------------------------------------------------------
    
    public bool PrintText(string htmltext)
    {
      return PrintText(htmltext, "");
    }
    
    public bool PrintText(string htmltext, string basepath)
    {
            wxString wxHtmlText = new wxString(htmltext);
            wxString wxBasePath = new wxString(basepath);
      return wxHtmlEasyPrinting_PrintText(wxObject, wxHtmlText.wxObject, wxBasePath.wxObject);
    }
    
    //-----------------------------------------------------------------------------
    
    /*public void PrinterSetup()
    {
      wxHtmlEasyPrinting_PrinterSetup(wxObject);
    }*/
    
    //-----------------------------------------------------------------------------
    
    public void PageSetup()
    {
      wxHtmlEasyPrinting_PageSetup(wxObject);
    }
    
    //-----------------------------------------------------------------------------
    
    public void SetHeader(string header)
    {
      SetHeader(header, wxPAGE_ALL);
    }
    
    public void SetHeader(string header, int pg)
    {
            wxString wxHeader = new wxString(header);
      wxHtmlEasyPrinting_SetHeader(wxObject, wxHeader.wxObject, pg);
    }
    
    //-----------------------------------------------------------------------------
    
    public void SetFooter(string footer)
    {
      SetFooter(footer, wxPAGE_ALL);
    }
    
    public void SetFooter(string footer, int pg)
    {
            wxString wxFooter = new wxString(footer);
      wxHtmlEasyPrinting_SetFooter(wxObject, wxFooter.wxObject, pg);
    }
    
    //-----------------------------------------------------------------------------
    
    public void SetFonts(string normal_face, string fixed_face)
    {
      SetFonts(normal_face, fixed_face, null);
    }
    
    public void SetFonts(string normal_face, string fixed_face, int[] sizes)
    {
            wxString wxFixedFont = new wxString(fixed_face);
            wxString wxNormalFont = new wxString(normal_face);
            wxHtmlEasyPrinting_SetFonts(wxObject, wxNormalFont.wxObject, wxFixedFont.wxObject, sizes);
    }
    
    //-----------------------------------------------------------------------------
    
    public void SetStandardFonts()
    {
      SetStandardFonts(-1, "", "");
    }
    
    public void SetStandardFonts(int size)
    {
      SetStandardFonts(size, "", "");
    }
    
    public void SetStandardFonts(int size, string normal_face)
    {
      SetStandardFonts(size, normal_face, "");
    }
    
    public void SetStandardFonts(int size, string normal_face, string fixed_face)
    {
            wxString wxFixedFont = new wxString(fixed_face);
            wxString wxNormalFont = new wxString(normal_face);
      wxHtmlEasyPrinting_SetStandardFonts(wxObject, size, wxNormalFont.wxObject, wxFixedFont.wxObject);
    }
    
    //-----------------------------------------------------------------------------
    
    public PrintData PrintData
    {
      get { return (PrintData)FindObject(wxHtmlEasyPrinting_GetPrintData(wxObject), typeof(PrintData)); }
    }
    
    //-----------------------------------------------------------------------------
    
    public PageSetupDialogData PageSetupData
    {
      get { return (PageSetupDialogData)FindObject(wxHtmlEasyPrinting_GetPageSetupData(wxObject), typeof(PageSetupDialogData)); }
    }
  }
}

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