Fixed floating image layout when typing in subsequent paragraph

Now makes use of max size for images and keeps the image size reasonable
Added original image size so can usually avoid reloading image when recomputing
cached bitmap size
Takes into account bottom of the last floating image so scrollbars are
set correctly
Original image size is shown in disabled size controls


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71277 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2012-04-25 11:42:31 +00:00
parent c6182d489c
commit 23698b123b
4 changed files with 194 additions and 37 deletions

View File

@@ -4012,7 +4012,7 @@ public:
/**
Default constructor.
*/
wxRichTextImage(wxRichTextObject* parent = NULL): wxRichTextObject(parent) { }
wxRichTextImage(wxRichTextObject* parent = NULL): wxRichTextObject(parent) { Init(); }
/**
Creates a wxRichTextImage from a wxImage.
@@ -4029,6 +4029,11 @@ public:
*/
wxRichTextImage(const wxRichTextImage& obj): wxRichTextObject(obj) { Copy(obj); }
/**
Initialisation.
*/
void Init();
// Overridables
virtual bool Draw(wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int descent, int style);
@@ -4079,12 +4084,12 @@ public:
/**
Sets the image cache.
*/
void SetImageCache(const wxBitmap& bitmap) { m_imageCache = bitmap; }
void SetImageCache(const wxBitmap& bitmap) { m_imageCache = bitmap; m_originalImageSize = wxSize(bitmap.GetWidth(), bitmap.GetHeight()); }
/**
Resets the image cache.
*/
void ResetImageCache() { m_imageCache = wxNullBitmap; }
void ResetImageCache() { m_imageCache = wxNullBitmap; m_originalImageSize = wxSize(-1, -1); }
/**
Returns the image block containing the raw data.
@@ -4108,9 +4113,20 @@ public:
*/
virtual bool LoadImageCache(wxDC& dc, bool resetCache = false);
/**
Gets the original image size.
*/
wxSize GetOriginalImageSize() const { return m_originalImageSize; }
/**
Sets the original image size.
*/
void SetOriginalImageSize(const wxSize& sz) { m_originalImageSize = sz; }
protected:
wxRichTextImageBlock m_imageBlock;
wxBitmap m_imageCache;
wxSize m_originalImageSize;
};
class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextCommand;