From 42882760e5e3920575588eb0bb5583a395490bbd Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 25 Sep 2024 18:28:50 +0200 Subject: [PATCH] Revert "Wrap label if necessary in wxInfoBar in wxGTK" This reverts commit 32d8b5954a1e6ff07581f0e5b55d37cad0947b6c which was broken in both the generic and GTK version: generic one didn't work at all and GTK one didn't adjust the height of the infobar correctly. See #1443, #14121. --- samples/dialogs/dialogs.cpp | 7 ------- samples/dialogs/dialogs.h | 2 -- src/generic/infobar.cpp | 1 - src/gtk/infobar.cpp | 6 +----- 4 files changed, 1 insertion(+), 15 deletions(-) diff --git a/samples/dialogs/dialogs.cpp b/samples/dialogs/dialogs.cpp index 9c9b7e41ec..77cf3512bb 100644 --- a/samples/dialogs/dialogs.cpp +++ b/samples/dialogs/dialogs.cpp @@ -166,7 +166,6 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame) #endif // wxUSE_LOG_DIALOG #if wxUSE_INFOBAR EVT_MENU(DIALOGS_INFOBAR_SIMPLE, MyFrame::InfoBarSimple) - EVT_MENU(DIALOGS_INFOBAR_SIMPLE_WRAPPED, MyFrame::InfoBarSimpleWrapped) EVT_MENU(DIALOGS_INFOBAR_ADVANCED, MyFrame::InfoBarAdvanced) #endif // wxUSE_INFOBAR @@ -580,7 +579,6 @@ bool MyApp::OnInit() #if wxUSE_INFOBAR info_menu->Append(DIALOGS_INFOBAR_SIMPLE, "Simple &info bar\tCtrl-I"); - info_menu->Append(DIALOGS_INFOBAR_SIMPLE_WRAPPED, "Simple info bar with wrapped text"); info_menu->Append(DIALOGS_INFOBAR_ADVANCED, "&Advanced info bar\tShift-Ctrl-I"); #endif // wxUSE_INFOBAR @@ -950,11 +948,6 @@ void MyFrame::InfoBarSimple(wxCommandEvent& WXUNUSED(event)) ); } -void MyFrame::InfoBarSimpleWrapped(wxCommandEvent &WXUNUSED(event)) -{ - m_infoBarSimple->ShowMessage( "This is very very long message to try the label wrapping on the info bar" ); -} - void MyFrame::InfoBarAdvanced(wxCommandEvent& WXUNUSED(event)) { m_infoBarAdvanced->ShowMessage("Sorry, it didn't work out.", wxICON_WARNING); diff --git a/samples/dialogs/dialogs.h b/samples/dialogs/dialogs.h index a1471d22a5..cf9e91b322 100644 --- a/samples/dialogs/dialogs.h +++ b/samples/dialogs/dialogs.h @@ -394,7 +394,6 @@ public: #if wxUSE_INFOBAR void InfoBarSimple(wxCommandEvent& event); - void InfoBarSimpleWrapped(wxCommandEvent &event); void InfoBarAdvanced(wxCommandEvent& event); #endif // wxUSE_INFOBAR @@ -633,7 +632,6 @@ enum DIALOGS_NUM_ENTRY, DIALOGS_LOG_DIALOG, DIALOGS_INFOBAR_SIMPLE, - DIALOGS_INFOBAR_SIMPLE_WRAPPED, DIALOGS_INFOBAR_ADVANCED, DIALOGS_MODAL, DIALOGS_MODELESS, diff --git a/src/generic/infobar.cpp b/src/generic/infobar.cpp index 1255d8961e..7f3a00471d 100644 --- a/src/generic/infobar.cpp +++ b/src/generic/infobar.cpp @@ -233,7 +233,6 @@ void wxInfoBarGeneric::ShowMessage(const wxString& msg, int flags) // notice the use of EscapeMnemonics() to ensure that "&" come through // correctly m_text->SetLabel(wxControl::EscapeMnemonics(msg)); - m_text->Wrap( GetClientSize().GetWidth() ); // then show this entire window if not done yet if ( !IsShown() ) diff --git a/src/gtk/infobar.cpp b/src/gtk/infobar.cpp index 10a9c6247a..be8f8218e4 100644 --- a/src/gtk/infobar.cpp +++ b/src/gtk/infobar.cpp @@ -193,11 +193,7 @@ void wxInfoBar::ShowMessage(const wxString& msg, int flags) if ( wxGTKImpl::ConvertMessageTypeFromWX(flags, &type) ) gtk_info_bar_set_message_type(GTK_INFO_BAR(m_widget), type); gtk_label_set_text(GTK_LABEL(m_impl->m_label), msg.utf8_str()); - gtk_label_set_line_wrap(GTK_LABEL(m_impl->m_label), TRUE ); -#if GTK_CHECK_VERSION(2,10,0) - if( wx_is_at_least_gtk2( 10 ) ) - gtk_label_set_line_wrap_mode(GTK_LABEL(m_impl->m_label), PANGO_WRAP_WORD); -#endif + if ( !IsShown() ) Show();