}
/// Set the attributes and optionally update the display
-bool wxRichTextFormattingDialog::SetStyle(const wxTextAttrEx& style, bool update)
+bool wxRichTextFormattingDialog::SetStyle(const wxTextAttr& style, bool update)
{
m_attributes = style;
if (update)
dialog->SetSheetInnerBorder(0);
dialog->SetSheetOuterBorder(0);
#else
- wxUnusedVar(dialog);
+ wxUnusedVar(dialog);
#endif // wxRICHTEXT_USE_TOOLBOOK
return true;
EVT_PAINT(wxRichTextFontPreviewCtrl::OnPaint)
END_EVENT_TABLE()
+wxRichTextFontPreviewCtrl::wxRichTextFontPreviewCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& sz, long style)
+{
+ if ((style & wxBORDER_MASK) == wxBORDER_DEFAULT)
+ style |= wxBORDER_THEME;
+
+ wxWindow::Create(parent, id, pos, sz, style);
+
+ SetBackgroundColour(*wxWHITE);
+ m_textEffects = 0;
+}
+
void wxRichTextFontPreviewCtrl::OnPaint(wxPaintEvent& WXUNUSED(event))
{
wxPaintDC dc(this);
wxSize size = GetSize();
wxFont font = GetFont();
+ if ((GetTextEffects() & wxTEXT_ATTR_EFFECT_SUPERSCRIPT) || (GetTextEffects() & wxTEXT_ATTR_EFFECT_SUBSCRIPT))
+ {
+ double size = static_cast<double>(font.GetPointSize()) / wxSCRIPT_MUL_FACTOR;
+ font.SetPointSize( static_cast<int>(size) );
+ }
+
if ( font.Ok() )
{
dc.SetFont(font);
// Calculate vertical and horizontal centre
- long w = 0, h = 0;
+ wxCoord w = 0, h = 0;
wxString text(_("ABCDEFGabcdefg12345"));
if (GetTextEffects() & wxTEXT_ATTR_EFFECT_CAPITALS)
int cx = wxMax(2, (size.x/2) - (w/2));
int cy = wxMax(2, (size.y/2) - (h/2));
+ if ( GetTextEffects() & wxTEXT_ATTR_EFFECT_SUPERSCRIPT )
+ cy -= h/2;
+ if ( GetTextEffects() & wxTEXT_ATTR_EFFECT_SUBSCRIPT )
+ cy += h/2;
+
dc.SetTextForeground(GetForegroundColour());
dc.SetClippingRegion(2, 2, size.x-4, size.y-4);
dc.DrawText(text, cx, cy);
// Helper for pages to get the attributes
-wxTextAttrEx* wxRichTextFormattingDialog::GetDialogAttributes(wxWindow* win)
+wxTextAttr* wxRichTextFormattingDialog::GetDialogAttributes(wxWindow* win)
{
wxRichTextFormattingDialog* dialog = GetDialog(win);
if (dialog)
IMPLEMENT_CLASS(wxRichTextColourSwatchCtrl, wxControl)
-wxRichTextColourSwatchCtrl::wxRichTextColourSwatchCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style):
- wxControl(parent, id, pos, size, style)
+wxRichTextColourSwatchCtrl::wxRichTextColourSwatchCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
{
+ if ((style & wxBORDER_MASK) == wxBORDER_DEFAULT)
+ style |= wxBORDER_THEME;
+
+ wxControl::Create(parent, id, pos, size, style);
+
SetColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
- SetBackgroundStyle(wxBG_STYLE_COLOUR);
}
wxRichTextColourSwatchCtrl::~wxRichTextColourSwatchCtrl()
wxColourDialog *dialog = new wxColourDialog(parent, &data);
// Crashes on wxMac (no m_peer)
#ifndef __WXMAC__
- dialog->SetTitle(_("Background colour"));
+ dialog->SetTitle(_("Colour"));
#endif
if (dialog->ShowModal() == wxID_OK)
{
bool wxRichTextFontListBox::Create(wxWindow* parent, wxWindowID id, const wxPoint& pos,
const wxSize& size, long style)
{
+ if ((style & wxBORDER_MASK) == wxBORDER_DEFAULT)
+ style |= wxBORDER_THEME;
+
return wxHtmlListBox::Create(parent, id, pos, size, style);
}