]>
Commit | Line | Data |
---|---|---|
489468fe SC |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: src/mac/carbon/toplevel.cpp | |
3 | // Purpose: implements wxTopLevelWindow for Mac | |
4 | // Author: Stefan Csomor | |
5 | // Modified by: | |
6 | // Created: 24.09.01 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 2001-2004 Stefan Csomor | |
9 | // License: wxWindows licence | |
10 | /////////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | // ============================================================================ | |
13 | // declarations | |
14 | // ============================================================================ | |
15 | ||
16 | // ---------------------------------------------------------------------------- | |
17 | // headers | |
18 | // ---------------------------------------------------------------------------- | |
19 | ||
20 | // For compilers that support precompilation, includes "wx.h". | |
21 | #include "wx/wxprec.h" | |
22 | ||
23 | #ifdef __BORLANDC__ | |
24 | #pragma hdrstop | |
25 | #endif | |
26 | ||
27 | #include "wx/toplevel.h" | |
28 | ||
29 | #ifndef WX_PRECOMP | |
30 | #include "wx/app.h" | |
31 | #include "wx/frame.h" | |
32 | #include "wx/string.h" | |
33 | #include "wx/log.h" | |
34 | #include "wx/intl.h" | |
35 | #include "wx/settings.h" | |
36 | #include "wx/strconv.h" | |
37 | #include "wx/control.h" | |
38 | #endif //WX_PRECOMP | |
39 | ||
489468fe SC |
40 | #include "wx/tooltip.h" |
41 | #include "wx/dnd.h" | |
42 | ||
43 | #if wxUSE_SYSTEM_OPTIONS | |
44 | #include "wx/sysopt.h" | |
45 | #endif | |
46 | ||
489468fe | 47 | // for targeting OSX |
1f0c8f31 | 48 | #include "wx/osx/private.h" |
489468fe SC |
49 | |
50 | // ============================================================================ | |
51 | // wxTopLevelWindowMac implementation | |
52 | // ============================================================================ | |
53 | ||
54 | BEGIN_EVENT_TABLE(wxTopLevelWindowMac, wxTopLevelWindowBase) | |
55 | END_EVENT_TABLE() | |
56 | ||
57 | // ---------------------------------------------------------------------------- | |
58 | // wxTopLevelWindowMac creation | |
59 | // ---------------------------------------------------------------------------- | |
60 | ||
489468fe SC |
61 | |
62 | void wxTopLevelWindowMac::Init() | |
63 | { | |
64 | m_iconized = | |
65 | m_maximizeOnShow = false; | |
489468fe SC |
66 | } |
67 | ||
68 | bool wxTopLevelWindowMac::Create(wxWindow *parent, | |
69 | wxWindowID id, | |
70 | const wxString& title, | |
71 | const wxPoint& pos, | |
72 | const wxSize& size, | |
73 | long style, | |
74 | const wxString& name) | |
75 | { | |
76 | if ( !wxNonOwnedWindow::Create(parent, id, pos, size, style, name) ) | |
77 | return false; | |
78 | ||
79 | wxWindow::SetLabel( title ) ; | |
b2680ced | 80 | m_nowpeer->SetTitle(title, GetFont().GetEncoding() ); |
489468fe SC |
81 | wxTopLevelWindows.Append(this); |
82 | ||
83 | return true; | |
84 | } | |
85 | ||
86 | wxTopLevelWindowMac::~wxTopLevelWindowMac() | |
87 | { | |
489468fe SC |
88 | } |
89 | ||
90 | ||
91 | // ---------------------------------------------------------------------------- | |
92 | // wxTopLevelWindowMac maximize/minimize | |
93 | // ---------------------------------------------------------------------------- | |
94 | ||
95 | void wxTopLevelWindowMac::Maximize(bool maximize) | |
96 | { | |
b2680ced SC |
97 | if ( IsMaximized() != maximize ) |
98 | m_nowpeer->Maximize(maximize); | |
489468fe SC |
99 | } |
100 | ||
101 | bool wxTopLevelWindowMac::IsMaximized() const | |
102 | { | |
b2680ced | 103 | return m_nowpeer->IsMaximized(); |
489468fe SC |
104 | } |
105 | ||
106 | void wxTopLevelWindowMac::Iconize(bool iconize) | |
107 | { | |
b2680ced SC |
108 | if ( IsIconized() != iconize ) |
109 | m_nowpeer->Iconize(iconize); | |
489468fe SC |
110 | } |
111 | ||
112 | bool wxTopLevelWindowMac::IsIconized() const | |
113 | { | |
b2680ced | 114 | return m_nowpeer->IsIconized(); |
489468fe SC |
115 | } |
116 | ||
117 | void wxTopLevelWindowMac::Restore() | |
118 | { | |
119 | if ( IsMaximized() ) | |
120 | Maximize(false); | |
121 | else if ( IsIconized() ) | |
122 | Iconize(false); | |
123 | } | |
124 | ||
125 | // ---------------------------------------------------------------------------- | |
126 | // wxTopLevelWindowMac misc | |
127 | // ---------------------------------------------------------------------------- | |
128 | ||
129 | wxPoint wxTopLevelWindowMac::GetClientAreaOrigin() const | |
130 | { | |
131 | return wxPoint(0, 0) ; | |
132 | } | |
133 | ||
134 | void wxTopLevelWindowMac::SetTitle(const wxString& title) | |
135 | { | |
136 | wxWindow::SetLabel( title ) ; | |
b2680ced | 137 | m_nowpeer->SetTitle(title, GetFont().GetEncoding() ); |
489468fe SC |
138 | } |
139 | ||
140 | wxString wxTopLevelWindowMac::GetTitle() const | |
141 | { | |
142 | return wxWindow::GetLabel(); | |
143 | } | |
144 | ||
145 | bool wxTopLevelWindowMac::ShowFullScreen(bool show, long style) | |
146 | { | |
b2680ced | 147 | return m_nowpeer->ShowFullScreen(show, style); |
489468fe SC |
148 | } |
149 | ||
150 | bool wxTopLevelWindowMac::IsFullScreen() const | |
151 | { | |
b2680ced | 152 | return m_nowpeer->IsFullScreen(); |
489468fe SC |
153 | } |
154 | ||
b2680ced | 155 | void wxTopLevelWindowMac::RequestUserAttention(int flags) |
489468fe | 156 | { |
b2680ced | 157 | return m_nowpeer->RequestUserAttention(flags); |
489468fe | 158 | } |