コード例 #1
0
def run():
    # Parse the XML file(s) building a collection of Extractor objects
    module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
    etgtools.parseDoxyXML(module, ITEMS)

    #-----------------------------------------------------------------
    # Tweak the parsed meta objects in the module object as needed for
    # customizing the generated code and docstrings.

    c = module.find('wxHtmlDCRenderer')
    assert isinstance(c, etgtools.ClassDef)
    c.addPrivateCopyCtor()
    tools.fixHtmlSetFonts(c)

    c.find('Render.from').name = 'from_'
    c.find('Render.to').name = 'to_'

    c = module.find('wxHtmlEasyPrinting')
    c.addPrivateCopyCtor()

    c = module.find('wxHtmlPrintout')
    c.addPrivateCopyCtor()

    #-----------------------------------------------------------------
    tools.doCommonTweaks(module)
    tools.runGenerators(module)
コード例 #2
0
ファイル: htmlprint.py プロジェクト: HelioGuilherme66/Phoenix
def run():
    # Parse the XML file(s) building a collection of Extractor objects
    module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
    etgtools.parseDoxyXML(module, ITEMS)
    
    #-----------------------------------------------------------------
    # Tweak the parsed meta objects in the module object as needed for
    # customizing the generated code and docstrings.
    
    c = module.find('wxHtmlDCRenderer')
    assert isinstance(c, etgtools.ClassDef)
    c.addPrivateCopyCtor()
    tools.fixHtmlSetFonts(c)
    
    c.find('Render.from').name = 'from_'
    c.find('Render.to').name = 'to_'
    
    c = module.find('wxHtmlEasyPrinting')
    c.addPrivateCopyCtor()
    
    c = module.find('wxHtmlPrintout')
    c.addPrivateCopyCtor()
    
    
    #-----------------------------------------------------------------
    tools.doCommonTweaks(module)
    tools.runGenerators(module)
コード例 #3
0
ファイル: htmlwin.py プロジェクト: ssbb/Phoenix
def run():
    # Parse the XML file(s) building a collection of Extractor objects
    module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
    etgtools.parseDoxyXML(module, ITEMS)

    #-----------------------------------------------------------------
    # Tweak the parsed meta objects in the module object as needed for
    # customizing the generated code and docstrings.

    c = module.find('wxHtmlWindow')
    assert isinstance(c, etgtools.ClassDef)
    tools.fixWindowClass(c)
    c.bases = ['wxScrolledWindow']

    c.find('OnCellClicked').ignore(False)
    c.find('OnCellMouseHover').ignore(False)

    for name in ['SetDefaultHTMLCursor', 'GetDefaultHTMLCursor']:
        c.find(name).find('type').type = 'wxHtmlWindowInterface::HTMLCursor'

    tools.fixHtmlSetFonts(c)

    # Pure virtuals inherited from wxHtmlWindowInterface
    c.addItem(etgtools.WigCode("""\
        virtual void SetHTMLWindowTitle(const wxString& title);
        virtual void OnHTMLLinkClicked(const wxHtmlLinkInfo& link);
        virtual wxHtmlOpeningStatus OnHTMLOpeningURL(wxHtmlURLType type,
                                                     const wxString& url,
                                                     wxString *redirect) const;
        virtual wxPoint HTMLCoordsToWindow(wxHtmlCell *cell,
                                           const wxPoint& pos) const;
        virtual wxWindow* GetHTMLWindow();
        virtual wxColour GetHTMLBackgroundColour() const;
        virtual void SetHTMLBackgroundColour(const wxColour& clr);
        virtual void SetHTMLBackgroundImage(const wxBitmap& bmpBg);
        virtual void SetHTMLStatusText(const wxString& text);
        virtual wxCursor GetHTMLCursor(wxHtmlWindowInterface::HTMLCursor type) const;
        """))

    c = module.find('wxHtmlLinkEvent')
    tools.fixEventClass(c)

    c = module.find('wxHtmlCellEvent')
    tools.fixEventClass(c)

    module.addPyCode("""\
        EVT_HTML_CELL_CLICKED = wx.PyEventBinder( wxEVT_HTML_CELL_CLICKED, 1 )
        EVT_HTML_CELL_HOVER   = wx.PyEventBinder( wxEVT_HTML_CELL_HOVER, 1 )
        EVT_HTML_LINK_CLICKED = wx.PyEventBinder( wxEVT_HTML_LINK_CLICKED, 1 )

        # deprecated wxEVT aliases
        wxEVT_COMMAND_HTML_CELL_CLICKED  = wxEVT_HTML_CELL_CLICKED
        wxEVT_COMMAND_HTML_CELL_HOVER    = wxEVT_HTML_CELL_HOVER
        wxEVT_COMMAND_HTML_LINK_CLICKED  = wxEVT_HTML_LINK_CLICKED
        """)


    #-----------------------------------------------------------------
    tools.doCommonTweaks(module)
    tools.runGenerators(module)
