#endif
#include "wx/control.h"
-#include "wx/panel.h"
-#include "wx/app.h"
-#include "wx/dc.h"
-#include "wx/dcclient.h"
+
+#ifndef WX_PRECOMP
+ #include "wx/app.h"
+ #include "wx/panel.h"
+ #include "wx/dc.h"
+ #include "wx/dcclient.h"
+ #include "wx/button.h"
+ #include "wx/dialog.h"
+ #include "wx/scrolbar.h"
+ #include "wx/stattext.h"
+ #include "wx/statbox.h"
+ #include "wx/radiobox.h"
+ #include "wx/sizer.h"
+#endif // WX_PRECOMP
+
#include "wx/notebook.h"
#include "wx/tabctrl.h"
-#include "wx/radiobox.h"
#include "wx/spinbutt.h"
-#include "wx/scrolbar.h"
-#include "wx/button.h"
-#include "wx/dialog.h"
-#include "wx/statbox.h"
-#include "wx/sizer.h"
-#include "wx/stattext.h"
IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
wxRemoveMacControlAssociation( this ) ;
// If we delete an item, we should initialize the parent panel,
// because it could now be invalid.
- wxWindow *parent = GetParent() ;
- if ( parent )
+ wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow);
+ if ( tlw )
{
- if (parent->GetDefaultItem() == (wxButton*) this)
- parent->SetDefaultItem(NULL);
+ if ( tlw->GetDefaultItem() == (wxButton*) this)
+ tlw->SetDefaultItem(NULL);
}
if ( (ControlHandle) m_macControl )
{
void wxControl::SetLabel(const wxString& title)
{
- m_label = wxStripMenuCodes(title) ;
+ m_label = GetLabelText(title) ;
if ( m_macControl )
{
((Rect*)outBounds)->bottom = 0;
((Rect*)outBounds)->right = 0;
- wxMacStringToPascal( wxStripMenuCodes(label) , maclabel ) ;
+ wxMacStringToPascal( GetLabelText(label) , maclabel ) ;
}
void wxControl::MacPostControlCreate()
SetSize(pos.x, pos.y, new_size.x, new_size.y);
#if wxUSE_UNICODE
- UMASetControlTitle( (ControlHandle) m_macControl , wxStripMenuCodes(m_label) , m_font.GetEncoding() ) ;
+ UMASetControlTitle( (ControlHandle) m_macControl , GetLabelText(m_label) , m_font.GetEncoding() ) ;
#endif
if ( m_macControlIsShown )
{
if ( IsKindOf( CLASSINFO( wxButton ) ) )
{
- m_width = m_label.Length() * 8 + 12 ;
+ m_width = m_label.length() * 8 + 12 ;
if ( m_width < 70 )
m_width = 70 ;
}
else if ( IsKindOf( CLASSINFO( wxStaticText ) ) )
{
- m_width = m_label.Length() * 8 ;
+ m_width = m_label.length() * 8 ;
}
else
m_width = bestsize.right - bestsize.left ;