1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/dialog.h
3 // Purpose: wxDialog class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
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
19 // not resizable and never show resize gripper anyhow so don't use it there
21 #define wxUSE_DIALOG_SIZEGRIP 0
23 #define wxUSE_DIALOG_SIZEGRIP 1
26 extern WXDLLIMPEXP_DATA_CORE(const char) wxDialogNameStr
[];
28 class WXDLLIMPEXP_FWD_CORE wxDialogModalData
;
30 #if wxUSE_TOOLBAR && (defined(__SMARTPHONE__) || defined(__POCKETPC__))
31 class WXDLLIMPEXP_FWD_CORE wxToolBar
;
32 extern WXDLLIMPEXP_DATA_CORE(const char) wxToolBarNameStr
[];
36 class WXDLLIMPEXP_CORE wxDialog
: public wxDialogBase
39 wxDialog() { Init(); }
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
)
51 (void)Create(parent
, id
, title
, pos
, size
, style
, name
);
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
);
63 // return true if we're showing the dialog modally
64 virtual bool IsModal() const { return m_modalData
!= NULL
; }
66 // show the dialog modally and return the value passed to EndModal()
67 virtual int ShowModal();
69 // may be called to terminate the dialog with the given return code
70 virtual void EndModal(int retCode
);
73 // we treat dialog toolbars specially under Windows CE
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
,
82 const wxString
& name
);
84 // get the main toolbar
85 wxToolBar
*GetToolBar() const { return m_dialogToolBar
; }
86 #endif // wxUSE_TOOLBAR && __POCKETPC__
89 // implementation only from now on
90 // -------------------------------
92 // override some base class virtuals
93 virtual bool Show(bool show
= true);
97 #if wxUSE_DIALOG_SIZEGRIP
98 virtual void SetWindowStyleFlag(long style
);
99 #endif // wxUSE_DIALOG_SIZEGRIP
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.
110 WXLRESULT
MSWWindowProc(WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
);
113 // common part of all ctors
117 #if wxUSE_DIALOG_SIZEGRIP
118 // these functions deal with the gripper window shown in the corner of
120 void CreateGripper();
121 void DestroyGripper();
122 void ShowGripper(bool show
);
123 void ResizeGripper();
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
);
129 // gripper window for a resizable dialog, NULL if we're not resizable
131 #endif // wxUSE_DIALOG_SIZEGRIP
133 #if wxUSE_TOOLBAR && defined(__POCKETPC__)
134 wxToolBar
* m_dialogToolBar
;
137 // this pointer is non-NULL only while the modal event loop is running
138 wxDialogModalData
*m_modalData
;
140 DECLARE_DYNAMIC_CLASS(wxDialog
)
141 wxDECLARE_NO_COPY_CLASS(wxDialog
);