]>
Commit | Line | Data |
---|---|---|
ffecfa5a JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/palmos/dialog.h | |
3 | // Purpose: wxDialog class | |
e1d63b79 | 4 | // Author: William Osborne - minimal working wxPalmOS port |
ffecfa5a JS |
5 | // Modified by: |
6 | // Created: 10/13/04 | |
e1d63b79 | 7 | // RCS-ID: $Id$ |
ffecfa5a JS |
8 | // Copyright: (c) William Osborne |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_DIALOG_H_ | |
13 | #define _WX_DIALOG_H_ | |
14 | ||
ffecfa5a JS |
15 | #include "wx/panel.h" |
16 | ||
17 | WXDLLEXPORT_DATA(extern const wxChar*) wxDialogNameStr; | |
18 | ||
19 | class WXDLLEXPORT wxDialogModalData; | |
20 | ||
21 | // Dialog boxes | |
22 | class WXDLLEXPORT wxDialog : public wxDialogBase | |
23 | { | |
24 | public: | |
25 | wxDialog() { Init(); } | |
26 | ||
27 | // full ctor | |
28 | wxDialog(wxWindow *parent, wxWindowID id, | |
29 | const wxString& title, | |
30 | const wxPoint& pos = wxDefaultPosition, | |
31 | const wxSize& size = wxDefaultSize, | |
32 | long style = wxDEFAULT_DIALOG_STYLE, | |
33 | const wxString& name = wxDialogNameStr) | |
34 | { | |
35 | Init(); | |
36 | ||
37 | (void)Create(parent, id, title, pos, size, style, name); | |
38 | } | |
39 | ||
40 | bool Create(wxWindow *parent, wxWindowID id, | |
41 | const wxString& title, | |
42 | const wxPoint& pos = wxDefaultPosition, | |
43 | const wxSize& size = wxDefaultSize, | |
44 | long style = wxDEFAULT_DIALOG_STYLE, | |
45 | const wxString& name = wxDialogNameStr); | |
46 | ||
47 | virtual ~wxDialog(); | |
48 | ||
49 | // return true if we're showing the dialog modally | |
50 | virtual bool IsModal() const { return m_modalData != NULL; } | |
51 | ||
52 | // show the dialog modally and return the value passed to EndModal() | |
53 | virtual int ShowModal(); | |
54 | ||
55 | // may be called to terminate the dialog with the given return code | |
56 | virtual void EndModal(int retCode); | |
57 | ||
58 | // implementation only from now on | |
59 | // ------------------------------- | |
60 | ||
61 | // override some base class virtuals | |
324eeecb | 62 | virtual bool Show(bool show = true); |
ffecfa5a JS |
63 | |
64 | virtual void Raise(); | |
65 | ||
66 | // event handlers | |
67 | void OnCharHook(wxKeyEvent& event); | |
68 | void OnCloseWindow(wxCloseEvent& event); | |
69 | ||
70 | // Standard buttons | |
71 | void OnOK(wxCommandEvent& event); | |
72 | void OnApply(wxCommandEvent& event); | |
73 | void OnCancel(wxCommandEvent& event); | |
74 | ||
ffecfa5a JS |
75 | protected: |
76 | // find the window to use as parent for this dialog if none has been | |
77 | // specified explicitly by the user | |
78 | // | |
79 | // may return NULL | |
80 | wxWindow *FindSuitableParent() const; | |
81 | ||
82 | // common part of all ctors | |
83 | void Init(); | |
84 | ||
85 | private: | |
86 | wxWindow* m_oldFocus; | |
87 | bool m_endModalCalled; // allow for closing within InitDialog | |
88 | ||
89 | // this pointer is non-NULL only while the modal event loop is running | |
90 | wxDialogModalData *m_modalData; | |
91 | ||
92 | ||
93 | DECLARE_DYNAMIC_CLASS(wxDialog) | |
94 | DECLARE_EVENT_TABLE() | |
95 | DECLARE_NO_COPY_CLASS(wxDialog) | |
96 | }; | |
97 | ||
98 | #endif | |
99 | // _WX_DIALOG_H_ |