added wxICON_NONE and implement support for it in wxGTK (closes #2897)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61234 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1824,7 +1824,7 @@ enum wxBorder
|
|||||||
#define wxICON_INFORMATION 0x00000800
|
#define wxICON_INFORMATION 0x00000800
|
||||||
#define wxICON_STOP wxICON_HAND
|
#define wxICON_STOP wxICON_HAND
|
||||||
#define wxICON_ASTERISK wxICON_INFORMATION
|
#define wxICON_ASTERISK wxICON_INFORMATION
|
||||||
#define wxICON_MASK (0x00000100|0x00000200|0x00000400|0x00000800)
|
#define wxICON_MASK (wxICON_EXCLAMATION|wxICON_HAND|wxICON_QUESTION|wxICON_INFORMATION)
|
||||||
|
|
||||||
#define wxFORWARD 0x00001000
|
#define wxFORWARD 0x00001000
|
||||||
#define wxBACKWARD 0x00002000
|
#define wxBACKWARD 0x00002000
|
||||||
@@ -1832,6 +1832,7 @@ enum wxBorder
|
|||||||
#define wxHELP 0x00008000
|
#define wxHELP 0x00008000
|
||||||
#define wxMORE 0x00010000
|
#define wxMORE 0x00010000
|
||||||
#define wxSETUP 0x00020000
|
#define wxSETUP 0x00020000
|
||||||
|
#define wxICON_NONE 0x00040000
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Background styles. See wxWindow::SetBackgroundStyle
|
* Background styles. See wxWindow::SetBackgroundStyle
|
||||||
|
@@ -31,10 +31,16 @@
|
|||||||
@style{wxOK_DEFAULT}
|
@style{wxOK_DEFAULT}
|
||||||
Makes the "OK" button default, this is the default behaviour and
|
Makes the "OK" button default, this is the default behaviour and
|
||||||
this flag exists solely for symmetry with @c wxCANCEL_DEFAULT.
|
this flag exists solely for symmetry with @c wxCANCEL_DEFAULT.
|
||||||
|
@style{wxICON_NONE}
|
||||||
|
Displays no icon in the dialog if possible (an icon might still be
|
||||||
|
displayed if the current platform mandates its use). This style may be
|
||||||
|
used to prevent the dialog from using the default icon based on @c
|
||||||
|
wxYES_NO presence as explained in @c wxICON_QUESTION and @c
|
||||||
|
wxICON_INFORMATION documentation below.
|
||||||
@style{wxICON_EXCLAMATION}
|
@style{wxICON_EXCLAMATION}
|
||||||
Displays an exclamation mark symbol.
|
Displays an exclamation, or warning, icon in the dialog.
|
||||||
@style{wxICON_ERROR}
|
@style{wxICON_ERROR}
|
||||||
Displays an error symbol.
|
Displays an error icon in the dialog.
|
||||||
@style{wxICON_HAND}
|
@style{wxICON_HAND}
|
||||||
Displays an error symbol, this is a MSW-inspired synonym for @c wxICON_ERROR.
|
Displays an error symbol, this is a MSW-inspired synonym for @c wxICON_ERROR.
|
||||||
@style{wxICON_QUESTION}
|
@style{wxICON_QUESTION}
|
||||||
|
@@ -2458,12 +2458,14 @@ TestMessageBoxDialog::TestMessageBoxDialog(wxWindow *parent)
|
|||||||
|
|
||||||
// icon choice
|
// icon choice
|
||||||
const wxString icons[] = {
|
const wxString icons[] = {
|
||||||
"&Information", "&Question", "&Warning", "&Error"
|
"&None", "&Information", "&Question", "&Warning", "&Error"
|
||||||
};
|
};
|
||||||
|
|
||||||
m_icons = new wxRadioBox(this, wxID_ANY, "&Icon:",
|
m_icons = new wxRadioBox(this, wxID_ANY, "&Icons",
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
WXSIZEOF(icons), icons);
|
WXSIZEOF(icons), icons);
|
||||||
|
// Make the 'Information' icon the default one:
|
||||||
|
m_icons->SetSelection(1);
|
||||||
sizerTop->Add(m_icons, wxSizerFlags().Expand().Border());
|
sizerTop->Add(m_icons, wxSizerFlags().Expand().Border());
|
||||||
|
|
||||||
|
|
||||||
@@ -2524,10 +2526,11 @@ void TestMessageBoxDialog::OnApply(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
switch ( m_icons->GetSelection() )
|
switch ( m_icons->GetSelection() )
|
||||||
{
|
{
|
||||||
case 0: style |= wxICON_INFORMATION; break;
|
case 0: style |= wxICON_NONE; break;
|
||||||
case 1: style |= wxICON_QUESTION; break;
|
case 1: style |= wxICON_INFORMATION; break;
|
||||||
case 2: style |= wxICON_WARNING; break;
|
case 2: style |= wxICON_QUESTION; break;
|
||||||
case 3: style |= wxICON_ERROR; break;
|
case 3: style |= wxICON_WARNING; break;
|
||||||
|
case 4: style |= wxICON_ERROR; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_chkCentre->IsChecked() )
|
if ( m_chkCentre->IsChecked() )
|
||||||
|
@@ -1283,14 +1283,14 @@ wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt)
|
|||||||
int wxMessageBox(const wxString& message, const wxString& caption, long style,
|
int wxMessageBox(const wxString& message, const wxString& caption, long style,
|
||||||
wxWindow *parent, int WXUNUSED(x), int WXUNUSED(y) )
|
wxWindow *parent, int WXUNUSED(x), int WXUNUSED(y) )
|
||||||
{
|
{
|
||||||
long decorated_style = style;
|
// add the appropriate icon unless this was explicitly disabled by use of
|
||||||
|
// wxICON_NONE
|
||||||
if ( ( style & ( wxICON_EXCLAMATION | wxICON_HAND | wxICON_INFORMATION | wxICON_QUESTION ) ) == 0 )
|
if ( !(style & wxICON_NONE) && !(style & wxICON_MASK) )
|
||||||
{
|
{
|
||||||
decorated_style |= ( style & wxYES ) ? wxICON_QUESTION : wxICON_INFORMATION ;
|
style |= style & wxYES ? wxICON_QUESTION : wxICON_INFORMATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMessageDialog dialog(parent, message, caption, decorated_style);
|
wxMessageDialog dialog(parent, message, caption, style);
|
||||||
|
|
||||||
int ans = dialog.ShowModal();
|
int ans = dialog.ShowModal();
|
||||||
switch ( ans )
|
switch ( ans )
|
||||||
|
@@ -86,7 +86,9 @@ void wxMessageDialog::GTKCreateMsgDialog()
|
|||||||
|
|
||||||
#if wxUSE_LIBHILDON
|
#if wxUSE_LIBHILDON
|
||||||
const char *stockIcon;
|
const char *stockIcon;
|
||||||
if ( m_dialogStyle & wxICON_ERROR )
|
if ( m_dialogStyle & wxICON_NONE )
|
||||||
|
stockIcon = "";
|
||||||
|
else if ( m_dialogStyle & wxICON_ERROR )
|
||||||
stockIcon = "qgn_note_gene_syserror";
|
stockIcon = "qgn_note_gene_syserror";
|
||||||
else if ( m_dialogStyle & wxICON_EXCLAMATION )
|
else if ( m_dialogStyle & wxICON_EXCLAMATION )
|
||||||
stockIcon = "qgn_note_gene_syswarning";
|
stockIcon = "qgn_note_gene_syswarning";
|
||||||
@@ -127,6 +129,11 @@ void wxMessageDialog::GTKCreateMsgDialog()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __WXGTK210__
|
||||||
|
if ( gtk_check_version(2, 10, 0) == NULL && (m_dialogStyle & wxICON_NONE))
|
||||||
|
type = GTK_MESSAGE_OTHER;
|
||||||
|
else
|
||||||
|
#endif // __WXGTK210__
|
||||||
if (m_dialogStyle & wxICON_EXCLAMATION)
|
if (m_dialogStyle & wxICON_EXCLAMATION)
|
||||||
type = GTK_MESSAGE_WARNING;
|
type = GTK_MESSAGE_WARNING;
|
||||||
else if (m_dialogStyle & wxICON_ERROR)
|
else if (m_dialogStyle & wxICON_ERROR)
|
||||||
@@ -137,7 +144,8 @@ void wxMessageDialog::GTKCreateMsgDialog()
|
|||||||
type = GTK_MESSAGE_QUESTION;
|
type = GTK_MESSAGE_QUESTION;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// GTK+ doesn't have a "typeless" msg box, so try to auto detect...
|
// if no style is explicitly specified, detect the suitable icon
|
||||||
|
// ourselves (this can be disabled by using wxICON_NONE)
|
||||||
type = m_dialogStyle & wxYES ? GTK_MESSAGE_QUESTION : GTK_MESSAGE_INFO;
|
type = m_dialogStyle & wxYES ? GTK_MESSAGE_QUESTION : GTK_MESSAGE_INFO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user