From: Robert Roebling Date: Tue, 15 Feb 2000 18:38:19 +0000 (+0000) Subject: list ctrl and tree ctrl didn't like the new focus code, X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/bce1406bff2a6c2eaa87b637335df22560b207de list ctrl and tree ctrl didn't like the new focus code, mem clean uop crash fixed. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6050 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/samples/treectrl/icon2.xpm b/samples/treectrl/icon2.xpm index 998ed1ec4b..d3d76ec8e4 100644 --- a/samples/treectrl/icon2.xpm +++ b/samples/treectrl/icon2.xpm @@ -5,7 +5,7 @@ static char *icon2_xpm[] = { /* colors */ ". c #000000", "# c #ff0000", -"a c #ffffff", +"a c None", /* pixels */ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", diff --git a/samples/treectrl/icon3.xpm b/samples/treectrl/icon3.xpm index efd67292fd..0dba5bef0d 100644 --- a/samples/treectrl/icon3.xpm +++ b/samples/treectrl/icon3.xpm @@ -7,7 +7,7 @@ static char *icon3_xpm[] = { "# c #c0c0c0", "a c #808080", "b c #ffff00", -"c c #ffffff", +"c c None", /* pixels */ "cccccccccccccccccccccccccccccccc", "cccccccccccccccccccccccccccccccc", diff --git a/samples/treectrl/icon5.xpm b/samples/treectrl/icon5.xpm index 557536a650..63820ef10f 100644 --- a/samples/treectrl/icon5.xpm +++ b/samples/treectrl/icon5.xpm @@ -5,7 +5,7 @@ static char *icon5_xpm[] = { /* colors */ ". c #000000", "# c #808000", -"a c #ffffff", +"a c None", "b c #ffff00", /* pixels */ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 1ba7eda09d..e051663178 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -1060,24 +1060,33 @@ void wxListTextCtrl::OnChar( wxKeyEvent &event ) { (*m_accept) = TRUE; (*m_res) = GetValue(); - m_owner->SetFocus(); + + if (!wxPendingDelete.Member(this)) + wxPendingDelete.Append(this); + + if ((*m_accept) && ((*m_res) != m_startValue)) + m_owner->OnRenameAccept(); + return; } if (event.m_keyCode == WXK_ESCAPE) { (*m_accept) = FALSE; (*m_res) = ""; - m_owner->SetFocus(); + + if (!wxPendingDelete.Member(this)) + wxPendingDelete.Append(this); + return; } + event.Skip(); } void wxListTextCtrl::OnKillFocus( wxFocusEvent &WXUNUSED(event) ) { - if (wxPendingDelete.Member(this)) return; - - wxPendingDelete.Append(this); + if (!wxPendingDelete.Member(this)) + wxPendingDelete.Append(this); if ((*m_accept) && ((*m_res) != m_startValue)) m_owner->OnRenameAccept(); diff --git a/src/generic/treectrl.cpp b/src/generic/treectrl.cpp index 0f45e548b7..3586419f4a 100644 --- a/src/generic/treectrl.cpp +++ b/src/generic/treectrl.cpp @@ -252,14 +252,23 @@ void wxTreeTextCtrl::OnChar( wxKeyEvent &event ) { (*m_accept) = TRUE; (*m_res) = GetValue(); - m_owner->SetFocus(); + + if (!wxPendingDelete.Member(this)) + wxPendingDelete.Append(this); + + if ((*m_accept) && ((*m_res) != m_startValue)) + m_owner->OnRenameAccept(); + return; } if (event.m_keyCode == WXK_ESCAPE) { (*m_accept) = FALSE; (*m_res) = ""; - m_owner->SetFocus(); + + if (!wxPendingDelete.Member(this)) + wxPendingDelete.Append(this); + return; } event.Skip(); @@ -267,9 +276,8 @@ void wxTreeTextCtrl::OnChar( wxKeyEvent &event ) void wxTreeTextCtrl::OnKillFocus( wxFocusEvent &WXUNUSED(event) ) { - if (wxPendingDelete.Member(this)) return; - - wxPendingDelete.Append(this); + if (!wxPendingDelete.Member(this)) + wxPendingDelete.Append(this); if ((*m_accept) && ((*m_res) != m_startValue)) m_owner->OnRenameAccept(); diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 13b9e50313..5e09f6f528 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -2147,7 +2147,10 @@ wxWindow::~wxWindow() if (m_widgetStyle) { - gtk_style_unref( m_widgetStyle ); + // don't delete if it's a pixmap theme style + if (!m_widgetStyle->engine_data) + gtk_style_unref( m_widgetStyle ); + m_widgetStyle = (GtkStyle*) NULL; } diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index 13b9e50313..5e09f6f528 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -2147,7 +2147,10 @@ wxWindow::~wxWindow() if (m_widgetStyle) { - gtk_style_unref( m_widgetStyle ); + // don't delete if it's a pixmap theme style + if (!m_widgetStyle->engine_data) + gtk_style_unref( m_widgetStyle ); + m_widgetStyle = (GtkStyle*) NULL; }