diff --git a/include/wx/msw/setup0.h b/include/wx/msw/setup0.h index b6a537f68f..ccbe7320e5 100644 --- a/include/wx/msw/setup0.h +++ b/include/wx/msw/setup0.h @@ -594,7 +594,6 @@ #define wxUSE_CTL3D 0 #else // Define 1 to use Microsoft CTL3D library. -// See note above about using FAFA and CTL3D. #define wxUSE_CTL3D 1 #endif diff --git a/include/wx/msw/textctrl.h b/include/wx/msw/textctrl.h index c14c9cd54a..d8fc915fd9 100644 --- a/include/wx/msw/textctrl.h +++ b/include/wx/msw/textctrl.h @@ -118,6 +118,12 @@ public: virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + // In WIN16, need to override normal erasing because + // Ctl3D doesn't use the wxWindows background colour. +#ifdef __WIN16__ + void OnEraseBackground(wxEraseEvent& event); +#endif + #if wxUSE_RICHEDIT bool IsRich() const { return m_isRich; } void SetRichEdit(bool isRich) { m_isRich = isRich; } diff --git a/samples/controls/controls.cpp b/samples/controls/controls.cpp index 6edff71271..cae7296c86 100644 --- a/samples/controls/controls.cpp +++ b/samples/controls/controls.cpp @@ -662,7 +662,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) panel = new wxPanel(m_notebook); (void)new wxStaticBox( panel, -1, "&wxGauge and wxSlider", wxPoint(10,10), wxSize(200,130) ); - m_gauge = new wxGauge( panel, -1, 200, wxPoint(18,50), wxSize(155, 30) ); + m_gauge = new wxGauge( panel, -1, 200, wxPoint(18,50), wxSize(155, 30), wxGA_HORIZONTAL|wxNO_BORDER ); m_slider = new wxSlider( panel, ID_SLIDER, 0, 0, 200, wxPoint(18,90), wxSize(155,-1), wxSL_LABELS ); (void)new wxStaticBox( panel, -1, "&Explanation", wxPoint(220,10), wxSize(270,130) ); #ifdef __WXMOTIF__ diff --git a/src/msw/checkbox.cpp b/src/msw/checkbox.cpp index 129a97eec0..fe6bfcece0 100644 --- a/src/msw/checkbox.cpp +++ b/src/msw/checkbox.cpp @@ -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 } diff --git a/src/msw/choice.cpp b/src/msw/choice.cpp index 204fe50832..87f286d943 100644 --- a/src/msw/choice.cpp +++ b/src/msw/choice.cpp @@ -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) && diff --git a/src/msw/control.cpp b/src/msw/control.cpp index 9df9911fc2..7fab4f0186 100644 --- a/src/msw/control.cpp +++ b/src/msw/control.cpp @@ -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 ) diff --git a/src/msw/gaugemsw.cpp b/src/msw/gaugemsw.cpp index cb8c2b91d5..278fbfce57 100644 --- a/src/msw/gaugemsw.cpp +++ b/src/msw/gaugemsw.cpp @@ -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) diff --git a/src/msw/slidrmsw.cpp b/src/msw/slidrmsw.cpp index 7aa2ccfe03..0310754665 100644 --- a/src/msw/slidrmsw.cpp +++ b/src/msw/slidrmsw.cpp @@ -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 ; diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index c0f230c15a..6b0dae49c8 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -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__