1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/msw/richmsgdlg.cpp
3 // Purpose: wxRichMessageDialog
4 // Author: Rickard Westerlund
7 // Copyright: (c) 2010 wxWidgets team
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
20 #include "wx/richmsgdlg.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 #ifdef wxHAS_MSW_TASKDIALOG
37 using namespace wxMSWMessageDialog
;
39 if ( HasNativeTaskDialog() )
41 // create a task dialog
42 WinStruct
<TASKDIALOGCONFIG
> tdc
;
43 wxMSWTaskDialogConfig
wxTdc(*this);
45 wxTdc
.MSWCommonTaskDialogInit( tdc
);
48 if ( !m_checkBoxText
.empty() )
50 tdc
.pszVerificationText
= m_checkBoxText
.wx_str();
51 if ( m_checkBoxValue
)
52 tdc
.dwFlags
|= TDF_VERIFICATION_FLAG_CHECKED
;
55 // add collapsible footer
56 if ( !m_detailedText
.empty() )
57 tdc
.pszExpandedInformation
= m_detailedText
.wx_str();
59 TaskDialogIndirect_t taskDialogIndirect
= GetTaskDialogIndirectFunc();
60 if ( !taskDialogIndirect
)
63 // create the task dialog, process the answer and return it.
66 HRESULT hr
= taskDialogIndirect( &tdc
, &msAns
, NULL
, &checkBoxChecked
);
69 wxLogApiError( "TaskDialogIndirect", hr
);
72 m_checkBoxValue
= checkBoxChecked
!= FALSE
;
74 return MSWTranslateReturnCode( msAns
);
76 #endif // wxHAS_MSW_TASKDIALOG
78 // use the generic version when task dialog is't available at either
79 // compile or run-time.
80 return wxGenericRichMessageDialog::ShowModal();
83 #endif // wxUSE_RICHMSGDLG