]>
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 | |
2bda0e17 KB |
15 | #include "wx/panel.h" |
16 | ||
40636dcb VZ |
17 | // this option is always enabled (there doesn't seem to be any good reason to |
18 | // disable it) for desktop Windows versions but Windows CE dialogs are usually | |
d13b34d3 | 19 | // not resizable and never show resize gripper anyhow so don't use it there |
40636dcb VZ |
20 | #ifdef __WXWINCE__ |
21 | #define wxUSE_DIALOG_SIZEGRIP 0 | |
22 | #else | |
23 | #define wxUSE_DIALOG_SIZEGRIP 1 | |
24 | #endif | |
25 | ||
53a2db12 | 26 | extern WXDLLIMPEXP_DATA_CORE(const char) wxDialogNameStr[]; |
2bda0e17 | 27 | |
b5dbe15d | 28 | class WXDLLIMPEXP_FWD_CORE wxDialogModalData; |
2b5f62a0 | 29 | |
ec5f0c24 | 30 | #if wxUSE_TOOLBAR && (defined(__SMARTPHONE__) || defined(__POCKETPC__)) |
b5dbe15d | 31 | class WXDLLIMPEXP_FWD_CORE wxToolBar; |
53a2db12 | 32 | extern WXDLLIMPEXP_DATA_CORE(const char) wxToolBarNameStr[]; |
ec5f0c24 JS |
33 | #endif |
34 | ||
2bda0e17 | 35 | // Dialog boxes |
53a2db12 | 36 | class WXDLLIMPEXP_CORE wxDialog : public wxDialogBase |
2bda0e17 | 37 | { |
462e2437 | 38 | public: |
b0a6bb75 | 39 | wxDialog() { Init(); } |
16f6dfd8 | 40 | |
f46f4c86 | 41 | // full ctor |
462e2437 VZ |
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 | { | |
00233716 VZ |
49 | Init(); |
50 | ||
51 | (void)Create(parent, id, title, pos, size, style, name); | |
462e2437 | 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 | |
82c9f85c | 61 | virtual ~wxDialog(); |
16f6dfd8 | 62 | |
f46f4c86 VZ |
63 | // return true if we're showing the dialog modally |
64 | virtual bool IsModal() const { return m_modalData != NULL; } | |
16f6dfd8 | 65 | |
f46f4c86 | 66 | // show the dialog modally and return the value passed to EndModal() |
b6c588e1 VZ |
67 | virtual int ShowModal(); |
68 | ||
69 | // may be called to terminate the dialog with the given return code | |
70 | virtual void EndModal(int retCode); | |
71 | ||
a141e018 VZ |
72 | |
73 | // we treat dialog toolbars specially under Windows CE | |
ec5f0c24 JS |
74 | #if wxUSE_TOOLBAR && defined(__POCKETPC__) |
75 | // create main toolbar by calling OnCreateToolBar() | |
76 | virtual wxToolBar* CreateToolBar(long style = -1, | |
77 | wxWindowID winid = wxID_ANY, | |
78 | const wxString& name = wxToolBarNameStr); | |
79 | // return a new toolbar | |
80 | virtual wxToolBar *OnCreateToolBar(long style, | |
81 | wxWindowID winid, | |
82 | const wxString& name ); | |
83 | ||
84 | // get the main toolbar | |
85 | wxToolBar *GetToolBar() const { return m_dialogToolBar; } | |
a141e018 VZ |
86 | #endif // wxUSE_TOOLBAR && __POCKETPC__ |
87 | ||
ec5f0c24 | 88 | |
b6c588e1 VZ |
89 | // implementation only from now on |
90 | // ------------------------------- | |
16f6dfd8 | 91 | |
82c9f85c | 92 | // override some base class virtuals |
d71cc120 | 93 | virtual bool Show(bool show = true); |
82c9f85c | 94 | |
8ba1d512 | 95 | #if wxUSE_DIALOG_SIZEGRIP |
2c66581e | 96 | virtual void SetWindowStyleFlag(long style); |
8ba1d512 | 97 | #endif // wxUSE_DIALOG_SIZEGRIP |
2c66581e | 98 | |
9ceeecb9 JS |
99 | #ifdef __POCKETPC__ |
100 | // Responds to the OK button in a PocketPC titlebar. This | |
101 | // can be overridden, or you can change the id used for | |
102 | // sending the event with SetAffirmativeId. Returns false | |
103 | // if the event was not processed. | |
104 | virtual bool DoOK(); | |
105 | #endif | |
106 | ||
b6c588e1 | 107 | // Windows callbacks |
c140b7e7 | 108 | WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); |
42e69d6b | 109 | |
dc1c4b62 | 110 | protected: |
b0a6bb75 VZ |
111 | // common part of all ctors |
112 | void Init(); | |
113 | ||
40636dcb VZ |
114 | private: |
115 | #if wxUSE_DIALOG_SIZEGRIP | |
2c66581e | 116 | // these functions deal with the gripper window shown in the corner of |
d13b34d3 | 117 | // resizable dialogs |
2c66581e VZ |
118 | void CreateGripper(); |
119 | void DestroyGripper(); | |
120 | void ShowGripper(bool show); | |
121 | void ResizeGripper(); | |
122 | ||
eddc468e VZ |
123 | // this function is used to adjust Z-order of new children relative to the |
124 | // gripper if we have one | |
125 | void OnWindowCreate(wxWindowCreateEvent& event); | |
126 | ||
40636dcb VZ |
127 | // gripper window for a resizable dialog, NULL if we're not resizable |
128 | WXHWND m_hGripper; | |
129 | #endif // wxUSE_DIALOG_SIZEGRIP | |
130 | ||
ec5f0c24 JS |
131 | #if wxUSE_TOOLBAR && defined(__POCKETPC__) |
132 | wxToolBar* m_dialogToolBar; | |
133 | #endif | |
134 | ||
6757b5e3 VZ |
135 | // this pointer is non-NULL only while the modal event loop is running |
136 | wxDialogModalData *m_modalData; | |
137 | ||
b0a6bb75 | 138 | DECLARE_DYNAMIC_CLASS(wxDialog) |
c0c133e1 | 139 | wxDECLARE_NO_COPY_CLASS(wxDialog); |
2bda0e17 KB |
140 | }; |
141 | ||
142 | #endif | |
bbcdf8bc | 143 | // _WX_DIALOG_H_ |