X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3396739da180ef3f8d006f11f8a13a9e0df7d88d..81533a3af6ed598c32a35e1c1c2b60f4908f5541:/src/common/textcmn.cpp diff --git a/src/common/textcmn.cpp b/src/common/textcmn.cpp index 6248877613..fa4d41ffbc 100644 --- a/src/common/textcmn.cpp +++ b/src/common/textcmn.cpp @@ -333,7 +333,7 @@ wxFont wxTextAttr::GetFont() const if (HasFontEncoding()) encoding = GetFontEncoding(); - int fontFamily = wxFONTFAMILY_DEFAULT; + wxFontFamily fontFamily = wxFONTFAMILY_DEFAULT; if (HasFontFamily()) fontFamily = GetFontFamily(); @@ -366,7 +366,16 @@ bool wxTextAttr::GetFontAttributes(const wxFont& font, int flags) m_fontEncoding = font.GetEncoding(); if (flags & wxTEXT_ATTR_FONT_FAMILY) - m_fontFamily = font.GetFamily(); + { + // wxFont might not know its family, avoid setting m_fontFamily to an + // invalid value and rather pretend that we don't have any font family + // information at all in this case + const wxFontFamily fontFamily = font.GetFamily(); + if ( fontFamily == wxFONTFAMILY_UNKNOWN ) + flags &= ~wxTEXT_ATTR_FONT_FAMILY; + else + m_fontFamily = fontFamily; + } m_flags |= flags; @@ -997,25 +1006,6 @@ wxTextAreaBase::HitTest(const wxPoint& WXUNUSED(pt), long * WXUNUSED(pos)) const return wxTE_HT_UNKNOWN; } -// ---------------------------------------------------------------------------- -// events -// ---------------------------------------------------------------------------- - -/* static */ -bool wxTextCtrlBase::SendTextUpdatedEvent(wxWindow *win) -{ - wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, win->GetId()); - - // do not do this as it could be very inefficient if the text control - // contains a lot of text and we're not using ref-counted wxString - // implementation -- instead, event.GetString() will query the control for - // its current text if needed - //event.SetString(win->GetValue()); - - event.SetEventObject(win); - return win->GetEventHandler()->ProcessEvent(event); -} - #else // !wxUSE_TEXTCTRL // define this one even if !wxUSE_TEXTCTRL because it is also used by other