diff --git a/include/wx/richtext/richtextbuffer.h b/include/wx/richtext/richtextbuffer.h index 557e5b46ca..ed0da6c2c1 100644 --- a/include/wx/richtext/richtextbuffer.h +++ b/include/wx/richtext/richtextbuffer.h @@ -2015,6 +2015,9 @@ void wxSetFontPreservingStyles(wxTextAttr& attr, const wxFont& font); /// Convert a decimal to Roman numerals wxString wxRichTextDecimalToRoman(long n); + +WXDLLIMPEXP_RICHTEXT void wxRichTextModuleInit(); + #endif // wxUSE_RICHTEXT diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index 0921ba0ff1..263152bc9b 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -4934,6 +4934,17 @@ public: IMPLEMENT_DYNAMIC_CLASS(wxRichTextModule, wxModule) +// If the richtext lib is dynamically loaded after the app has already started +// (such as from wxPython) then the built-in module system will not init this +// module. Provide this function to do it manually. +void wxRichTextModuleInit() +{ + wxModule* module = new wxRichTextModule; + module->Init(); + wxModule::RegisterModule(module); +} + + /*! * Commands for undo/redo *