added wxNotificationMessage and implemented it generically and natively for Maemo

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50205 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-11-24 01:56:13 +00:00
parent c52b96359b
commit e36a173933
29 changed files with 1086 additions and 11 deletions

View File

@@ -29,6 +29,7 @@
#include "wx/imaglist.h"
#include "wx/minifram.h"
#include "wx/sysopt.h"
#include "wx/notifmsg.h"
#if wxUSE_COLOURDLG
#include "wx/colordlg.h"
@@ -219,10 +220,16 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(DIALOGS_PROPERTY_SHEET, MyFrame::OnPropertySheet)
EVT_MENU(DIALOGS_PROPERTY_SHEET_TOOLBOOK, MyFrame::OnPropertySheet)
EVT_MENU(DIALOGS_PROPERTY_SHEET_BUTTONTOOLBOOK, MyFrame::OnPropertySheet)
#endif
#endif // USE_SETTINGS_DIALOG
EVT_MENU(DIALOGS_STANDARD_BUTTON_SIZER_DIALOG, MyFrame::OnStandardButtonsSizerDialog)
EVT_MENU(DIALOGS_REQUEST, MyFrame::OnRequestUserAttention)
#if wxUSE_NOTIFICATION_MESSAGE
EVT_MENU(DIALOGS_NOTIFY_AUTO, MyFrame::OnNotifMsgAuto)
EVT_MENU(DIALOGS_NOTIFY_SHOW, MyFrame::OnNotifMsgShow)
EVT_MENU(DIALOGS_NOTIFY_HIDE, MyFrame::OnNotifMsgHide)
#endif // wxUSE_NOTIFICATION_MESSAGE
EVT_MENU(wxID_EXIT, MyFrame::OnExit)
END_EVENT_TABLE()
@@ -422,9 +429,16 @@ bool MyApp::OnInit()
menuDlg->Append(wxID_ANY, _T("&Property sheets"), sheet_menu);
#endif // USE_SETTINGS_DIALOG
menuDlg->Append(DIALOGS_STANDARD_BUTTON_SIZER_DIALOG, _T("&Standard Buttons Sizer Dialog"));
wxMenu *menuNotif = new wxMenu;
menuNotif->Append(DIALOGS_REQUEST, _T("&Request user attention\tCtrl-R"));
#if wxUSE_NOTIFICATION_MESSAGE
menuNotif->Append(DIALOGS_NOTIFY_AUTO, "&Automatically hidden notification");
menuNotif->Append(DIALOGS_NOTIFY_SHOW, "&Show manual notification");
menuNotif->Append(DIALOGS_NOTIFY_HIDE, "&Hide manual notification");
#endif // wxUSE_NOTIFICATION_MESSAGE
menuDlg->AppendSubMenu(menuNotif, "&User notifications");
menuDlg->Append(DIALOGS_REQUEST, _T("&Request user attention\tCtrl-R"));
menuDlg->Append(DIALOGS_STANDARD_BUTTON_SIZER_DIALOG, _T("&Standard Buttons Sizer Dialog"));
menuDlg->AppendSeparator();
menuDlg->Append(wxID_EXIT, _T("E&xit\tAlt-X"));
@@ -483,11 +497,22 @@ MyFrame::MyFrame(wxWindow *parent,
}
#endif // wxUSE_COLOURDLG
#if wxUSE_NOTIFICATION_MESSAGE
m_notifMsg = NULL;
#endif // wxUSE_NOTIFICATION_MESSAGE
#if wxUSE_STATUSBAR
CreateStatusBar();
#endif // wxUSE_STATUSBAR
}
MyFrame::~MyFrame()
{
#if wxUSE_NOTIFICATION_MESSAGE
delete m_notifMsg;
#endif // wxUSE_NOTIFICATION_MESSAGE
}
#if wxUSE_COLOURDLG
void MyFrame::ChooseColour(wxCommandEvent& WXUNUSED(event))
@@ -1147,6 +1172,50 @@ void MyFrame::OnRequestUserAttention(wxCommandEvent& WXUNUSED(event))
RequestUserAttention(wxUSER_ATTENTION_ERROR);
}
#if wxUSE_NOTIFICATION_MESSAGE
void MyFrame::OnNotifMsgAuto(wxCommandEvent& WXUNUSED(event))
{
if ( !wxNotificationMessage
(
"Automatic Notification",
"Nothing important has happened\n"
"this notification will disappear soon."
).Show() )
{
wxLogStatus("Failed to show notification message");
}
}
void MyFrame::OnNotifMsgShow(wxCommandEvent& WXUNUSED(event))
{
if ( !m_notifMsg )
{
m_notifMsg = new wxNotificationMessage
(
"wxWidgets Manual Notification",
"You can hide this notification from the menu",
this
);
}
if ( !m_notifMsg->Show(wxNotificationMessage::Timeout_Never) )
{
wxLogStatus("Failed to show manual notification message");
}
}
void MyFrame::OnNotifMsgHide(wxCommandEvent& WXUNUSED(event))
{
if ( m_notifMsg )
{
if ( !m_notifMsg->Close() )
wxLogStatus("Failed to hide manual notification message");
}
}
#endif // wxUSE_NOTIFICATION_MESSAGE
void MyFrame::OnStandardButtonsSizerDialog(wxCommandEvent& WXUNUSED(event))
{
StdButtonSizerDialog dialog(this);

View File

@@ -206,6 +206,7 @@ class MyFrame: public wxFrame
{
public:
MyFrame(wxWindow *parent, const wxString& title);
virtual ~MyFrame();
#if wxUSE_MSGDLG
void MessageBox(wxCommandEvent& event);
@@ -304,7 +305,14 @@ public:
#endif // USE_FONTDLG_GENERIC
void OnPropertySheet(wxCommandEvent& event);
void OnRequestUserAttention(wxCommandEvent& event);
#if wxUSE_NOTIFICATION_MESSAGE
void OnNotifMsgAuto(wxCommandEvent& event);
void OnNotifMsgShow(wxCommandEvent& event);
void OnNotifMsgHide(wxCommandEvent& event);
#endif // wxUSE_NOTIFICATION_MESSAGE
void OnStandardButtonsSizerDialog(wxCommandEvent& event);
void OnExit(wxCommandEvent& event);
@@ -324,6 +332,10 @@ private:
*m_dlgReplace;
#endif // wxUSE_FINDREPLDLG
#if wxUSE_NOTIFICATION_MESSAGE
wxNotificationMessage *m_notifMsg;
#endif // wxUSE_NOTIFICATION_MESSAGE
wxColourData m_clrData;
DECLARE_EVENT_TABLE()
@@ -384,6 +396,9 @@ enum
DIALOGS_FIND,
DIALOGS_REPLACE,
DIALOGS_REQUEST,
DIALOGS_NOTIFY_AUTO,
DIALOGS_NOTIFY_SHOW,
DIALOGS_NOTIFY_HIDE,
DIALOGS_PROPERTY_SHEET,
DIALOGS_PROPERTY_SHEET_TOOLBOOK,
DIALOGS_PROPERTY_SHEET_BUTTONTOOLBOOK,