]>
Commit | Line | Data |
---|---|---|
2bda0e17 KB |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: dialog.h | |
3 | // Purpose: wxDialog class | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart and Markus Holzem | |
16f6dfd8 | 9 | // Licence: wxWindows license |
2bda0e17 KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
bbcdf8bc JS |
12 | #ifndef _WX_DIALOG_H_ |
13 | #define _WX_DIALOG_H_ | |
2bda0e17 KB |
14 | |
15 | #ifdef __GNUG__ | |
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 KB |
22 | |
23 | // Dialog boxes | |
c50f1fb9 | 24 | class WXDLLEXPORT wxDialog : public wxDialogBase |
2bda0e17 | 25 | { |
462e2437 | 26 | public: |
b0a6bb75 | 27 | wxDialog() { Init(); } |
16f6dfd8 | 28 | |
462e2437 VZ |
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) | |
35 | { | |
36 | long modalStyle = modal ? wxDIALOG_MODAL : wxDIALOG_MODELESS ; | |
37 | Create(parent, -1, title, wxPoint(x, y), wxSize(width, height), | |
38 | style | modalStyle, name); | |
39 | } | |
16f6dfd8 | 40 | |
462e2437 VZ |
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) | |
48 | { | |
49 | Create(parent, id, title, pos, size, style, name); | |
50 | } | |
16f6dfd8 | 51 | |
462e2437 VZ |
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); | |
16f6dfd8 | 58 | |
462e2437 | 59 | ~wxDialog(); |
16f6dfd8 | 60 | |
b6c588e1 | 61 | // override some base class virtuals |
462e2437 | 62 | virtual bool Destroy(); |
b6c588e1 VZ |
63 | virtual bool Show(bool show); |
64 | virtual void Iconize(bool iconize); | |
65 | virtual bool IsIconized() const; | |
16f6dfd8 | 66 | |
b6c588e1 | 67 | virtual bool IsTopLevel() const { return TRUE; } |
16f6dfd8 | 68 | |
b6c588e1 VZ |
69 | void SetModal(bool flag); |
70 | virtual bool IsModal() const; | |
16f6dfd8 | 71 | |
b6c588e1 VZ |
72 | // For now, same as Show(TRUE) but returns return code |
73 | virtual int ShowModal(); | |
74 | ||
75 | // may be called to terminate the dialog with the given return code | |
76 | virtual void EndModal(int retCode); | |
77 | ||
78 | // returns TRUE if we're in a modal loop | |
79 | bool IsModalShowing() const; | |
16f6dfd8 | 80 | |
2bda0e17 | 81 | #if WXWIN_COMPATIBILITY |
462e2437 | 82 | bool Iconized() const { return IsIconized(); }; |
2bda0e17 | 83 | #endif |
16f6dfd8 | 84 | |
c4d305b7 VZ |
85 | // wxMSW only: remove the "Close" button from the dialog |
86 | bool EnableCloseButton(bool enable = TRUE); | |
87 | ||
b6c588e1 VZ |
88 | // implementation only from now on |
89 | // ------------------------------- | |
16f6dfd8 | 90 | |
b6c588e1 | 91 | // event handlers |
462e2437 VZ |
92 | bool OnClose(); |
93 | void OnCharHook(wxKeyEvent& event); | |
462e2437 | 94 | void OnCloseWindow(wxCloseEvent& event); |
16f6dfd8 | 95 | |
462e2437 VZ |
96 | // Standard buttons |
97 | void OnOK(wxCommandEvent& event); | |
98 | void OnApply(wxCommandEvent& event); | |
99 | void OnCancel(wxCommandEvent& event); | |
16f6dfd8 | 100 | |
462e2437 VZ |
101 | // Responds to colour changes |
102 | void OnSysColourChanged(wxSysColourChangedEvent& event); | |
16f6dfd8 | 103 | |
b6c588e1 | 104 | // Windows callbacks |
42e69d6b VZ |
105 | long MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); |
106 | ||
b6c588e1 | 107 | #if wxUSE_CTL3D |
462e2437 VZ |
108 | virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, |
109 | WXUINT message, WXWPARAM wParam, WXLPARAM lParam); | |
b6c588e1 | 110 | #endif // wxUSE_CTL3D |
16f6dfd8 | 111 | |
dc1c4b62 | 112 | protected: |
b6c588e1 VZ |
113 | // override more base class virtuals |
114 | virtual void DoSetClientSize(int width, int height); | |
115 | virtual void DoGetPosition(int *x, int *y) const; | |
16f6dfd8 | 116 | |
b6c588e1 VZ |
117 | // show modal dialog and enter modal loop |
118 | void DoShowModal(); | |
16f6dfd8 | 119 | |
b0a6bb75 VZ |
120 | // common part of all ctors |
121 | void Init(); | |
122 | ||
dfe1eee3 | 123 | private: |
52a07708 VZ |
124 | wxWindow *m_oldFocus; |
125 | ||
b0a6bb75 VZ |
126 | // while we are showing a modal dialog we disable the other windows using |
127 | // this object | |
128 | class wxWindowDisabler *m_windowDisabler; | |
129 | ||
130 | DECLARE_DYNAMIC_CLASS(wxDialog) | |
462e2437 | 131 | DECLARE_EVENT_TABLE() |
2bda0e17 KB |
132 | }; |
133 | ||
134 | #endif | |
bbcdf8bc | 135 | // _WX_DIALOG_H_ |