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