]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/carbon/dialog.h
implemented wxEventLoop for wxMac
[wxWidgets.git] / include / wx / mac / carbon / dialog.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: dialog.h
3 // Purpose: wxDialog class
4 // Author: Stefan Csomor
5 // Modified by:
6 // Created: 1998-01-01
7 // RCS-ID: $Id$
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_DIALOG_H_
13 #define _WX_DIALOG_H_
14
15 #include "wx/panel.h"
16
17 WXDLLEXPORT_DATA(extern const wxChar*) wxDialogNameStr;
18
19 WXDLLEXPORT_DATA(extern const wxChar*) wxDialogNameStr;
20
21 class WXDLLEXPORT wxMacToolTip ;
22
23 // Dialog boxes
24 class WXDLLEXPORT wxDialog : public wxDialogBase
25 {
26 DECLARE_DYNAMIC_CLASS(wxDialog)
27
28 public:
29 wxDialog() { Init(); }
30
31 // Constructor with a modal flag, but no window id - the old convention
32 wxDialog(wxWindow *parent,
33 const wxString& title, bool modal,
34 int x = -1, int y= -1, int width = 500, int height = 500,
35 long style = wxDEFAULT_DIALOG_STYLE,
36 const wxString& name = wxDialogNameStr)
37 {
38 Init();
39 m_isModalStyle = modal;
40 Create(parent, -1, title, wxPoint(x, y), wxSize(width, height),
41 style, name);
42 }
43
44 // Constructor with no modal flag - the new convention.
45 wxDialog(wxWindow *parent, wxWindowID id,
46 const wxString& title,
47 const wxPoint& pos = wxDefaultPosition,
48 const wxSize& size = wxDefaultSize,
49 long style = wxDEFAULT_DIALOG_STYLE,
50 const wxString& name = wxDialogNameStr)
51 {
52 Init();
53 Create(parent, id, title, pos, size, style, name);
54 }
55
56 bool Create(wxWindow *parent, wxWindowID id,
57 const wxString& title,
58 const wxPoint& pos = wxDefaultPosition,
59 const wxSize& size = wxDefaultSize,
60 long style = wxDEFAULT_DIALOG_STYLE,
61 const wxString& name = wxDialogNameStr);
62
63 ~wxDialog();
64
65 // virtual bool Destroy();
66 virtual bool Show(bool show = true);
67
68 void SetModal(bool flag);
69 virtual bool IsModal() const;
70
71 // For now, same as Show(TRUE) but returns return code
72 virtual int ShowModal();
73
74 // may be called to terminate the dialog with the given return code
75 virtual void EndModal(int retCode);
76
77 // returns TRUE if we're in a modal loop
78 bool IsModalShowing() const;
79
80 // implementation
81 // --------------
82
83 // event handlers
84 void OnCharHook(wxKeyEvent& event);
85 void OnCloseWindow(wxCloseEvent& event);
86
87 // Standard buttons
88 void OnOK(wxCommandEvent& event);
89 void OnApply(wxCommandEvent& event);
90 void OnCancel(wxCommandEvent& event);
91
92 // Responds to colour changes
93 void OnSysColourChanged(wxSysColourChangedEvent& event);
94
95 // show modal dialog and enter modal loop
96 void DoShowModal();
97
98 private:
99 void Init();
100 bool m_isModalStyle;
101 DECLARE_EVENT_TABLE()
102 };
103
104 #endif
105 // _WX_DIALOG_H_