1 ///////////////////////////////////////////////////////////////////////////// 2 // Name: wx/cocoa/dialog.h 3 // Purpose: wxDialog class 4 // Author: David Elliott 5 // Modified by: 6 // Created: 2002/12/15 7 // Copyright: David Elliott 8 // Licence: wxWindows licence 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 19 // ======================================================================== 20 // wxDialog 21 // ======================================================================== 22 class WXDLLIMPEXP_CORE wxDialog : public wxDialogBase, protected wxCocoaNSPanel 23 { 24 DECLARE_DYNAMIC_CLASS(wxDialog) WX_DECLARE_COCOA_OWNER(NSPanel,NSWindow,NSWindow)25 WX_DECLARE_COCOA_OWNER(NSPanel,NSWindow,NSWindow) 26 // ------------------------------------------------------------------------ 27 // initialization 28 // ------------------------------------------------------------------------ 29 public: 30 wxDialog() { Init(); } 31 32 #if WXWIN_COMPATIBILITY_2_6 33 // Constructor with a modal flag, but no window id - the old convention 34 wxDialog(wxWindow *parent, 35 const wxString& title, bool WXUNUSED(modal), 36 int x = wxDefaultCoord, int y= wxDefaultCoord, int width = 500, int height = 500, 37 long style = wxDEFAULT_DIALOG_STYLE, 38 const wxString& name = wxDialogNameStr) 39 { 40 Init(); 41 Create(parent, wxID_ANY, title, wxPoint(x, y), wxSize(width, height), 42 style, name); 43 } 44 #endif // WXWIN_COMPATIBILITY_2_6 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 65 virtual ~wxDialog(); 66 protected: 67 void Init(); 68 69 // ------------------------------------------------------------------------ 70 // Cocoa specifics 71 // ------------------------------------------------------------------------ 72 protected: 73 virtual void CocoaDelegate_windowWillClose(void); Cocoa_canBecomeMainWindow(bool & canBecome)74 virtual bool Cocoa_canBecomeMainWindow(bool &canBecome) 75 { canBecome = true; return true; } 76 77 // ------------------------------------------------------------------------ 78 // Implementation 79 // ------------------------------------------------------------------------ 80 public: 81 virtual bool Show(bool show = true); 82 83 void SetModal(bool flag); IsModal()84 virtual bool IsModal() const { return m_isModal; } 85 bool m_isModal; 86 87 // For now, same as Show(true) but returns return code 88 virtual int ShowModal(); 89 90 // may be called to terminate the dialog with the given return code 91 virtual void EndModal(int retCode); 92 }; 93 94 #endif // _WX_COCOA_DIALOG_H_ 95