Use wxBitmapBundle in wxHtmlWindow
This commit is contained in:
@@ -21,7 +21,7 @@
|
|||||||
#include "wx/filesys.h"
|
#include "wx/filesys.h"
|
||||||
#include "wx/html/htmlfilt.h"
|
#include "wx/html/htmlfilt.h"
|
||||||
#include "wx/filename.h"
|
#include "wx/filename.h"
|
||||||
#include "wx/bitmap.h"
|
#include "wx/bmpbndl.h"
|
||||||
|
|
||||||
class wxHtmlProcessor;
|
class wxHtmlProcessor;
|
||||||
class wxHtmlWinModule;
|
class wxHtmlWinModule;
|
||||||
@@ -106,7 +106,7 @@ public:
|
|||||||
virtual void SetHTMLBackgroundColour(const wxColour& clr) = 0;
|
virtual void SetHTMLBackgroundColour(const wxColour& clr) = 0;
|
||||||
|
|
||||||
/// Sets window's background to given bitmap.
|
/// Sets window's background to given bitmap.
|
||||||
virtual void SetHTMLBackgroundImage(const wxBitmap& bmpBg) = 0;
|
virtual void SetHTMLBackgroundImage(const wxBitmapBundle& bmpBg) = 0;
|
||||||
|
|
||||||
/// Sets status bar text.
|
/// Sets status bar text.
|
||||||
virtual void SetHTMLStatusText(const wxString& text) = 0;
|
virtual void SetHTMLStatusText(const wxString& text) = 0;
|
||||||
@@ -315,7 +315,7 @@ public:
|
|||||||
|
|
||||||
// Sets the bitmap to use for background (currnetly it will be tiled,
|
// Sets the bitmap to use for background (currnetly it will be tiled,
|
||||||
// when/if we have CSS support we could add other possibilities...)
|
// when/if we have CSS support we could add other possibilities...)
|
||||||
void SetBackgroundImage(const wxBitmap& bmpBg) { m_bmpBg = bmpBg; }
|
void SetBackgroundImage(const wxBitmapBundle& bmpBg) { m_bmpBg = bmpBg; }
|
||||||
|
|
||||||
#if wxUSE_CONFIG
|
#if wxUSE_CONFIG
|
||||||
// Saves custom settings into cfg config. it will use the path 'path'
|
// Saves custom settings into cfg config. it will use the path 'path'
|
||||||
@@ -460,7 +460,7 @@ public:
|
|||||||
virtual wxWindow* GetHTMLWindow() wxOVERRIDE;
|
virtual wxWindow* GetHTMLWindow() wxOVERRIDE;
|
||||||
virtual wxColour GetHTMLBackgroundColour() const wxOVERRIDE;
|
virtual wxColour GetHTMLBackgroundColour() const wxOVERRIDE;
|
||||||
virtual void SetHTMLBackgroundColour(const wxColour& clr) wxOVERRIDE;
|
virtual void SetHTMLBackgroundColour(const wxColour& clr) wxOVERRIDE;
|
||||||
virtual void SetHTMLBackgroundImage(const wxBitmap& bmpBg) wxOVERRIDE;
|
virtual void SetHTMLBackgroundImage(const wxBitmapBundle& bmpBg) wxOVERRIDE;
|
||||||
virtual void SetHTMLStatusText(const wxString& text) wxOVERRIDE;
|
virtual void SetHTMLStatusText(const wxString& text) wxOVERRIDE;
|
||||||
virtual wxCursor GetHTMLCursor(HTMLCursor type) const wxOVERRIDE;
|
virtual wxCursor GetHTMLCursor(HTMLCursor type) const wxOVERRIDE;
|
||||||
|
|
||||||
@@ -523,7 +523,7 @@ private:
|
|||||||
wxBitmap m_backBuffer;
|
wxBitmap m_backBuffer;
|
||||||
|
|
||||||
// background image, may be invalid
|
// background image, may be invalid
|
||||||
wxBitmap m_bmpBg;
|
wxBitmapBundle m_bmpBg;
|
||||||
|
|
||||||
// variables used when user is selecting text
|
// variables used when user is selecting text
|
||||||
wxPoint m_tmpSelFromPos;
|
wxPoint m_tmpSelFromPos;
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ private:
|
|||||||
virtual wxWindow* GetHTMLWindow() wxOVERRIDE;
|
virtual wxWindow* GetHTMLWindow() wxOVERRIDE;
|
||||||
virtual wxColour GetHTMLBackgroundColour() const wxOVERRIDE;
|
virtual wxColour GetHTMLBackgroundColour() const wxOVERRIDE;
|
||||||
virtual void SetHTMLBackgroundColour(const wxColour& clr) wxOVERRIDE;
|
virtual void SetHTMLBackgroundColour(const wxColour& clr) wxOVERRIDE;
|
||||||
virtual void SetHTMLBackgroundImage(const wxBitmap& bmpBg) wxOVERRIDE;
|
virtual void SetHTMLBackgroundImage(const wxBitmapBundle& bmpBg) wxOVERRIDE;
|
||||||
virtual void SetHTMLStatusText(const wxString& text) wxOVERRIDE;
|
virtual void SetHTMLStatusText(const wxString& text) wxOVERRIDE;
|
||||||
virtual wxCursor GetHTMLCursor(HTMLCursor type) const wxOVERRIDE;
|
virtual wxCursor GetHTMLCursor(HTMLCursor type) const wxOVERRIDE;
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ public:
|
|||||||
virtual void SetHTMLBackgroundColour(const wxColour& clr) = 0;
|
virtual void SetHTMLBackgroundColour(const wxColour& clr) = 0;
|
||||||
|
|
||||||
/// Sets window's background to given bitmap.
|
/// Sets window's background to given bitmap.
|
||||||
virtual void SetHTMLBackgroundImage(const wxBitmap& bmpBg) = 0;
|
virtual void SetHTMLBackgroundImage(const wxBitmapBundle& bmpBg) = 0;
|
||||||
|
|
||||||
/// Sets status bar text.
|
/// Sets status bar text.
|
||||||
virtual void SetHTMLStatusText(const wxString& text) = 0;
|
virtual void SetHTMLStatusText(const wxString& text) = 0;
|
||||||
|
|||||||
@@ -488,7 +488,7 @@ void wxHtmlListBox::SetHTMLBackgroundColour(const wxColour& WXUNUSED(clr))
|
|||||||
// nothing to do
|
// nothing to do
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxHtmlListBox::SetHTMLBackgroundImage(const wxBitmap& WXUNUSED(bmpBg))
|
void wxHtmlListBox::SetHTMLBackgroundImage(const wxBitmapBundle& WXUNUSED(bmpBg))
|
||||||
{
|
{
|
||||||
// nothing to do
|
// nothing to do
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1045,25 +1045,27 @@ void wxHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link)
|
|||||||
|
|
||||||
void wxHtmlWindow::DoEraseBackground(wxDC& dc)
|
void wxHtmlWindow::DoEraseBackground(wxDC& dc)
|
||||||
{
|
{
|
||||||
|
wxBitmap bmp = m_bmpBg.GetBitmapFor(this);
|
||||||
|
|
||||||
// if we don't have any background bitmap we just fill it with background
|
// if we don't have any background bitmap we just fill it with background
|
||||||
// colour and we also must do it if the background bitmap is not fully
|
// colour and we also must do it if the background bitmap is not fully
|
||||||
// opaque as otherwise junk could be left there
|
// opaque as otherwise junk could be left there
|
||||||
if ( !m_bmpBg.IsOk() || m_bmpBg.GetMask() )
|
if ( !bmp.IsOk() || bmp.GetMask() )
|
||||||
{
|
{
|
||||||
dc.SetBackground(GetBackgroundColour());
|
dc.SetBackground(GetBackgroundColour());
|
||||||
dc.Clear();
|
dc.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_bmpBg.IsOk() )
|
if ( bmp.IsOk() )
|
||||||
{
|
{
|
||||||
// draw the background bitmap tiling it over the entire window area
|
// draw the background bitmap tiling it over the entire window area
|
||||||
const wxSize sz = GetVirtualSize();
|
const wxSize sz = GetVirtualSize();
|
||||||
const wxSize sizeBmp(m_bmpBg.GetWidth(), m_bmpBg.GetHeight());
|
const wxSize sizeBmp(bmp.GetLogicalWidth(), bmp.GetLogicalHeight());
|
||||||
for ( wxCoord x = 0; x < sz.x; x += sizeBmp.x )
|
for ( wxCoord x = 0; x < sz.x; x += sizeBmp.x )
|
||||||
{
|
{
|
||||||
for ( wxCoord y = 0; y < sz.y; y += sizeBmp.y )
|
for ( wxCoord y = 0; y < sz.y; y += sizeBmp.y )
|
||||||
{
|
{
|
||||||
dc.DrawBitmap(m_bmpBg, x, y, true /* use mask */);
|
dc.DrawBitmap(bmp, x, y, true /* use mask */);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1321,7 +1323,9 @@ void wxHtmlWindow::OnSize(wxSizeEvent& event)
|
|||||||
|
|
||||||
void wxHtmlWindow::OnDPIChanged(wxDPIChangedEvent& WXUNUSED(event))
|
void wxHtmlWindow::OnDPIChanged(wxDPIChangedEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
|
wxBitmapBundle bmpBg = m_bmpBg;
|
||||||
DoSetPage(*(m_Parser->GetSource()));
|
DoSetPage(*(m_Parser->GetSource()));
|
||||||
|
SetBackgroundImage(bmpBg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxHtmlWindow::OnMouseMove(wxMouseEvent& WXUNUSED(event))
|
void wxHtmlWindow::OnMouseMove(wxMouseEvent& WXUNUSED(event))
|
||||||
@@ -1827,7 +1831,7 @@ void wxHtmlWindow::SetHTMLBackgroundColour(const wxColour& clr)
|
|||||||
SetBackgroundColour(clr);
|
SetBackgroundColour(clr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxHtmlWindow::SetHTMLBackgroundImage(const wxBitmap& bmpBg)
|
void wxHtmlWindow::SetHTMLBackgroundImage(const wxBitmapBundle& bmpBg)
|
||||||
{
|
{
|
||||||
SetBackgroundImage(bmpBg);
|
SetBackgroundImage(bmpBg);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user