X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f6bcfd974ef26faf6f91a62cac09827e09463fd1..df16a53ef9ae506c51023178e4fe45ce45e69447:/src/msw/bmpbuttn.cpp diff --git a/src/msw/bmpbuttn.cpp b/src/msw/bmpbuttn.cpp index e5b40ea968..cb9c724e6e 100644 --- a/src/msw/bmpbuttn.cpp +++ b/src/msw/bmpbuttn.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: bmpbuttn.cpp +// Name: src/msw/bmpbuttn.cpp // Purpose: wxBitmapButton // Author: Julian Smart // Modified by: @@ -17,9 +17,11 @@ #include "wx/wxprec.h" #ifdef __BORLANDC__ -#pragma hdrstop + #pragma hdrstop #endif +#if wxUSE_BMPBUTTON + #ifndef WX_PRECOMP #include "wx/bmpbuttn.h" #include "wx/log.h" @@ -38,7 +40,7 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit const wxValidator& validator, const wxString& name) { - m_buttonBitmap = bitmap; + m_bmpNormal = bitmap; SetName(name); #if wxUSE_VALIDATORS @@ -50,8 +52,6 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit m_backgroundColour = parent->GetBackgroundColour(); m_foregroundColour = parent->GetForegroundColour(); m_windowStyle = style; - m_marginX = 0; - m_marginY = 0; if ( style & wxBU_AUTODRAW ) { @@ -77,6 +77,9 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit long msStyle = WS_VISIBLE | WS_TABSTOP | WS_CHILD | BS_OWNERDRAW ; + if ( m_windowStyle & wxCLIP_SIBLINGS ) + msStyle |= WS_CLIPSIBLINGS; + #ifdef __WIN32__ if(m_windowStyle & wxBU_LEFT) msStyle |= BS_LEFT; @@ -94,7 +97,7 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit wxT("BUTTON"), wxT(""), msStyle, - 0, 0, 0, 0, + 0, 0, 0, 0, GetWinHwnd(parent), (HMENU)m_windowId, wxGetInstance(), @@ -111,11 +114,6 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit return TRUE; } -void wxBitmapButton::SetBitmapLabel(const wxBitmap& bitmap) -{ - m_buttonBitmap = bitmap; -} - // VZ: should be at the very least less than wxDEFAULT_BUTTON_MARGIN #define FOCUS_MARGIN 3 @@ -141,14 +139,14 @@ bool wxBitmapButton::MSWOnDraw(WXDRAWITEMSTRUCT *item) // choose the bitmap to use depending on the button state wxBitmap* bitmap; - if ( isSelected && m_buttonBitmapSelected.Ok() ) - bitmap = &m_buttonBitmapSelected; - else if ((state & ODS_FOCUS) && m_buttonBitmapFocus.Ok()) - bitmap = &m_buttonBitmapFocus; - else if ((state & ODS_DISABLED) && m_buttonBitmapDisabled.Ok()) - bitmap = &m_buttonBitmapDisabled; + if ( isSelected && m_bmpSelected.Ok() ) + bitmap = &m_bmpSelected; + else if ((state & ODS_FOCUS) && m_bmpFocus.Ok()) + bitmap = &m_bmpFocus; + else if ((state & ODS_DISABLED) && m_bmpDisabled.Ok()) + bitmap = &m_bmpDisabled; else - bitmap = &m_buttonBitmap; + bitmap = &m_bmpNormal; if ( !bitmap->Ok() ) return FALSE; @@ -196,7 +194,7 @@ bool wxBitmapButton::MSWOnDraw(WXDRAWITEMSTRUCT *item) wxDC dst; dst.SetHDC((WXHDC) hDC, FALSE); dst.DrawBitmap(*bitmap, x1, y1, TRUE); - + // draw focus / disabled state, if auto-drawing if ( (state & ODS_DISABLED) && autoDraw ) { @@ -352,6 +350,7 @@ void wxBitmapButton::DrawButtonFocus( WXHDC dc, int left, int top, int right, in if ( sel ) OffsetRect( &rect, 1, 1 ); */ + (void)sel; DrawFocusRect( (HDC) dc, &rect ); } @@ -384,3 +383,5 @@ void wxBitmapButton::SetDefault() { wxButton::SetDefault(); } + +#endif // wxUSE_BMPBUTTON