]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/dialog.h
?lk
[wxWidgets.git] / include / wx / mac / dialog.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: dialog.h
3 // Purpose: wxDialog class
4 // Author: AUTHOR
5 // Modified by:
6 // Created: ??/??/98
7 // RCS-ID: $Id$
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_DIALOG_H_
13 #define _WX_DIALOG_H_
14
15 #ifdef __GNUG__
16 #pragma interface "dialog.h"
17 #endif
18
19 #include "wx/panel.h"
20
21 WXDLLEXPORT_DATA(extern const char*) wxDialogNameStr;
22
23 WXDLLEXPORT_DATA(extern const wxChar*) wxDialogNameStr;
24
25 class WXDLLEXPORT wxMacToolTip ;
26
27 // Dialog boxes
28 class WXDLLEXPORT wxDialog : public wxDialogBase
29 {
30 DECLARE_DYNAMIC_CLASS(wxDialog)
31
32 public:
33 wxDialog();
34
35 // Constructor with a modal flag, but no window id - the old convention
36 wxDialog(wxWindow *parent,
37 const wxString& title, bool modal,
38 int x = -1, int y= -1, int width = 500, int height = 500,
39 long style = wxDEFAULT_DIALOG_STYLE,
40 const wxString& name = wxDialogNameStr)
41 {
42 long modalStyle = modal ? wxDIALOG_MODAL : wxDIALOG_MODELESS ;
43 Create(parent, -1, title, wxPoint(x, y), wxSize(width, height),
44 style | modalStyle, name);
45 }
46
47 // Constructor with no modal flag - the new convention.
48 wxDialog(wxWindow *parent, wxWindowID id,
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 Create(parent, id, title, pos, size, style, name);
56 }
57
58 bool Create(wxWindow *parent, wxWindowID id,
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 ~wxDialog();
66
67 virtual bool Destroy();
68
69 virtual void DoSetClientSize(int width, int height);
70
71 virtual void GetPosition(int *x, int *y) const;
72
73 bool Show(bool show);
74 bool IsShown() const;
75 void Iconize(bool iconize);
76
77 #if WXWIN_COMPATIBILITY
78 bool Iconized() const { return IsIconized(); };
79 #endif
80
81 virtual bool IsIconized() const;
82 void Fit();
83
84 void SetTitle(const wxString& title);
85 wxString GetTitle() const ;
86
87 void OnSize(wxSizeEvent& event);
88 bool OnClose();
89 void OnCharHook(wxKeyEvent& event);
90 void OnPaint(wxPaintEvent& event);
91 void OnCloseWindow(wxCloseEvent& event);
92
93 void SetModal(bool flag);
94
95 virtual void Centre(int direction = wxBOTH);
96 virtual bool IsModal() const;
97
98 // For now, same as Show(TRUE) but returns return code
99 virtual int ShowModal();
100 virtual void EndModal(int retCode);
101
102 // Standard buttons
103 void OnOK(wxCommandEvent& event);
104 void OnApply(wxCommandEvent& event);
105 void OnCancel(wxCommandEvent& event);
106
107 // Responds to colour changes
108 void OnSysColourChanged(wxSysColourChangedEvent& event);
109
110 // implementation
111 // --------------
112
113 bool IsModalShowing() const { return m_modalShowing; }
114
115 // tooltip management
116 #if wxUSE_TOOLTIPS
117 wxMacToolTip* GetToolTipCtrl() const { return m_hwndToolTip; }
118 void SetToolTipCtrl(wxMacToolTip *tt) { m_hwndToolTip = tt; }
119 wxMacToolTip* m_hwndToolTip ;
120 #endif // tooltips
121
122 protected:
123 bool m_modalShowing;
124 WXHWND m_hwndOldFocus; // the window which had focus before we were shown
125
126 private:
127 DECLARE_EVENT_TABLE()
128 };
129
130 #endif
131 // _WX_DIALOG_H_