Limit indentation in style listbox, and also show centring

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43458 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2006-11-17 08:21:38 +00:00
parent 61a0bf7c4b
commit 380a5dd803

View File

@@ -537,16 +537,30 @@ wxString wxRichTextStyleListBox::CreateHTML(wxRichTextStyleDefinition* def) cons
{
// TODO: indicate list format for list style types
wxString str(wxT("<table><tr>"));
wxString str;
bool isCentred = false;
if (def->GetStyle().HasAlignment() && def->GetStyle().GetAlignment() == wxTEXT_ALIGNMENT_CENTRE)
isCentred = true;
if (isCentred)
str << wxT("<center>");
str << wxT("<table><tr>");
if (def->GetStyle().GetLeftIndent() > 0)
{
wxClientDC dc((wxWindow*) this);
str << wxT("<td width=") << (ConvertTenthsMMToPixels(dc, def->GetStyle().GetLeftIndent())/2) << wxT("></td>");
str << wxT("<td width=") << wxMin(50, (ConvertTenthsMMToPixels(dc, def->GetStyle().GetLeftIndent())/2)) << wxT("></td>");
}
str << wxT("<td nowrap>");
if (isCentred)
str << wxT("<td nowrap align=\"center\">");
else
str << wxT("<td nowrap>");
#ifdef __WXMSW__
int size = 3;
@@ -601,9 +615,16 @@ wxString wxRichTextStyleListBox::CreateHTML(wxRichTextStyleDefinition* def) cons
if (hasBold)
str << wxT("</b>");
if (isCentred)
str << wxT("</centre>");
str << wxT("</font>");
str += wxT("</td></tr></table>");
str << wxT("</td></tr></table>");
if (isCentred)
str << wxT("</center>");
return str;
}