From 67339f7d9ddfa94e314b71d62b2fed728df334e5 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Mon, 4 Dec 2006 08:26:24 +0000 Subject: [PATCH] Added SetEncoding git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43788 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/htmllbox.h | 11 +++++++++-- src/generic/htmllbox.cpp | 5 ++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/include/wx/htmllbox.h b/include/wx/htmllbox.h index 2f0675fa62..6557e4e036 100644 --- a/include/wx/htmllbox.h +++ b/include/wx/htmllbox.h @@ -74,6 +74,9 @@ public: virtual void RefreshAll(); virtual void SetItemCount(size_t count); + // provide a way to set the default encoding (non-Unicode only) + void SetEncoding(wxFontEncoding encoding) { m_fontEncoding = encoding; } + wxFontEncoding GetEncoding() { return m_fontEncoding; } #if wxUSE_FILESYSTEM // retrieve the file system used by the wxHtmlWinParser: if you use @@ -168,6 +171,9 @@ private: // HTML parser we use wxHtmlWinParser *m_htmlParser; + // font encoding (used in non-Unicode mode only) + wxFontEncoding m_fontEncoding; + #if wxUSE_FILESYSTEM // file system used by m_htmlParser wxFileSystem m_filesystem; @@ -312,8 +318,9 @@ protected: virtual wxString OnGetItem(size_t n) const { return m_items[n]; } - wxArrayString m_items; - wxArrayPtrVoid m_HTMLclientData; + wxArrayString m_items; + wxArrayPtrVoid m_HTMLclientData; + // Note: For the benefit of old compilers (like gcc-2.8) this should // not be named m_clientdata as that clashes with the name of an // anonymous struct member in wxEvtHandler, which we derive from. diff --git a/src/generic/htmllbox.cpp b/src/generic/htmllbox.cpp index 8d415e1051..c4256b2dea 100644 --- a/src/generic/htmllbox.cpp +++ b/src/generic/htmllbox.cpp @@ -225,6 +225,7 @@ void wxHtmlListBox::Init() m_htmlParser = NULL; m_htmlRendStyle = new wxHtmlListBoxStyle(*this); m_cache = new wxHtmlListBoxCache; + m_fontEncoding = wxFONTENCODING_ISO8859_1; } bool wxHtmlListBox::Create(wxWindow *parent, @@ -293,7 +294,9 @@ void wxHtmlListBox::CacheItem(size_t n) const self->m_htmlParser = new wxHtmlWinParser(self); m_htmlParser->SetDC(new wxClientDC(self)); m_htmlParser->SetFS(&self->m_filesystem); - +#if !wxUSE_UNICODE + m_htmlParser->SetInputEncoding(m_fontEncoding); +#endif // use system's default GUI font by default: m_htmlParser->SetStandardFonts(); }