wxUniv use wxBU flags [bug #1040584]

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30531 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba 2004-11-15 06:23:57 +00:00
parent fa9ad408a1
commit 041ae20237
2 changed files with 23 additions and 10 deletions

View File

@ -25,7 +25,7 @@
#define wxBU_TOP 0x0080
#define wxBU_RIGHT 0x0100
#define wxBU_BOTTOM 0x0200
#define wxBU_ALIGN_MASK ( wxBU_LEFT | wxBU_TOP | wxBU_RIGHT | wxBU_BOTTOM )
#endif
#if wxUSE_BUTTON

View File

@ -81,13 +81,26 @@ bool wxButton::Create(wxWindow *parent,
if (label.empty() && wxIsStockID(id))
label = wxGetStockLabel(id);
// center label by default
if ( !(style & wxALIGN_MASK) )
{
style |= wxALIGN_CENTRE_HORIZONTAL | wxALIGN_CENTRE_VERTICAL;
}
long ctrl_style = style & !wxBU_ALIGN_MASK;
if ( !wxControl::Create(parent, id, pos, size, style, validator, name) )
wxASSERT_MSG( (ctrl_style & wxALIGN_MASK) == 0,
_T("Some style conflicts with align flags") );
if((style & wxBU_RIGHT) == wxBU_RIGHT)
ctrl_style |= wxALIGN_RIGHT;
else if((style & wxBU_LEFT) == wxBU_LEFT)
ctrl_style |= wxALIGN_LEFT;
else
ctrl_style |= wxALIGN_CENTRE_HORIZONTAL;
if((style & wxBU_TOP) == wxBU_TOP)
ctrl_style |= wxALIGN_TOP;
else if((style & wxBU_BOTTOM) == wxBU_BOTTOM)
ctrl_style |= wxALIGN_BOTTOM;
else
ctrl_style |= wxALIGN_CENTRE_VERTICAL;
if ( !wxControl::Create(parent, id, pos, size, ctrl_style, validator, name) )
return false;
SetLabel(label);
@ -144,7 +157,7 @@ wxSize wxButton::DoGetBestClientSize() const
width += m_bitmap.GetWidth() + 2*m_marginBmpX;
}
// The default size should not be adjusted, so the code is moved into the
// The default size should not be adjusted, so the code is moved into the
// renderer. This is conceptual wrong but currently the only solution.
// (Otto Wyss, Patch 664399)
@ -184,7 +197,7 @@ bool wxButton::DoDrawBackground(wxDC& dc)
wxSize size = GetSize();
rect.width = size.x;
rect.height = size.y;
if ( GetBackgroundBitmap().Ok() )
{
// get the bitmap and the flags
@ -280,7 +293,7 @@ void wxButton::SetImageMargins(wxCoord x, wxCoord y)
{
m_marginBmpX = x + 2;
m_marginBmpY = y + 2;
SetBestSize(wxDefaultSize);
}