fix for [ 1055191 ] wxTextCtrl::GetStyle() wrong attr and extended stat bar in text ctrl sample with rich text to show font attributes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30341 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1696,6 +1696,21 @@ void RichTextFrame::OnIdle(wxIdleEvent& WXUNUSED(event))
|
|||||||
(const wxChar*) facename,
|
(const wxChar*) facename,
|
||||||
attr.GetTextColour().Red(), attr.GetTextColour().Green(), attr.GetTextColour().Blue(),
|
attr.GetTextColour().Red(), attr.GetTextColour().Green(), attr.GetTextColour().Blue(),
|
||||||
(const wxChar*) alignment);
|
(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);
|
SetStatusText(msg);
|
||||||
}
|
}
|
||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
|
@@ -2496,6 +2496,7 @@ bool wxTextCtrl::GetStyle(long position, wxTextAttr& style)
|
|||||||
(void) ::SendMessage(GetHwnd(), EM_GETCHARFORMAT,
|
(void) ::SendMessage(GetHwnd(), EM_GETCHARFORMAT,
|
||||||
SCF_SELECTION, (LPARAM)&cf) ;
|
SCF_SELECTION, (LPARAM)&cf) ;
|
||||||
|
|
||||||
|
|
||||||
LOGFONT lf;
|
LOGFONT lf;
|
||||||
lf.lfHeight = cf.yHeight;
|
lf.lfHeight = cf.yHeight;
|
||||||
lf.lfWidth = 0;
|
lf.lfWidth = 0;
|
||||||
@@ -2503,17 +2504,32 @@ bool wxTextCtrl::GetStyle(long position, wxTextAttr& style)
|
|||||||
lf.lfClipPrecision = 0;
|
lf.lfClipPrecision = 0;
|
||||||
lf.lfEscapement = 0;
|
lf.lfEscapement = 0;
|
||||||
wxStrcpy(lf.lfFaceName, cf.szFaceName);
|
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)
|
if (cf.dwEffects & CFE_ITALIC)
|
||||||
lf.lfItalic = TRUE;
|
lf.lfItalic = TRUE;
|
||||||
|
else
|
||||||
|
lf.lfItalic = FALSE;
|
||||||
|
|
||||||
lf.lfOrientation = 0;
|
lf.lfOrientation = 0;
|
||||||
lf.lfPitchAndFamily = cf.bPitchAndFamily;
|
lf.lfPitchAndFamily = cf.bPitchAndFamily;
|
||||||
lf.lfQuality = 0;
|
lf.lfQuality = 0;
|
||||||
|
|
||||||
if (cf.dwEffects & CFE_STRIKEOUT)
|
if (cf.dwEffects & CFE_STRIKEOUT)
|
||||||
lf.lfStrikeOut = TRUE;
|
lf.lfStrikeOut = TRUE;
|
||||||
|
else
|
||||||
|
lf.lfStrikeOut = FALSE;
|
||||||
|
|
||||||
if (cf.dwEffects & CFE_UNDERLINE)
|
if (cf.dwEffects & CFE_UNDERLINE)
|
||||||
lf.lfUnderline = TRUE;
|
lf.lfUnderline = TRUE;
|
||||||
|
else
|
||||||
|
lf.lfUnderline = FALSE;
|
||||||
|
|
||||||
if (cf.dwEffects & CFE_BOLD)
|
if (cf.dwEffects & CFE_BOLD)
|
||||||
lf.lfWeight = FW_BOLD;
|
lf.lfWeight = FW_BOLD;
|
||||||
|
else
|
||||||
|
lf.lfWeight = FW_NORMAL;
|
||||||
|
|
||||||
wxFont font = wxCreateFontFromLogFont(& lf);
|
wxFont font = wxCreateFontFromLogFont(& lf);
|
||||||
if (font.Ok())
|
if (font.Ok())
|
||||||
|
Reference in New Issue
Block a user