コード例 #4
0
def run():
    # Parse the XML file(s) building a collection of Extractor objects
    module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
    etgtools.parseDoxyXML(module, ITEMS)

    #-----------------------------------------------------------------
    # Tweak the parsed meta objects in the module object as needed for
    # customizing the generated code and docstrings.

    c = module.find('wxHtmlWindow')
    assert isinstance(c, etgtools.ClassDef)
    tools.fixWindowClass(c)
    c.bases = ['wxScrolledWindow']

    c.find('OnCellClicked').ignore(False)
    c.find('OnCellMouseHover').ignore(False)
    c.find('AddFilter.filter').transfer = True

    tools.fixHtmlSetFonts(c)

    # Pure virtuals inherited from wxHtmlWindowInterface
    c.addItem(etgtools.WigCode("""\
        virtual void SetHTMLWindowTitle(const wxString& title);
        virtual void OnHTMLLinkClicked(const wxHtmlLinkInfo& link);
        virtual wxHtmlOpeningStatus OnHTMLOpeningURL(wxHtmlURLType type,
                                                     const wxString& url,
                                                     wxString *redirect) const;
        virtual wxPoint HTMLCoordsToWindow(wxHtmlCell *cell,
                                           const wxPoint& pos) const;
        virtual wxWindow* GetHTMLWindow();
        virtual wxColour GetHTMLBackgroundColour() const;
        virtual void SetHTMLBackgroundColour(const wxColour& clr);
        virtual void SetHTMLBackgroundImage(const wxBitmap& bmpBg);
        virtual void SetHTMLStatusText(const wxString& text);
        virtual wxCursor GetHTMLCursor(wxHtmlWindowInterface::HTMLCursor type) const;
        """))

    c = module.find('wxHtmlLinkEvent')
    tools.fixEventClass(c)

    c = module.find('wxHtmlCellEvent')
    tools.fixEventClass(c)

    module.addPyCode("""\
        EVT_HTML_CELL_CLICKED = wx.PyEventBinder( wxEVT_HTML_CELL_CLICKED, 1 )
        EVT_HTML_CELL_HOVER   = wx.PyEventBinder( wxEVT_HTML_CELL_HOVER, 1 )
        EVT_HTML_LINK_CLICKED = wx.PyEventBinder( wxEVT_HTML_LINK_CLICKED, 1 )

        # deprecated wxEVT aliases
        wxEVT_COMMAND_HTML_CELL_CLICKED  = wxEVT_HTML_CELL_CLICKED
        wxEVT_COMMAND_HTML_CELL_HOVER    = wxEVT_HTML_CELL_HOVER
        wxEVT_COMMAND_HTML_LINK_CLICKED  = wxEVT_HTML_LINK_CLICKED
        """)


    #-----------------------------------------------------------------
    tools.doCommonTweaks(module)
    tools.runGenerators(module)
