]>
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 | |
313901f3 JS |
95 | virtual void Raise(); |
96 | ||
8ba1d512 | 97 | #if wxUSE_DIALOG_SIZEGRIP |
2c66581e | 98 | virtual void SetWindowStyleFlag(long style); |
8ba1d512 | 99 | #endif // wxUSE_DIALOG_SIZEGRIP |
2c66581e | 100 | |
9ceeecb9 JS |
101 | #ifdef __POCKETPC__ |
102 | // Responds to the OK button in a PocketPC titlebar. This | |
103 | // can be overridden, or you can change the id used for | |
104 | // sending the event with SetAffirmativeId. Returns false | |
105 | // if the event was not processed. | |
106 | virtual bool DoOK(); | |
107 | #endif | |
108 | ||
b6c588e1 | 109 | // Windows callbacks |
c140b7e7 | 110 | WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); |
42e69d6b | 111 | |
dc1c4b62 | 112 | protected: |
b0a6bb75 VZ |
113 | // common part of all ctors |
114 | void Init(); | |
115 | ||
40636dcb VZ |
116 | private: |
117 | #if wxUSE_DIALOG_SIZEGRIP | |
2c66581e | 118 | // these functions deal with the gripper window shown in the corner of |
d13b34d3 | 119 | // resizable dialogs |
2c66581e VZ |
120 | void CreateGripper(); |
121 | void DestroyGripper(); | |
122 | void ShowGripper(bool show); | |
123 | void ResizeGripper(); | |
124 | ||
eddc468e VZ |
125 | // this function is used to adjust Z-order of new children relative to the |
126 | // gripper if we have one | |
127 | void OnWindowCreate(wxWindowCreateEvent& event); | |
128 | ||
40636dcb VZ |
129 | // gripper window for a resizable dialog, NULL if we're not resizable |
130 | WXHWND m_hGripper; | |
131 | #endif // wxUSE_DIALOG_SIZEGRIP | |
132 | ||
ec5f0c24 JS |
133 | #if wxUSE_TOOLBAR && defined(__POCKETPC__) |
134 | wxToolBar* m_dialogToolBar; | |
135 | #endif | |
136 | ||
6757b5e3 VZ |
137 | // this pointer is non-NULL only while the modal event loop is running |
138 | wxDialogModalData *m_modalData; | |
139 | ||
b0a6bb75 | 140 | DECLARE_DYNAMIC_CLASS(wxDialog) |
c0c133e1 | 141 | wxDECLARE_NO_COPY_CLASS(wxDialog); |
2bda0e17 KB |
142 | }; |
143 | ||
144 | #endif | |
bbcdf8bc | 145 | // _WX_DIALOG_H_ |