Fixed #12566 (assert on deletion) due to inconsistent commit

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65805 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2010-10-14 18:06:02 +00:00
parent eb7a47b7b9
commit 5ad9ae3a29
3 changed files with 45 additions and 8 deletions

View File

@@ -1510,14 +1510,14 @@ protected:
* TODO: a floating text box * TODO: a floating text box
*/ */
class WXDLLIMPEXP_RICHTEXT wxRichTextBox: public wxRichTextParagraphLayoutBox class WXDLLIMPEXP_RICHTEXT wxRichTextBox: public wxRichTextCompositeObject
{ {
DECLARE_DYNAMIC_CLASS(wxRichTextBox) DECLARE_DYNAMIC_CLASS(wxRichTextBox)
public: public:
// Constructors // Constructors
wxRichTextBox(wxRichTextObject* parent = NULL); wxRichTextBox(wxRichTextObject* parent = NULL);
wxRichTextBox(const wxRichTextBox& obj): wxRichTextParagraphLayoutBox() { Copy(obj); } wxRichTextBox(const wxRichTextBox& obj): wxRichTextCompositeObject() { Copy(obj); }
// Overrideables // Overrideables
@@ -1527,6 +1527,10 @@ public:
/// Lay the item out /// Lay the item out
virtual bool Layout(wxDC& dc, const wxRect& rect, int style); virtual bool Layout(wxDC& dc, const wxRect& rect, int style);
/// Get/set the object size for the given range. Returns false if the range
/// is invalid for this object.
virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const;
// Accessors // Accessors
// Operations // Operations

View File

@@ -792,7 +792,7 @@ void MyFrame::WriteInitialText()
imageAttr.GetTextBoxAttr().GetTop().SetUnits(wxTEXT_ATTR_UNITS_PIXELS); imageAttr.GetTextBoxAttr().GetTop().SetUnits(wxTEXT_ATTR_UNITS_PIXELS);
imageAttr.GetTextBoxAttr().SetFloatMode(wxTEXT_BOX_ATTR_FLOAT_RIGHT); imageAttr.GetTextBoxAttr().SetFloatMode(wxTEXT_BOX_ATTR_FLOAT_RIGHT);
r.WriteImage(wxBitmap(zebra_xpm), wxBITMAP_TYPE_PNG, imageAttr); r.WriteImage(wxBitmap(zebra_xpm), wxBITMAP_TYPE_PNG, imageAttr);
r.WriteText(wxString(wxT("This is a simple test for a floating left image test. The zebra image should be placed at the left side of the current buffer and all the text should flow around it at the right side. This is a simple test for a floating left image test. The zebra image should be placed at the left side of the current buffer and all the text should flow around it at the right side. This is a simple test for a floating left image test. The zebra image should be placed at the left side of the current buffer and all the text should flow around it at the right side."))); r.WriteText(wxString(wxT("This is a simple test for a floating right image test. The zebra image should be placed at the right side of the current buffer and all the text should flow around it at the left side. This is a simple test for a floating left image test. The zebra image should be placed at the right side of the current buffer and all the text should flow around it at the left side. This is a simple test for a floating left image test. The zebra image should be placed at the right side of the current buffer and all the text should flow around it at the left side.")));
r.EndAlignment(); r.EndAlignment();
r.Newline(); r.Newline();

View File

@@ -6866,26 +6866,59 @@ bool wxRichTextStdRenderer::EnumerateStandardBulletNames(wxArrayString& bulletNa
IMPLEMENT_DYNAMIC_CLASS(wxRichTextBox, wxRichTextCompositeObject) IMPLEMENT_DYNAMIC_CLASS(wxRichTextBox, wxRichTextCompositeObject)
wxRichTextBox::wxRichTextBox(wxRichTextObject* parent): wxRichTextBox::wxRichTextBox(wxRichTextObject* parent):
wxRichTextParagraphLayoutBox(parent) wxRichTextCompositeObject(parent)
{ {
} }
/// Draw the item /// Draw the item
bool wxRichTextBox::Draw(wxDC& dc, const wxRichTextRange& range, const wxRichTextRange& selectionRange, const wxRect& rect, int descent, int style) bool wxRichTextBox::Draw(wxDC& dc, const wxRichTextRange& range, const wxRichTextRange& selectionRange, const wxRect& WXUNUSED(rect), int descent, int style)
{ {
return wxRichTextParagraphLayoutBox::Draw(dc, range, selectionRange, rect, descent, style); wxRichTextObjectList::compatibility_iterator node = m_children.GetFirst();
while (node)
{
wxRichTextObject* child = node->GetData();
wxRect childRect = wxRect(child->GetPosition(), child->GetCachedSize());
child->Draw(dc, range, selectionRange, childRect, descent, style);
node = node->GetNext();
}
return true;
} }
/// Lay the item out /// Lay the item out
bool wxRichTextBox::Layout(wxDC& dc, const wxRect& rect, int style) bool wxRichTextBox::Layout(wxDC& dc, const wxRect& rect, int style)
{ {
return wxRichTextParagraphLayoutBox::Layout(dc, rect, style); wxRichTextObjectList::compatibility_iterator node = m_children.GetFirst();
while (node)
{
wxRichTextObject* child = node->GetData();
child->Layout(dc, rect, style);
node = node->GetNext();
}
m_dirty = false;
return true;
} }
/// Copy /// Copy
void wxRichTextBox::Copy(const wxRichTextBox& obj) void wxRichTextBox::Copy(const wxRichTextBox& obj)
{ {
wxRichTextParagraphLayoutBox::Copy(obj); wxRichTextCompositeObject::Copy(obj);
}
/// Get/set the size for the given range. Assume only has one child.
bool wxRichTextBox::GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, int flags, wxPoint position, wxArrayInt* partialExtents) const
{
wxRichTextObjectList::compatibility_iterator node = m_children.GetFirst();
if (node)
{
wxRichTextObject* child = node->GetData();
return child->GetRangeSize(range, size, descent, dc, flags, position, partialExtents);
}
else
return false;
} }
/* /*