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 resizeable 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 virtual void SetWindowStyleFlag(long style
);
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.
108 WXLRESULT
MSWWindowProc(WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
);
111 // common part of all ctors
115 #if wxUSE_DIALOG_SIZEGRIP
116 // these functions deal with the gripper window shown in the corner of
117 // resizeable dialogs
118 void CreateGripper();
119 void DestroyGripper();
120 void ShowGripper(bool show
);
121 void ResizeGripper();
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
);
127 // gripper window for a resizable dialog, NULL if we're not resizable
129 #endif // wxUSE_DIALOG_SIZEGRIP
131 #if wxUSE_TOOLBAR && defined(__POCKETPC__)
132 wxToolBar
* m_dialogToolBar
;
135 // this pointer is non-NULL only while the modal event loop is running
136 wxDialogModalData
*m_modalData
;
138 DECLARE_DYNAMIC_CLASS(wxDialog
)
139 wxDECLARE_NO_COPY_CLASS(wxDialog
);