]>
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 | DECLARE_DYNAMIC_CLASS(wxDialog) |
2bda0e17 | 27 | |
462e2437 VZ |
28 | public: |
29 | wxDialog(); | |
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 | |
462e2437 | 61 | ~wxDialog(); |
16f6dfd8 | 62 | |
b6c588e1 | 63 | // override some base class virtuals |
462e2437 | 64 | virtual bool Destroy(); |
b6c588e1 VZ |
65 | virtual bool Show(bool show); |
66 | virtual void Iconize(bool iconize); | |
67 | virtual bool IsIconized() const; | |
16f6dfd8 | 68 | |
b6c588e1 | 69 | virtual bool IsTopLevel() const { return TRUE; } |
16f6dfd8 | 70 | |
b6c588e1 VZ |
71 | void SetModal(bool flag); |
72 | virtual bool IsModal() const; | |
16f6dfd8 | 73 | |
b6c588e1 VZ |
74 | // For now, same as Show(TRUE) but returns return code |
75 | virtual int ShowModal(); | |
76 | ||
77 | // may be called to terminate the dialog with the given return code | |
78 | virtual void EndModal(int retCode); | |
79 | ||
80 | // returns TRUE if we're in a modal loop | |
81 | bool IsModalShowing() const; | |
16f6dfd8 | 82 | |
2bda0e17 | 83 | #if WXWIN_COMPATIBILITY |
462e2437 | 84 | bool Iconized() const { return IsIconized(); }; |
2bda0e17 | 85 | #endif |
16f6dfd8 | 86 | |
b6c588e1 VZ |
87 | // implementation only from now on |
88 | // ------------------------------- | |
16f6dfd8 | 89 | |
b6c588e1 | 90 | // event handlers |
462e2437 VZ |
91 | bool OnClose(); |
92 | void OnCharHook(wxKeyEvent& event); | |
462e2437 | 93 | void OnCloseWindow(wxCloseEvent& event); |
16f6dfd8 | 94 | |
462e2437 VZ |
95 | // Standard buttons |
96 | void OnOK(wxCommandEvent& event); | |
97 | void OnApply(wxCommandEvent& event); | |
98 | void OnCancel(wxCommandEvent& event); | |
16f6dfd8 | 99 | |
462e2437 VZ |
100 | // Responds to colour changes |
101 | void OnSysColourChanged(wxSysColourChangedEvent& event); | |
16f6dfd8 | 102 | |
b6c588e1 | 103 | // Windows callbacks |
42e69d6b VZ |
104 | long MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); |
105 | ||
b6c588e1 | 106 | #if wxUSE_CTL3D |
462e2437 VZ |
107 | virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, |
108 | WXUINT message, WXWPARAM wParam, WXLPARAM lParam); | |
b6c588e1 | 109 | #endif // wxUSE_CTL3D |
16f6dfd8 | 110 | |
dc1c4b62 | 111 | protected: |
b6c588e1 VZ |
112 | // override more base class virtuals |
113 | virtual void DoSetClientSize(int width, int height); | |
114 | virtual void DoGetPosition(int *x, int *y) const; | |
16f6dfd8 | 115 | |
b6c588e1 VZ |
116 | // show modal dialog and enter modal loop |
117 | void DoShowModal(); | |
16f6dfd8 | 118 | |
dfe1eee3 | 119 | private: |
52a07708 VZ |
120 | wxWindow *m_oldFocus; |
121 | ||
462e2437 | 122 | DECLARE_EVENT_TABLE() |
2bda0e17 KB |
123 | }; |
124 | ||
125 | #endif | |
bbcdf8bc | 126 | // _WX_DIALOG_H_ |