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