1. wColour now accepts both grey and gray under MSW

2. implemented setting colours for rich edit controls


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7702 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-07-06 21:34:07 +00:00
parent 97b0241cf2
commit 0119459c53
3 changed files with 168 additions and 118 deletions

View File

@@ -1135,6 +1135,54 @@ void wxTextCtrl::OnUpdateRedo(wxUpdateUIEvent& event)
event.Enable( CanRedo() );
}
// ----------------------------------------------------------------------------
// colour setting for the rich edit controls
// ----------------------------------------------------------------------------
#if wxUSE_RICHEDIT
bool wxTextCtrl::SetBackgroundColour(const wxColour& colour)
{
if ( !wxTextCtrlBase::SetBackgroundColour(colour) )
{
// colour didn't really change
return FALSE;
}
if ( IsRich() )
{
// rich edit doesn't use WM_CTLCOLOR, hence we need to send
// EM_SETBKGNDCOLOR additionally
::SendMessage(GetHwnd(), EM_SETBKGNDCOLOR, 0, wxColourToRGB(colour));
}
return TRUE;
}
bool wxTextCtrl::SetForegroundColour(const wxColour& colour)
{
if ( !wxTextCtrlBase::SetForegroundColour(colour) )
{
// colour didn't really change
return FALSE;
}
if ( IsRich() )
{
// change the colour of everything
CHARFORMAT cf;
wxZeroMemory(cf);
cf.cbSize = sizeof(cf);
cf.dwMask = CFM_COLOR;
cf.crTextColor = wxColourToRGB(colour);
::SendMessage(GetHwnd(), EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
}
return TRUE;
}
#endif // wxUSE_RICHEDIT
// ----------------------------------------------------------------------------
// wxRichEditModule
// ----------------------------------------------------------------------------