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 WXDLLEXPORT_DATA(const wxChar
) wxDialogNameStr
[];
19 class WXDLLEXPORT wxDialogModalData
;
21 #if wxUSE_TOOLBAR && (defined(__SMARTPHONE__) || defined(__POCKETPC__))
22 class WXDLLEXPORT wxToolBar
;
23 extern WXDLLEXPORT_DATA(const wxChar
) wxToolBarNameStr
[];
27 class WXDLLEXPORT 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);
89 void OnCharHook(wxKeyEvent
& event
);
90 void OnCloseWindow(wxCloseEvent
& event
);
93 void OnOK(wxCommandEvent
& event
);
94 void OnApply(wxCommandEvent
& event
);
95 void OnCancel(wxCommandEvent
& event
);
97 // Responds to colour changes
98 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
101 // Responds to the OK button in a PocketPC titlebar. This
102 // can be overridden, or you can change the id used for
103 // sending the event with SetAffirmativeId. Returns false
104 // if the event was not processed.
109 WXLRESULT
MSWWindowProc(WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
);
111 #if WXWIN_COMPATIBILITY_2_6
112 // use the other ctor
113 wxDEPRECATED( wxDialog(wxWindow
*parent
,
114 const wxString
& title
, bool modal
,
115 int x
= wxDefaultCoord
, int y
= wxDefaultCoord
, int width
= 500, int height
= 500,
116 long style
= wxDEFAULT_DIALOG_STYLE
,
117 const wxString
& name
= wxDialogNameStr
) );
119 // just call Show() or ShowModal()
120 wxDEPRECATED( void SetModal(bool flag
) );
123 wxDEPRECATED( bool IsModalShowing() const );
124 #endif // WXWIN_COMPATIBILITY_2_6
126 // handle Escape here
127 virtual bool MSWProcessMessage(WXMSG
* pMsg
);
130 // find the window to use as parent for this dialog if none has been
131 // specified explicitly by the user
134 wxWindow
*FindSuitableParent() const;
136 // common part of all ctors
139 // end either modal or modeless dialog
140 void EndDialog(int rc
);
142 // emulate click of a button with the given id if it's present in the dialog
144 // return true if button was "clicked" or false if we don't have it
145 bool EmulateButtonClickIfPresent(int id
);
148 wxWindow
* m_oldFocus
;
149 bool m_endModalCalled
; // allow for closing within InitDialog
151 #if wxUSE_TOOLBAR && defined(__POCKETPC__)
152 wxToolBar
* m_dialogToolBar
;
155 // this pointer is non-NULL only while the modal event loop is running
156 wxDialogModalData
*m_modalData
;
158 DECLARE_DYNAMIC_CLASS(wxDialog
)
159 DECLARE_EVENT_TABLE()
160 DECLARE_NO_COPY_CLASS(wxDialog
)