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 /////////////////////////////////////////////////////////////////////////////
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "dialog.h"
21 extern WXDLLEXPORT_DATA(const wxChar
*) wxDialogNameStr
;
23 class WXDLLEXPORT wxDialogModalData
;
26 class WXDLLEXPORT wxDialog
: public wxDialogBase
29 wxDialog() { Init(); }
32 wxDialog(wxWindow
*parent
, wxWindowID id
,
33 const wxString
& title
,
34 const wxPoint
& pos
= wxDefaultPosition
,
35 const wxSize
& size
= wxDefaultSize
,
36 long style
= wxDEFAULT_DIALOG_STYLE
,
37 const wxString
& name
= wxDialogNameStr
)
41 (void)Create(parent
, id
, title
, pos
, size
, style
, name
);
44 bool Create(wxWindow
*parent
, wxWindowID id
,
45 const wxString
& title
,
46 const wxPoint
& pos
= wxDefaultPosition
,
47 const wxSize
& size
= wxDefaultSize
,
48 long style
= wxDEFAULT_DIALOG_STYLE
,
49 const wxString
& name
= wxDialogNameStr
);
53 // return true if we're showing the dialog modally
54 virtual bool IsModal() const { return m_modalData
!= NULL
; }
56 // show the dialog modally and return the value passed to EndModal()
57 virtual int ShowModal();
59 // may be called to terminate the dialog with the given return code
60 virtual void EndModal(int retCode
);
62 // implementation only from now on
63 // -------------------------------
65 // override some base class virtuals
66 virtual bool Show(bool show
= true);
71 void OnCharHook(wxKeyEvent
& event
);
72 void OnCloseWindow(wxCloseEvent
& event
);
75 void OnOK(wxCommandEvent
& event
);
76 void OnApply(wxCommandEvent
& event
);
77 void OnCancel(wxCommandEvent
& event
);
79 // Responds to colour changes
80 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
83 // Responds to the OK button in a PocketPC titlebar. This
84 // can be overridden, or you can change the id used for
85 // sending the event with SetAffirmativeId. Returns false
86 // if the event was not processed.
91 WXLRESULT
MSWWindowProc(WXUINT message
, WXWPARAM wParam
, WXLPARAM lParam
);
97 wxDEPRECATED( wxDialog(wxWindow
*parent
,
98 const wxString
& title
, bool modal
,
99 int x
= wxDefaultCoord
, int y
= wxDefaultCoord
, int width
= 500, int height
= 500,
100 long style
= wxDEFAULT_DIALOG_STYLE
,
101 const wxString
& name
= wxDialogNameStr
) );
103 // just call Show() or ShowModal()
104 wxDEPRECATED( void SetModal(bool flag
) );
107 wxDEPRECATED( bool IsModalShowing() const );
110 // find the window to use as parent for this dialog if none has been
111 // specified explicitly by the user
114 wxWindow
*FindSuitableParent() const;
116 // common part of all ctors
119 // end either modal or modeless dialog
120 void EndDialog(int rc
);
123 wxWindow
* m_oldFocus
;
124 bool m_endModalCalled
; // allow for closing within InitDialog
126 // this pointer is non-NULL only while the modal event loop is running
127 wxDialogModalData
*m_modalData
;
130 DECLARE_DYNAMIC_CLASS(wxDialog
)
131 DECLARE_EVENT_TABLE()
132 DECLARE_NO_COPY_CLASS(wxDialog
)