Add wxMessageDialog::GetEffectiveIcon() and use it in all ports.

Remove code duplication and inconsistencies among different ports by using a
single function in the base class for the determination of the effective icon
style to use, correctly handling both wxICON_NONE and the absence of any
wxICON_XXX styles.

Closes #11822.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63725 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-03-20 13:18:23 +00:00
parent 5eb342f9a2
commit a4578b0ced
7 changed files with 126 additions and 57 deletions

View File

@@ -90,19 +90,26 @@ void wxMessageDialog::GTKCreateMsgDialog()
GtkWindow * const parent = m_parent ? GTK_WINDOW(m_parent->m_widget) : NULL;
#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2
const char *stockIcon;
if ( m_dialogStyle & wxICON_NONE )
stockIcon = "";
else if ( m_dialogStyle & wxICON_ERROR )
stockIcon = "qgn_note_gene_syserror";
else if ( m_dialogStyle & wxICON_EXCLAMATION )
stockIcon = "qgn_note_gene_syswarning";
else if ( m_dialogStyle & wxICON_INFORMATION )
stockIcon = "qgn_note_info";
else if ( m_dialogStyle & wxICON_QUESTION )
stockIcon = "qgn_note_confirm";
else
stockIcon = "";
const char *stockIcon = "";
switch ( GetEffectiveIcon() )
{
case wxICON_ERROR:
stockIcon = "qgn_note_gene_syserror";
break;
case wxICON_WARNING:
stockIcon = "qgn_note_gene_syswarning";
break;
case wxICON_QUESTION:
stockIcon = "qgn_note_confirm";
break;
case wxICON_INFORMATION:
stockIcon = "qgn_note_info";
break;
}
// there is no generic note creation function in public API so we have no
// choice but to use g_object_new() directly
@@ -138,7 +145,7 @@ void wxMessageDialog::GTKCreateMsgDialog()
}
}
if ( !wxGTKImpl::ConvertMessageTypeFromWX(m_dialogStyle, &type) )
if ( !wxGTKImpl::ConvertMessageTypeFromWX(GetEffectiveIcon(), &type) )
{
// if no style is explicitly specified, detect the suitable icon
// ourselves (this can be disabled by using wxICON_NONE)