diff --git a/samples/dialogs/dialogs.cpp b/samples/dialogs/dialogs.cpp index 6b9ef63ec8..9f7dc652f7 100644 --- a/samples/dialogs/dialogs.cpp +++ b/samples/dialogs/dialogs.cpp @@ -159,6 +159,7 @@ 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 @@ -530,6 +531,7 @@ 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 @@ -890,6 +892,11 @@ 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 89e96557e4..085e9eaeba 100644 --- a/samples/dialogs/dialogs.h +++ b/samples/dialogs/dialogs.h @@ -391,6 +391,7 @@ public: #if wxUSE_INFOBAR void InfoBarSimple(wxCommandEvent& event); + void InfoBarSimpleWrapped(wxCommandEvent &event); void InfoBarAdvanced(wxCommandEvent& event); #endif // wxUSE_INFOBAR @@ -598,6 +599,7 @@ 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 7da357176e..68830d3936 100644 --- a/src/generic/infobar.cpp +++ b/src/generic/infobar.cpp @@ -236,7 +236,7 @@ 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 55859bca32..c3d4d4018d 100644 --- a/src/gtk/infobar.cpp +++ b/src/gtk/infobar.cpp @@ -196,7 +196,11 @@ 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), wxGTK_CONV(msg)); - + 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();