Win16 fixes (incl. slider not sending messages, text ctrl not showing consistent

colours


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7304 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2000-04-28 09:49:32 +00:00
parent 647455ee0f
commit 61dfd2bea1
9 changed files with 57 additions and 11 deletions

View File

@@ -184,7 +184,7 @@ bool wxCheckBox::GetValue() const
#ifdef __WIN32__
return (SendMessage(GetHwnd(), BM_GETCHECK, 0, 0) == BST_CHECKED);
#else
return ((0x003 & SendMessage(GetHwnd(), BM_GETCHECK, 0, 0)) == 0x003);
return ((0x001 & SendMessage(GetHwnd(), BM_GETCHECK, 0, 0)) == 0x001);
#endif
}

View File

@@ -64,7 +64,7 @@ bool wxChoice::Create(wxWindow *parent,
if ( style & wxCB_SORT )
msStyle |= CBS_SORT;
// the experience shows that wxChoice vs. wxComboBox distinction confuses
// Experience shows that wxChoice vs. wxComboBox distinction confuses
// quite a few people - try to help them
wxASSERT_MSG( !(style & wxCB_DROPDOWN) &&
!(style & wxCB_READONLY) &&

View File

@@ -79,9 +79,11 @@ bool wxControl::MSWCreateControl(const wxChar *classname,
const wxString& label,
WXDWORD exstyle)
{
// VZ: if someone could put a comment here explaining what exactly this is
// needed for, it would be nice...
bool want3D;
// want3D tells us whether or not the style specified a 3D border.
// If so, under WIN16 we can use Ctl3D to give it an appropriate style.
// Sometimes want3D is used to indicate that the non-extended style should have
// WS_BORDER.
bool want3D = TRUE;
// if no extended style given, determine it ourselves
if ( exstyle == (WXDWORD)-1 )

View File

@@ -104,7 +104,10 @@ bool wxGaugeMSW::Create(wxWindow *parent, wxWindowID id,
int height = size.y;
long msFlags = WS_CHILD | WS_VISIBLE | WS_TABSTOP;
msFlags |= ZYZGS_3D;
bool want3D;
WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D);
if (want3D)
msFlags |= ZYZGS_3D;
HWND wx_button =
CreateWindowEx(MakeExtendedStyle(m_windowStyle), wxT("zYzGauge"), NULL, msFlags,
@@ -129,6 +132,9 @@ bool wxGaugeMSW::Create(wxWindow *parent, wxWindowID id,
SendMessage(GetHwnd(), ZYZG_SETFGCOLOR, 0, RGB(GetForegroundColour().Red(), GetForegroundColour().Green(), GetForegroundColour().Blue()));
SendMessage(GetHwnd(), ZYZG_SETBKCOLOR, 0, RGB(GetBackgroundColour().Red(), GetBackgroundColour().Green(), GetBackgroundColour().Blue()));
//SetBezelFace(1);
//SetShadowWidth(1);
SetFont(parent->GetFont());
if (width == -1)

View File

@@ -97,9 +97,6 @@ bool wxSliderMSW::Create(wxWindow *parent, wxWindowID id,
0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)NewControlId(),
wxGetInstance(), NULL);
// Now create slider
m_windowId = (int)NewControlId();
msStyle = 0;
if (m_windowStyle & wxSL_VERTICAL)
msStyle = SBS_VERT | WS_CHILD | WS_VISIBLE | WS_TABSTOP ;

View File

@@ -121,6 +121,9 @@ BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
EVT_UPDATE_UI(wxID_PASTE, wxTextCtrl::OnUpdatePaste)
EVT_UPDATE_UI(wxID_UNDO, wxTextCtrl::OnUpdateUndo)
EVT_UPDATE_UI(wxID_REDO, wxTextCtrl::OnUpdateRedo)
#ifdef __WIN16__
EVT_ERASE_BACKGROUND(wxTextCtrl::OnEraseBackground)
#endif
END_EVENT_TABLE()
@@ -986,6 +989,39 @@ WXHBRUSH wxTextCtrl::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
return (WXHBRUSH)brush->GetResourceHandle();
}
// In WIN16, need to override normal erasing because
// Ctl3D doesn't use the wxWindows background colour.
#ifdef __WIN16__
void wxTextCtrl::OnEraseBackground(wxEraseEvent& event)
{
wxColour col(m_backgroundColour);
#if wxUSE_CTL3D
if (m_useCtl3D)
col = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW);
#endif
RECT rect;
::GetClientRect(GetHwnd(), &rect);
COLORREF ref = PALETTERGB(col.Red(),
col.Green(),
col.Blue());
HBRUSH hBrush = ::CreateSolidBrush(ref);
if ( !hBrush )
wxLogLastError(wxT("CreateSolidBrush"));
HDC hdc = (HDC)event.GetDC()->GetHDC();
int mode = ::SetMapMode(hdc, MM_TEXT);
::FillRect(hdc, &rect, hBrush);
::DeleteObject(hBrush);
::SetMapMode(hdc, mode);
}
#endif
void wxTextCtrl::AdjustSpaceLimit()
{
#ifndef __WIN16__