]>
Commit | Line | Data |
---|---|---|
2bda0e17 | 1 | ///////////////////////////////////////////////////////////////////////////// |
82c9f85c | 2 | // Name: wx/msw/dialog.h |
2bda0e17 KB |
3 | // Purpose: wxDialog class |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
371a5b4e JS |
8 | // Copyright: (c) Julian Smart |
9 | // Licence: wxWindows licence | |
2bda0e17 KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
bbcdf8bc JS |
12 | #ifndef _WX_DIALOG_H_ |
13 | #define _WX_DIALOG_H_ | |
2bda0e17 | 14 | |
12028905 | 15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
462e2437 | 16 | #pragma interface "dialog.h" |
2bda0e17 KB |
17 | #endif |
18 | ||
19 | #include "wx/panel.h" | |
20 | ||
32c1cda2 | 21 | WXDLLEXPORT_DATA(extern const wxChar*) wxDialogNameStr; |
2bda0e17 | 22 | |
6757b5e3 | 23 | class WXDLLEXPORT wxDialogModalData; |
2b5f62a0 | 24 | |
2bda0e17 | 25 | // Dialog boxes |
c50f1fb9 | 26 | class WXDLLEXPORT wxDialog : public wxDialogBase |
2bda0e17 | 27 | { |
462e2437 | 28 | public: |
b0a6bb75 | 29 | wxDialog() { Init(); } |
16f6dfd8 | 30 | |
462e2437 VZ |
31 | // Constructor with a modal flag, but no window id - the old convention |
32 | wxDialog(wxWindow *parent, | |
33 | const wxString& title, bool modal, | |
34 | int x = -1, int y= -1, int width = 500, int height = 500, | |
35 | long style = wxDEFAULT_DIALOG_STYLE, | |
36 | const wxString& name = wxDialogNameStr) | |
37 | { | |
38 | long modalStyle = modal ? wxDIALOG_MODAL : wxDIALOG_MODELESS ; | |
39 | Create(parent, -1, title, wxPoint(x, y), wxSize(width, height), | |
40 | style | modalStyle, name); | |
41 | } | |
16f6dfd8 | 42 | |
462e2437 VZ |
43 | // Constructor with no modal flag - the new convention. |
44 | wxDialog(wxWindow *parent, wxWindowID id, | |
45 | const wxString& title, | |
46 | const wxPoint& pos = wxDefaultPosition, | |
47 | const wxSize& size = wxDefaultSize, | |
48 | long style = wxDEFAULT_DIALOG_STYLE, | |
49 | const wxString& name = wxDialogNameStr) | |
50 | { | |
51 | Create(parent, id, title, pos, size, style, name); | |
52 | } | |
16f6dfd8 | 53 | |
462e2437 VZ |
54 | bool Create(wxWindow *parent, wxWindowID id, |
55 | const wxString& title, | |
56 | const wxPoint& pos = wxDefaultPosition, | |
57 | const wxSize& size = wxDefaultSize, | |
58 | long style = wxDEFAULT_DIALOG_STYLE, | |
59 | const wxString& name = wxDialogNameStr); | |
16f6dfd8 | 60 | |
82c9f85c | 61 | virtual ~wxDialog(); |
16f6dfd8 | 62 | |
b6c588e1 VZ |
63 | void SetModal(bool flag); |
64 | virtual bool IsModal() const; | |
16f6dfd8 | 65 | |
b6c588e1 VZ |
66 | // For now, same as Show(TRUE) but returns return code |
67 | virtual int ShowModal(); | |
68 | ||
69 | // may be called to terminate the dialog with the given return code | |
70 | virtual void EndModal(int retCode); | |
71 | ||
72 | // returns TRUE if we're in a modal loop | |
73 | bool IsModalShowing() const; | |
16f6dfd8 | 74 | |
b6c588e1 VZ |
75 | // implementation only from now on |
76 | // ------------------------------- | |
16f6dfd8 | 77 | |
82c9f85c | 78 | // override some base class virtuals |
356c7bfa | 79 | virtual bool Show(bool show = TRUE); |
82c9f85c | 80 | |
313901f3 JS |
81 | virtual void Raise(); |
82 | ||
b6c588e1 | 83 | // event handlers |
462e2437 | 84 | void OnCharHook(wxKeyEvent& event); |
462e2437 | 85 | void OnCloseWindow(wxCloseEvent& event); |
16f6dfd8 | 86 | |
462e2437 VZ |
87 | // Standard buttons |
88 | void OnOK(wxCommandEvent& event); | |
89 | void OnApply(wxCommandEvent& event); | |
90 | void OnCancel(wxCommandEvent& event); | |
16f6dfd8 | 91 | |
462e2437 VZ |
92 | // Responds to colour changes |
93 | void OnSysColourChanged(wxSysColourChangedEvent& event); | |
16f6dfd8 | 94 | |
b6c588e1 | 95 | // Windows callbacks |
42e69d6b VZ |
96 | long MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); |
97 | ||
b6c588e1 | 98 | #if wxUSE_CTL3D |
462e2437 VZ |
99 | virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, |
100 | WXUINT message, WXWPARAM wParam, WXLPARAM lParam); | |
b6c588e1 | 101 | #endif // wxUSE_CTL3D |
16f6dfd8 | 102 | |
dc1c4b62 | 103 | protected: |
a543e3ce VZ |
104 | // find the window to use as parent for this dialog if none has been |
105 | // specified explicitly by the user | |
106 | // | |
107 | // may return NULL | |
108 | wxWindow *FindSuitableParent() const; | |
109 | ||
b6c588e1 VZ |
110 | // show modal dialog and enter modal loop |
111 | void DoShowModal(); | |
16f6dfd8 | 112 | |
b0a6bb75 VZ |
113 | // common part of all ctors |
114 | void Init(); | |
115 | ||
dfe1eee3 | 116 | private: |
52a07708 VZ |
117 | wxWindow *m_oldFocus; |
118 | ||
6757b5e3 VZ |
119 | // this pointer is non-NULL only while the modal event loop is running |
120 | wxDialogModalData *m_modalData; | |
121 | ||
b0a6bb75 VZ |
122 | |
123 | DECLARE_DYNAMIC_CLASS(wxDialog) | |
462e2437 | 124 | DECLARE_EVENT_TABLE() |
22f3361e | 125 | DECLARE_NO_COPY_CLASS(wxDialog) |
2bda0e17 KB |
126 | }; |
127 | ||
128 | #endif | |
bbcdf8bc | 129 | // _WX_DIALOG_H_ |