本文整理汇总了C++中wxWebEvent::GetFilename方法的典型用法代码示例。如果您正苦于以下问题:C++ wxWebEvent::GetFilename方法的具体用法?C++ wxWebEvent::GetFilename怎么用?C++ wxWebEvent::GetFilename使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxWebEvent
的用法示例。
在下文中一共展示了wxWebEvent::GetFilename方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnInitDownload
void MyFrame::OnInitDownload(wxWebEvent& evt)
{
// TODO: add download status indicator and option
// to open content in the browser
// note: this handler gets called when content is
// available to download; the content can be handled
// as follows:
// evt.SetDownloadAction(wxWEB_DOWNLOAD_OPEN); // open content
// evt.SetDownloadAction(wxWEB_DOWNLOAD_SAVEAS); // save content
// evt.SetDownloadAction(wxWEB_DOWNLOAD_CANCEL); // cancel the operation
// here, we'll allow the user to download it or cancel
// the operation
// get the filename
wxString filename = evt.GetFilename();
wxMessageDialog dlg(this,
wxString::Format(wxT("Would you like to download %s?"), (const wxChar*)filename.c_str()),
wxT("Download File"),
wxYES_NO);
int result = dlg.ShowModal();
switch (result)
{
case wxID_YES:
{
wxString filter;
filter += _("All Files");
filter += wxT(" (*.*)|*.*");
wxFileDialog dlg(this,
_("Save As"),
wxT(""),
filename,
filter,
wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
if (dlg.ShowModal() != wxID_OK)
{
evt.SetDownloadAction(wxWEB_DOWNLOAD_CANCEL);
return;
}
wxWebProgressBase* listener = new wxWebProgressBase;
evt.SetDownloadAction(wxWEB_DOWNLOAD_SAVEAS);
evt.SetDownloadTarget(dlg.GetPath());
evt.SetDownloadListener(listener);
}
break;
case wxID_NO:
evt.SetDownloadAction(wxWEB_DOWNLOAD_CANCEL);
break;
}
}