コード例 #5
0
ファイル: htmlprint.py プロジェクト: yufi113/Phoenix
def run():
    # Parse the XML file(s) building a collection of Extractor objects
    module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
    etgtools.parseDoxyXML(module, ITEMS)

    #-----------------------------------------------------------------
    # Tweak the parsed meta objects in the module object as needed for
    # customizing the generated code and docstrings.

    c = module.find('wxHtmlDCRenderer')
    assert isinstance(c, etgtools.ClassDef)
    c.mustHaveApp()
    c.addPrivateCopyCtor()
    tools.fixHtmlSetFonts(c)

    c.find('Render.from').name = 'from_'
    c.find('Render.to').name = 'to_'

    c = module.find('wxHtmlEasyPrinting')
    c.mustHaveApp()
    c.addPrivateCopyCtor()
    tools.fixHtmlSetFonts(c)

    c = module.find('wxHtmlPrintout')
    c.mustHaveApp()
    c.addPrivateCopyCtor()
    tools.fixHtmlSetFonts(c)

    # Ensure sip knows these virtuals are present in this class.
    c.addItem(
        etgtools.WigCode("""\
        bool OnPrintPage(int page);
        bool HasPage(int page);
        void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo);
        bool OnBeginDocument(int startPage, int endPage);
        void OnPreparePrinting();
        """))

    #-----------------------------------------------------------------
    tools.doCommonTweaks(module)
    tools.runGenerators(module)
コード例 #6
0
ファイル: htmlprint.py プロジェクト: GadgetSteve/Phoenix
def run():
    # Parse the XML file(s) building a collection of Extractor objects
    module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
    etgtools.parseDoxyXML(module, ITEMS)

    #-----------------------------------------------------------------
    # Tweak the parsed meta objects in the module object as needed for
    # customizing the generated code and docstrings.

    c = module.find('wxHtmlDCRenderer')
    assert isinstance(c, etgtools.ClassDef)
    c.mustHaveApp()
    c.addPrivateCopyCtor()
    tools.fixHtmlSetFonts(c)

    c.find('Render.from').name = 'from_'
    c.find('Render.to').name = 'to_'

    c = module.find('wxHtmlEasyPrinting')
    c.mustHaveApp()
    c.addPrivateCopyCtor()
    tools.fixHtmlSetFonts(c)

    c = module.find('wxHtmlPrintout')
    c.mustHaveApp()
    c.addPrivateCopyCtor()
    tools.fixHtmlSetFonts(c)

    # Ensure sip knows these virtuals are present in this class.
    c.addItem(etgtools.WigCode("""\
        bool OnPrintPage(int page);
        bool HasPage(int page);
        void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo);
        bool OnBeginDocument(int startPage, int endPage);
        void OnPreparePrinting();
        """))

    #-----------------------------------------------------------------
    tools.doCommonTweaks(module)
    tools.runGenerators(module)
コード例 #7
0
def run():
    # Parse the XML file(s) building a collection of Extractor objects
    module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
    etgtools.parseDoxyXML(module, ITEMS)

    #-----------------------------------------------------------------
    # Tweak the parsed meta objects in the module object as needed for
    # customizing the generated code and docstrings.

    c = module.find('wxHtmlWinTagHandler')
    assert isinstance(c, etgtools.ClassDef)

    c.addCppMethod('wxHtmlWinParser*',
                   'GetParser',
                   '()',
                   body="return (wxHtmlWinParser*)self->GetParser();")

    c.addPrivateCopyCtor()

    c = module.find('wxHtmlWinParser')
    c.find('GetEncodingConverter').ignore()
    c.find('GetInputEncoding').ignore()
    c.find('GetOutputEncoding').ignore()
    c.find('SetInputEncoding').ignore()

    tools.fixHtmlSetFonts(c)

    c.find('AddModule').ignore()

    c.addItem(
        etgtools.WigCode("""\
        virtual wxObject* GetProduct();
        """))

    module.addCppCode("""\
        class wxPyHtmlTagsModule : public wxHtmlTagsModule {
        public:
            wxPyHtmlTagsModule() : wxHtmlTagsModule() {
            }

            bool OnInit() {
                wxHtmlWinParser::AddModule(this);
                return true;
            }

            void OnExit() {
                wxPyThreadBlocker blocker;
                for (size_t x=0; x < m_tagHandlersArray.GetCount(); x++) {
                    PyObject* obj = (PyObject*)m_tagHandlersArray.Item(x);
                    Py_DECREF(obj);
                }
                m_tagHandlersArray.Clear();
                wxHtmlWinParser::RemoveModule(this);
            }

            void FillHandlersTable(wxHtmlWinParser *parser) {
                wxPyThreadBlocker blocker;

                // make a new instance of each handler class and register it with the parser
                for (size_t cls=0; cls < s_tagHandlerClasses.GetCount(); cls++) {
                    PyObject* pyClass = (PyObject*)s_tagHandlerClasses.Item(cls);

                    wxHtmlWinTagHandler* thPtr = NULL;

                    PyObject* arg = PyTuple_New(0);
                    PyObject* obj = PyObject_CallObject(pyClass, arg);
                    Py_DECREF(arg);

                    // Make sure it succeeded
                    if (!obj) {
                        PyErr_Print();
                        return;
                    }

                    // now figure out where it's C++ object is...
                    if (! wxPyConvertWrappedPtr(obj, (void **)&thPtr, wxT("wxHtmlWinTagHandler"))) {
                        return;
                    }

                    // add it,
                    parser->AddTagHandler(thPtr);

                    // and track it
                    m_tagHandlersArray.Add(obj);
                }
            }

            static void AddPyTagHandler(PyObject* tagHandlerClass) {
                wxPyThreadBlocker blocker;
                Py_INCREF(tagHandlerClass);
                s_tagHandlerClasses.Add(tagHandlerClass);
            }

        private:
            wxDECLARE_DYNAMIC_CLASS(wxPyHtmlTagsModule);

            static wxArrayPtrVoid       s_tagHandlerClasses;
            wxArrayPtrVoid              m_tagHandlersArray;
        };

        wxIMPLEMENT_DYNAMIC_CLASS(wxPyHtmlTagsModule, wxHtmlTagsModule)
        wxArrayPtrVoid wxPyHtmlTagsModule::s_tagHandlerClasses;
        """)

    module.addCppFunction('void',
                          'HtmlWinParser_AddTagHandler',
                          '(PyObject* tagHandlerClass)',
                          body="""\
            wxPyHtmlTagsModule::AddPyTagHandler(tagHandlerClass);
            wxPyReinitializeModules();
            """)

    #-----------------------------------------------------------------
    tools.doCommonTweaks(module)
    tools.runGenerators(module)
