]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/textcmn.cpp
Allow user code to override key events in generic wxListCtrl.
[wxWidgets.git] / src / common / textcmn.cpp
index 6248877613b79b8ee4fb0182b3dfdefbe34eb9f5..fa4d41ffbca30ccf3157da7522dd20d4ad566224 100644 (file)
@@ -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