From b1fbde6261830f428d1a4c2d74bd6d3562d1a233 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Thu, 24 Oct 2013 07:00:59 +0000 Subject: [PATCH] Use specified height in a text box, if there is one git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75057 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/richtext/richtextbuffer.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index c223616445..fd203c2eab 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -2139,9 +2139,15 @@ bool wxRichTextParagraphLayoutBox::Layout(wxDC& dc, wxRichTextDrawingContext& co // breaking layout of a box within a paragraph. } - // TODO: (also in para layout) should set the - // object's size to an absolute one if specified, - // but if not specified, calculate it from content. + if (attr.GetTextBoxAttr().GetSize().GetHeight().IsValid()) + { + wxRect r = AdjustAvailableSpace(dc, GetBuffer(), wxRichTextAttr() /* not used */, attr, parentRect, parentRect); + int h = r.GetHeight(); + + // Convert external to content rect + h = h - topMargin - bottomMargin; + maxHeight = wxMax(maxHeight, h); + } // We need to add back the margins etc. {