]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/toplevel_osx.cpp
Get wxSearchCtrl text events working, and share the text event handler code among...
[wxWidgets.git] / src / osx / toplevel_osx.cpp
index 1886e988c9bb4be69477ff7a627b9d23abb19b3b..8abcfbab435bc4773589a7513f9464cadd23c7b2 100644 (file)
@@ -73,7 +73,10 @@ bool wxTopLevelWindowMac::Create(wxWindow *parent,
                                  long style,
                                  const wxString& name)
 {
-    if ( !wxNonOwnedWindow::Create(parent, id, pos, size, style, name) )
+    int w = WidthDefault(size.x);
+    int h = HeightDefault(size.y);
+
+    if ( !wxNonOwnedWindow::Create(parent, id, pos, wxSize(w,h), style, name) )
         return false;
 
     wxWindow::SetLabel( title ) ;
@@ -87,6 +90,17 @@ wxTopLevelWindowMac::~wxTopLevelWindowMac()
 {
 }
 
+bool wxTopLevelWindowMac::Destroy()
+{
+    // NB: this will get called during destruction if we don't do it now,
+    // and may fire a kill focus event on a control being destroyed
+#if wxOSX_USE_CARBON
+    if (m_nowpeer->GetWXWindow())
+        ClearKeyboardFocus( (WindowRef)m_nowpeer->GetWXWindow() );
+#endif
+    return wxTopLevelWindowBase::Destroy();
+}
+
 
 // ----------------------------------------------------------------------------
 // wxTopLevelWindowMac maximize/minimize
@@ -134,7 +148,8 @@ wxPoint wxTopLevelWindowMac::GetClientAreaOrigin() const
 void wxTopLevelWindowMac::SetTitle(const wxString& title)
 {
     wxWindow::SetLabel( title ) ;
-    m_nowpeer->SetTitle(title, GetFont().GetEncoding() );
+    if ( m_nowpeer )
+        m_nowpeer->SetTitle(title, GetFont().GetEncoding() );
 }
 
 wxString wxTopLevelWindowMac::GetTitle() const
@@ -142,6 +157,18 @@ wxString wxTopLevelWindowMac::GetTitle() const
     return wxWindow::GetLabel();
 }
 
+void wxTopLevelWindowMac::ShowWithoutActivating()
+{
+    // wxTopLevelWindowBase is derived from wxNonOwnedWindow, so don't
+    // call it here.
+    if ( !wxWindow::Show(true) )
+        return;
+
+    m_nowpeer->ShowWithoutActivating();
+    
+    // TODO: Should we call EVT_SIZE here?
+}
+
 bool wxTopLevelWindowMac::ShowFullScreen(bool show, long style)
 {
     return m_nowpeer->ShowFullScreen(show, style);
@@ -156,3 +183,18 @@ void wxTopLevelWindowMac::RequestUserAttention(int flags)
 {
     return m_nowpeer->RequestUserAttention(flags);
 }
+
+bool wxTopLevelWindowMac::IsActive()
+{
+    return m_nowpeer->IsActive();
+}
+
+void wxTopLevelWindowMac::OSXSetModified(bool modified)
+{
+    m_nowpeer->SetModified(modified);
+}
+
+bool wxTopLevelWindowMac::OSXIsModified() const
+{
+    return m_nowpeer->IsModified();
+}