git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43722
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
r.BeginBold();
r.BeginFontSize(14);
r.BeginBold();
r.BeginFontSize(14);
wxString lineBreak = (wxChar) 29;
wxString lineBreak = (wxChar) 29;
r.WriteText(wxString(wxT("Welcome to wxRichTextCtrl, a wxWidgets control")) + lineBreak + wxT("for editing and presenting styled text and images"));
r.EndFontSize();
r.Newline();
r.WriteText(wxString(wxT("Welcome to wxRichTextCtrl, a wxWidgets control")) + lineBreak + wxT("for editing and presenting styled text and images"));
r.EndFontSize();
r.Newline();
if (m_richTextCtrl->HasSelection())
range = m_richTextCtrl->GetSelectionRange();
if (m_richTextCtrl->HasSelection())
range = m_richTextCtrl->GetSelectionRange();
attr.SetLeftIndent(attr.GetLeftIndent() + 100);
attr.SetFlags(wxTEXT_ATTR_LEFT_INDENT);
attr.SetLeftIndent(attr.GetLeftIndent() + 100);
attr.SetFlags(wxTEXT_ATTR_LEFT_INDENT);
if (m_richTextCtrl->HasSelection())
range = m_richTextCtrl->GetSelectionRange();
if (m_richTextCtrl->HasSelection())
range = m_richTextCtrl->GetSelectionRange();
- if (attr.GetLeftIndent() >= 100)
+ if (attr.GetLeftIndent() > 0)
- wxFontData fontData;
- attr.SetLeftIndent(attr.GetLeftIndent() - 100);
+ attr.SetLeftIndent(wxMax(0, attr.GetLeftIndent() - 100));
m_richTextCtrl->SetStyle(range, attr);
}
m_richTextCtrl->SetStyle(range, attr);
}
if (m_richTextCtrl->HasSelection())
range = m_richTextCtrl->GetSelectionRange();
if (m_richTextCtrl->HasSelection())
range = m_richTextCtrl->GetSelectionRange();
attr.SetFlags(wxTEXT_ATTR_LINE_SPACING);
attr.SetLineSpacing(15);
attr.SetFlags(wxTEXT_ATTR_LINE_SPACING);
attr.SetLineSpacing(15);
if (m_richTextCtrl->HasSelection())
range = m_richTextCtrl->GetSelectionRange();
if (m_richTextCtrl->HasSelection())
range = m_richTextCtrl->GetSelectionRange();
attr.SetFlags(wxTEXT_ATTR_LINE_SPACING);
attr.SetLineSpacing(20);
attr.SetFlags(wxTEXT_ATTR_LINE_SPACING);
attr.SetLineSpacing(20);
if (m_richTextCtrl->HasSelection())
range = m_richTextCtrl->GetSelectionRange();
if (m_richTextCtrl->HasSelection())
range = m_richTextCtrl->GetSelectionRange();
attr.SetFlags(wxTEXT_ATTR_LINE_SPACING);
attr.SetLineSpacing(0); // Can also use 10
attr.SetFlags(wxTEXT_ATTR_LINE_SPACING);
attr.SetLineSpacing(0); // Can also use 10
if (m_richTextCtrl->HasSelection())
range = m_richTextCtrl->GetSelectionRange();
if (m_richTextCtrl->HasSelection())
range = m_richTextCtrl->GetSelectionRange();
attr.SetParagraphSpacingAfter(attr.GetParagraphSpacingAfter() + 20);
attr.SetFlags(wxTEXT_ATTR_PARA_SPACING_AFTER);
attr.SetParagraphSpacingAfter(attr.GetParagraphSpacingAfter() + 20);
attr.SetFlags(wxTEXT_ATTR_PARA_SPACING_AFTER);
if (attr.GetParagraphSpacingAfter() >= 20)
{
if (attr.GetParagraphSpacingAfter() >= 20)
{
attr.SetParagraphSpacingAfter(attr.GetParagraphSpacingAfter() - 20);
attr.SetFlags(wxTEXT_ATTR_PARA_SPACING_AFTER);
attr.SetParagraphSpacingAfter(attr.GetParagraphSpacingAfter() - 20);
attr.SetFlags(wxTEXT_ATTR_PARA_SPACING_AFTER);
wxRichTextHTMLHandler htmlHandler;
htmlHandler.SetFlags(wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_MEMORY);
wxRichTextHTMLHandler htmlHandler;
htmlHandler.SetFlags(wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_MEMORY);
wxArrayInt fontSizeMapping;
fontSizeMapping.Add(7);
fontSizeMapping.Add(9);
wxArrayInt fontSizeMapping;
fontSizeMapping.Add(7);
fontSizeMapping.Add(9);
fontSizeMapping.Add(14);
fontSizeMapping.Add(22);
fontSizeMapping.Add(100);
fontSizeMapping.Add(14);
fontSizeMapping.Add(22);
fontSizeMapping.Add(100);
htmlHandler.SetFontSizeMapping(fontSizeMapping);
if (htmlHandler.SaveFile(& m_richTextCtrl->GetBuffer(), strStream))
htmlHandler.SetFontSizeMapping(fontSizeMapping);
if (htmlHandler.SaveFile(& m_richTextCtrl->GetBuffer(), strStream))
wxRichTextAttr urlStyle;
urlStyle.SetTextColour(*wxBLUE);
urlStyle.SetFontUnderlined(true);
wxRichTextAttr urlStyle;
urlStyle.SetTextColour(*wxBLUE);
urlStyle.SetFontUnderlined(true);
m_richTextCtrl->BeginStyle(urlStyle);
m_richTextCtrl->BeginURL(url);
m_richTextCtrl->WriteText(url);
m_richTextCtrl->BeginStyle(urlStyle);
m_richTextCtrl->BeginURL(url);
m_richTextCtrl->WriteText(url);