]>
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 | 8 | // Copyright: (c) Julian Smart |
65571936 | 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 | ||
ef359b43 | 21 | extern WXDLLEXPORT_DATA(const wxChar*) wxDialogNameStr; |
2bda0e17 | 22 | |
6757b5e3 | 23 | class WXDLLEXPORT wxDialogModalData; |
2b5f62a0 | 24 | |
ec5f0c24 JS |
25 | #if wxUSE_TOOLBAR && (defined(__SMARTPHONE__) || defined(__POCKETPC__)) |
26 | class WXDLLEXPORT wxToolBar; | |
27 | #endif | |
28 | ||
2bda0e17 | 29 | // Dialog boxes |
c50f1fb9 | 30 | class WXDLLEXPORT wxDialog : public wxDialogBase |
2bda0e17 | 31 | { |
462e2437 | 32 | public: |
b0a6bb75 | 33 | wxDialog() { Init(); } |
16f6dfd8 | 34 | |
f46f4c86 | 35 | // full ctor |
462e2437 VZ |
36 | wxDialog(wxWindow *parent, wxWindowID id, |
37 | const wxString& title, | |
38 | const wxPoint& pos = wxDefaultPosition, | |
39 | const wxSize& size = wxDefaultSize, | |
40 | long style = wxDEFAULT_DIALOG_STYLE, | |
41 | const wxString& name = wxDialogNameStr) | |
42 | { | |
00233716 VZ |
43 | Init(); |
44 | ||
45 | (void)Create(parent, id, title, pos, size, style, name); | |
462e2437 | 46 | } |
16f6dfd8 | 47 | |
462e2437 VZ |
48 | bool Create(wxWindow *parent, wxWindowID id, |
49 | const wxString& title, | |
50 | const wxPoint& pos = wxDefaultPosition, | |
51 | const wxSize& size = wxDefaultSize, | |
52 | long style = wxDEFAULT_DIALOG_STYLE, | |
53 | const wxString& name = wxDialogNameStr); | |
16f6dfd8 | 54 | |
82c9f85c | 55 | virtual ~wxDialog(); |
16f6dfd8 | 56 | |
f46f4c86 VZ |
57 | // return true if we're showing the dialog modally |
58 | virtual bool IsModal() const { return m_modalData != NULL; } | |
16f6dfd8 | 59 | |
f46f4c86 | 60 | // show the dialog modally and return the value passed to EndModal() |
b6c588e1 VZ |
61 | virtual int ShowModal(); |
62 | ||
63 | // may be called to terminate the dialog with the given return code | |
64 | virtual void EndModal(int retCode); | |
65 | ||
ec5f0c24 JS |
66 | #if wxUSE_TOOLBAR && defined(__POCKETPC__) |
67 | // create main toolbar by calling OnCreateToolBar() | |
68 | virtual wxToolBar* CreateToolBar(long style = -1, | |
69 | wxWindowID winid = wxID_ANY, | |
70 | const wxString& name = wxToolBarNameStr); | |
71 | // return a new toolbar | |
72 | virtual wxToolBar *OnCreateToolBar(long style, | |
73 | wxWindowID winid, | |
74 | const wxString& name ); | |
75 | ||
76 | // get the main toolbar | |
77 | wxToolBar *GetToolBar() const { return m_dialogToolBar; } | |
78 | #endif | |
79 | ||
b6c588e1 VZ |
80 | // implementation only from now on |
81 | // ------------------------------- | |
16f6dfd8 | 82 | |
82c9f85c | 83 | // override some base class virtuals |
d71cc120 | 84 | virtual bool Show(bool show = true); |
82c9f85c | 85 | |
313901f3 JS |
86 | virtual void Raise(); |
87 | ||
b6c588e1 | 88 | // event handlers |
462e2437 | 89 | void OnCharHook(wxKeyEvent& event); |
462e2437 | 90 | void OnCloseWindow(wxCloseEvent& event); |
16f6dfd8 | 91 | |
462e2437 VZ |
92 | // Standard buttons |
93 | void OnOK(wxCommandEvent& event); | |
94 | void OnApply(wxCommandEvent& event); | |
95 | void OnCancel(wxCommandEvent& event); | |
16f6dfd8 | 96 | |
462e2437 VZ |
97 | // Responds to colour changes |
98 | void OnSysColourChanged(wxSysColourChangedEvent& event); | |
16f6dfd8 | 99 | |
9ceeecb9 JS |
100 | #ifdef __POCKETPC__ |
101 | // Responds to the OK button in a PocketPC titlebar. This | |
102 | // can be overridden, or you can change the id used for | |
103 | // sending the event with SetAffirmativeId. Returns false | |
104 | // if the event was not processed. | |
105 | virtual bool DoOK(); | |
106 | #endif | |
107 | ||
b6c588e1 | 108 | // Windows callbacks |
c140b7e7 | 109 | WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); |
42e69d6b | 110 | |
f46f4c86 VZ |
111 | // obsolete methods |
112 | // ---------------- | |
113 | ||
114 | // use the other ctor | |
115 | wxDEPRECATED( wxDialog(wxWindow *parent, | |
116 | const wxString& title, bool modal, | |
d71cc120 | 117 | int x = wxDefaultCoord, int y = wxDefaultCoord, int width = 500, int height = 500, |
f46f4c86 VZ |
118 | long style = wxDEFAULT_DIALOG_STYLE, |
119 | const wxString& name = wxDialogNameStr) ); | |
120 | ||
121 | // just call Show() or ShowModal() | |
122 | wxDEPRECATED( void SetModal(bool flag) ); | |
123 | ||
124 | // use IsModal() | |
125 | wxDEPRECATED( bool IsModalShowing() const ); | |
126 | ||
dc1c4b62 | 127 | protected: |
a543e3ce VZ |
128 | // find the window to use as parent for this dialog if none has been |
129 | // specified explicitly by the user | |
130 | // | |
131 | // may return NULL | |
132 | wxWindow *FindSuitableParent() const; | |
133 | ||
b0a6bb75 VZ |
134 | // common part of all ctors |
135 | void Init(); | |
136 | ||
12b58624 VZ |
137 | // end either modal or modeless dialog |
138 | void EndDialog(int rc); | |
139 | ||
dfe1eee3 | 140 | private: |
1a33ac8f JS |
141 | wxWindow* m_oldFocus; |
142 | bool m_endModalCalled; // allow for closing within InitDialog | |
52a07708 | 143 | |
ec5f0c24 JS |
144 | #if wxUSE_TOOLBAR && defined(__POCKETPC__) |
145 | wxToolBar* m_dialogToolBar; | |
146 | #endif | |
147 | ||
6757b5e3 VZ |
148 | // this pointer is non-NULL only while the modal event loop is running |
149 | wxDialogModalData *m_modalData; | |
150 | ||
b0a6bb75 | 151 | DECLARE_DYNAMIC_CLASS(wxDialog) |
462e2437 | 152 | DECLARE_EVENT_TABLE() |
22f3361e | 153 | DECLARE_NO_COPY_CLASS(wxDialog) |
2bda0e17 KB |
154 | }; |
155 | ||
156 | #endif | |
bbcdf8bc | 157 | // _WX_DIALOG_H_ |