]> git.saurik.com Git - wxWidgets.git/blob - include/wx/cocoa/dialog.h
Catch and forward the following mouse related events:
[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 license
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 WXDLLEXPORT_DATA(extern const wxChar*) wxDialogNameStr;
21
22 // ========================================================================
23 // wxDialog
24 // ========================================================================
25 class WXDLLEXPORT wxDialog : public wxDialogBase, protected wxCocoaNSPanel
26 {
27 DECLARE_DYNAMIC_CLASS(wxDialog)
28 DECLARE_EVENT_TABLE()
29 WX_DECLARE_COCOA_OWNER(NSPanel,NSWindow,NSWindow)
30 // ------------------------------------------------------------------------
31 // initialization
32 // ------------------------------------------------------------------------
33 public:
34 wxDialog() { Init(); }
35
36 // Constructor with a modal flag, but no window id - the old convention
37 wxDialog(wxWindow *parent,
38 const wxString& title, bool modal,
39 int x = -1, int y= -1, int width = 500, int height = 500,
40 long style = wxDEFAULT_DIALOG_STYLE,
41 const wxString& name = wxDialogNameStr)
42 {
43 Init();
44 long modalStyle = modal ? wxDIALOG_MODAL : wxDIALOG_MODELESS ;
45 Create(parent, -1, title, wxPoint(x, y), wxSize(width, height),
46 style | modalStyle, name);
47 }
48
49 // Constructor with no modal flag - the new convention.
50 wxDialog(wxWindow *parent, wxWindowID winid,
51 const wxString& title,
52 const wxPoint& pos = wxDefaultPosition,
53 const wxSize& size = wxDefaultSize,
54 long style = wxDEFAULT_DIALOG_STYLE,
55 const wxString& name = wxDialogNameStr)
56 {
57 Init();
58 Create(parent, winid, title, pos, size, style, name);
59 }
60
61 bool Create(wxWindow *parent, wxWindowID winid,
62 const wxString& title,
63 const wxPoint& pos = wxDefaultPosition,
64 const wxSize& size = wxDefaultSize,
65 long style = wxDEFAULT_DIALOG_STYLE,
66 const wxString& name = wxDialogNameStr);
67
68 ~wxDialog();
69 protected:
70 void Init();
71
72 // ------------------------------------------------------------------------
73 // Cocoa specifics
74 // ------------------------------------------------------------------------
75 protected:
76 virtual void Cocoa_close(void);
77
78 // ------------------------------------------------------------------------
79 // Implementation
80 // ------------------------------------------------------------------------
81 public:
82 bool Show(bool show);
83
84 void SetModal(bool flag);
85 virtual bool IsModal() const;
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 // Event handlers
95 // ------------------------------------------------------------------------
96 protected:
97 void OnCloseWindow(wxCloseEvent& event);
98 // Standard buttons
99 void OnOK(wxCommandEvent& event);
100 void OnApply(wxCommandEvent& event);
101 void OnCancel(wxCommandEvent& event);
102 };
103
104 #endif // _WX_COCOA_DIALOG_H_