1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        wx/msw/msgdlg.h
3 // Purpose:     wxMessageDialog class
4 // Author:      Julian Smart
5 // Modified by:
6 // Created:     01/02/97
7 // Copyright:   (c) Julian Smart
8 // Licence:     wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10 
11 #ifndef _WX_MSGBOXDLG_H_
12 #define _WX_MSGBOXDLG_H_
13 
14 class WXDLLIMPEXP_CORE wxMessageDialog : public wxMessageDialogBase
15 {
16 public:
17     wxMessageDialog(wxWindow *parent,
18                     const wxString& message,
19                     const wxString& caption = wxASCII_STR(wxMessageBoxCaptionStr),
20                     long style = wxOK|wxCENTRE,
21                     const wxPoint& WXUNUSED(pos) = wxDefaultPosition)
wxMessageDialogBase(parent,message,caption,style)22         : wxMessageDialogBase(parent, message, caption, style)
23     {
24         m_hook = NULL;
25     }
26 
27     virtual int ShowModal() wxOVERRIDE;
28 
29     virtual long GetEffectiveIcon() const wxOVERRIDE;
30 
31     // implementation-specific
32 
33     // return the font used for the text in the message box
34     static wxFont GetMessageFont();
35 
36 protected:
37     // Override this as task dialogs are always centered on parent.
38     virtual void DoCentre(int dir) wxOVERRIDE;
39 
40 private:
41     // hook procedure used to adjust the message box beyond what the standard
42     // MessageBox() function can do for us
43     static WXLRESULT wxCALLBACK HookFunction(int code, WXWPARAM, WXLPARAM);
44 
45     static const struct ButtonAccessors
46     {
47         int id;
48         wxString (wxMessageDialog::*getter)() const;
49     } ms_buttons[];
50 
51     // replace the static text control with a text control in order to show
52     // scrollbar (and also, incidentally, allow text selection)
53     void ReplaceStaticWithEdit();
54 
55     // adjust the button labels
56     //
57     // this is called from HookFunction() and our HWND is valid at this moment
58     void AdjustButtonLabels();
59 
60     // offset all buttons starting from the first one given by dx to the right
61     void OffsetButtonsStartingFrom(int first, int dx);
62 
63     // used by ShowModal() to display a message box when task dialogs
64     // aren't available.
65     int ShowMessageBox();
66 
67 
68     WXHANDLE m_hook; // HHOOK used to position the message box
69 
70     wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxMessageDialog);
71 };
72 
73 
74 #endif // _WX_MSGBOXDLG_H_
75