コード例 #8
0
def run():
    # Parse the XML file(s) building a collection of Extractor objects
    module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
    etgtools.parseDoxyXML(module, ITEMS)

    #-----------------------------------------------------------------
    # Tweak the parsed meta objects in the module object as needed for
    # customizing the generated code and docstrings.

    c = module.find('wxHtmlWindowInterface')
    assert isinstance(c, etgtools.ClassDef)
    c.find('OnHTMLOpeningURL.redirect').out = True
    c.find('OnHTMLOpeningURL.redirect').name = 'redirectTo'

    c = module.find('wxHtmlWindow')
    assert isinstance(c, etgtools.ClassDef)
    tools.fixWindowClass(c)
    c.bases = ['wxScrolledWindow', 'wxHtmlWindowInterface']
    tools.fixHtmlSetFonts(c)

    c.find('AddFilter.filter').transfer = True
    c.find('OnOpeningURL.redirect').out = True
    c.find('OnOpeningURL.redirect').name = 'redirectTo'

    # Turn the virtual flag back on for some methods
    for name in [
            'OnLinkClicked', 'OnOpeningURL', 'OnSetTitle', 'OnCellMouseHover',
            'OnCellClicked'
    ]:
        c.find(name).isVirtual = True
        c.find(name).ignore(False)

    # Declare that the pure virtuals inherited from wxHtmlWindowInterface have
    # implementations here
    c.addItem(
        etgtools.WigCode("""\
        virtual void SetHTMLWindowTitle(const wxString& title);
        virtual void OnHTMLLinkClicked(const wxHtmlLinkInfo& link);
        virtual wxHtmlOpeningStatus OnHTMLOpeningURL(wxHtmlURLType type,
                                                     const wxString& url,
                                                     wxString *redirectTo /Out/) const;
        virtual wxPoint HTMLCoordsToWindow(wxHtmlCell *cell,
                                           const wxPoint& pos) const;
        virtual wxWindow* GetHTMLWindow();
        virtual wxColour GetHTMLBackgroundColour() const;
        virtual void SetHTMLBackgroundColour(const wxColour& clr);
        virtual void SetHTMLBackgroundImage(const wxBitmap& bmpBg);
        virtual void SetHTMLStatusText(const wxString& text);
        virtual wxCursor GetHTMLCursor(wxHtmlWindowInterface::HTMLCursor type) const;
        """))

    m = MethodDef(name='ScrollToAnchor',
                  type='bool',
                  protection='protected',
                  items=[ParamDef(type='const wxString&', name='anchor')],
                  doc="""\
            Scrolls to anchor of this name.
            Returns True is anchor exists, False otherwise.
        """)
    c.addItem(m)

    c = module.find('wxHtmlLinkEvent')
    tools.fixEventClass(c)

    c = module.find('wxHtmlCellEvent')
    tools.fixEventClass(c)

    module.addPyCode("""\
        EVT_HTML_CELL_CLICKED = wx.PyEventBinder( wxEVT_HTML_CELL_CLICKED, 1 )
        EVT_HTML_CELL_HOVER   = wx.PyEventBinder( wxEVT_HTML_CELL_HOVER, 1 )
        EVT_HTML_LINK_CLICKED = wx.PyEventBinder( wxEVT_HTML_LINK_CLICKED, 1 )

        # deprecated wxEVT aliases
        wxEVT_COMMAND_HTML_CELL_CLICKED  = wxEVT_HTML_CELL_CLICKED
        wxEVT_COMMAND_HTML_CELL_HOVER    = wxEVT_HTML_CELL_HOVER
        wxEVT_COMMAND_HTML_LINK_CLICKED  = wxEVT_HTML_LINK_CLICKED
        """)

    #-----------------------------------------------------------------
    tools.doCommonTweaks(module)
    tools.runGenerators(module)
