X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/07cf98cb8eb7625eeffc95e407a9fa1ad863b451..2a31049201e9c1ff9f515eb9d144ae392f4b4e5a:/src/msw/statbox.cpp diff --git a/src/msw/statbox.cpp b/src/msw/statbox.cpp index 1e70d4c60e..da2eac0ecc 100644 --- a/src/msw/statbox.cpp +++ b/src/msw/statbox.cpp @@ -41,14 +41,7 @@ // wxWin macros // ---------------------------------------------------------------------------- -#if !USE_SHARED_LIBRARY -IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl) - -BEGIN_EVENT_TABLE(wxStaticBox, wxControl) - EVT_ERASE_BACKGROUND(wxStaticBox::OnEraseBackground) -END_EVENT_TABLE() - -#endif + IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl) // ============================================================================ // implementation @@ -69,15 +62,13 @@ bool wxStaticBox::Create(wxWindow *parent, if ( !CreateControl(parent, id, pos, size, style, wxDefaultValidator, name) ) return FALSE; - if ( !MSWCreateControl(wxT("BUTTON"), BS_GROUPBOX) ) + if ( !MSWCreateControl(wxT("BUTTON"), BS_GROUPBOX, pos, size, label, 0) ) return FALSE; - SetSize(pos.x, pos.y, size.x, size.y); - return TRUE; } -wxSize wxStaticBox::DoGetBestSize() +wxSize wxStaticBox::DoGetBestSize() const { int cx, cy; wxGetCharSize(GetHWND(), &cx, &cy, &GetFont()); @@ -91,54 +82,37 @@ wxSize wxStaticBox::DoGetBestSize() return wxSize(wBox, hBox); } -WXHBRUSH wxStaticBox::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, - WXUINT message, - WXWPARAM wParam, - WXLPARAM lParam) -{ -#if wxUSE_CTL3D - if ( m_useCtl3D ) - { - HBRUSH hbrush = Ctl3dCtlColorEx(message, wParam, lParam); - return (WXHBRUSH) hbrush; - } -#endif // wxUSE_CTL3D - - HDC hdc = (HDC)pDC; - if (GetParent()->GetTransparentBackground()) - SetBkMode(hdc, TRANSPARENT); - else - SetBkMode(hdc, OPAQUE); - - const wxColour& colBack = GetBackgroundColour(); - ::SetBkColor(hdc, wxColourToRGB(colBack)); - ::SetTextColor(hdc, wxColourToRGB(GetForegroundColour())); - - wxBrush *brush = wxTheBrushList->FindOrCreateBrush(colBack, wxSOLID); - - return (WXHBRUSH)brush->GetResourceHandle(); -} - -void wxStaticBox::OnEraseBackground(wxEraseEvent& event) -{ - // do nothing - the aim of having this function is to prevent - // wxControl::OnEraseBackground() to paint over the control inside the - // static box -} - long wxStaticBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) { - if ( nMsg == WM_NCHITTEST) + switch ( nMsg ) { - int xPos = LOWORD(lParam); // horizontal position of cursor - int yPos = HIWORD(lParam); // vertical position of cursor - - ScreenToClient(&xPos, &yPos); - - // Make sure you can drag by the top of the groupbox, but let - // other (enclosed) controls get mouse events also - if (yPos < 10) - return (long)HTCLIENT; + case WM_NCHITTEST: + // FIXME: this hack is specific to dialog ed, shouldn't it be + // somehow disabled during normal operation? + { + int xPos = LOWORD(lParam); // horizontal position of cursor + int yPos = HIWORD(lParam); // vertical position of cursor + + ScreenToClient(&xPos, &yPos); + + // Make sure you can drag by the top of the groupbox, but let + // other (enclosed) controls get mouse events also + if ( yPos < 10 ) + return (long)HTCLIENT; + } + break; + + // VZ: I will remove (or change) this soon... (15.11.99) +#if 0 + case WM_ERASEBKGND: + // prevent wxControl from processing this message because it will + // erase the background incorrectly and there is no way for us to + // override this at wxWin event level (if we do process the event, + // we don't know how to do it properly - paint the background + // without painting over other controls - and if we don't, + // wxControl still gets it) + return MSWDefWindowProc(nMsg, wParam, lParam); +#endif } return wxControl::MSWWindowProc(nMsg, wParam, lParam);