]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/textctrl.cpp
use wxTR_HIDE_ROOT in wxHtmlHelpFrame
[wxWidgets.git] / src / msw / textctrl.cpp
index 4282e711fe633b58402e843df7e34f125633bfdb..7b7d9d905ec2b022c9eab64801783d3a11f46260 100644 (file)
     } ENLINK;
 #endif // ENLINK
 
     } ENLINK;
 #endif // ENLINK
 
+#ifndef SF_UNICODE
+    #define SF_UNICODE 0x0010
+#endif
+
 // ----------------------------------------------------------------------------
 // private functions
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // private functions
 // ----------------------------------------------------------------------------
@@ -434,12 +438,16 @@ void wxTextCtrl::SetValue(const wxString& value)
 
         WriteText(value);
 
 
         WriteText(value);
 
+        // mark the control as being not dirty - we changed its text, not the
+        // user
+        DiscardEdits();
+
         // for compatibility, don't move the cursor when doing SetValue()
         SetInsertionPoint(0);
     }
 }
 
         // for compatibility, don't move the cursor when doing SetValue()
         SetInsertionPoint(0);
     }
 }
 
-#if wxUSE_RICHEDIT
+#if wxUSE_RICHEDIT && !wxUSE_UNICODE
 
 DWORD CALLBACK wxRichEditStreamIn(DWORD dwCookie, BYTE *buf, LONG cb, LONG *pcb)
 {
 
 DWORD CALLBACK wxRichEditStreamIn(DWORD dwCookie, BYTE *buf, LONG cb, LONG *pcb)
 {
@@ -491,7 +499,8 @@ bool wxTextCtrl::StreamIn(const wxString& value, wxFontEncoding encoding)
     EDITSTREAM eds;
     wxZeroMemory(eds);
     eds.dwCookie = (DWORD)&wpc;
     EDITSTREAM eds;
     wxZeroMemory(eds);
     eds.dwCookie = (DWORD)&wpc;
-    eds.pfnCallback = wxRichEditStreamIn;
+    // the cast below is needed for broken (very) old mingw32 headers
+    eds.pfnCallback = (EDITSTREAMCALLBACK)wxRichEditStreamIn;
 
     if ( !::SendMessage(GetHwnd(), EM_STREAMIN,
                         SF_TEXT | SF_UNICODE | SFF_SELECTION,
 
     if ( !::SendMessage(GetHwnd(), EM_STREAMIN,
                         SF_TEXT | SF_UNICODE | SFF_SELECTION,
@@ -524,6 +533,7 @@ void wxTextCtrl::WriteText(const wxString& value)
             SetStyle(start, end, m_defaultStyle );
         }
 
             SetStyle(start, end, m_defaultStyle );
         }
 
+#if !wxUSE_UNICODE
         // next check if the text we're inserting must be shown in a non
         // default charset -- this only works for RichEdit > 1.0
         if ( GetRichVersion() > 1 )
         // next check if the text we're inserting must be shown in a non
         // default charset -- this only works for RichEdit > 1.0
         if ( GetRichVersion() > 1 )
@@ -541,6 +551,7 @@ void wxTextCtrl::WriteText(const wxString& value)
                }
             }
         }
                }
             }
         }
+#endif // !wxUSE_UNICODE
     }
 
     if ( !done )
     }
 
     if ( !done )