コード例 #9
0
ファイル: htmlwinpars.py プロジェクト: swt2c/Phoenix
def run():
    # Parse the XML file(s) building a collection of Extractor objects
    module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
    etgtools.parseDoxyXML(module, ITEMS)

    #-----------------------------------------------------------------
    # Tweak the parsed meta objects in the module object as needed for
    # customizing the generated code and docstrings.

    c = module.find('wxHtmlWinTagHandler')
    assert isinstance(c, etgtools.ClassDef)

    c.addCppMethod('wxHtmlWinParser*', 'GetParser', '()',
        body="return (wxHtmlWinParser*)self->GetParser();")

    c.addPrivateCopyCtor()


    c = module.find('wxHtmlWinParser')
    c.find('GetEncodingConverter').ignore()
    c.find('GetInputEncoding').ignore()
    c.find('GetOutputEncoding').ignore()
    c.find('SetInputEncoding').ignore()

    tools.fixHtmlSetFonts(c)

    c.find('AddModule').ignore()

    c.addItem(etgtools.WigCode("""\
        virtual wxObject* GetProduct();
        """))


    module.addCppCode("""\
        class wxPyHtmlTagsModule : public wxHtmlTagsModule {
        public:
            wxPyHtmlTagsModule(PyObject* thc) : wxHtmlTagsModule() {
                m_tagHandlerClass = thc;
                wxPyThreadBlocker blocker;
                Py_INCREF(m_tagHandlerClass);
                RegisterModule(this);
                wxHtmlWinParser::AddModule(this);
            }

            void OnExit() {
                wxPyThreadBlocker blocker;
                Py_DECREF(m_tagHandlerClass);
                m_tagHandlerClass = NULL;
                for (size_t x=0; x < m_objArray.GetCount(); x++) {
                    PyObject* obj = (PyObject*)m_objArray.Item(x);
                    Py_DECREF(obj);
                }
            }

            void FillHandlersTable(wxHtmlWinParser *parser) {
                wxPyThreadBlocker blocker;
                wxHtmlWinTagHandler* thPtr = 0;
                // First, make a new instance of the tag handler
                PyObject* arg = PyTuple_New(0);
                PyObject* obj = PyObject_CallObject(m_tagHandlerClass, arg);
                Py_DECREF(arg);

                // Make sure it succeeded
                if (!obj) {
                    PyErr_Print();
                    return;
                }

                // now figure out where it's C++ object is...
                if (! wxPyConvertWrappedPtr(obj, (void **)&thPtr, wxT("wxHtmlWinTagHandler"))) {
                    return;
                }

                // add it,
                parser->AddTagHandler(thPtr);

                // and track it.
                m_objArray.Add(obj);
            }

        private:
            PyObject*           m_tagHandlerClass;
            wxArrayPtrVoid      m_objArray;

        };
        """)


    module.addCppFunction('void', 'HtmlWinParser_AddTagHandler', '(PyObject* tagHandlerClass)',
        body="""\
            // Dynamically create a new wxModule.  Refcounts tagHandlerClass
            // and adds itself to the wxModules list and to the wxHtmlWinParser.
            new wxPyHtmlTagsModule(tagHandlerClass);
            wxModule::InitializeModules();
            """)


    #-----------------------------------------------------------------
    tools.doCommonTweaks(module)
    tools.runGenerators(module)
