1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/msw/richmsgdlg.cpp
3 // Purpose: wxRichMessageDialog
4 // Author: Rickard Westerlund
6 // Copyright: (c) 2010 wxWidgets team
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
19 #include "wx/richmsgdlg.h"
20 #include "wx/modalhook.h"
23 #include "wx/msw/private.h"
26 // This will define wxHAS_MSW_TASKDIALOG if we have support for it in the
28 #include "wx/msw/private/msgdlg.h"
30 // ----------------------------------------------------------------------------
31 // wxRichMessageDialog
32 // ----------------------------------------------------------------------------
34 int wxRichMessageDialog::ShowModal()
36 WX_HOOK_MODAL_DIALOG();
38 #ifdef wxHAS_MSW_TASKDIALOG
39 using namespace wxMSWMessageDialog
;
41 if ( HasNativeTaskDialog() )
43 // create a task dialog
44 WinStruct
<TASKDIALOGCONFIG
> tdc
;
45 wxMSWTaskDialogConfig
wxTdc(*this);
47 wxTdc
.MSWCommonTaskDialogInit( tdc
);
50 if ( !m_checkBoxText
.empty() )
52 tdc
.pszVerificationText
= m_checkBoxText
.t_str();
53 if ( m_checkBoxValue
)
54 tdc
.dwFlags
|= TDF_VERIFICATION_FLAG_CHECKED
;
57 // add collapsible footer
58 if ( !m_detailedText
.empty() )
59 tdc
.pszExpandedInformation
= m_detailedText
.t_str();
61 TaskDialogIndirect_t taskDialogIndirect
= GetTaskDialogIndirectFunc();
62 if ( !taskDialogIndirect
)
65 // create the task dialog, process the answer and return it.
68 HRESULT hr
= taskDialogIndirect( &tdc
, &msAns
, NULL
, &checkBoxChecked
);
71 wxLogApiError( "TaskDialogIndirect", hr
);
74 m_checkBoxValue
= checkBoxChecked
!= FALSE
;
76 return MSWTranslateReturnCode( msAns
);
78 #endif // wxHAS_MSW_TASKDIALOG
80 // use the generic version when task dialog is't available at either
81 // compile or run-time.
82 return wxGenericRichMessageDialog::ShowModal();
85 #endif // wxUSE_RICHMSGDLG