]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/treectrl.cpp
got rid of more duplicated code for working with DIBs
[wxWidgets.git] / src / mac / treectrl.cpp
index 137a885dbfa7e32c9096f78376146fda7cffaf68..7a548a743646328e7e24f73973c8ef446102337f 100644 (file)
@@ -1,12 +1,12 @@
 /////////////////////////////////////////////////////////////////////////////
 // Name:        treectrl.cpp
 // Purpose:     wxTreeCtrl. See also Robert's generic wxTreeCtrl.
-// Author:      AUTHOR
+// Author:      Stefan Csomor
 // Modified by:
-// Created:     ??/??/98
+// Created:     1998-01-01
 // RCS-ID:      $Id$
-// Copyright:   (c) AUTHOR
-// Licence:    wxWindows licence
+// Copyright:   (c) Stefan Csomor
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -14,6 +14,7 @@
 #endif
 
 #include "wx/stubs/textctrl.h"
+#include "wx/treebase.h"
 #include "wx/stubs/treectrl.h"
 
 #if !USE_SHARED_LIBRARY
@@ -80,15 +81,15 @@ void wxTreeCtrl::SetIndent(int indent)
 
 wxImageList *wxTreeCtrl::GetImageList(int which) const
 {
-  if ( which == wxIMAGE_LIST_NORMAL )
+    if ( which == wxIMAGE_LIST_NORMAL )
     {
-    return m_imageListNormal;
-  }
-  else if ( which == wxIMAGE_LIST_STATE )
+        return m_imageListNormal;
+    }
+    else if ( which == wxIMAGE_LIST_STATE )
     {
-    return m_imageListState;
-  }
-  return NULL;
+        return m_imageListState;
+    }
+    return NULL;
 }
 
 void wxTreeCtrl::SetImageList(wxImageList *imageList, int which)
@@ -122,7 +123,7 @@ long wxTreeCtrl::GetChild(long item) const
     return 0;
 }
 
-long wxTreeCtrl::GetParent(long item) const
+long wxTreeCtrl::GetItemParent(long item) const
 {
     // TODO
     return 0;
@@ -273,50 +274,50 @@ bool wxTreeCtrl::DeleteItem(long item)
 bool wxTreeCtrl::ExpandItem(long item, int action)
 {
     // TODO
-  switch ( action )
-  {
+    switch ( action )
+    {
     case wxTREE_EXPAND_EXPAND:
-      break;
-
+        break;
+        
     case wxTREE_EXPAND_COLLAPSE:
-      break;
-
+        break;
+        
     case wxTREE_EXPAND_COLLAPSE_RESET:
-      break;
-
+        break;
+        
     case wxTREE_EXPAND_TOGGLE:
-      break;
-
+        break;
+        
     default:
-      wxFAIL_MSG("unknown action in wxTreeCtrl::ExpandItem");
-  }
-
-  bool bOk = FALSE; // TODO expand item
-
-  // May not send messages, so emulate them
-  if ( bOk ) {
-    wxTreeEvent event(wxEVT_NULL, m_windowId);
-    event.m_item.m_itemId  = item;
-    event.m_item.m_mask      =
-    event.m_item.m_stateMask = 0xffff; // get all
-    GetItem(event.m_item);
-
-    bool bIsExpanded = (event.m_item.m_state & wxTREE_STATE_EXPANDED) != 0;
-
-    event.m_code = action;
-    event.SetEventObject(this);
-
-    // @@@ return values of {EXPAND|COLLAPS}ING event handler is discarded
-    event.SetEventType(bIsExpanded ? wxEVT_COMMAND_TREE_ITEM_EXPANDING
-                                   : wxEVT_COMMAND_TREE_ITEM_COLLAPSING);
-    GetEventHandler()->ProcessEvent(event);
-
-    event.SetEventType(bIsExpanded ? wxEVT_COMMAND_TREE_ITEM_EXPANDED
-                                   : wxEVT_COMMAND_TREE_ITEM_COLLAPSED);
-    GetEventHandler()->ProcessEvent(event);
-  }
-
-  return bOk;
+        wxFAIL_MSG("unknown action in wxTreeCtrl::ExpandItem");
+    }
+    
+    bool bOk = FALSE; // TODO expand item
+    
+    // May not send messages, so emulate them
+    if ( bOk ) {
+        wxTreeEvent event(wxEVT_NULL, m_windowId);
+        event.m_item.m_itemId  = item;
+        event.m_item.m_mask      =
+            event.m_item.m_stateMask = 0xffff; // get all
+        GetItem(event.m_item);
+        
+        bool bIsExpanded = (event.m_item.m_state & wxTREE_STATE_EXPANDED) != 0;
+        
+        event.m_code = action;
+        event.SetEventObject(this);
+        
+        // @@@ return values of {EXPAND|COLLAPS}ING event handler is discarded
+        event.SetEventType(bIsExpanded ? wxEVT_COMMAND_TREE_ITEM_EXPANDING
+            : wxEVT_COMMAND_TREE_ITEM_COLLAPSING);
+        GetEventHandler()->ProcessEvent(event);
+        
+        event.SetEventType(bIsExpanded ? wxEVT_COMMAND_TREE_ITEM_EXPANDED
+            : wxEVT_COMMAND_TREE_ITEM_COLLAPSED);
+        GetEventHandler()->ProcessEvent(event);
+    }
+    
+    return bOk;
 }
 
 long wxTreeCtrl::InsertItem(long parent, wxTreeItem& info, long insertAfter)