]>
git.saurik.com Git - wxWidgets.git/blob - src/osx/toplevel_osx.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/toplevel.cpp
3 // Purpose: implements wxTopLevelWindow for Mac
4 // Author: Stefan Csomor
8 // Copyright: (c) 2001-2004 Stefan Csomor
9 // License: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
27 #include "wx/toplevel.h"
32 #include "wx/string.h"
35 #include "wx/settings.h"
36 #include "wx/strconv.h"
37 #include "wx/control.h"
40 #include "wx/tooltip.h"
43 #if wxUSE_SYSTEM_OPTIONS
44 #include "wx/sysopt.h"
48 #include "wx/osx/private.h"
50 // ============================================================================
51 // wxTopLevelWindowMac implementation
52 // ============================================================================
54 BEGIN_EVENT_TABLE(wxTopLevelWindowMac
, wxTopLevelWindowBase
)
57 // ----------------------------------------------------------------------------
58 // wxTopLevelWindowMac creation
59 // ----------------------------------------------------------------------------
62 void wxTopLevelWindowMac::Init()
65 m_maximizeOnShow
= false;
68 bool wxTopLevelWindowMac::Create(wxWindow
*parent
,
70 const wxString
& title
,
76 int w
= WidthDefault(size
.x
);
77 int h
= HeightDefault(size
.y
);
79 if ( !wxNonOwnedWindow::Create(parent
, id
, pos
, wxSize(w
,h
), style
, name
) )
82 wxWindow::SetLabel( title
) ;
83 m_nowpeer
->SetTitle(title
, GetFont().GetEncoding() );
84 wxTopLevelWindows
.Append(this);
89 wxTopLevelWindowMac::~wxTopLevelWindowMac()
93 bool wxTopLevelWindowMac::Destroy()
95 // NB: this will get called during destruction if we don't do it now,
96 // and may fire a kill focus event on a control being destroyed
98 if (m_nowpeer
->GetWXWindow())
99 ClearKeyboardFocus( (WindowRef
)m_nowpeer
->GetWXWindow() );
101 return wxTopLevelWindowBase::Destroy();
105 // ----------------------------------------------------------------------------
106 // wxTopLevelWindowMac maximize/minimize
107 // ----------------------------------------------------------------------------
109 void wxTopLevelWindowMac::Maximize(bool maximize
)
111 if ( IsMaximized() != maximize
)
112 m_nowpeer
->Maximize(maximize
);
115 bool wxTopLevelWindowMac::IsMaximized() const
117 return m_nowpeer
->IsMaximized();
120 void wxTopLevelWindowMac::Iconize(bool iconize
)
122 if ( IsIconized() != iconize
)
123 m_nowpeer
->Iconize(iconize
);
126 bool wxTopLevelWindowMac::IsIconized() const
128 return m_nowpeer
->IsIconized();
131 void wxTopLevelWindowMac::Restore()
135 else if ( IsIconized() )
139 // ----------------------------------------------------------------------------
140 // wxTopLevelWindowMac misc
141 // ----------------------------------------------------------------------------
143 wxPoint
wxTopLevelWindowMac::GetClientAreaOrigin() const
145 return wxPoint(0, 0) ;
148 void wxTopLevelWindowMac::SetTitle(const wxString
& title
)
150 wxWindow::SetLabel( title
) ;
151 m_nowpeer
->SetTitle(title
, GetFont().GetEncoding() );
154 wxString
wxTopLevelWindowMac::GetTitle() const
156 return wxWindow::GetLabel();
159 bool wxTopLevelWindowMac::ShowFullScreen(bool show
, long style
)
161 return m_nowpeer
->ShowFullScreen(show
, style
);
164 bool wxTopLevelWindowMac::IsFullScreen() const
166 return m_nowpeer
->IsFullScreen();
169 void wxTopLevelWindowMac::RequestUserAttention(int flags
)
171 return m_nowpeer
->RequestUserAttention(flags
);