]> git.saurik.com Git - wxWidgets.git/blame - include/wx/cocoa/dialog.h
wxMessageBox off the main thread lost result code.
[wxWidgets.git] / include / wx / cocoa / dialog.h
CommitLineData
fb896a32
DE
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/cocoa/dialog.h
3// Purpose: wxDialog class
4// Author: David Elliott
5// Modified by:
6// Created: 2002/12/15
fb896a32 7// Copyright: David Elliott
555f645a 8// Licence: wxWindows licence
fb896a32
DE
9/////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_COCOA_DIALOG_H_
12#define _WX_COCOA_DIALOG_H_
13
14#include "wx/defs.h"
15// NOTE: we don't need panel.h, but other things expect it to be included
16#include "wx/panel.h"
17#include "wx/cocoa/NSPanel.h"
18
fb896a32
DE
19// ========================================================================
20// wxDialog
21// ========================================================================
53a2db12 22class WXDLLIMPEXP_CORE wxDialog : public wxDialogBase, protected wxCocoaNSPanel
fb896a32
DE
23{
24 DECLARE_DYNAMIC_CLASS(wxDialog)
fb896a32
DE
25 WX_DECLARE_COCOA_OWNER(NSPanel,NSWindow,NSWindow)
26// ------------------------------------------------------------------------
27// initialization
28// ------------------------------------------------------------------------
29public:
30 wxDialog() { Init(); }
31
1c067fe3 32#if WXWIN_COMPATIBILITY_2_6
fb896a32
DE
33 // Constructor with a modal flag, but no window id - the old convention
34 wxDialog(wxWindow *parent,
1c067fe3
WS
35 const wxString& title, bool WXUNUSED(modal),
36 int x = wxDefaultCoord, int y= wxDefaultCoord, int width = 500, int height = 500,
fb896a32
DE
37 long style = wxDEFAULT_DIALOG_STYLE,
38 const wxString& name = wxDialogNameStr)
39 {
40 Init();
1c067fe3
WS
41 Create(parent, wxID_ANY, title, wxPoint(x, y), wxSize(width, height),
42 style, name);
fb896a32 43 }
1c067fe3 44#endif // WXWIN_COMPATIBILITY_2_6
fb896a32
DE
45
46 // Constructor with no modal flag - the new convention.
47 wxDialog(wxWindow *parent, wxWindowID winid,
48 const wxString& title,
49 const wxPoint& pos = wxDefaultPosition,
50 const wxSize& size = wxDefaultSize,
51 long style = wxDEFAULT_DIALOG_STYLE,
52 const wxString& name = wxDialogNameStr)
53 {
54 Init();
55 Create(parent, winid, title, pos, size, style, name);
56 }
57
58 bool Create(wxWindow *parent, wxWindowID winid,
59 const wxString& title,
60 const wxPoint& pos = wxDefaultPosition,
61 const wxSize& size = wxDefaultSize,
62 long style = wxDEFAULT_DIALOG_STYLE,
63 const wxString& name = wxDialogNameStr);
64
d3c7fc99 65 virtual ~wxDialog();
fb896a32
DE
66protected:
67 void Init();
68
69// ------------------------------------------------------------------------
70// Cocoa specifics
71// ------------------------------------------------------------------------
72protected:
9692f42b 73 virtual void CocoaDelegate_windowWillClose(void);
456fef85
DE
74 virtual bool Cocoa_canBecomeMainWindow(bool &canBecome)
75 { canBecome = true; return true; }
fb896a32
DE
76
77// ------------------------------------------------------------------------
78// Implementation
79// ------------------------------------------------------------------------
80public:
555f645a 81 virtual bool Show(bool show = true);
fb896a32
DE
82
83 void SetModal(bool flag);
90c10896
DE
84 virtual bool IsModal() const { return m_isModal; }
85 bool m_isModal;
fb896a32 86
1c067fe3 87 // For now, same as Show(true) but returns return code
fb896a32
DE
88 virtual int ShowModal();
89
90 // may be called to terminate the dialog with the given return code
91 virtual void EndModal(int retCode);
fb896a32
DE
92};
93
94#endif // _WX_COCOA_DIALOG_H_