1. reset default item in ~wxWindow (better to be safe)

2. blind fix for Motif compilation


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11377 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2001-08-14 14:59:44 +00:00
parent 75c9da2562
commit b0ee47ff76
4 changed files with 7 additions and 12 deletions

View File

@ -46,8 +46,6 @@ public:
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)) { }

View File

@ -268,6 +268,12 @@ wxWindowBase::~wxWindowBase()
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()

View File

@ -110,8 +110,7 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
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.

View File

@ -62,14 +62,6 @@ bool wxControl::Create( wxWindow *parent,
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() ;