Update from Hartwig for OS X implementation

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49079 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling 2007-10-07 19:15:30 +00:00
parent b85e0ae0a1
commit a5fb925380
3 changed files with 239 additions and 204 deletions

View File

@ -178,11 +178,11 @@ public:
OSStatus UpdateItems(void) // updates all items
{
return this->UpdateItems(kDataBrowserNoItem,0,NULL,kDataBrowserItemNoProperty,kDataBrowserNoItem);
return this->UpdateItems(kDataBrowserNoItem,0,NULL,kDataBrowserItemNoProperty,kDataBrowserItemNoProperty);
}
OSStatus UpdateItems(DataBrowserItemID const* item) // updates all columns of item
{
return this->UpdateItems(kDataBrowserNoItem,1,item,kDataBrowserItemNoProperty,kDataBrowserNoItem);
return this->UpdateItems(kDataBrowserNoItem,1,item,kDataBrowserItemNoProperty,kDataBrowserItemNoProperty);
}
OSStatus UpdateItems(DataBrowserItemID container, UInt32 numItems, DataBrowserItemID const* items, DataBrowserPropertyID preSortProperty, DataBrowserPropertyID propertyID) const;

View File

@ -10,31 +10,9 @@
/////////////////////////////////////////////////////////////////////////////
#ifndef wxUSE_GENERICDATAVIEWCTRL
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include "wx/wxprec.h"
#if wxUSE_DATAVIEWCTRL
#include "wx/utils.h"
#ifndef WX_PRECOMP
#include "wx/app.h"
#include "wx/toplevel.h"
#include "wx/font.h"
#endif
#include "wx/apptrait.h"
#include "wx/mac/uma.h"
#include <limits>
#ifdef __DARWIN__
#include <Carbon/Carbon.h>
#else
@ -43,7 +21,19 @@
#include <TextEncodingConverter.h>
#endif
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include "wx/app.h"
#include "wx/toplevel.h"
#include "wx/font.h"
#endif
#include "wx/dataview.h"
#include "wx/utils.h"
#include "wx/mac/carbon/databrow.h"
#include "wx/mac/private.h"
#include "wx/mac/uma.h"
#if defined(__MWERKS__) && wxUSE_UNICODE
#if __MWERKS__ < 0x4100 || !defined(__DARWIN__)
@ -51,12 +41,6 @@
#endif
#endif
#include <limits>
#include "wx/mac/carbon/databrow.h"
#include "wx/dataview.h"
// ============================================================================
// wxMacDataBrowserTableViewControl
// ============================================================================
@ -813,14 +797,14 @@ OSStatus wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc(
void wxMacDataViewDataBrowserListViewControl::DataBrowserItemNotificationProc(DataBrowserItemID itemID, DataBrowserItemNotification message, DataBrowserItemDataRef itemData)
{
switch (message)
{
case kDataBrowserContainerClosed:
{
// variable definitions:
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetPeer()));
if (dataViewCtrlPtr != NULL) // can become NULL when the window is being deleted (wxWidget has already disposed the data before receiving this event
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetPeer()));
// check if the data view control pointer still exists because this call back function can still be called when the control has already been deleted:
if (dataViewCtrlPtr != NULL)
switch (message)
{
case kDataBrowserContainerClosed:
{
// initialize wxWidget event:
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED,dataViewCtrlPtr->GetId()); // variable definition
@ -829,31 +813,22 @@ void wxMacDataViewDataBrowserListViewControl::DataBrowserItemNotificationProc(Da
dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
// finally send the equivalent wxWidget event:
dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
} /* if */
} /* block */
break;
case kDataBrowserContainerOpened:
{
// variable definitions:
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetPeer()));
wxCHECK_RET(dataViewCtrlPtr != NULL,_("Pointer to data view control not set correctly."));
dataViewCtrlPtr->AddChildrenLevel(wxDataViewItem(reinterpret_cast<void*>(itemID)));
// initialize wxWidget event:
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED,dataViewCtrlPtr->GetId()); // variable definition
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
// finally send the equivalent wxWidget event:
dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
} /* block */
break;
case kDataBrowserEditStarted:
{
// variable definitions:
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetPeer()));
if (dataViewCtrlPtr != NULL)
} /* block */
break;
case kDataBrowserContainerOpened:
{
// initialize wxWidget event:
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED,dataViewCtrlPtr->GetId()); // variable definition
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
// finally send the equivalent wxWidget event:
dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
// add children to the expanded container:
dataViewCtrlPtr->AddChildrenLevel(wxDataViewItem(reinterpret_cast<void*>(itemID)));
} /* block */
break;
case kDataBrowserEditStarted:
{
// initialize wxWidget event:
DataBrowserPropertyID propertyID;
@ -872,150 +847,104 @@ void wxMacDataViewDataBrowserListViewControl::DataBrowserItemNotificationProc(Da
} /* if */
// finally send the equivalent wxWidget event:
dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
} /* if */
} /* block */
break;
case kDataBrowserEditStopped:
{
// variable definitions:
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetPeer()));
if (dataViewCtrlPtr != NULL)
{
// initialize wxWidget event:
DataBrowserPropertyID propertyID;
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE,dataViewCtrlPtr->GetId()); // variable definition
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
if (this->GetPropertyID(itemData,&propertyID) == noErr)
{
// variable definition and initialization:
DataBrowserTableViewColumnIndex columnIndex;
wxCHECK_RET(this->GetColumnIndex(propertyID,&columnIndex),_("Column index not found."));
dataViewEvent.SetColumn(columnIndex);
dataViewEvent.SetDataViewColumn(dataViewCtrlPtr->GetColumnPtr(propertyID));
} /* if */
// finally send the equivalent wxWidget event:
dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
} /* if */
} /* block */
break;
case kDataBrowserItemAdded:
{
// variable definitions:
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetPeer()));
wxCHECK_RET(dataViewCtrlPtr != NULL,_("Pointer to data view control not set correctly."));
// initialize wxWidget event:
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_MODEL_ITEM_ADDED,dataViewCtrlPtr->GetId()); // variable definition
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
// finally send the equivalent wxWidget event:
dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
} /* block */
break;
case kDataBrowserItemDeselected:
break; // not implemented by wxWidgets; see kDataBrowserSelectionSetChanged
case kDataBrowserItemDoubleClicked:
{
// variable definitions:
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetPeer()));
wxCHECK_RET(dataViewCtrlPtr != NULL,_("Pointer to data view control not set correctly."));
// initialize wxWidget event:
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED,dataViewCtrlPtr->GetId()); // variable definition
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
// finally send the equivalent wxWidget event:
dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
} /* block */
break;
case kDataBrowserItemRemoved:
{
// variable definitions:
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetPeer()));
if (dataViewCtrlPtr != NULL) // can become NULL when the window is being deleted (wxWidget has already disposed the data before receiving this event
} /* block */
break;
case kDataBrowserEditStopped:
{
// initialize wxWidget event:
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_MODEL_ITEM_DELETED,dataViewCtrlPtr->GetId()); // variable definition
DataBrowserPropertyID propertyID;
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE,dataViewCtrlPtr->GetId()); // variable definition
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
if (this->GetPropertyID(itemData,&propertyID) == noErr)
{
// variable definition and initialization:
DataBrowserTableViewColumnIndex columnIndex;
wxCHECK_RET(this->GetColumnIndex(propertyID,&columnIndex),_("Column index not found."));
dataViewEvent.SetColumn(columnIndex);
dataViewEvent.SetDataViewColumn(dataViewCtrlPtr->GetColumnPtr(propertyID));
} /* if */
// finally send the equivalent wxWidget event:
dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
} /* block */
break;
case kDataBrowserItemAdded:
break; // not used anymore
case kDataBrowserItemDeselected:
break; // not implemented by wxWidgets; see kDataBrowserSelectionSetChanged
case kDataBrowserItemDoubleClicked:
{
// initialize wxWidget event:
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED,dataViewCtrlPtr->GetId()); // variable definition
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID)));
// finally send the equivalent wxWidget event:
dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
} /* if */
} /* block */
break;
case kDataBrowserItemSelected:
break; // not implemented by wxWidgets; see kDataBrowserSelectionSetChanged
case kDataBrowserSelectionSetChanged:
{
// variable definitions:
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetPeer()));
wxCHECK_RET(dataViewCtrlPtr != NULL,_("Pointer to data view control not set correctly."));
// initialize wxWidget event:
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED,dataViewCtrlPtr->GetId()); // variable definition
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetModel (dataViewCtrlPtr->GetModel());
// finally send the equivalent wxWidget event:
dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
} /* block */
break;
case kDataBrowserUserStateChanged:
{
// variable definitions and initialization:
DataBrowserPropertyID propertyID;
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetPeer()));
wxCHECK_RET(dataViewCtrlPtr != NULL,_("Pointer to data view control not set correctly"));
// update column widths:
for (size_t i=0; i<dataViewCtrlPtr->GetColumnCount(); ++i)
} /* block */
break;
case kDataBrowserItemRemoved:
break; // not used anymore
case kDataBrowserItemSelected:
break; // not implemented by wxWidgets; see kDataBrowserSelectionSetChanged
case kDataBrowserSelectionSetChanged:
{
// constant definition for abbreviational purposes:
wxDataViewColumn* const columnPtr = dataViewCtrlPtr->GetColumn(i);
// variable definition:
UInt16 columnWidth;
wxCHECK_RET(this->GetColumnWidth(columnPtr->GetPropertyID(),&columnWidth) == noErr,_("Column width could not be determined"));
columnPtr->SetWidthVariable(columnWidth);
} /* for */
// update order status:
if ((this->GetSortProperty(&propertyID) == noErr) && (propertyID >= kMinPropertyID))
// initialize wxWidget event:
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED,dataViewCtrlPtr->GetId()); // variable definition
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetModel (dataViewCtrlPtr->GetModel());
// finally send the equivalent wxWidget event:
dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
} /* block */
break;
case kDataBrowserUserStateChanged:
{
DataBrowserSortOrder sortOrder;
DataBrowserTableViewColumnIndex columnIndex;
if ((this->GetSortOrder(&sortOrder) == noErr) && (this->GetColumnIndex(propertyID,&columnIndex) == noErr))
// update column widths:
for (size_t i=0; i<dataViewCtrlPtr->GetColumnCount(); ++i)
{
// variable definition and initialization:
wxDataViewColumn* columnPtr;
columnPtr = dataViewCtrlPtr->GetColumn(columnIndex);
// check if the sort order has changed:
if ( columnPtr->IsSortOrderAscending() && (sortOrder == kDataBrowserOrderDecreasing) ||
!(columnPtr->IsSortOrderAscending()) && (sortOrder == kDataBrowserOrderIncreasing))
{
columnPtr->SetSortOrder(!(columnPtr->IsSortOrderAscending()));
// initialize wxWidget event:
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED,dataViewCtrlPtr->GetId()); // variable defintion
// constant definition for abbreviational purposes:
wxDataViewColumn* const columnPtr = dataViewCtrlPtr->GetColumn(i);
// variable definition:
UInt16 columnWidth;
wxCHECK_RET(this->GetColumnWidth(columnPtr->GetPropertyID(),&columnWidth) == noErr,_("Column width could not be determined"));
columnPtr->SetWidthVariable(columnWidth);
} /* for */
// update order status:
DataBrowserPropertyID propertyID; // variable definition
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetColumn(columnIndex);
dataViewEvent.SetDataViewColumn(columnPtr);
// finally send the equivalent wxWidget event:
dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
if ((this->GetSortProperty(&propertyID) == noErr) && (propertyID >= kMinPropertyID))
{
DataBrowserSortOrder sortOrder;
DataBrowserTableViewColumnIndex columnIndex;
if ((this->GetSortOrder(&sortOrder) == noErr) && (this->GetColumnIndex(propertyID,&columnIndex) == noErr))
{
// variable definition and initialization:
wxDataViewColumn* columnPtr;
columnPtr = dataViewCtrlPtr->GetColumn(columnIndex);
// check if the sort order has changed:
if ( columnPtr->IsSortOrderAscending() && (sortOrder == kDataBrowserOrderDecreasing) ||
!(columnPtr->IsSortOrderAscending()) && (sortOrder == kDataBrowserOrderIncreasing))
{
columnPtr->SetSortOrder(!(columnPtr->IsSortOrderAscending()));
// initialize wxWidget event:
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED,dataViewCtrlPtr->GetId()); // variable defintion
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetColumn(columnIndex);
dataViewEvent.SetDataViewColumn(columnPtr);
// finally send the equivalent wxWidget event:
dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
} /* if */
} /* if */
} /* if */
} /* if */
} /* block */
break;
} /* switch */
} /* block */
break;
} /* switch */
} /* wxMacDataViewDataBrowserListViewControl::DataBrowserItemNotificationProc(DataBrowserItemID, DataBrowserItemNotification, DataBrowserItemDataRef) */

