wxHtmlWordCell::wxHtmlWordCell(const wxString& word, wxDC& dc) : wxHtmlCell() { m_Word = word; dc.GetTextExtent(m_Word, &m_Width, &m_Height, &m_Descent); SetCanLiveOnPagebreak(false); m_allowLinebreak = true; }
wxHtmlWordCell::wxHtmlWordCell(const wxString& word, const wxDC& dc) : wxHtmlCell() { m_Word = word; wxCoord w, h, d; dc.GetTextExtent(m_Word, &w, &h, &d); m_Width = w; m_Height = h; m_Descent = d; SetCanLiveOnPagebreak(false); m_allowLinebreak = true; }
/**************************************************************************** REMARKS: Constructor for the HTML cell class to store our wxApplet windows in the HTML page to be rendered by wxHTML. ****************************************************************************/ wxHtmlAppletCell::wxHtmlAppletCell( wxWindow *wnd, int align) : wxHtmlCell() { int sx, sy; m_Wnd = wnd; m_Wnd->GetSize(&sx, &sy); m_Width = sx, m_Height = sy; switch (align) { case wxHTML_ALIGN_TOP : m_Descent = m_Height; break; case wxHTML_ALIGN_CENTER : m_Descent = m_Height / 2; break; case wxHTML_ALIGN_BOTTOM : default : m_Descent = 0; break; } SetCanLiveOnPagebreak(FALSE); }
wxHtmlImageCell::wxHtmlImageCell(wxHtmlWindowInterface *windowIface, wxFSFile *input, int w, bool wpercent, int h, bool hpresent, double scale, int align, const wxString& mapname) : wxHtmlCell() { m_windowIface = windowIface; m_scale = scale; m_showFrame = false; m_bitmap = NULL; m_bmpW = w; m_bmpH = h; m_align = align; m_bmpWpercent = wpercent; m_bmpHpresent = hpresent; m_imageMap = NULL; m_mapName = mapname; SetCanLiveOnPagebreak(false); #if wxUSE_GIF && wxUSE_TIMER m_gifDecoder = NULL; m_gifTimer = NULL; m_physX = m_physY = wxDefaultCoord; m_nCurrFrame = 0; #endif if ( m_bmpW && m_bmpH ) { if ( input ) { wxInputStream *s = input->GetStream(); if ( s ) { #if wxUSE_GIF && wxUSE_TIMER bool readImg = true; if ( m_windowIface && (input->GetLocation().Matches(wxT("*.gif")) || input->GetLocation().Matches(wxT("*.GIF"))) ) { m_gifDecoder = new wxGIFDecoder(); if ( m_gifDecoder->LoadGIF(*s) == wxGIF_OK ) { wxImage img; if ( m_gifDecoder->ConvertToImage(0, &img) ) SetImage(img); readImg = false; if ( m_gifDecoder->IsAnimation() ) { m_gifTimer = new wxGIFTimer(this); long delay = m_gifDecoder->GetDelay(0); if ( delay == 0 ) delay = 1; m_gifTimer->Start(delay, true); } else { wxDELETE(m_gifDecoder); } } else { wxDELETE(m_gifDecoder); } } if ( readImg ) #endif // wxUSE_GIF && wxUSE_TIMER { wxImage image(*s, wxBITMAP_TYPE_ANY); if ( image.IsOk() ) SetImage(image); } } } else // input==NULL, use "broken image" bitmap { if ( m_bmpW == wxDefaultCoord && m_bmpH == wxDefaultCoord ) { m_bmpW = 29; m_bmpH = 31; } else { m_showFrame = true; if ( m_bmpW == wxDefaultCoord ) m_bmpW = 31; if ( m_bmpH == wxDefaultCoord ) m_bmpH = 33; } m_bitmap = new wxBitmap(wxArtProvider::GetBitmap(wxART_MISSING_IMAGE)); } } //else: ignore the 0-sized images used sometimes on the Web pages }