コード例 #10
0
ファイル: htmlwinpars.py プロジェクト: GadgetSteve/Phoenix
def run():
    # Parse the XML file(s) building a collection of Extractor objects
    module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
    etgtools.parseDoxyXML(module, ITEMS)

    #-----------------------------------------------------------------
    # Tweak the parsed meta objects in the module object as needed for
    # customizing the generated code and docstrings.

    c = module.find('wxHtmlWinTagHandler')
    assert isinstance(c, etgtools.ClassDef)

    c.addCppMethod('wxHtmlWinParser*', 'GetParser', '()',
        body="return (wxHtmlWinParser*)self->GetParser();")

    c.addPrivateCopyCtor()


    c = module.find('wxHtmlWinParser')
    c.find('GetEncodingConverter').ignore()
    c.find('GetInputEncoding').ignore()
    c.find('GetOutputEncoding').ignore()
    c.find('SetInputEncoding').ignore()

    tools.fixHtmlSetFonts(c)

    c.find('AddModule').ignore()

    c.addItem(etgtools.WigCode("""\
        virtual wxObject* GetProduct();
        """))


    module.addCppCode("""\
        class wxPyHtmlTagsModule : public wxHtmlTagsModule {
        public:
            wxPyHtmlTagsModule() : wxHtmlTagsModule() {
            }

            bool OnInit() {
                wxHtmlWinParser::AddModule(this);
                return true;
            }

            void OnExit() {
                wxPyThreadBlocker blocker;
                for (size_t x=0; x < m_tagHandlersArray.GetCount(); x++) {
                    PyObject* obj = (PyObject*)m_tagHandlersArray.Item(x);
                    Py_DECREF(obj);
                }
                m_tagHandlersArray.Clear();
                wxHtmlWinParser::RemoveModule(this);
            }

            void FillHandlersTable(wxHtmlWinParser *parser) {
                wxPyThreadBlocker blocker;

                // make a new instance of each handler class and register it with the parser
                for (size_t cls=0; cls < s_tagHandlerClasses.GetCount(); cls++) {
                    PyObject* pyClass = (PyObject*)s_tagHandlerClasses.Item(cls);

                    wxHtmlWinTagHandler* thPtr = NULL;

                    PyObject* arg = PyTuple_New(0);
                    PyObject* obj = PyObject_CallObject(pyClass, arg);
                    Py_DECREF(arg);

                    // Make sure it succeeded
                    if (!obj) {
                        PyErr_Print();
                        return;
                    }

                    // now figure out where it's C++ object is...
                    if (! wxPyConvertWrappedPtr(obj, (void **)&thPtr, wxT("wxHtmlWinTagHandler"))) {
                        return;
                    }

                    // add it,
                    parser->AddTagHandler(thPtr);

                    // and track it
                    m_tagHandlersArray.Add(obj);
                }
            }

            static void AddPyTagHandler(PyObject* tagHandlerClass) {
                wxPyThreadBlocker blocker;
                Py_INCREF(tagHandlerClass);
                s_tagHandlerClasses.Add(tagHandlerClass);
            }

        private:
            wxDECLARE_DYNAMIC_CLASS(wxPyHtmlTagsModule);

            static wxArrayPtrVoid       s_tagHandlerClasses;
            wxArrayPtrVoid              m_tagHandlersArray;
        };

        wxIMPLEMENT_DYNAMIC_CLASS(wxPyHtmlTagsModule, wxHtmlTagsModule)
        wxArrayPtrVoid wxPyHtmlTagsModule::s_tagHandlerClasses;
        """)


    module.addCppFunction('void', 'HtmlWinParser_AddTagHandler', '(PyObject* tagHandlerClass)',
        body="""\
            wxPyHtmlTagsModule::AddPyTagHandler(tagHandlerClass);
            wxPyReinitializeModules();
            """)


    #-----------------------------------------------------------------
    tools.doCommonTweaks(module)
    tools.runGenerators(module)
