]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/private/msgdlg.h
Provide a task-dialog based wxMSW wxMessageDialog implementation.
[wxWidgets.git] / include / wx / msw / private / msgdlg.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/private/msgdlg.h
3 // Purpose: helper functions used with native message dialog
4 // Author: Rickard Westerlund
5 // Created: 2010-07-12
6 // RCS-ID: $Id$
7 // Copyright: (c) 2010 wxWidgets team
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_MSW_PRIVATE_MSGDLG_H_
12 #define _WX_MSW_PRIVATE_MSGDLG_H_
13
14 #include "wx/msw/wrapcctl.h"
15 #include "wx/scopedarray.h"
16
17 // Macro to help identify if task dialogs are available: we rely on
18 // TD_WARNING_ICON being defined in the headers for this as this symbol is used
19 // by the task dialogs only. Also notice that task dialogs are available for
20 // Unicode applications only.
21 #if defined(TD_WARNING_ICON) && wxUSE_UNICODE
22 #define wxHAS_MSW_TASKDIALOG
23 #endif
24
25 // Provides methods for creating a task dialog.
26 namespace wxMSWMessageDialog
27 {
28
29 #ifdef wxHAS_MSW_TASKDIALOG
30 class wxMSWTaskDialogConfig
31 {
32 public:
33 wxMSWTaskDialogConfig()
34 : buttons(new TASKDIALOG_BUTTON[3]),
35 parent(NULL),
36 iconId(0),
37 style(0),
38 useCustomLabels(false)
39 { }
40
41 // initializes the object from a message dialog.
42 wxMSWTaskDialogConfig(const wxMessageDialogBase& dlg);
43
44 wxScopedArray<TASKDIALOG_BUTTON> buttons;
45 wxWindow *parent;
46 wxString caption;
47 wxString message;
48 wxString extendedMessage;
49 long iconId;
50 long style;
51 bool useCustomLabels;
52 wxString btnYesLabel;
53 wxString btnNoLabel;
54 wxString btnOKLabel;
55 wxString btnCancelLabel;
56
57 // Will create a task dialog with it's paremeters for it's creation
58 // stored in the provided TASKDIALOGCONFIG parameter.
59 // NOTE: The wxMSWTaskDialogConfig object needs to remain accessible
60 // during the subsequent call to TaskDialogIndirect().
61 void MSWCommonTaskDialogInit(TASKDIALOGCONFIG &tdc);
62
63 // Used by MSWCommonTaskDialogInit() to add a regular button or a
64 // button with a custom label if used.
65 void AddTaskDialogButton(TASKDIALOGCONFIG &tdc,
66 int btnCustomId,
67 int btnCommonId,
68 const wxString& customLabel);
69 }; // class wxMSWTaskDialogConfig
70
71
72 typedef HRESULT (WINAPI *TaskDialogIndirect_t)(const TASKDIALOGCONFIG *,
73 int *, int *, BOOL *);
74
75 // Return the pointer to TaskDialogIndirect(). This should only be called
76 // if HasNativeTaskDialog() returned true and is normally guaranteed to
77 // succeed in this case.
78 TaskDialogIndirect_t GetTaskDialogIndirectFunc();
79 #endif // wxHAS_MSW_TASKDIALOG
80
81
82 // Check if the task dialog is available: this simply checks the OS version
83 // as we know that it's only present in Vista and later.
84 bool HasNativeTaskDialog();
85
86 // Translates standard MSW button IDs like IDCANCEL into an equivalent
87 // wx constant such as wxCANCEL.
88 int MSWTranslateReturnCode(int msAns);
89 }; // namespace wxMSWMessageDialog
90
91 #endif // _WX_MSW_PRIVATE_MSGDLG_H_