]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/textctrl.cpp
more wxPostEvent MT fixes
[wxWidgets.git] / src / msw / textctrl.cpp
index 36b2359fbef72c6bdb874f121c399810d970e38e..c1975d4c5192b5518a3a82a8fa7ae0c3fb027974 100644 (file)
@@ -2176,6 +2176,23 @@ bool wxTextCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
     return wxTextCtrlBase::MSWOnNotify(idCtrl, lParam, result);
 }
 
+// ----------------------------------------------------------------------------
+// Default colors for MSW text control
+//
+// Set default background color to the native white instead of
+// the default wxSYS_COLOUR_BTNFACE (is triggered with wxNullColour). 
+// ----------------------------------------------------------------------------
+
+wxVisualAttributes wxTextCtrl::GetDefaultAttributes() const
+{
+    wxVisualAttributes attrs;
+    attrs.font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
+    attrs.colFg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
+    attrs.colBg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); //white
+
+    return attrs;
+}
+
 // ----------------------------------------------------------------------------
 // colour setting for the rich edit controls
 // ----------------------------------------------------------------------------
@@ -2496,6 +2513,7 @@ bool wxTextCtrl::GetStyle(long position, wxTextAttr& style)
     (void) ::SendMessage(GetHwnd(), EM_GETCHARFORMAT,
                             SCF_SELECTION, (LPARAM)&cf) ;
 
+
     LOGFONT lf;
     lf.lfHeight = cf.yHeight;
     lf.lfWidth = 0;
@@ -2503,17 +2521,32 @@ bool wxTextCtrl::GetStyle(long position, wxTextAttr& style)
     lf.lfClipPrecision = 0;
     lf.lfEscapement = 0;
     wxStrcpy(lf.lfFaceName, cf.szFaceName);
+
+    //NOTE:  we _MUST_ set each of these values to _something_ since we
+    //do not call wxZeroMemory on the LOGFONT lf 
     if (cf.dwEffects & CFE_ITALIC)
         lf.lfItalic = TRUE;
+    else
+        lf.lfItalic = FALSE;
+
     lf.lfOrientation = 0;
     lf.lfPitchAndFamily = cf.bPitchAndFamily;
     lf.lfQuality = 0;
+
     if (cf.dwEffects & CFE_STRIKEOUT)
         lf.lfStrikeOut = TRUE;
+    else
+        lf.lfStrikeOut = FALSE;
+
     if (cf.dwEffects & CFE_UNDERLINE)
         lf.lfUnderline = TRUE;
+    else
+        lf.lfUnderline = FALSE;
+
     if (cf.dwEffects & CFE_BOLD)
         lf.lfWeight = FW_BOLD;
+    else
+        lf.lfWeight = FW_NORMAL;
 
     wxFont font = wxCreateFontFromLogFont(& lf);
     if (font.Ok())