Add a "not specified" icon style to the message box test dialog.

The sample allowed to test the behaviour with all wxICON_XXX including
wxICON_NONE but not without any icon styles at all. Do allow it now.

Also use symbolic names for the radiobox indices for clarity.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63681 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2010-03-14 14:15:42 +00:00
parent d9ffb9fdcc
commit 8783d72f04
2 changed files with 50 additions and 10 deletions

View File

@ -2589,15 +2589,24 @@ TestMessageBoxDialog::TestMessageBoxDialog(wxWindow *parent)
// icon choice
const wxString icons[] = {
"&None", "&Information", "&Question", "&Warning", "&Error"
const wxString icons[] =
{
"&Not specified",
"E&xplicitly none",
"&Information icon",
"&Question icon",
"&Warning icon",
"&Error icon"
};
m_icons = new wxRadioBox(this, wxID_ANY, "&Icons",
wxCOMPILE_TIME_ASSERT( WXSIZEOF(icons) == MsgDlgIcon_Max, IconMismatch );
m_icons = new wxRadioBox(this, wxID_ANY, "&Icon style",
wxDefaultPosition, wxDefaultSize,
WXSIZEOF(icons), icons);
WXSIZEOF(icons), icons,
2, wxRA_SPECIFY_ROWS);
// Make the 'Information' icon the default one:
m_icons->SetSelection(1);
m_icons->SetSelection(MsgDlgIcon_Info);
sizerTop->Add(m_icons, wxSizerFlags().Expand().Border());
@ -2658,11 +2667,31 @@ void TestMessageBoxDialog::OnApply(wxCommandEvent& WXUNUSED(event))
switch ( m_icons->GetSelection() )
{
case 0: style |= wxICON_NONE; break;
case 1: style |= wxICON_INFORMATION; break;
case 2: style |= wxICON_QUESTION; break;
case 3: style |= wxICON_WARNING; break;
case 4: style |= wxICON_ERROR; break;
case MsgDlgIcon_Max:
wxFAIL_MSG( "unexpected selection" );
case MsgDlgIcon_No:
break;
case MsgDlgIcon_None:
style |= wxICON_NONE;
break;
case MsgDlgIcon_Info:
style |= wxICON_INFORMATION;
break;
case MsgDlgIcon_Question:
style |= wxICON_QUESTION;
break;
case MsgDlgIcon_Warning:
style |= wxICON_WARNING;
break;
case MsgDlgIcon_Error:
style |= wxICON_ERROR;
break;
}
if ( m_chkCentre->IsChecked() )

View File

@ -214,6 +214,17 @@ private:
static const BtnInfo ms_btnInfo[Btn_Max];
enum
{
MsgDlgIcon_No,
MsgDlgIcon_None,
MsgDlgIcon_Info,
MsgDlgIcon_Question,
MsgDlgIcon_Warning,
MsgDlgIcon_Error,
MsgDlgIcon_Max
};
wxTextCtrl *m_textMsg,
*m_textExtMsg;