]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/carbon/dataview.cpp
minor fixes; replace references to Windows95 with references to wxMSW where possible
[wxWidgets.git] / src / osx / carbon / dataview.cpp
index e6435e32fb02d3fc6a07a7415a372a117f4470e8..3255d7dc9807f0bd6482ba5b73adb4ea947275bd 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        src/mac/carbon/datavgen.cpp
+// Name:        src/osx/carbon/datavgen.cpp
 // Purpose:     wxDataViewCtrl native mac implementation
 // Author:      
 // Id:          $Id$
@@ -220,7 +220,7 @@ public:
     bool noFailureFlag = (!(parent.IsOk()) && (this->m_dataViewControlPtr->AddItem(kDataBrowserNoItem,&itemID) == noErr) ||
                   parent.IsOk()  && (this->m_dataViewControlPtr->AddItem(reinterpret_cast<DataBrowserItemID>(parent.GetID()),&itemID) == noErr));
     
-    wxDataViewCtrl *dvc = (wxDataViewCtrl*) this->m_dataViewControlPtr->GetPeer();
+    wxDataViewCtrl *dvc = (wxDataViewCtrl*) this->m_dataViewControlPtr->GetWXPeer();
     if (dvc->GetWindowStyle() & wxDV_VARIABLE_LINE_HEIGHT)
     {
         wxDataViewModel *model = GetOwner();
@@ -270,7 +270,7 @@ public:
    // give allocated array space free again:
     delete[] itemIDs;
 
-    wxDataViewCtrl *dvc = (wxDataViewCtrl*) this->m_dataViewControlPtr->GetPeer();
+    wxDataViewCtrl *dvc = (wxDataViewCtrl*) this->m_dataViewControlPtr->GetWXPeer();
     if (dvc->GetWindowStyle() & wxDV_VARIABLE_LINE_HEIGHT)
     {
         wxDataViewModel *model = GetOwner();
@@ -321,7 +321,7 @@ public:
     wxCHECK_MSG(item.IsOk(),false,_("Changed item is invalid."));
     if (this->m_dataViewControlPtr->UpdateItems(&itemID) == noErr)
     {
-      wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer()));
+      wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetWXPeer()));
       
      // sent the equivalent wxWidget event:
       wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED,dataViewCtrlPtr->GetId()); // variable defintion
@@ -356,7 +356,7 @@ public:
     noFailureFlag = (this->m_dataViewControlPtr->UpdateItems(kDataBrowserNoItem,noOfEntries,itemIDs,kDataBrowserItemNoProperty,kDataBrowserItemNoProperty) == noErr);
     if (noFailureFlag)
     {
-      wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer()));
+      wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetWXPeer()));
       
      // send for all changed items a wxWidget event:
       wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED,dataViewCtrlPtr->GetId()); // variable defintion
@@ -385,7 +385,7 @@ public:
      // variable definition and initialization:
       DataBrowserItemID itemID(reinterpret_cast<DataBrowserItemID>(item.GetID()));
       OSStatus          errorStatus;
-      wxDataViewCtrl*   dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer()));
+      wxDataViewCtrl*   dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetWXPeer()));
       
      // when this method is called and currently an item is being edited this item may have already been deleted in the model (the passed item and the being edited item have
      // not to be identical because the being edited item might be below the passed item in the hierarchy);
@@ -407,7 +407,7 @@ public:
 
     DataBrowserItemID* itemIDs;
     
-    wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer()));
+    wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetWXPeer()));
 
     size_t noOfEntries;
     
@@ -439,7 +439,7 @@ public:
     
     DataBrowserPropertyID propertyID;
 
-    wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer()));
+    wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetWXPeer()));
 
 
     wxCHECK_MSG(item.IsOk(),             false,_("Passed item is invalid."));
@@ -475,6 +475,7 @@ public:
     wxDataViewItemArray array;
     GetOwner()->GetChildren( item, array );
     ItemsAdded( item, array );
+    this->m_dataViewControlPtr->SetScrollPosition(0, 0);
     return noFailureFlag;
   } /* Cleared() */
 
@@ -546,7 +547,6 @@ wxDataViewCustomRenderer::wxDataViewCustomRenderer(wxString const& varianttype,
 
 wxDataViewCustomRenderer::~wxDataViewCustomRenderer()
 {
-  if (this->m_DCPtr != NULL)
     delete this->m_DCPtr;
 } /* wxDataViewCustomRenderer::~wxDataViewCustomRenderer() */
 
@@ -1096,7 +1096,7 @@ void wxDataViewCtrl::Init()
 
 bool wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator )
 {
-  if (!(this->wxControl::Create(parent,id,pos,size,(style | wxSUNKEN_BORDER) & ~(wxHSCROLL | wxVSCROLL),validator)))
+  if (!(this->wxControl::Create(parent,id,pos,size,style & ~(wxHSCROLL | wxVSCROLL),validator)))
     return false;
 
 #ifdef __WXMAC__
@@ -1104,6 +1104,10 @@ bool wxDataViewCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos,
 #endif
 
   this->m_peer = new wxMacDataViewDataBrowserListViewControl(this,pos,size,style);
+  
+  if ( style & wxBORDER_NONE )
+    this->m_peer->SetData( kControlNoPart, kControlDataBrowserIncludesFrameAndFocusTag, (Boolean) false ) ;
+
   this->MacPostControlCreate(pos,size);
   ::SetAutomaticControlDragTrackingEnabledForWindow(::GetControlOwner(this->m_peer->GetControlRef()),true);