2009-01-17 10:43:43 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2011-03-20 00:14:35 +00:00
|
|
|
// Name: wx/osx/dialog.h
|
2009-01-17 10:43:43 +00:00
|
|
|
// Purpose: wxDialog class
|
|
|
|
// Author: Stefan Csomor
|
|
|
|
// Modified by:
|
|
|
|
// Created: 1998-01-01
|
|
|
|
// Copyright: (c) Stefan Csomor
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_DIALOG_H_
|
|
|
|
#define _WX_DIALOG_H_
|
|
|
|
|
|
|
|
#include "wx/panel.h"
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxMacToolTip ;
|
2010-04-02 14:52:08 +00:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxModalEventLoop ;
|
2009-01-17 10:43:43 +00:00
|
|
|
|
|
|
|
// Dialog boxes
|
|
|
|
class WXDLLIMPEXP_CORE wxDialog : public wxDialogBase
|
|
|
|
{
|
2015-04-23 11:49:01 +00:00
|
|
|
wxDECLARE_DYNAMIC_CLASS(wxDialog);
|
2009-01-17 10:43:43 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
wxDialog() { Init(); }
|
|
|
|
|
|
|
|
// Constructor with no modal flag - the new convention.
|
|
|
|
wxDialog(wxWindow *parent, wxWindowID id,
|
|
|
|
const wxString& title,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxDEFAULT_DIALOG_STYLE,
|
|
|
|
const wxString& name = wxDialogNameStr)
|
|
|
|
{
|
|
|
|
Init();
|
|
|
|
Create(parent, id, title, pos, size, style, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Create(wxWindow *parent, wxWindowID id,
|
|
|
|
const wxString& title,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxDEFAULT_DIALOG_STYLE,
|
|
|
|
const wxString& name = wxDialogNameStr);
|
|
|
|
|
|
|
|
virtual ~wxDialog();
|
|
|
|
|
|
|
|
// virtual bool Destroy();
|
2019-04-05 18:08:53 +00:00
|
|
|
virtual bool Show(bool show = true) wxOVERRIDE;
|
2009-01-17 10:43:43 +00:00
|
|
|
|
2010-01-25 22:27:42 +00:00
|
|
|
// return true if we're showing the dialog modally
|
2019-04-05 18:08:53 +00:00
|
|
|
virtual bool IsModal() const wxOVERRIDE;
|
2009-01-17 10:43:43 +00:00
|
|
|
|
2010-01-25 22:27:42 +00:00
|
|
|
// show the dialog modally and return the value passed to EndModal()
|
2019-04-05 18:08:53 +00:00
|
|
|
virtual int ShowModal() wxOVERRIDE;
|
2010-09-30 11:44:45 +00:00
|
|
|
|
2019-04-05 18:08:53 +00:00
|
|
|
virtual void ShowWindowModal() wxOVERRIDE;
|
2009-01-17 10:43:43 +00:00
|
|
|
|
|
|
|
// may be called to terminate the dialog with the given return code
|
2019-04-05 18:08:53 +00:00
|
|
|
virtual void EndModal(int retCode) wxOVERRIDE;
|
2010-09-30 11:44:45 +00:00
|
|
|
|
2010-04-20 19:09:38 +00:00
|
|
|
static bool OSXHasModalDialogsOpen();
|
2018-08-27 11:57:58 +00:00
|
|
|
void OSXBeginModalDialog();
|
|
|
|
void OSXEndModalDialog();
|
2019-01-30 16:28:08 +00:00
|
|
|
|
2018-08-27 11:57:58 +00:00
|
|
|
#if wxOSX_USE_COCOA
|
|
|
|
bool OSXGetWorksWhenModal();
|
|
|
|
void OSXSetWorksWhenModal(bool worksWhenModal);
|
|
|
|
#endif
|
2009-01-17 10:43:43 +00:00
|
|
|
|
|
|
|
// implementation
|
|
|
|
// --------------
|
|
|
|
|
2019-04-05 18:08:53 +00:00
|
|
|
wxDialogModality GetModality() const wxOVERRIDE;
|
2010-09-30 11:44:45 +00:00
|
|
|
|
2010-01-28 04:06:23 +00:00
|
|
|
#if wxOSX_USE_COCOA
|
|
|
|
virtual void ModalFinishedCallback(void* WXUNUSED(panel), int WXUNUSED(returnCode)) {}
|
|
|
|
#endif
|
|
|
|
|
2010-01-25 22:27:42 +00:00
|
|
|
protected:
|
2010-09-30 11:44:45 +00:00
|
|
|
// show window modal dialog
|
2010-01-25 22:27:42 +00:00
|
|
|
void DoShowWindowModal();
|
2009-01-17 10:43:43 +00:00
|
|
|
|
2010-04-02 14:52:08 +00:00
|
|
|
// end window modal dialog.
|
|
|
|
void EndWindowModal();
|
|
|
|
|
2009-01-17 10:43:43 +00:00
|
|
|
// mac also takes command-period as cancel
|
2019-04-05 18:08:53 +00:00
|
|
|
virtual bool IsEscapeKey(const wxKeyEvent& event) wxOVERRIDE;
|
2009-01-17 10:43:43 +00:00
|
|
|
|
2010-01-23 20:06:48 +00:00
|
|
|
|
2010-01-28 04:06:23 +00:00
|
|
|
wxDialogModality m_modality;
|
2010-09-30 11:44:45 +00:00
|
|
|
|
2010-04-02 14:52:08 +00:00
|
|
|
wxModalEventLoop* m_eventLoop;
|
2010-01-28 04:06:23 +00:00
|
|
|
|
2009-01-17 10:43:43 +00:00
|
|
|
private:
|
|
|
|
void Init();
|
2019-01-30 16:28:08 +00:00
|
|
|
|
2018-08-27 11:57:58 +00:00
|
|
|
static wxVector<wxDialog*> s_modalStack;
|
|
|
|
#if wxOSX_USE_COCOA
|
|
|
|
static wxVector<bool> s_modalWorksStack;
|
|
|
|
#endif
|
2009-01-17 10:43:43 +00:00
|
|
|
};
|
|
|
|
|
2008-06-11 16:30:48 +00:00
|
|
|
#endif
|
2009-01-17 10:43:43 +00:00
|
|
|
// _WX_DIALOG_H_
|