]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/dialog.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/dialog.h
3 // Purpose: wxDialog class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
16 #pragma interface "dialog.h"
21 WXDLLEXPORT_DATA(extern const wxChar
*) wxDialogNameStr
;
24 class WXDLLEXPORT wxDialog
: public wxDialogBase
27 wxDialog() { Init(); }
29 // Constructor with a modal flag, but no window id - the old convention
30 wxDialog(wxWindow
*parent
,
31 const wxString
& title
, bool modal
,
32 int x
= -1, int y
= -1, int width
= 500, int height
= 500,
33 long style
= wxDEFAULT_DIALOG_STYLE
,
34 const wxString
& name
= wxDialogNameStr
)
36 long modalStyle
= modal
? wxDIALOG_MODAL
: wxDIALOG_MODELESS
;
37 Create(parent
, -1, title
, wxPoint(x
, y
), wxSize(width
, height
),
38 style
| modalStyle
, name
);
41 // Constructor with no modal flag - the new convention.
42 wxDialog(wxWindow
*parent
, wxWindowID id
,
43 const wxString
& title
,
44 const wxPoint
& pos
= wxDefaultPosition
,
45 const wxSize
& size
= wxDefaultSize
,
46 long style
= wxDEFAULT_DIALOG_STYLE
,
47 const wxString
& name
= wxDialogNameStr
)
49 Create(parent
, id
, title
, pos
, size
, style
, name
);
52 bool Create(wxWindow
*parent
, wxWindowID id
,
53 const wxString
& title
,
54 const wxPoint
& pos
= wxDefaultPosition
,
55 const wxSize
& size
= wxDefaultSize
,
56 long style
= wxDEFAULT_DIALOG_STYLE
,
57 const wxString
& name
= wxDialogNameStr
);
61 void SetModal(bool flag
);
62 virtual bool IsModal() const;
64 // For now, same as Show(TRUE) but returns return code
65 virtual int ShowModal();
67 // may be called to terminate the dialog with the given return code
68 virtual void EndModal(int retCode
);
70 // returns TRUE if we're in a modal loop
71 bool IsModalShowing() const;
73 // wxMSW only: remove the "Close" button from the dialog
74 bool EnableCloseButton(bool enable
= TRUE
);
76 // implementation only from now on
77 // -------------------------------
79 // override some base class virtuals
80 virtual bool Show(bool show
);
84 void OnCharHook(wxKeyEvent
& event
);
85 void OnCloseWindow(wxCloseEvent
& event
);
88 void OnOK(wxCommandEvent
& event
);
89 void OnApply(wxCommandEvent
& event
);
90 void OnCancel(wxCommandEvent
& event
);
92 // Responds to colour changes
93 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
96 long MSWWindowProc(WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
);
99 virtual WXHBRUSH
OnCtlColor(WXHDC pDC
, WXHWND pWnd
, WXUINT nCtlColor
,
100 WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
);
101 #endif // wxUSE_CTL3D
104 // show modal dialog and enter modal loop
107 // common part of all ctors
111 wxWindow
*m_oldFocus
;
113 // while we are showing a modal dialog we disable the other windows using
115 class wxWindowDisabler
*m_windowDisabler
;
117 DECLARE_DYNAMIC_CLASS(wxDialog
)
118 DECLARE_EVENT_TABLE()