Make wxAppProgressIndicator actually usable.

First of all, do define it under non-MSW platforms.

Second, don't crash in it when running under XP where wxTaskBarButton is not
available.

Also add IsAvailable() method to check for its availability explicitly and add
a demonstration of this class to the dialogs sample.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77706 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-09-14 23:58:26 +00:00
parent 03e245091f
commit 28516f5643
7 changed files with 92 additions and 10 deletions

View File

@@ -60,6 +60,8 @@
#include "wx/progdlg.h"
#endif // wxUSE_PROGRESSDLG
#include "wx/appprogress.h"
#if wxUSE_ABOUTDLG
#include "wx/aboutdlg.h"
@@ -220,6 +222,8 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(DIALOGS_PROGRESS, MyFrame::ShowProgress)
#endif // wxUSE_PROGRESSDLG
EVT_MENU(DIALOGS_APP_PROGRESS, MyFrame::ShowAppProgress)
#if wxUSE_ABOUTDLG
EVT_MENU(DIALOGS_ABOUTDLG_SIMPLE, MyFrame::ShowSimpleAboutDialog)
EVT_MENU(DIALOGS_ABOUTDLG_FANCY, MyFrame::ShowFancyAboutDialog)
@@ -466,6 +470,8 @@ bool MyApp::OnInit()
info_menu->Append(DIALOGS_PROGRESS, wxT("Pro&gress dialog\tCtrl-G"));
#endif // wxUSE_PROGRESSDLG
info_menu->Append(DIALOGS_APP_PROGRESS, wxT("&App progress\tShift-Ctrl-G"));
#if wxUSE_BUSYINFO
info_menu->Append(DIALOGS_BUSYINFO, wxT("&Busy info dialog\tCtrl-B"));
#endif // wxUSE_BUSYINFO
@@ -2268,6 +2274,29 @@ void MyFrame::ShowProgress( wxCommandEvent& WXUNUSED(event) )
#endif // wxUSE_PROGRESSDLG
void MyFrame::ShowAppProgress( wxCommandEvent& WXUNUSED(event) )
{
wxAppProgressIndicator progress(this);
if ( !progress.IsAvailable() )
{
wxLogStatus("Progress indicator not available under this platform.");
return;
}
wxLogStatus("Using application progress indicator...");
const int range = 10;
progress.SetRange(range);
for ( int i = 0; i < range; i++ )
{
progress.SetValue(i);
wxMilliSleep(500);
}
wxLogStatus("Progress finished");
}
#if wxUSE_ABOUTDLG
static void InitAboutInfoMinimal(wxAboutDialogInfo& info)