#include "wx/settings.h"
#include "wx/dcscreen.h"
#include "wx/dcclient.h"
+ #include "wx/toplevel.h"
#endif
#include "wx/stockitem.h"
wxCoord wBtn,
hBtn;
- dc.GetMultiLineTextExtent(wxStripMenuCodes(GetLabel()), &wBtn, &hBtn);
+ dc.GetMultiLineTextExtent(GetLabelText(), &wBtn, &hBtn);
// add a margin -- the button is wider than just its label
wBtn += 3*GetCharWidth();
*/
// set this button as the (permanently) default one in its panel
-void wxButton::SetDefault()
+wxWindow *wxButton::SetDefault()
{
- wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow);
-
- wxCHECK_RET( tlw, _T("button without top level window?") );
-
// set this one as the default button both for wxWidgets ...
- wxWindow *winOldDefault = tlw->SetDefaultItem(this);
+ wxWindow *winOldDefault = wxButtonBase::SetDefault();
// ... and Windows
SetDefaultStyle(wxDynamicCast(winOldDefault, wxButton), false);
SetDefaultStyle(this, true);
+
+ return winOldDefault;
}
// set this button as being currently default
}
COLORREF colFg = wxColourToRGB(GetForegroundColour());
- DrawButtonText(hdc, &rectBtn,
- (state & ODS_NOACCEL ? wxStripMenuCodes(GetLabel())
- : GetLabel()),
- state & ODS_DISABLED ? GetSysColor(COLOR_GRAYTEXT)
- : colFg);
+ if ( state & ODS_DISABLED ) colFg = GetSysColor(COLOR_GRAYTEXT) ;
+ wxString label = GetLabel();
+ if ( state & ODS_NOACCEL ) label = GetLabelText() ;
+ DrawButtonText(hdc, &rectBtn, label, colFg);
return true;
}