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 extern WXDLLIMPEXP_DATA_CORE(const char) wxDialogNameStr
[];
19 class WXDLLIMPEXP_FWD_CORE wxDialogModalData
;
21 #if wxUSE_TOOLBAR && (defined(__SMARTPHONE__) || defined(__POCKETPC__))
22 class WXDLLIMPEXP_FWD_CORE wxToolBar
;
23 extern WXDLLIMPEXP_DATA_CORE(const char) wxToolBarNameStr
[];
27 class WXDLLIMPEXP_CORE wxDialog
: public wxDialogBase
30 wxDialog() { Init(); }
33 wxDialog(wxWindow
*parent
, wxWindowID id
,
34 const wxString
& title
,
35 const wxPoint
& pos
= wxDefaultPosition
,
36 const wxSize
& size
= wxDefaultSize
,
37 long style
= wxDEFAULT_DIALOG_STYLE
,
38 const wxString
& name
= wxDialogNameStr
)
42 (void)Create(parent
, id
, title
, pos
, size
, style
, name
);
45 bool Create(wxWindow
*parent
, wxWindowID id
,
46 const wxString
& title
,
47 const wxPoint
& pos
= wxDefaultPosition
,
48 const wxSize
& size
= wxDefaultSize
,
49 long style
= wxDEFAULT_DIALOG_STYLE
,
50 const wxString
& name
= wxDialogNameStr
);
54 // return true if we're showing the dialog modally
55 virtual bool IsModal() const { return m_modalData
!= NULL
; }
57 // show the dialog modally and return the value passed to EndModal()
58 virtual int ShowModal();
60 // may be called to terminate the dialog with the given return code
61 virtual void EndModal(int retCode
);
64 // we treat dialog toolbars specially under Windows CE
65 #if wxUSE_TOOLBAR && defined(__POCKETPC__)
66 // create main toolbar by calling OnCreateToolBar()
67 virtual wxToolBar
* CreateToolBar(long style
= -1,
68 wxWindowID winid
= wxID_ANY
,
69 const wxString
& name
= wxToolBarNameStr
);
70 // return a new toolbar
71 virtual wxToolBar
*OnCreateToolBar(long style
,
73 const wxString
& name
);
75 // get the main toolbar
76 wxToolBar
*GetToolBar() const { return m_dialogToolBar
; }
77 #endif // wxUSE_TOOLBAR && __POCKETPC__
80 // implementation only from now on
81 // -------------------------------
83 // override some base class virtuals
84 virtual bool Show(bool show
= true);
88 virtual void SetWindowStyleFlag(long style
);
91 // Responds to the OK button in a PocketPC titlebar. This
92 // can be overridden, or you can change the id used for
93 // sending the event with SetAffirmativeId. Returns false
94 // if the event was not processed.
99 WXLRESULT
MSWWindowProc(WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
);
102 // find the window to use as parent for this dialog if none has been
103 // specified explicitly by the user
106 wxWindow
*FindSuitableParent() const;
108 // common part of all ctors
111 // these functions deal with the gripper window shown in the corner of
112 // resizeable dialogs
113 void CreateGripper();
114 void DestroyGripper();
115 void ShowGripper(bool show
);
116 void ResizeGripper();
119 // this function is used to adjust Z-order of new children relative to the
120 // gripper if we have one
121 void OnWindowCreate(wxWindowCreateEvent
& event
);
124 wxWindow
* m_oldFocus
;
125 bool m_endModalCalled
; // allow for closing within InitDialog
127 #if wxUSE_TOOLBAR && defined(__POCKETPC__)
128 wxToolBar
* m_dialogToolBar
;
131 // this pointer is non-NULL only while the modal event loop is running
132 wxDialogModalData
*m_modalData
;
134 // gripper window for a resizable dialog, NULL if we're not resizable
137 DECLARE_DYNAMIC_CLASS(wxDialog
)
138 DECLARE_NO_COPY_CLASS(wxDialog
)