]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/private/msgdlg.h
Implement GetSizeFromTextSize() for wxSpinCtrl.
[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 enum { MAX_BUTTONS = 4 };
34
35 wxMSWTaskDialogConfig()
36 : buttons(new TASKDIALOG_BUTTON[MAX_BUTTONS]),
37 parent(NULL),
38 iconId(0),
39 style(0),
40 useCustomLabels(false)
41 { }
42
43 // initializes the object from a message dialog.
44 wxMSWTaskDialogConfig(const wxMessageDialogBase& dlg);
45
46 wxScopedArray<TASKDIALOG_BUTTON> buttons;
47 wxWindow *parent;
48 wxString caption;
49 wxString message;
50 wxString extendedMessage;
51 long iconId;
52 long style;
53 bool useCustomLabels;
54 wxString btnYesLabel;
55 wxString btnNoLabel;
56 wxString btnOKLabel;
57 wxString btnCancelLabel;
58 wxString btnHelpLabel;
59
60 // Will create a task dialog with it's paremeters for it's creation
61 // stored in the provided TASKDIALOGCONFIG parameter.
62 // NOTE: The wxMSWTaskDialogConfig object needs to remain accessible
63 // during the subsequent call to TaskDialogIndirect().
64 void MSWCommonTaskDialogInit(TASKDIALOGCONFIG &tdc);
65
66 // Used by MSWCommonTaskDialogInit() to add a regular button or a
67 // button with a custom label if used.
68 void AddTaskDialogButton(TASKDIALOGCONFIG &tdc,
69 int btnCustomId,
70 int btnCommonId,
71 const wxString& customLabel);
72 }; // class wxMSWTaskDialogConfig
73
74
75 typedef HRESULT (WINAPI *TaskDialogIndirect_t)(const TASKDIALOGCONFIG *,
76 int *, int *, BOOL *);
77
78 // Return the pointer to TaskDialogIndirect(). This should only be called
79 // if HasNativeTaskDialog() returned true and is normally guaranteed to
80 // succeed in this case.
81 TaskDialogIndirect_t GetTaskDialogIndirectFunc();
82 #endif // wxHAS_MSW_TASKDIALOG
83
84
85 // Check if the task dialog is available: this simply checks the OS version
86 // as we know that it's only present in Vista and later.
87 bool HasNativeTaskDialog();
88
89 // Translates standard MSW button IDs like IDCANCEL into an equivalent
90 // wx constant such as wxCANCEL.
91 int MSWTranslateReturnCode(int msAns);
92 }; // namespace wxMSWMessageDialog
93
94 #endif // _WX_MSW_PRIVATE_MSGDLG_H_