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