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