#############################################################################
## Name:        ext/html/XS/HtmlParser.xsp
## Purpose:     XS++ for Wx::HtmlParser and Wx::HtmlWinParser
## Author:      Mattia Barbon
## Modified by:
## Created:     30/11/2003
## RCS-ID:      $Id: HtmlParser.xsp 2079 2007-07-08 21:18:04Z mbarbon $
## Copyright:   (c) 2003, 2006 Mattia Barbon
## Licence:     This program is free software; you can redistribute it and/or
##              modify it under the same terms as Perl itself
#############################################################################

%module{Wx};

%{
#include <wx/dc.h>
#include <wx/html/winpars.h>
%}

%name{Wx::HtmlParser} class wxHtmlParser
{
##    wxHtmlParser();
##    ~wxHtmlParser();

    void SetFS(wxFileSystem *fs);
    wxFileSystem* GetFS() const;
    wxFSFile *OpenURL(wxHtmlURLType type, const wxString& url) const;
    wxObject* Parse(const wxString& source);
    void InitParser(const wxString& source);
    void DoneParser();
    void StopParsing();

##    void DoParsing(int begin_pos, int end_pos);
##    void DoParsing();

    wxHtmlTag *GetCurrentTag() const;

    wxObject* GetProduct();

    void AddTagHandler(wxHtmlTagHandler *handler);

    void PushTagHandler(wxHtmlTagHandler *handler, wxString tags);
    void PopTagHandler();

##    wxString* GetSource();
    void SetSource(const wxString& src);
    
    void SetSourceAndSaveState(const wxString& src);
    bool RestoreState();
};

%name{Wx::HtmlWinParser} class wxHtmlWinParser
{
##    wxHtmlWinParser(wxHtmlWindow *wnd = NULL);
##    ~wxHtmlWinParser();

    wxFSFile *OpenURL(wxHtmlURLType type, const wxString& url) const;

    void SetDC(wxDC *dc, double pixel_scale = 1.0);

    wxDC *GetDC();
    double GetPixelScale();
    int GetCharHeight() const;
    int GetCharWidth() const;

#if WXPERL_W_VERSION_LT( 2, 7, 0 )
    wxHtmlWindow* GetWindow();
#else
    wxWindow* GetWindow()
        %code{% RETVAL = THIS->GetWindowInterface()->GetHTMLWindow(); %};
#endif

##    void SetFonts(wxString normal_face, wxString fixed_face,
##                  const int *sizes = NULL);

##    static void AddModule(wxHtmlTagsModule *module);
##    static void RemoveModule(wxHtmlTagsModule *module);

    wxHtmlContainerCell *GetContainer() const;
    wxHtmlContainerCell *OpenContainer();
    wxHtmlContainerCell *SetContainer(wxHtmlContainerCell *c);
    wxHtmlContainerCell *CloseContainer();

    int GetFontSize() const;
    void SetFontSize(int s);
    int GetFontBold() const;
    void SetFontBold(int x);
    int GetFontItalic() const;
    void SetFontItalic(int x);
    int GetFontUnderlined() const;
    void SetFontUnderlined(int x);
    int GetFontFixed() const;
    void SetFontFixed(int x);
    wxString GetFontFace() const;
    void SetFontFace(const wxString& face);

    int GetAlign() const;
    void SetAlign(int a);
    const wxColour& GetLinkColor() const;
    void SetLinkColor(const wxColour& clr);
    const wxColour& GetActualColor() const;
    void SetActualColor(const wxColour& clr);
    const wxHtmlLinkInfo& GetLink() const;
    void SetLink(const wxHtmlLinkInfo& link);

#if !wxUSE_UNICODE
    void SetInputEncoding(wxFontEncoding enc);
    wxFontEncoding GetInputEncoding() const;
    wxFontEncoding GetOutputEncoding() const;
    wxEncodingConverter *GetEncodingConverter() const;
#endif

    wxFont* CreateCurrentFont();
};
