X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4f73f25cc81a95cbfff4f1afa850aae5976a423c..032e024c1c6ab6a20226604baab9d00558620e72:/include/wx/dialog.h?ds=sidebyside diff --git a/include/wx/dialog.h b/include/wx/dialog.h index a791d83c55..51852d4953 100644 --- a/include/wx/dialog.h +++ b/include/wx/dialog.h @@ -53,17 +53,18 @@ enum wxDialogLayoutAdaptationMode wxDIALOG_ADAPTATION_MODE_DISABLED = 2 // disable this dialog overriding global status }; +enum wxDialogModality +{ + wxDIALOG_MODALITY_NONE = 0, + wxDIALOG_MODALITY_WINDOW_MODAL = 1, + wxDIALOG_MODALITY_APP_MODAL = 2 +}; + extern WXDLLIMPEXP_DATA_CORE(const char) wxDialogNameStr[]; class WXDLLIMPEXP_CORE wxDialogBase : public wxTopLevelWindow { public: - enum - { - // all flags allowed in wxDialogBase::CreateButtonSizer() - ButtonSizerFlags = wxOK|wxCANCEL|wxYES|wxNO|wxHELP|wxNO_DEFAULT - }; - wxDialogBase() { Init(); } virtual ~wxDialogBase() { } @@ -71,7 +72,10 @@ public: virtual int ShowModal() = 0; virtual void EndModal(int retCode) = 0; virtual bool IsModal() const = 0; - + // show the dialog frame-modally (needs a parent), using app-modal + // dialogs on platforms that don't support it + virtual bool ShowWindowModal () ; + virtual void SendWindowModalDialogEvent ( wxEventType type ); // Modal dialogs have a return code - usually the id of the last // pressed button @@ -159,6 +163,8 @@ public: static bool IsLayoutAdaptationEnabled() { return sm_layoutAdaptation; } static void EnableLayoutAdaptation(bool enable) { sm_layoutAdaptation = enable; } + // modality kind + wxDialogModality GetModality() const; protected: // emulate click of a button with the given id if it's present in the dialog // @@ -181,7 +187,6 @@ protected: // wxID_OK return code void AcceptAndClose(); - // The return code from modal dialog int m_returnCode; @@ -329,5 +334,30 @@ public: #endif #endif +class WXDLLIMPEXP_CORE wxWindowModalDialogEvent : public wxCommandEvent +{ +public: + wxWindowModalDialogEvent (wxEventType commandType = wxEVT_NULL, int id = 0) + : wxCommandEvent(commandType, id) { } + + wxDialog *GetDialog() const + { return wxStaticCast(GetEventObject(), wxDialog); } + + int GetReturnCode() const + { return GetDialog()->GetReturnCode(); } + + virtual wxEvent *Clone() const { return new wxWindowModalDialogEvent (*this); } + +private: + DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWindowModalDialogEvent ) +}; + +wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_WINDOW_MODAL_DIALOG_CLOSED , wxWindowModalDialogEvent ); + +typedef void (wxEvtHandler::*wxWindowModalDialogEventFunction)(wxWindowModalDialogEvent &); + +#define wxWindowModalDialogEventHandler(func) \ + wxEVENT_HANDLER_CAST(wxWindowModalDialogEventFunction, func) + #endif // _WX_DIALOG_H_BASE_