/////////////////////////////////////////////////////////////////////////////
-// Name: bmpbuttn.cpp
+// Name: src/msw/bmpbuttn.cpp
// Purpose: wxBitmapButton
// Author: Julian Smart
// Modified by:
#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"
const wxValidator& validator,
const wxString& name)
{
- m_buttonBitmap = bitmap;
+ m_bmpNormal = bitmap;
SetName(name);
#if wxUSE_VALIDATORS
m_backgroundColour = parent->GetBackgroundColour();
m_foregroundColour = parent->GetForegroundColour();
m_windowStyle = style;
- m_marginX = 0;
- m_marginY = 0;
if ( style & wxBU_AUTODRAW )
{
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;
wxT("BUTTON"),
wxT(""),
msStyle,
- 0, 0, 0, 0,
+ 0, 0, 0, 0,
GetWinHwnd(parent),
(HMENU)m_windowId,
wxGetInstance(),
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
// 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;
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 )
{
if ( sel )
OffsetRect( &rect, 1, 1 );
*/
+ (void)sel;
DrawFocusRect( (HDC) dc, &rect );
}
{
wxButton::SetDefault();
}
+
+#endif // wxUSE_BMPBUTTON