View File

@ -92,6 +92,25 @@ static pascal OSStatus wxMacDataViewCtrlEventHandler(EventHandlerCallRef handler
return eventNotHandledErr;
} /* wxMacDataViewCtrlEventHandler(EventHandlerCallRef, EventRef, void*) */
static DataBrowserItemID* CreateDataBrowserItemIDArray(size_t& noOfEntries, wxDataViewItemArray const& items) // returns a newly allocated pointer to valid data browser item IDs
{
size_t const noOfItems = items.GetCount();
DataBrowserItemID* itemIDs(new DataBrowserItemID[noOfItems]);
// convert all valid data view items to data browser items
noOfEntries = 0;
for (size_t i=0; i<noOfItems; ++i)
if (items[i].IsOk())
{
itemIDs[noOfEntries] = reinterpret_cast<DataBrowserItemID>(items[i].GetID());
++noOfEntries;
} /* if */
// done:
return itemIDs;
} /* CreateDataBrowserItemIDArray(size_t&, wxDataViewItemArray const&) */
//-----------------------------------------------------------------------------
// local function pointers
//-----------------------------------------------------------------------------
@ -119,19 +138,39 @@ public:
parent.IsOk() && (this->m_dataViewControlPtr->AddItem(reinterpret_cast<DataBrowserItemID>(parent.GetID()),&itemID) == noErr));
} /* ItemAdded(wxDataViewItem const&, wxDataViewItem const&) */
virtual bool ItemsAdded(wxDataViewItem const& parent, wxDataViewItemArray const& items)
{
bool noFailureFlag;
DataBrowserItemID* itemIDs;
size_t noOfEntries;
// convert all valid data view items to data browser items:
itemIDs = ::CreateDataBrowserItemIDArray(noOfEntries,items);
// insert all valid items into control:
noFailureFlag = ((noOfEntries == 0) ||
!(parent.IsOk()) && (this->m_dataViewControlPtr->AddItems(kDataBrowserNoItem,noOfEntries,itemIDs,kDataBrowserItemNoProperty) == noErr) ||
parent.IsOk() && (this->m_dataViewControlPtr->AddItems(reinterpret_cast<DataBrowserItemID>(parent.GetID()),noOfEntries,itemIDs,kDataBrowserItemNoProperty) == noErr));
// give allocated array space free again:
delete[] itemIDs;
// done:
return noFailureFlag;
} /* ItemsAdded(wxDataViewItem const&, wxDataViewItemArray const&) */
virtual bool ItemChanged(wxDataViewItem const& item)
{
DataBrowserItemID itemID(reinterpret_cast<DataBrowserItemID>(item.GetID()));
wxCHECK_MSG(item.IsOk(), false,_("Changed item is invalid."));
wxCHECK_MSG(this->GetOwner() != NULL,false,_("Owner not initialized."));
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()));
// sent the equivalent wxWidget event:
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_VALUE_ITEM_CHANGED,dataViewCtrlPtr->GetId()); // variable defintion
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED,dataViewCtrlPtr->GetId()); // variable defintion
dataViewEvent.SetEventObject(dataViewCtrlPtr);
dataViewEvent.SetItem(item);
@ -144,6 +183,39 @@ public:
return false;
} /* ItemChanged(wxDataViewItem const&) */
virtual bool ItemsChanged(wxDataViewItemArray const& items)
{
bool noFailureFlag;
DataBrowserItemID* itemIDs;
size_t noOfEntries;
// convert all valid data view items to data browser items:
itemIDs = ::CreateDataBrowserItemIDArray(noOfEntries,items);
// change items (ATTENTION: ONLY ITEMS OF THE ROOT ARE CHANGED BECAUSE THE PARENT PARAMETER IS MISSING):
noFailureFlag = (this->m_dataViewControlPtr->UpdateItems(kDataBrowserNoItem,noOfEntries,itemIDs,kDataBrowserItemNoProperty,kDataBrowserItemNoProperty) == noErr);
if (noFailureFlag)
{
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer()));
// send for all changed items a wxWidget event:
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED,dataViewCtrlPtr->GetId()); // variable defintion
dataViewEvent.SetEventObject(dataViewCtrlPtr);
for (size_t i=0; i<noOfEntries; ++i)
{
dataViewEvent.SetItem(reinterpret_cast<void*>(itemIDs[i]));
dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent);
} /* for */
} /* if */
// release allocated array space:
delete[] itemIDs;
// done:
return noFailureFlag;
} /* ItemsChanged(wxDataViewItem const&) */
virtual bool ItemDeleted(wxDataViewItem const& parent, wxDataViewItem const& item)
{
if (item.IsOk())
@ -154,10 +226,12 @@ public:
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer()));
// 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); therefore, the control is informed that currently a deleting process
// is started and that variables can currently not be updated even when requested by the system:
// not to be identical because the being edited item might be below the passed item in the hierarchy);
// to prevent the control trying to ask the model to update an already deleted item the control is informed that currently a deleting process
// has been started and that variables can currently not be updated even when requested by the system:
dataViewCtrlPtr->SetDeleting(true);
errorStatus = this->m_dataViewControlPtr->RemoveItem(reinterpret_cast<DataBrowserItemID>(parent.GetID()),&itemID);
// enable automatic updating again:
dataViewCtrlPtr->SetDeleting(false);
return (errorStatus == noErr);
} /* if */
@ -165,6 +239,37 @@ public:
return false;
} /* ItemDeleted(wxDataViewItem const&, wxDataViewItem const&) */
virtual bool ItemsDeleted(wxDataViewItem const& parent, wxDataViewItemArray const& items)
{
bool noFailureFlag;
DataBrowserItemID* itemIDs;
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer()));
size_t noOfEntries;
wxCHECK_MSG(dataViewCtrlPtr != NULL,false,_("Data view control is not correctly initialized"));
// convert all valid data view items to data browser items:
itemIDs = ::CreateDataBrowserItemIDArray(noOfEntries,items);
// 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);
// to prevent the control trying to ask the model to update an already deleted item the control is informed that currently a deleting process
// has been started and that variables can currently not be updated even when requested by the system:
dataViewCtrlPtr->SetDeleting(true);
// insert all valid items into control:
noFailureFlag = ((noOfEntries == 0) ||
!(parent.IsOk()) && (this->m_dataViewControlPtr->RemoveItems(kDataBrowserNoItem,noOfEntries,itemIDs,kDataBrowserItemNoProperty) == noErr) ||
parent.IsOk() && (this->m_dataViewControlPtr->RemoveItems(reinterpret_cast<DataBrowserItemID>(parent.GetID()),noOfEntries,itemIDs,kDataBrowserItemNoProperty) == noErr));
// enable automatic updating again:
dataViewCtrlPtr->SetDeleting(false);
// give allocated array space free again:
delete[] itemIDs;
// done:
return noFailureFlag;
} /* ItemsDeleted(wxDataViewItem const&, wxDataViewItemArray const&) */
virtual bool ValueChanged(wxDataViewItem const& item, unsigned int col)
{
DataBrowserItemID itemID(reinterpret_cast<DataBrowserItemID>(item.GetID()));
@ -199,10 +304,7 @@ public:
virtual bool Cleared(void)
{
if (this->m_dataViewControlPtr->RemoveItems() == noErr)
return true;
else
return false;
return (this->m_dataViewControlPtr->RemoveItems() == noErr);
} /* Cleared(void) */
virtual void Resort(void)
@ -1107,8 +1209,12 @@ void wxDataViewCtrl::AddChildrenLevel(wxDataViewItem const& parentItem)
wxCHECK_RET(this->GetModel() != NULL,_("Model pointer not initialized."));
NoOfChildren = this->GetModel()->GetChildren(parentItem,items);
#if 0
for (int i=0; i<NoOfChildren; ++i)
(void) this->GetModel()->ItemAdded(parentItem,items[i]);
#else
(void) this->GetModel()->ItemsAdded(parentItem,items);
#endif
} /* wxDataViewCtrl::AddChildrenLevel(wxDataViewItem const&) */
wxDataViewColumn* wxDataViewCtrl::GetColumnPtr(DataBrowserPropertyID propertyID) const