All:
-- wxEvent and its derivatives have their variable members nonpublic now.
- Use the Get/Set accessors (Mart Raudsepp)
+- wxEvent and derived classes don't have public members any more, you must
+ use accessors methods now (Mart Raudsepp)
- new classes for reading and writing ZIP files (M.J.Wetherell)
- large files support for wxFFile (M.J.Wetherell)
- classes in the manual are now cross-referenced (Zbigniew Zagórski)
- added wxMediaCtrl
- added wxDatePickerCtrl
+- wxHtmlWindow now supports background images given in <body> tag
- wxSplitterWindow now supports gravity parameter (Zbigniew Zagórski)
- recursive wxSizer::GetItem returns item of given window, sizer or nth index
- wxLayoutConstraints now use best size, not current size, for AsIs() condition
// Sets space between text and window borders.
void SetBorders(int b) {m_Borders = b;}
+ // Sets the bitmap to use for background (currnetly it will be tiled,
+ // when/if we have CSS support we could add other possibilities...)
+ void SetBackgroundImage(const wxBitmap& bmpBg) { m_bmpBg = bmpBg; }
+
// Saves custom settings into cfg config. it will use the path 'path'
// if given, otherwise it will save info into currently selected path.
// saved values : things set by SetFonts, SetBorders.
// Adds HTML processor to wxHtmlWindow class as whole:
static void AddGlobalProcessor(wxHtmlProcessor *processor);
+
// -- Callbacks --
// Sets the title of the window
// Converts current page to text:
wxString ToText();
-#endif
-
- virtual void ApplyParentThemeBackground(const wxColour& WXUNUSED(bg))
- { /* do nothing */ }
+#endif // wxUSE_CLIPBOARD
protected:
void Init();
// window content for double buffered rendering:
wxBitmap *m_backBuffer;
+ // background image, may be invalid
+ wxBitmap m_bmpBg;
+
// variables used when user is selecting text
wxPoint m_tmpSelFromPos;
wxHtmlCell *m_tmpSelFromCell;
wxClientDC *dc = new wxClientDC(this);
dc->SetMapMode(wxMM_TEXT);
SetBackgroundColour(wxColour(0xFF, 0xFF, 0xFF));
+ SetBackgroundImage(wxNullBitmap);
m_OpenedPage = m_OpenedAnchor = m_OpenedPageTitle = wxEmptyString;
m_Parser->SetDC(dc);
if (m_Cell)
void wxHtmlWindow::OnEraseBackground(wxEraseEvent& event)
{
- // we do have to erase background now that we reuse it (instead of
- // overwriting it) in OnPaint() below, but maybe we should set some flag if
- // we get here as this would mean that user code doesn't paint background
- // itself and then we wouldn't have to copy old bits to dcm below...
- event.Skip();
+ if ( !m_bmpBg.Ok() )
+ {
+ // we used to do nothing at all here but we do have to erase background
+ // now that we reuse it (instead of overwriting it) in OnPaint() below
+ event.Skip();
+
+ return;
+ }
+
+ wxDC& dc = *event.GetDC();
+
+ // if the image is not fully opaque, we have to erase the background before
+ // drawing it, however avoid doing it for opaque images as this would just
+ // result in extra flicker without any other effect as background is
+ // completely covered anyhow
+ if ( m_bmpBg.GetMask() )
+ {
+ dc.SetBackground(wxBrush(GetBackgroundColour(), wxSOLID));
+ dc.Clear();
+ }
+
+ const wxSize sizeWin(GetClientSize());
+ const wxSize sizeBmp(m_bmpBg.GetWidth(), m_bmpBg.GetHeight());
+ for ( wxCoord x = 0; x < sizeWin.x; x += sizeBmp.x )
+ {
+ for ( wxCoord y = 0; y < sizeWin.y; y += sizeBmp.y )
+ {
+ dc.DrawBitmap(m_bmpBg, x, y, true /* use mask */);
+ }
+ }
}
void wxHtmlWindow::OnPaint(wxPaintEvent& WXUNUSED(event))
#include "wx/wxprec.h"
-
#include "wx/defs.h"
+
#if wxUSE_HTML && wxUSE_STREAMS
+
#ifdef __BORLANDC__
-#pragma hdrstop
+ #pragma hdrstop
#endif
#ifndef WXPRECOMP
#endif
+#include "wx/image.h"
#include "wx/html/forcelnk.h"
#include "wx/html/m_templ.h"
if (tag.GetParamAsColour(wxT("LINK"), &clr))
m_WParser->SetLinkColor(clr);
+ if (tag.HasParam(wxT("BACKGROUND")))
+ {
+ wxFSFile *fileBgImage = m_WParser->OpenURL
+ (
+ wxHTML_URL_IMAGE,
+ tag.GetParam(wxT("BACKGROUND"))
+ );
+ if ( fileBgImage )
+ {
+ wxInputStream *is = fileBgImage->GetStream();
+ if ( is )
+ {
+ wxImage image(*is);
+ if ( image.Ok() )
+ m_WParser->GetWindow()->SetBackgroundImage(image);
+ }
+ }
+ }
+
if (tag.GetParamAsColour(wxT("BGCOLOR"), &clr))
{
m_WParser->GetContainer()->InsertCell(
if (m_WParser->GetWindow() != NULL)
m_WParser->GetWindow()->SetBackgroundColour(clr);
}
+
return false;
}