protected:
long GetMessageDialogStyle() const { return m_dialogStyle; }
+ // based on message dialog style, returns exactly one of: wxICON_NONE,
+ // wxICON_ERROR, wxICON_WARNING, wxICON_QUESTION, wxICON_INFORMATION
+ long GetEffectiveIcon() const
+ {
+ if ( m_dialogStyle & wxICON_NONE )
+ return wxICON_NONE;
+ else if ( m_dialogStyle & wxICON_ERROR )
+ return wxICON_ERROR;
+ else if ( m_dialogStyle & wxICON_WARNING )
+ return wxICON_WARNING;
+ else if ( m_dialogStyle & wxICON_QUESTION )
+ return wxICON_QUESTION;
+ else if ( m_dialogStyle & wxICON_INFORMATION )
+ return wxICON_INFORMATION;
+ else if ( m_dialogStyle & wxYES )
+ return wxICON_QUESTION;
+ else
+ return wxICON_INFORMATION;
+ }
+
// for the platforms not supporting separate main and extended messages
// this function should be used to combine both of them in a single string
const long style = GetMessageDialogStyle();
NSAlertStyle nsStyle = NSInformationalAlertStyle;
- if (style & wxICON_EXCLAMATION)
- nsStyle = NSWarningAlertStyle;
- else if (style & wxICON_HAND)
- nsStyle = NSCriticalAlertStyle;
- else if (style & wxICON_INFORMATION)
- nsStyle = NSInformationalAlertStyle;
- else if (style & wxICON_QUESTION)
- nsStyle = NSInformationalAlertStyle;
+
+ switch ( GetEffectiveIcon() )
+ {
+ case wxICON_ERROR:
+ nsStyle = NSCriticalAlertStyle;
+ break;
+
+ case wxICON_WARNING:
+ nsStyle = NSWarningAlertStyle;
+ break;
+ }
[alert setAlertStyle:nsStyle];
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
}
}
- 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)
}
// set the icon style
- if (wxStyle & wxICON_EXCLAMATION)
- msStyle |= MB_ICONEXCLAMATION;
- else if (wxStyle & wxICON_HAND)
- msStyle |= MB_ICONHAND;
- else if (wxStyle & wxICON_INFORMATION)
- msStyle |= MB_ICONINFORMATION;
- else if (wxStyle & wxICON_QUESTION)
- msStyle |= MB_ICONQUESTION;
- else if (!(wxStyle & wxICON_NONE))
- msStyle |= wxStyle & wxYES ? MB_ICONQUESTION : MB_ICONINFORMATION;
+ switch ( GetEffectiveIcon() )
+ {
+ case wxICON_ERROR:
+ msStyle |= MB_ICONHAND;
+ break;
+
+ case wxICON_WARNING:
+ msStyle |= MB_ICONEXCLAMATION;
+ break;
+
+ case wxICON_QUESTION:
+ msStyle |= MB_ICONQUESTION;
+ break;
+
+ case wxICON_INFORMATION:
+ msStyle |= MB_ICONINFORMATION;
+ break;
+ }
if ( wxStyle & wxSTAY_ON_TOP )
msStyle |= MB_TOPMOST;
else
ulStyle = MB_OK;
}
- if (lStyle & wxICON_EXCLAMATION)
- ulStyle |= MB_ICONEXCLAMATION;
- else if (lStyle & wxICON_HAND)
- ulStyle |= MB_ICONHAND;
- else if (lStyle & wxICON_INFORMATION)
- ulStyle |= MB_ICONEXCLAMATION;
- else if (lStyle & wxICON_QUESTION)
- ulStyle |= MB_ICONQUESTION;
+
+ switch ( GetEffectiveIcon() )
+ {
+ case wxICON_ERROR:
+ ulStyle |= MB_ERROR;
+ break;
+
+ case wxICON_WARNING:
+ ulStyle |= MB_WARNING;
+ break;
+
+ case wxICON_QUESTION:
+ ulStyle |= MB_QUERY;
+ break;
+
+ case wxICON_INFORMATION:
+ ulStyle |= MB_INFORMATION;
+ break;
+ }
if (hWnd != HWND_DESKTOP)
ulStyle |= MB_APPLMODAL;
const long style = GetMessageDialogStyle();
- wxASSERT_MSG( (style & 0x3F) != wxYES, wxT("this style is not supported on Mac") );
+ wxASSERT_MSG( (style & 0x3F) != wxYES,
+ "this style is not supported on Mac" );
AlertType alertType = kAlertPlainAlert;
- if (style & wxICON_EXCLAMATION)
- alertType = kAlertCautionAlert;
- else if (style & wxICON_HAND)
- alertType = kAlertStopAlert;
- else if (style & wxICON_INFORMATION)
- alertType = kAlertNoteAlert;
- else if (style & wxICON_QUESTION)
- alertType = kAlertNoteAlert;
+
+ switch ( GetEffectiveIcon() )
+ {
+ case wxICON_ERROR:
+ alertType = kAlertStopAlert;
+ break;
+
+ case wxICON_WARNING:
+ alertType = kAlertCautionAlert;
+ break;
+
+ case wxICON_QUESTION:
+ case wxICON_INFORMATION:
+ alertType = kAlertNoteAlert;
+ break;
+ }
// work out what to display
}
// Add the icon styles
- if (style & wxICON_EXCLAMATION)
- AlertID=AlertID+0; // Warning
- else if (style & wxICON_HAND)
- AlertID=AlertID+1; // Error
- else if (style & wxICON_INFORMATION)
- AlertID=AlertID+2; // Information
- else if (style & wxICON_QUESTION)
- AlertID=AlertID+3; // Confirmation
+ switch ( GetEffectiveIcon() )
+ {
+ case wxICON_ERROR:
+ AlertID = AlertID + 1;
+ break;
+
+ case wxICON_WARNING:
+ AlertID = AlertID + 0;
+ break;
+
+ case wxICON_QUESTION:
+ AlertID = AlertID + 3;
+ break;
+
+ case wxICON_NONE:
+ case wxICON_INFORMATION:
+ AlertID = AlertID + 2;
+ break;
+ }
// The Palm OS Dialog API does not support custom titles in a dialog box.
// So we have to set the title by manipulating the resource.