]>
Commit | Line | Data |
---|---|---|
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 | #ifndef WX_PRECOMP | |
23 | #include "wx/msw/private.h" | |
24 | #endif | |
25 | ||
26 | // This will define wxHAS_MSW_TASKDIALOG if we have support for it in the | |
27 | // headers we use. | |
28 | #include "wx/msw/private/msgdlg.h" | |
29 | ||
30 | // ---------------------------------------------------------------------------- | |
31 | // wxRichMessageDialog | |
32 | // ---------------------------------------------------------------------------- | |
33 | ||
34 | int wxRichMessageDialog::ShowModal() | |
35 | { | |
36 | #ifdef wxHAS_MSW_TASKDIALOG | |
37 | using namespace wxMSWMessageDialog; | |
38 | ||
39 | if ( HasNativeTaskDialog() ) | |
40 | { | |
41 | // create a task dialog | |
42 | WinStruct<TASKDIALOGCONFIG> tdc; | |
43 | wxMSWTaskDialogConfig wxTdc(*this); | |
44 | ||
45 | wxTdc.MSWCommonTaskDialogInit( tdc ); | |
46 | ||
47 | // add a checkbox | |
48 | if ( !m_checkBoxText.empty() ) | |
49 | { | |
50 | tdc.pszVerificationText = m_checkBoxText.t_str(); | |
51 | if ( m_checkBoxValue ) | |
52 | tdc.dwFlags |= TDF_VERIFICATION_FLAG_CHECKED; | |
53 | } | |
54 | ||
55 | // add collapsible footer | |
56 | if ( !m_detailedText.empty() ) | |
57 | tdc.pszExpandedInformation = m_detailedText.t_str(); | |
58 | ||
59 | TaskDialogIndirect_t taskDialogIndirect = GetTaskDialogIndirectFunc(); | |
60 | if ( !taskDialogIndirect ) | |
61 | return wxID_CANCEL; | |
62 | ||
63 | // create the task dialog, process the answer and return it. | |
64 | BOOL checkBoxChecked; | |
65 | int msAns; | |
66 | HRESULT hr = taskDialogIndirect( &tdc, &msAns, NULL, &checkBoxChecked ); | |
67 | if ( FAILED(hr) ) | |
68 | { | |
69 | wxLogApiError( "TaskDialogIndirect", hr ); | |
70 | return wxID_CANCEL; | |
71 | } | |
72 | m_checkBoxValue = checkBoxChecked != FALSE; | |
73 | ||
74 | return MSWTranslateReturnCode( msAns ); | |
75 | } | |
76 | #endif // wxHAS_MSW_TASKDIALOG | |
77 | ||
78 | // use the generic version when task dialog is't available at either | |
79 | // compile or run-time. | |
80 | return wxGenericRichMessageDialog::ShowModal(); | |
81 | } | |
82 | ||
83 | #endif // wxUSE_RICHMSGDLG |