const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxControlNameStr);
- ~wxControl();
-
// simulates the event, returns TRUE if the event was processed
virtual void Command(wxCommandEvent& WXUNUSED(event)) { }
if ( m_tooltip )
delete m_tooltip;
#endif // wxUSE_TOOLTIPS
+
+ // reset the dangling pointer our parent window may keep to us
+ if ( m_parent && m_parent->GetDefaultItem() == this )
+ {
+ m_parent->SetDefaultItem(NULL);
+ }
}
bool wxWindowBase::Destroy()
void wxButton::SetDefault()
{
wxWindow *parent = GetParent();
- wxPanel *panel = wxDynamicCast(parent, wxPanel);
- if ( panel )
+ if ( parent )
panel->SetDefaultItem(this);
// We initially do not set XmNdefaultShadowThickness, to have small buttons.
return ret;
}
-wxControl::~wxControl()
-{
- // If we delete an item, we should initialize the parent panel,
- // because it could now be invalid.
- if ( GetParent()->panel->GetDefaultItem() == this)
- panel->SetDefaultItem(NULL);
-}
-
void wxControl::SetLabel(const wxString& label)
{
Widget widget = (Widget) GetLabelWidget() ;