1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/dialog.h
3 // Purpose: wxDialog class
4 // Author: Julian Smart
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
16 // this option is always enabled (there doesn't seem to be any good reason to
17 // disable it) for desktop Windows versions but Windows CE dialogs are usually
18 // not resizable and never show resize gripper anyhow so don't use it there
20 #define wxUSE_DIALOG_SIZEGRIP 0
22 #define wxUSE_DIALOG_SIZEGRIP 1
25 extern WXDLLIMPEXP_DATA_CORE(const char) wxDialogNameStr
[];
27 class WXDLLIMPEXP_FWD_CORE wxDialogModalData
;
29 #if wxUSE_TOOLBAR && (defined(__SMARTPHONE__) || defined(__POCKETPC__))
30 class WXDLLIMPEXP_FWD_CORE wxToolBar
;
31 extern WXDLLIMPEXP_DATA_CORE(const char) wxToolBarNameStr
[];
35 class WXDLLIMPEXP_CORE wxDialog
: public wxDialogBase
38 wxDialog() { Init(); }
41 wxDialog(wxWindow
*parent
, wxWindowID id
,
42 const wxString
& title
,
43 const wxPoint
& pos
= wxDefaultPosition
,
44 const wxSize
& size
= wxDefaultSize
,
45 long style
= wxDEFAULT_DIALOG_STYLE
,
46 const wxString
& name
= wxDialogNameStr
)
50 (void)Create(parent
, id
, title
, pos
, size
, style
, name
);
53 bool Create(wxWindow
*parent
, wxWindowID id
,
54 const wxString
& title
,
55 const wxPoint
& pos
= wxDefaultPosition
,
56 const wxSize
& size
= wxDefaultSize
,
57 long style
= wxDEFAULT_DIALOG_STYLE
,
58 const wxString
& name
= wxDialogNameStr
);
62 // return true if we're showing the dialog modally
63 virtual bool IsModal() const { return m_modalData
!= NULL
; }
65 // show the dialog modally and return the value passed to EndModal()
66 virtual int ShowModal();
68 // may be called to terminate the dialog with the given return code
69 virtual void EndModal(int retCode
);
72 // we treat dialog toolbars specially under Windows CE
73 #if wxUSE_TOOLBAR && defined(__POCKETPC__)
74 // create main toolbar by calling OnCreateToolBar()
75 virtual wxToolBar
* CreateToolBar(long style
= -1,
76 wxWindowID winid
= wxID_ANY
,
77 const wxString
& name
= wxToolBarNameStr
);
78 // return a new toolbar
79 virtual wxToolBar
*OnCreateToolBar(long style
,
81 const wxString
& name
);
83 // get the main toolbar
84 wxToolBar
*GetToolBar() const { return m_dialogToolBar
; }
85 #endif // wxUSE_TOOLBAR && __POCKETPC__
88 // implementation only from now on
89 // -------------------------------
91 // override some base class virtuals
92 virtual bool Show(bool show
= true);
94 #if wxUSE_DIALOG_SIZEGRIP
95 virtual void SetWindowStyleFlag(long style
);
96 #endif // wxUSE_DIALOG_SIZEGRIP
99 // Responds to the OK button in a PocketPC titlebar. This
100 // can be overridden, or you can change the id used for
101 // sending the event with SetAffirmativeId. Returns false
102 // if the event was not processed.
107 WXLRESULT
MSWWindowProc(WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
);
110 // common part of all ctors
114 #if wxUSE_DIALOG_SIZEGRIP
115 // these functions deal with the gripper window shown in the corner of
117 void CreateGripper();
118 void DestroyGripper();
119 void ShowGripper(bool show
);
120 void ResizeGripper();
122 // this function is used to adjust Z-order of new children relative to the
123 // gripper if we have one
124 void OnWindowCreate(wxWindowCreateEvent
& event
);
126 // gripper window for a resizable dialog, NULL if we're not resizable
128 #endif // wxUSE_DIALOG_SIZEGRIP
130 #if wxUSE_TOOLBAR && defined(__POCKETPC__)
131 wxToolBar
* m_dialogToolBar
;
134 // this pointer is non-NULL only while the modal event loop is running
135 wxDialogModalData
*m_modalData
;
137 DECLARE_DYNAMIC_CLASS(wxDialog
)
138 wxDECLARE_NO_COPY_CLASS(wxDialog
);