]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/textcmn.cpp
To avoid error message, do not even try to set focus on MSW popup window that doesn...
[wxWidgets.git] / src / common / textcmn.cpp
index 8bc1d2775432aef5908122e6b8a93a9a1547fe0a..53dd431459f416f20f98134fead81e9b2bcad2fd 100644 (file)
@@ -362,6 +362,18 @@ bool wxTextAttr::GetFontAttributes(const wxFont& font, int flags)
     return true;
 }
 
+// Resets bits in destination so new attributes aren't merged with mutually exclusive ones
+static bool wxResetIncompatibleBits(const int mask, const int srcFlags, int& destFlags, int& destBits)
+{
+    if ((srcFlags & mask) && (destFlags & mask))
+    {
+        destBits &= ~mask;
+        destFlags &= ~mask;
+    }
+
+    return true;
+}
+
 bool wxTextAttr::Apply(const wxTextAttr& style, const wxTextAttr* compareWith)
 {
     wxTextAttr& destStyle = (*this);
@@ -524,6 +536,11 @@ bool wxTextAttr::Apply(const wxTextAttr& style, const wxTextAttr* compareWith)
             int srcBits = style.GetTextEffects();
             int srcFlags = style.GetTextEffectFlags();
 
+            // Reset incompatible bits in the destination
+            wxResetIncompatibleBits((wxTEXT_ATTR_EFFECT_SUPERSCRIPT|wxTEXT_ATTR_EFFECT_SUBSCRIPT), srcFlags, destFlags, destBits);
+            wxResetIncompatibleBits((wxTEXT_ATTR_EFFECT_CAPITALS|wxTEXT_ATTR_EFFECT_SMALL_CAPITALS), srcFlags, destFlags, destBits);
+            wxResetIncompatibleBits((wxTEXT_ATTR_EFFECT_STRIKETHROUGH|wxTEXT_ATTR_EFFECT_DOUBLE_STRIKETHROUGH), srcFlags, destFlags, destBits);
+
             CombineBitlists(destBits, srcBits, destFlags, srcFlags);
 
             destStyle.SetTextEffects(destBits);