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

@@ -594,7 +594,6 @@
#define wxUSE_CTL3D 0 #define wxUSE_CTL3D 0
#else #else
// Define 1 to use Microsoft CTL3D library. // Define 1 to use Microsoft CTL3D library.
// See note above about using FAFA and CTL3D.
#define wxUSE_CTL3D 1 #define wxUSE_CTL3D 1
#endif #endif

View File

@@ -118,6 +118,12 @@ public:
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
WXUINT message, WXWPARAM wParam, WXLPARAM lParam); 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 #if wxUSE_RICHEDIT
bool IsRich() const { return m_isRich; } bool IsRich() const { return m_isRich; }
void SetRichEdit(bool isRich) { m_isRich = isRich; } void SetRichEdit(bool isRich) { m_isRich = isRich; }

View File

@@ -662,7 +662,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
panel = new wxPanel(m_notebook); panel = new wxPanel(m_notebook);
(void)new wxStaticBox( panel, -1, "&wxGauge and wxSlider", wxPoint(10,10), wxSize(200,130) ); (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 ); 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) ); (void)new wxStaticBox( panel, -1, "&Explanation", wxPoint(220,10), wxSize(270,130) );
#ifdef __WXMOTIF__ #ifdef __WXMOTIF__

View File

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

View File

@@ -64,7 +64,7 @@ bool wxChoice::Create(wxWindow *parent,
if ( style & wxCB_SORT ) if ( style & wxCB_SORT )
msStyle |= CBS_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 // quite a few people - try to help them
wxASSERT_MSG( !(style & wxCB_DROPDOWN) && wxASSERT_MSG( !(style & wxCB_DROPDOWN) &&
!(style & wxCB_READONLY) && !(style & wxCB_READONLY) &&

View File

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

View File

@@ -104,7 +104,10 @@ bool wxGaugeMSW::Create(wxWindow *parent, wxWindowID id,
int height = size.y; int height = size.y;
long msFlags = WS_CHILD | WS_VISIBLE | WS_TABSTOP; 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 = HWND wx_button =
CreateWindowEx(MakeExtendedStyle(m_windowStyle), wxT("zYzGauge"), NULL, msFlags, 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_SETFGCOLOR, 0, RGB(GetForegroundColour().Red(), GetForegroundColour().Green(), GetForegroundColour().Blue()));
SendMessage(GetHwnd(), ZYZG_SETBKCOLOR, 0, RGB(GetBackgroundColour().Red(), GetBackgroundColour().Green(), GetBackgroundColour().Blue())); SendMessage(GetHwnd(), ZYZG_SETBKCOLOR, 0, RGB(GetBackgroundColour().Red(), GetBackgroundColour().Green(), GetBackgroundColour().Blue()));
//SetBezelFace(1);
//SetShadowWidth(1);
SetFont(parent->GetFont()); SetFont(parent->GetFont());
if (width == -1) 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(), 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)NewControlId(),
wxGetInstance(), NULL); wxGetInstance(), NULL);
// Now create slider
m_windowId = (int)NewControlId();
msStyle = 0; msStyle = 0;
if (m_windowStyle & wxSL_VERTICAL) if (m_windowStyle & wxSL_VERTICAL)
msStyle = SBS_VERT | WS_CHILD | WS_VISIBLE | WS_TABSTOP ; 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_PASTE, wxTextCtrl::OnUpdatePaste)
EVT_UPDATE_UI(wxID_UNDO, wxTextCtrl::OnUpdateUndo) EVT_UPDATE_UI(wxID_UNDO, wxTextCtrl::OnUpdateUndo)
EVT_UPDATE_UI(wxID_REDO, wxTextCtrl::OnUpdateRedo) EVT_UPDATE_UI(wxID_REDO, wxTextCtrl::OnUpdateRedo)
#ifdef __WIN16__
EVT_ERASE_BACKGROUND(wxTextCtrl::OnEraseBackground)
#endif
END_EVENT_TABLE() END_EVENT_TABLE()
@@ -986,6 +989,39 @@ WXHBRUSH wxTextCtrl::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
return (WXHBRUSH)brush->GetResourceHandle(); 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() void wxTextCtrl::AdjustSpaceLimit()
{ {
#ifndef __WIN16__ #ifndef __WIN16__