#include "wx/textctrl.h"
#include "wx/settings.h"
#include "wx/brush.h"
+ #include "wx/dcclient.h"
#include "wx/utils.h"
#include "wx/intl.h"
#include "wx/log.h"
// implementation detail
m_updatesCount = -2;
- if ( !MSWCreateControl(windowClass.wx_str(), msStyle, pos, size, valueWin) )
+ if ( !MSWCreateControl(windowClass.t_str(), msStyle, pos, size, valueWin) )
return false;
m_updatesCount = -1;
::SendMessage(GetHwnd(), selectionOnly ? EM_REPLACESEL : WM_SETTEXT,
// EM_REPLACESEL takes 1 to indicate the operation should be redoable
- selectionOnly ? 1 : 0, (LPARAM)valueDos.wx_str());
+ selectionOnly ? 1 : 0, wxMSW_CONV_LPARAM(valueDos));
if ( !ucf.GotUpdate() && (flags & SetValue_SendEvent) )
{
// fall through
case 0:
- if ( IsMultiLine() && vkey == VK_RETURN )
- return false;
+ switch ( vkey )
+ {
+ case VK_RETURN:
+ // This one is only special for multi line controls.
+ if ( !IsMultiLine() )
+ break;
+ // fall through
+
+ case VK_DELETE:
+ case VK_HOME:
+ case VK_END:
+ return false;
+ }
// fall through
case 2:
break;
WXHBRUSH wxTextCtrl::MSWControlColor(WXHDC hDC, WXHWND hWnd)
{
- if ( !IsEnabled() && !HasFlag(wxTE_MULTILINE) )
+ if ( !IsThisEnabled() && !HasFlag(wxTE_MULTILINE) )
return MSWControlColorDisabled(hDC);
return wxTextCtrlBase::MSWControlColor(hDC, hWnd);
if ( IsRich() )
{
// change the colour of everything
- CHARFORMAT cf;
- wxZeroMemory(cf);
- cf.cbSize = sizeof(cf);
+ WinStruct<CHARFORMAT> cf;
cf.dwMask = CFM_COLOR;
cf.crTextColor = wxColourToRGB(colour);
::SendMessage(GetHwnd(), EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
LOGFONT lf;
- lf.lfHeight = cf.yHeight;
+ // Convert the height from the units of 1/20th of the point in which
+ // CHARFORMAT stores it to pixel-based units used by LOGFONT.
+ const wxCoord ppi = wxClientDC(this).GetPPI().y;
+ lf.lfHeight = -MulDiv(cf.yHeight/20, ppi, 72);
lf.lfWidth = 0;
lf.lfCharSet = ANSI_CHARSET; // FIXME: how to get correct charset?
lf.lfClipPrecision = 0;