]> git.saurik.com Git - wxWidgets.git/commitdiff
fix for [ 1055191 ] wxTextCtrl::GetStyle() wrong attr and extended stat bar in text...
authorRyan Norton <wxprojects@comcast.net>
Sun, 7 Nov 2004 13:01:59 +0000 (13:01 +0000)
committerRyan Norton <wxprojects@comcast.net>
Sun, 7 Nov 2004 13:01:59 +0000 (13:01 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30341 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/text/text.cpp
src/msw/textctrl.cpp

index 2b6f3701e44d50ba42d622497d2fbd788a55820c..c5f32c8d0e7d3befdfdf8e164b01efc522766c9d 100644 (file)
@@ -1696,6 +1696,21 @@ void RichTextFrame::OnIdle(wxIdleEvent& WXUNUSED(event))
                 (const wxChar*) facename,
                 attr.GetTextColour().Red(), attr.GetTextColour().Green(), attr.GetTextColour().Blue(),
                 (const wxChar*) alignment);
+
+            if (attr.HasFont())
+            {
+                if (attr.GetFont().GetWeight() == wxBOLD)
+                    msg += wxT(" BOLD");
+                else if (attr.GetFont().GetWeight() == wxNORMAL)
+                    msg += wxT(" NORMAL");
+
+                if (attr.GetFont().GetStyle() == wxITALIC)
+                    msg += wxT(" ITALIC");
+
+                if (attr.GetFont().GetUnderlined())
+                    msg += wxT(" UNDERLINED");
+            }
+
             SetStatusText(msg);
         }
 #endif // wxUSE_STATUSBAR
index 36b2359fbef72c6bdb874f121c399810d970e38e..25aecb4bdfb2e7344edabcad5047bced359c395f 100644 (file)
@@ -2496,6 +2496,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 +2504,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())