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
;
25 #if wxUSE_TOOLBAR && (defined(__SMARTPHONE__) || defined(__POCKETPC__))
26 class WXDLLEXPORT wxToolBar
;
30 class WXDLLEXPORT wxDialog
: public wxDialogBase
33 wxDialog() { Init(); }
36 wxDialog(wxWindow
*parent
, wxWindowID id
,
37 const wxString
& title
,
38 const wxPoint
& pos
= wxDefaultPosition
,
39 const wxSize
& size
= wxDefaultSize
,
40 long style
= wxDEFAULT_DIALOG_STYLE
,
41 const wxString
& name
= wxDialogNameStr
)
45 (void)Create(parent
, id
, title
, pos
, size
, style
, name
);
48 bool Create(wxWindow
*parent
, wxWindowID id
,
49 const wxString
& title
,
50 const wxPoint
& pos
= wxDefaultPosition
,
51 const wxSize
& size
= wxDefaultSize
,
52 long style
= wxDEFAULT_DIALOG_STYLE
,
53 const wxString
& name
= wxDialogNameStr
);
57 // return true if we're showing the dialog modally
58 virtual bool IsModal() const { return m_modalData
!= NULL
; }
60 // show the dialog modally and return the value passed to EndModal()
61 virtual int ShowModal();
63 // may be called to terminate the dialog with the given return code
64 virtual void EndModal(int retCode
);
66 #if wxUSE_TOOLBAR && defined(__POCKETPC__)
67 // create main toolbar by calling OnCreateToolBar()
68 virtual wxToolBar
* CreateToolBar(long style
= -1,
69 wxWindowID winid
= wxID_ANY
,
70 const wxString
& name
= wxToolBarNameStr
);
71 // return a new toolbar
72 virtual wxToolBar
*OnCreateToolBar(long style
,
74 const wxString
& name
);
76 // get the main toolbar
77 wxToolBar
*GetToolBar() const { return m_dialogToolBar
; }
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
);
114 // use the other ctor
115 wxDEPRECATED( wxDialog(wxWindow
*parent
,
116 const wxString
& title
, bool modal
,
117 int x
= wxDefaultCoord
, int y
= wxDefaultCoord
, int width
= 500, int height
= 500,
118 long style
= wxDEFAULT_DIALOG_STYLE
,
119 const wxString
& name
= wxDialogNameStr
) );
121 // just call Show() or ShowModal()
122 wxDEPRECATED( void SetModal(bool flag
) );
125 wxDEPRECATED( bool IsModalShowing() const );
128 // find the window to use as parent for this dialog if none has been
129 // specified explicitly by the user
132 wxWindow
*FindSuitableParent() const;
134 // common part of all ctors
137 // end either modal or modeless dialog
138 void EndDialog(int rc
);
140 // emulate click of a button with the given id if it's present in the dialog
142 // return true if button was "clicked" or false if we don't have it
143 bool EmulateButtonClickIfPresent(int id
);
145 // handle Escape here
146 virtual bool MSWProcessMessage(WXMSG
* pMsg
);
149 wxWindow
* m_oldFocus
;
150 bool m_endModalCalled
; // allow for closing within InitDialog
152 #if wxUSE_TOOLBAR && defined(__POCKETPC__)
153 wxToolBar
* m_dialogToolBar
;
156 // this pointer is non-NULL only while the modal event loop is running
157 wxDialogModalData
*m_modalData
;
159 DECLARE_DYNAMIC_CLASS(wxDialog
)
160 DECLARE_EVENT_TABLE()
161 DECLARE_NO_COPY_CLASS(wxDialog
)