]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/window.cpp
Added a notification observer for NSWindow. Observe the become key and
[wxWidgets.git] / src / mac / window.cpp
index aa3e705ea1ace34751e772d7357df3edb400747c..51406e6bb79aec70ed8a97a398668f86d6835527 100644 (file)
@@ -75,7 +75,6 @@ BEGIN_EVENT_TABLE(wxWindowMac, wxWindowBase)
   EVT_ERASE_BACKGROUND(wxWindowMac::OnEraseBackground)
   EVT_SYS_COLOUR_CHANGED(wxWindowMac::OnSysColourChanged)
   EVT_INIT_DIALOG(wxWindowMac::OnInitDialog)
-  EVT_IDLE(wxWindowMac::OnIdle)
   EVT_SET_FOCUS(wxWindowMac::OnSetFocus)
   EVT_MOUSE_EVENTS(wxWindowMac::OnMouseEvent)
 END_EVENT_TABLE()
@@ -923,48 +922,6 @@ void wxWindowMac::Refresh(bool eraseBack, const wxRect *rect)
     }
 }
 
-#if wxUSE_CARET && WXWIN_COMPATIBILITY
-// ---------------------------------------------------------------------------
-// Caret manipulation
-// ---------------------------------------------------------------------------
-
-void wxWindowMac::CreateCaret(int w, int h)
-{
-    SetCaret(new wxCaret(this, w, h));
-}
-
-void wxWindowMac::CreateCaret(const wxBitmap *WXUNUSED(bitmap))
-{
-    wxFAIL_MSG("not implemented");
-}
-
-void wxWindowMac::ShowCaret(bool show)
-{
-    wxCHECK_RET( m_caret, "no caret to show" );
-
-    m_caret->Show(show);
-}
-
-void wxWindowMac::DestroyCaret()
-{
-    SetCaret(NULL);
-}
-
-void wxWindowMac::SetCaretPos(int x, int y)
-{
-    wxCHECK_RET( m_caret, "no caret to move" );
-
-    m_caret->Move(x, y);
-}
-
-void wxWindowMac::GetCaretPos(int *x, int *y) const
-{
-    wxCHECK_RET( m_caret, "no caret to get position of" );
-
-    m_caret->GetPosition(x, y);
-}
-#endif // wxUSE_CARET
-
 wxWindowMac *wxGetActiveWindow()
 {
     // actually this is a windows-only concept
@@ -1305,37 +1262,6 @@ wxWindowMac *wxWindowBase::FindFocus()
     return gFocusWindow ;
 }
 
-#if WXWIN_COMPATIBILITY
-// If nothing defined for this, try the parent.
-// E.g. we may be a button loaded from a resource, with no callback function
-// defined.
-void wxWindowMac::OnCommand(wxWindowMac& win, wxCommandEvent& event)
-{
-    if ( GetEventHandler()->ProcessEvent(event)  )
-        return;
-    if ( m_parent )
-        m_parent->GetEventHandler()->OnCommand(win, event);
-}
-#endif // WXWIN_COMPATIBILITY_2
-
-#if WXWIN_COMPATIBILITY
-wxObject* wxWindowMac::GetChild(int number) const
-{
-    // Return a pointer to the Nth object in the Panel
-    wxNode *node = GetChildren().GetFirst();
-    int n = number;
-    while (node && n--)
-        node = node->GetNext();
-    if ( node )
-    {
-        wxObject *obj = (wxObject *)node->GetData();
-        return(obj);
-    }
-    else
-        return NULL;
-}
-#endif // WXWIN_COMPATIBILITY
-
 void wxWindowMac::OnSetFocus(wxFocusEvent& event)
 {
     // panel wants to track the window which was the last to have focus in it,
@@ -1352,14 +1278,6 @@ void wxWindowMac::OnSetFocus(wxFocusEvent& event)
     event.Skip();
 }
 
-void wxWindowMac::Clear()
-{
-    wxClientDC dc(this);
-    wxBrush brush(GetBackgroundColour(), wxSOLID);
-    dc.SetBackground(brush);
-    dc.Clear();
-}
-
 // Setup background and foreground colours correctly
 void wxWindowMac::SetupColours()
 {
@@ -1367,11 +1285,12 @@ void wxWindowMac::SetupColours()
         SetBackgroundColour(GetParent()->GetBackgroundColour());
 }
 
-void wxWindowMac::OnIdle(wxIdleEvent& event)
+void wxWindowMac::OnInternalIdle()
 {
     // This calls the UI-update mechanism (querying windows for
     // menu/toolbar/control state information)
-    UpdateWindowUI();
+    if (wxUpdateUIEvent::CanUpdate(this))
+        UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
 }
 
 // Raise the window to the top of the Z order