コード例 #11
0
ファイル: htmlwin.py プロジェクト: RobinD42/Phoenix
def run():
    # Parse the XML file(s) building a collection of Extractor objects
    module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
    etgtools.parseDoxyXML(module, ITEMS)

    #-----------------------------------------------------------------
    # Tweak the parsed meta objects in the module object as needed for
    # customizing the generated code and docstrings.

    c = module.find('wxHtmlWindowInterface')
    assert isinstance(c, etgtools.ClassDef)
    c.find('OnHTMLOpeningURL.redirect').out = True
    c.find('OnHTMLOpeningURL.redirect').name = 'redirectTo'


    c = module.find('wxHtmlWindow')
    assert isinstance(c, etgtools.ClassDef)
    tools.fixWindowClass(c)
    c.bases = ['wxScrolledWindow', 'wxHtmlWindowInterface']
    tools.fixHtmlSetFonts(c)

    c.find('AddFilter.filter').transfer = True
    c.find('OnOpeningURL.redirect').out = True
    c.find('OnOpeningURL.redirect').name = 'redirectTo'

    # Turn the virtual flag back on for some methods
    for name in [ 'OnLinkClicked',
                  'OnOpeningURL',
                  'OnSetTitle',
                  'OnCellMouseHover',
                  'OnCellClicked' ]:
        c.find(name).isVirtual = True
        c.find(name).ignore(False)

    # Declare that the pure virtuals inherited from wxHtmlWindowInterface have
    # implementations here
    c.addItem(etgtools.WigCode("""\
        virtual void SetHTMLWindowTitle(const wxString& title);
        virtual void OnHTMLLinkClicked(const wxHtmlLinkInfo& link);
        virtual wxHtmlOpeningStatus OnHTMLOpeningURL(wxHtmlURLType type,
                                                     const wxString& url,
                                                     wxString *redirectTo /Out/) const;
        virtual wxPoint HTMLCoordsToWindow(wxHtmlCell *cell,
                                           const wxPoint& pos) const;
        virtual wxWindow* GetHTMLWindow();
        virtual wxColour GetHTMLBackgroundColour() const;
        virtual void SetHTMLBackgroundColour(const wxColour& clr);
        virtual void SetHTMLBackgroundImage(const wxBitmap& bmpBg);
        virtual void SetHTMLStatusText(const wxString& text);
        virtual wxCursor GetHTMLCursor(wxHtmlWindowInterface::HTMLCursor type) const;
        """))

    m = MethodDef(name='ScrollToAnchor', type='bool', protection='protected',
        items=[ParamDef(type='const wxString&', name='anchor')],
        doc="""\
            Scrolls to anchor of this name.
            Returns True is anchor exists, False otherwise.
        """)
    c.addItem(m)


    c = module.find('wxHtmlLinkEvent')
    tools.fixEventClass(c)


    c = module.find('wxHtmlCellEvent')
    tools.fixEventClass(c)

    module.addPyCode("""\
        EVT_HTML_CELL_CLICKED = wx.PyEventBinder( wxEVT_HTML_CELL_CLICKED, 1 )
        EVT_HTML_CELL_HOVER   = wx.PyEventBinder( wxEVT_HTML_CELL_HOVER, 1 )
        EVT_HTML_LINK_CLICKED = wx.PyEventBinder( wxEVT_HTML_LINK_CLICKED, 1 )

        # deprecated wxEVT aliases
        wxEVT_COMMAND_HTML_CELL_CLICKED  = wxEVT_HTML_CELL_CLICKED
        wxEVT_COMMAND_HTML_CELL_HOVER    = wxEVT_HTML_CELL_HOVER
        wxEVT_COMMAND_HTML_LINK_CLICKED  = wxEVT_HTML_LINK_CLICKED
        """)


    #-----------------------------------------------------------------
    tools.doCommonTweaks(module)
    tools.runGenerators(module)