X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2bda0e173844e8e0f8acf4e8ad8b5c26e5c6fe5d..b3031762e87338b20e682af9278731aec1d123c6:/src/msw/statbmp.cpp?ds=sidebyside diff --git a/src/msw/statbmp.cpp b/src/msw/statbmp.cpp index dfdaec3496..5c56d88f69 100644 --- a/src/msw/statbmp.cpp +++ b/src/msw/statbmp.cpp @@ -35,11 +35,11 @@ IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl) * wxStaticBitmap */ -bool wxStaticBitmap::Create(wxWindow *parent, const wxWindowID id, +bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bitmap, const wxPoint& pos, const wxSize& size, - const long style, + long style, const wxString& name) { m_messageBitmap = bitmap; @@ -69,19 +69,28 @@ bool wxStaticBitmap::Create(wxWindow *parent, const wxWindowID id, // Use an ownerdraw button to produce a static bitmap, since there's // no ownerdraw static. // TODO: perhaps this should be a static item, with style SS_BITMAP. - HWND static_item = - CreateWindowEx(0, "BUTTON", "", BS_OWNERDRAW | WS_TABSTOP | WS_CHILD, - 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId, - wxGetInstance(), NULL); - m_hWnd = (WXHWND) static_item; + m_hWnd = (WXHWND)CreateWindow + ( + "BUTTON", + "", + BS_OWNERDRAW | WS_TABSTOP | WS_CHILD | WS_VISIBLE, + 0, 0, 0, 0, + (HWND)parent->GetHWND(), + (HMENU)m_windowId, + wxGetInstance(), + NULL + ); // Subclass again for purposes of dialog editing mode - SubclassWin((WXHWND) static_item); + SubclassWin(m_hWnd); + + SetFont(* GetParent()->GetFont()); + SetSize(x, y, width, height); return TRUE; } -void wxStaticBitmap::SetSize(const int x, const int y, const int width, const int height, const int sizeFlags) +void wxStaticBitmap::SetSize(int x, int y, int width, int height, int sizeFlags) { int currentX, currentY; GetPosition(¤tX, ¤tY); @@ -93,6 +102,8 @@ void wxStaticBitmap::SetSize(const int x, const int y, const int width, const in if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE)) y1 = currentY; + AdjustForParentClientOrigin(x1, y1, sizeFlags); + int actualWidth = width; int actualHeight = height; @@ -110,17 +121,6 @@ void wxStaticBitmap::SetSize(const int x, const int y, const int width, const in else actualHeight = height; MoveWindow((HWND) GetHWND(), x1, y1, actualWidth, actualHeight, TRUE); - - if (!((width == -1) && (height == -1))) - { -#if WXWIN_COMPATIBILITY - GetEventHandler()->OldOnSize(actualWidth, actualHeight); -#else - wxSizeEvent event(wxSize(actualWidth, actualHeight), m_windowId); - event.eventObject = this; - GetEventHandler()->ProcessEvent(event); -#endif - } } void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap) @@ -165,7 +165,7 @@ bool wxStaticBitmap::MSWOnDraw(WXDRAWITEMSTRUCT *item) HDC hDC = lpDIS->hDC; HDC memDC = ::CreateCompatibleDC(hDC); - HBITMAP old = ::SelectObject(memDC, (HBITMAP) bitmap->GetHBITMAP()); + HBITMAP old = (HBITMAP) ::SelectObject(memDC, (HBITMAP) bitmap->GetHBITMAP()); if (!old) return FALSE;