1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
/////////////////////////////////////////////////////////////////////////////
// Name: src/msw/richmsgdlg.cpp
// Purpose: wxRichMessageDialog
// Author: Rickard Westerlund
// Created: 2010-07-04
// RCS-ID: $Id: richmsgdlg.cpp 71640 2012-06-03 19:16:59Z VZ $
// Copyright: (c) 2010 wxWidgets team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#if wxUSE_RICHMSGDLG
#include "wx/richmsgdlg.h"
#ifndef WX_PRECOMP
#include "wx/msw/private.h"
#endif
// This will define wxHAS_MSW_TASKDIALOG if we have support for it in the
// headers we use.
#include "wx/msw/private/msgdlg.h"
// ----------------------------------------------------------------------------
// wxRichMessageDialog
// ----------------------------------------------------------------------------
int wxRichMessageDialog::ShowModal()
{
#ifdef wxHAS_MSW_TASKDIALOG
using namespace wxMSWMessageDialog;
if ( HasNativeTaskDialog() )
{
// create a task dialog
WinStruct<TASKDIALOGCONFIG> tdc;
wxMSWTaskDialogConfig wxTdc(*this);
wxTdc.MSWCommonTaskDialogInit( tdc );
// add a checkbox
if ( !m_checkBoxText.empty() )
{
tdc.pszVerificationText = m_checkBoxText.t_str();
if ( m_checkBoxValue )
tdc.dwFlags |= TDF_VERIFICATION_FLAG_CHECKED;
}
// add collapsible footer
if ( !m_detailedText.empty() )
tdc.pszExpandedInformation = m_detailedText.t_str();
TaskDialogIndirect_t taskDialogIndirect = GetTaskDialogIndirectFunc();
if ( !taskDialogIndirect )
return wxID_CANCEL;
// create the task dialog, process the answer and return it.
BOOL checkBoxChecked;
int msAns;
HRESULT hr = taskDialogIndirect( &tdc, &msAns, NULL, &checkBoxChecked );
if ( FAILED(hr) )
{
wxLogApiError( "TaskDialogIndirect", hr );
return wxID_CANCEL;
}
m_checkBoxValue = checkBoxChecked != FALSE;
return MSWTranslateReturnCode( msAns );
}
#endif // wxHAS_MSW_TASKDIALOG
// use the generic version when task dialog is't available at either
// compile or run-time.
return wxGenericRichMessageDialog::ShowModal();
}
#endif // wxUSE_RICHMSGDLG
|