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"
21 #include "wx/testing.h"
24 #include "wx/msw/private.h"
27 // This will define wxHAS_MSW_TASKDIALOG if we have support for it in the
29 #include "wx/msw/private/msgdlg.h"
31 // ----------------------------------------------------------------------------
32 // wxRichMessageDialog
33 // ----------------------------------------------------------------------------
35 int wxRichMessageDialog::ShowModal()
37 WX_TESTING_SHOW_MODAL_HOOK();
39 #ifdef wxHAS_MSW_TASKDIALOG
40 using namespace wxMSWMessageDialog
;
42 if ( HasNativeTaskDialog() )
44 // create a task dialog
45 WinStruct
<TASKDIALOGCONFIG
> tdc
;
46 wxMSWTaskDialogConfig
wxTdc(*this);
48 wxTdc
.MSWCommonTaskDialogInit( tdc
);
51 if ( !m_checkBoxText
.empty() )
53 tdc
.pszVerificationText
= m_checkBoxText
.t_str();
54 if ( m_checkBoxValue
)
55 tdc
.dwFlags
|= TDF_VERIFICATION_FLAG_CHECKED
;
58 // add collapsible footer
59 if ( !m_detailedText
.empty() )
60 tdc
.pszExpandedInformation
= m_detailedText
.t_str();
62 TaskDialogIndirect_t taskDialogIndirect
= GetTaskDialogIndirectFunc();
63 if ( !taskDialogIndirect
)
66 // create the task dialog, process the answer and return it.
69 HRESULT hr
= taskDialogIndirect( &tdc
, &msAns
, NULL
, &checkBoxChecked
);
72 wxLogApiError( "TaskDialogIndirect", hr
);
75 m_checkBoxValue
= checkBoxChecked
!= FALSE
;
77 return MSWTranslateReturnCode( msAns
);
79 #endif // wxHAS_MSW_TASKDIALOG
81 // use the generic version when task dialog is't available at either
82 // compile or run-time.
83 return wxGenericRichMessageDialog::ShowModal();
86 #endif // wxUSE_RICHMSGDLG