]>
Commit | Line | Data |
---|---|---|
ffecfa5a JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/palmos/dialog.h | |
3 | // Purpose: wxDialog class | |
4 | // Author: William Osborne | |
5 | // Modified by: | |
6 | // Created: 10/13/04 | |
7 | // RCS-ID: $Id: | |
8 | // Copyright: (c) William Osborne | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_DIALOG_H_ | |
13 | #define _WX_DIALOG_H_ | |
14 | ||
15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) | |
16 | #pragma interface "dialog.h" | |
17 | #endif | |
18 | ||
19 | #include "wx/panel.h" | |
20 | ||
21 | WXDLLEXPORT_DATA(extern const wxChar*) wxDialogNameStr; | |
22 | ||
23 | class WXDLLEXPORT wxDialogModalData; | |
24 | ||
25 | // Dialog boxes | |
26 | class WXDLLEXPORT wxDialog : public wxDialogBase | |
27 | { | |
28 | public: | |
29 | wxDialog() { Init(); } | |
30 | ||
31 | // full ctor | |
32 | wxDialog(wxWindow *parent, wxWindowID id, | |
33 | const wxString& title, | |
34 | const wxPoint& pos = wxDefaultPosition, | |
35 | const wxSize& size = wxDefaultSize, | |
36 | long style = wxDEFAULT_DIALOG_STYLE, | |
37 | const wxString& name = wxDialogNameStr) | |
38 | { | |
39 | Init(); | |
40 | ||
41 | (void)Create(parent, id, title, pos, size, style, name); | |
42 | } | |
43 | ||
44 | bool Create(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 | virtual ~wxDialog(); | |
52 | ||
53 | // return true if we're showing the dialog modally | |
54 | virtual bool IsModal() const { return m_modalData != NULL; } | |
55 | ||
56 | // show the dialog modally and return the value passed to EndModal() | |
57 | virtual int ShowModal(); | |
58 | ||
59 | // may be called to terminate the dialog with the given return code | |
60 | virtual void EndModal(int retCode); | |
61 | ||
62 | // implementation only from now on | |
63 | // ------------------------------- | |
64 | ||
65 | // override some base class virtuals | |
66 | virtual bool Show(bool show = TRUE); | |
67 | ||
68 | virtual void Raise(); | |
69 | ||
70 | // event handlers | |
71 | void OnCharHook(wxKeyEvent& event); | |
72 | void OnCloseWindow(wxCloseEvent& event); | |
73 | ||
74 | // Standard buttons | |
75 | void OnOK(wxCommandEvent& event); | |
76 | void OnApply(wxCommandEvent& event); | |
77 | void OnCancel(wxCommandEvent& event); | |
78 | ||
79 | // Responds to colour changes | |
80 | void OnSysColourChanged(wxSysColourChangedEvent& event); | |
81 | ||
82 | // Windows callbacks | |
83 | WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); | |
84 | ||
85 | #if wxUSE_CTL3D | |
86 | virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, | |
87 | WXUINT message, WXWPARAM wParam, WXLPARAM lParam); | |
88 | #endif // wxUSE_CTL3D | |
89 | ||
90 | // obsolete methods | |
91 | // ---------------- | |
92 | ||
93 | // use the other ctor | |
94 | wxDEPRECATED( wxDialog(wxWindow *parent, | |
95 | const wxString& title, bool modal, | |
96 | int x = -1, int y= -1, int width = 500, int height = 500, | |
97 | long style = wxDEFAULT_DIALOG_STYLE, | |
98 | const wxString& name = wxDialogNameStr) ); | |
99 | ||
100 | // just call Show() or ShowModal() | |
101 | wxDEPRECATED( void SetModal(bool flag) ); | |
102 | ||
103 | // use IsModal() | |
104 | wxDEPRECATED( bool IsModalShowing() const ); | |
105 | ||
106 | protected: | |
107 | // find the window to use as parent for this dialog if none has been | |
108 | // specified explicitly by the user | |
109 | // | |
110 | // may return NULL | |
111 | wxWindow *FindSuitableParent() const; | |
112 | ||
113 | // common part of all ctors | |
114 | void Init(); | |
115 | ||
116 | private: | |
117 | wxWindow* m_oldFocus; | |
118 | bool m_endModalCalled; // allow for closing within InitDialog | |
119 | ||
120 | // this pointer is non-NULL only while the modal event loop is running | |
121 | wxDialogModalData *m_modalData; | |
122 | ||
123 | ||
124 | DECLARE_DYNAMIC_CLASS(wxDialog) | |
125 | DECLARE_EVENT_TABLE() | |
126 | DECLARE_NO_COPY_CLASS(wxDialog) | |
127 | }; | |
128 | ||
129 | #endif | |
130 | // _WX_DIALOG_H_ |