void ContentBoxCtrol::CacheItem(size_t n) const { if ( !m_cache->Has(n) ) { if ( !m_htmlParser ) { ContentBoxCtrol *self = wxConstCast(this, ContentBoxCtrol); self->m_htmlParser = LENMUS_NEW wxHtmlWinParser(self); LMB_TagHandler* pTagHandler = LENMUS_NEW LMB_TagHandler(m_appScope); m_htmlParser->AddTagHandler(pTagHandler); m_htmlParser->SetDC(LENMUS_NEW wxClientDC(self)); m_htmlParser->SetFS(&self->m_filesystem); // use system's default GUI font by default: m_htmlParser->SetFontFace("Tahoma"); m_htmlParser->SetFontSize(10); //m_htmlParser->SetStandardFonts(); } wxHtmlContainerCell *cell = (wxHtmlContainerCell *)m_htmlParser-> Parse(OnGetItemMarkup(n)); wxCHECK_RET( cell, "wxHtmlParser::Parse() returned NULL?" ); // set the cell's ID to item's index so that CellCoordsToPhysical() // can quickly find the item: cell->SetId(wxString::Format("%lu", (unsigned long)n)); cell->Layout(GetClientSize().x - 2*GetMargins().x); m_cache->Store(n, cell); } }
void wxHtmlListBox::CacheItem(size_t n) const { if ( !m_cache->Has(n) ) { if ( !m_htmlParser ) { wxHtmlListBox *self = wxConstCast(this, wxHtmlListBox); self->m_htmlParser = new wxHtmlWinParser(self); m_htmlParser->SetDC(new wxClientDC(self)); m_htmlParser->SetFS(&self->m_filesystem); #if !wxUSE_UNICODE if (GetFont().IsOk()) m_htmlParser->SetInputEncoding(GetFont().GetEncoding()); #endif // use system's default GUI font by default: m_htmlParser->SetStandardFonts(); } wxHtmlContainerCell *cell = (wxHtmlContainerCell *)m_htmlParser-> Parse(OnGetItemMarkup(n)); wxCHECK_RET( cell, wxT("wxHtmlParser::Parse() returned NULL?") ); // set the cell's ID to item's index so that CellCoordsToPhysical() // can quickly find the item: cell->SetId(wxString::Format(wxT("%lu"), (unsigned long)n)); cell->Layout(GetClientSize().x - 2*GetMargins().x); m_cache->Store(n, cell); } }