// Purpose: wxAnyButton
// Author: Julian Smart
// Created: 1998-01-04 (extracted from button.cpp)
-// RCS-ID: $Id: anybutton.cpp 67384 2011-04-03 20:31:32Z DS $
+// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
wxODButtonImageData(wxAnyButton *btn, const wxBitmap& bitmap)
{
SetBitmap(bitmap, wxAnyButton::State_Normal);
+#if wxUSE_IMAGE
SetBitmap(bitmap.ConvertToDisabled(), wxAnyButton::State_Disabled);
-
+#endif
m_dir = wxLEFT;
// we use margins when we have both bitmap and text, but when we have
// initialize all bitmaps except for the disabled one to normal state
for ( int n = 0; n < wxAnyButton::State_Max; n++ )
{
+#if wxUSE_IMAGE
m_iml.Add(n == wxAnyButton::State_Disabled ? bitmap.ConvertToDisabled()
: bitmap);
+#else
+ m_iml.Add(bitmap);
+#endif
}
m_data.himl = GetHimagelistOf(&m_iml);
{
// We still need some margin or the text would be overwritten, just
// make it as small as possible.
- sizeBtn.x += (3*win->GetCharWidth())/2;
+ sizeBtn.x += (3*win->GetCharWidth());
}
else
{
if ( m_imageData &&
bitmap.GetSize() != m_imageData->GetBitmap(State_Normal).GetSize() )
{
- wxASSERT_MSG( which == State_Normal,
+ wxASSERT_MSG( (which == State_Normal) || bitmap.IsNull(),
"Must set normal bitmap with the new size first" );
#if wxUSE_UXTHEME
// first we need to compute its bounding rect
RECT rc;
::CopyRect(&rc, pRect);
- ::DrawText(hdc, text.wx_str(), text.length(), &rc,
+ ::DrawText(hdc, text.t_str(), text.length(), &rc,
DT_CENTER | DT_CALCRECT);
// now center this rect inside the entire button area
rc.top = pRect->top + (pRect->bottom - pRect->top)/2 - h/2;
rc.bottom = rc.top+h;
- ::DrawText(hdc, text.wx_str(), text.length(), &rc, flags);
+ ::DrawText(hdc, text.t_str(), text.length(), &rc, flags);
}
else // single line label
{
// notice that we must have DT_SINGLELINE for vertical alignment flags
// to work
- ::DrawText(hdc, text.wx_str(), text.length(), pRect,
+ ::DrawText(hdc, text.t_str(), text.length(), pRect,
flags | DT_SINGLELINE );
}
}