X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/608eeb0f24383e1ab3d6cccc0e9e9bf29e1beef1..2035e10e83324c6925d12725b842768f6e2b00a2:/src/msw/statbr95.cpp diff --git a/src/msw/statbr95.cpp b/src/msw/statbr95.cpp index 9a15d4d1f7..2820bef97c 100644 --- a/src/msw/statbr95.cpp +++ b/src/msw/statbr95.cpp @@ -36,8 +36,8 @@ #include "wx/msw/private.h" #include -#if !defined(__GNUWIN32__) || defined(__TWIN32__) || defined(wxUSE_NORLANDER_HEADERS) -#include +#if !(defined(__GNUWIN32_OLD__) || defined(__TWIN32__)) + #include #endif // ---------------------------------------------------------------------------- @@ -47,10 +47,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxStatusBar95, wxWindow); IMPLEMENT_DYNAMIC_CLASS(wxStatusBar, wxStatusBar95) -BEGIN_EVENT_TABLE(wxStatusBar95, wxWindow) - EVT_SIZE(wxStatusBar95::OnSize) -END_EVENT_TABLE() - // ---------------------------------------------------------------------------- // macros // ---------------------------------------------------------------------------- @@ -65,7 +61,8 @@ END_EVENT_TABLE() // // ---------------------------------------------------------------------------- -static WNDPROC gs_wndprocStatBar = NULL; +// static WNDPROC gs_wndprocStatBar = NULL; +static WXFARPROC gs_wndprocStatBar = (WXFARPROC) NULL; LRESULT APIENTRY wxStatusBarProc(HWND hwnd, UINT message, @@ -78,7 +75,7 @@ LRESULT APIENTRY wxStatusBarProc(HWND hwnd, sb->MSWWindowProc(message, wParam, lParam); } - return ::CallWindowProc(gs_wndprocStatBar, hwnd, message, wParam, lParam); + return ::CallWindowProc(CASTWNDPROC gs_wndprocStatBar, hwnd, message, wParam, lParam); } // ============================================================================ @@ -101,13 +98,15 @@ bool wxStatusBar95::Create(wxWindow *parent, long style, const wxString& name) { + wxCHECK_MSG( parent, FALSE, wxT("status bar must have a parent") ); + SetName(name); + SetWindowStyleFlag(style); SetParent(parent); - if (id == -1) - m_windowId = NewControlId(); - else - m_windowId = id; + parent->AddChild(this); + + m_windowId = id == -1 ? NewControlId() : id; DWORD wstyle = WS_CHILD | WS_VISIBLE; if ( style & wxST_SIZEGRIP ) @@ -124,13 +123,13 @@ bool wxStatusBar95::Create(wxWindow *parent, return FALSE; } - // for some reason, subclassing in the usual way doesn't work at all - many - // strange things start happening (status bar is not positioned correctly, - // all methods fail...) + // we can't subclass this window as usual because the status bar window + // proc processes WM_SIZE and WM_PAINT specially // SubclassWin(m_hWnd); - // but we want to process the messages from it still, so must subclass it - gs_wndprocStatBar = (WNDPROC)GetWindowLong(GetHwnd(), GWL_WNDPROC); + // but we want to process the messages from it still, so do custom + // subclassing here + gs_wndprocStatBar = (WXFARPROC)GetWindowLong(GetHwnd(), GWL_WNDPROC); SetWindowLong(GetHwnd(), GWL_WNDPROC, (LONG)wxStatusBarProc); SetWindowLong(GetHwnd(), GWL_USERDATA, (LONG)this); @@ -157,7 +156,7 @@ void wxStatusBar95::CopyFieldsWidth(const int widths[]) } } -void wxStatusBar95::SetFieldsCount(int nFields, const int widths[]) +void wxStatusBar95::SetFieldsCount(int nFields, const int *widths) { // this is Windows limitation wxASSERT_MSG( (nFields > 0) && (nFields < 255), _T("too many fields") ); @@ -300,11 +299,9 @@ bool wxStatusBar95::GetFieldRect(int i, wxRect& rect) const return TRUE; } -void wxStatusBar95::OnSize(wxSizeEvent& event) +void wxStatusBar95::DoMoveWindow(int x, int y, int width, int height) { - FORWARD_WM_SIZE(GetHwnd(), SIZE_RESTORED, - event.GetSize().x, event.GetSize().y, - SendMessage); + FORWARD_WM_SIZE(GetHwnd(), SIZE_RESTORED, x, y, SendMessage); // adjust fields widths to the new size SetFieldsWidth();