added support for icon flags to wxGenericNotificationMessage
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50435 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -23,8 +23,9 @@ public:
|
|||||||
wxGenericNotificationMessage() { Init(); }
|
wxGenericNotificationMessage() { Init(); }
|
||||||
wxGenericNotificationMessage(const wxString& title,
|
wxGenericNotificationMessage(const wxString& title,
|
||||||
const wxString& message = wxString(),
|
const wxString& message = wxString(),
|
||||||
wxWindow *parent = NULL)
|
wxWindow *parent = NULL,
|
||||||
: wxNotificationMessageBase(title, message, parent)
|
int flags = wxICON_INFORMATION)
|
||||||
|
: wxNotificationMessageBase(title, message, parent, flags)
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
@@ -34,6 +34,8 @@
|
|||||||
#include "wx/timer.h"
|
#include "wx/timer.h"
|
||||||
#endif //WX_PRECOMP
|
#endif //WX_PRECOMP
|
||||||
|
|
||||||
|
#include "wx/artprov.h"
|
||||||
|
|
||||||
// even if the platform has the native implementation, we still normally want
|
// even if the platform has the native implementation, we still normally want
|
||||||
// to use the generic one (unless it's totally unsuitable for the target UI as
|
// to use the generic one (unless it's totally unsuitable for the target UI as
|
||||||
// is the case of Hildon) because it may provide more features, so include
|
// is the case of Hildon) because it may provide more features, so include
|
||||||
@@ -52,11 +54,13 @@ class wxNotificationMessageDialog : public wxDialog
|
|||||||
public:
|
public:
|
||||||
wxNotificationMessageDialog(wxWindow *parent,
|
wxNotificationMessageDialog(wxWindow *parent,
|
||||||
const wxString& text,
|
const wxString& text,
|
||||||
int timeout);
|
int timeout,
|
||||||
|
int flags);
|
||||||
|
|
||||||
void Set(wxWindow *parent,
|
void Set(wxWindow *parent,
|
||||||
const wxString& text,
|
const wxString& text,
|
||||||
int timeout);
|
int timeout,
|
||||||
|
int flags);
|
||||||
|
|
||||||
bool IsAutomatic() const { return m_timer.IsRunning(); }
|
bool IsAutomatic() const { return m_timer.IsRunning(); }
|
||||||
void SetDeleteOnHide() { m_deleteOnHide = true; }
|
void SetDeleteOnHide() { m_deleteOnHide = true; }
|
||||||
@@ -90,7 +94,8 @@ END_EVENT_TABLE()
|
|||||||
|
|
||||||
wxNotificationMessageDialog::wxNotificationMessageDialog(wxWindow *parent,
|
wxNotificationMessageDialog::wxNotificationMessageDialog(wxWindow *parent,
|
||||||
const wxString& text,
|
const wxString& text,
|
||||||
int timeout)
|
int timeout,
|
||||||
|
int flags)
|
||||||
: wxDialog(parent, wxID_ANY, _("Notice"),
|
: wxDialog(parent, wxID_ANY, _("Notice"),
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
0 /* no caption, no border styles */),
|
0 /* no caption, no border styles */),
|
||||||
@@ -98,16 +103,29 @@ wxNotificationMessageDialog::wxNotificationMessageDialog(wxWindow *parent,
|
|||||||
{
|
{
|
||||||
m_deleteOnHide = false;
|
m_deleteOnHide = false;
|
||||||
|
|
||||||
Set(parent, text, timeout);
|
Set(parent, text, timeout, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
wxNotificationMessageDialog::Set(wxWindow * WXUNUSED(parent),
|
wxNotificationMessageDialog::Set(wxWindow * WXUNUSED(parent),
|
||||||
const wxString& text,
|
const wxString& text,
|
||||||
int timeout)
|
int timeout,
|
||||||
|
int flags)
|
||||||
{
|
{
|
||||||
wxSizer *sizer = CreateTextSizer(text);
|
wxSizer * const sizerTop = new wxBoxSizer(wxHORIZONTAL);
|
||||||
SetSizerAndFit(sizer);
|
if ( flags & wxICON_MASK )
|
||||||
|
{
|
||||||
|
sizerTop->Add(new wxStaticBitmap
|
||||||
|
(
|
||||||
|
this,
|
||||||
|
wxID_ANY,
|
||||||
|
wxArtProvider::GetMessageBoxIcon(flags)
|
||||||
|
),
|
||||||
|
wxSizerFlags().Centre().Border());
|
||||||
|
}
|
||||||
|
|
||||||
|
sizerTop->Add(CreateTextSizer(text), wxSizerFlags(1).Border());
|
||||||
|
SetSizerAndFit(sizerTop);
|
||||||
|
|
||||||
if ( timeout != wxGenericNotificationMessage::Timeout_Never )
|
if ( timeout != wxGenericNotificationMessage::Timeout_Never )
|
||||||
{
|
{
|
||||||
@@ -194,12 +212,13 @@ bool wxGenericNotificationMessage::Show(int timeout)
|
|||||||
(
|
(
|
||||||
GetParent(),
|
GetParent(),
|
||||||
GetFullMessage(),
|
GetFullMessage(),
|
||||||
timeout
|
timeout,
|
||||||
|
GetFlags()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else // update the existing dialog
|
else // update the existing dialog
|
||||||
{
|
{
|
||||||
m_dialog->Set(GetParent(), GetFullMessage(), timeout);
|
m_dialog->Set(GetParent(), GetFullMessage(), timeout, GetFlags());
|
||||||
}
|
}
|
||||||
|
|
||||||
m_dialog->Show();
|
m_dialog->Show();
|
||||||
|
Reference in New Issue
Block a user