preliminary editing support

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41324 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor 2006-09-20 15:48:15 +00:00
parent 0428ac8c47
commit 8d700f716f

View File

@ -1276,6 +1276,13 @@ void wxMacListCtrlItem::Notification(wxMacDataItemBrowserControl *owner ,
wxListEvent event( wxEVT_COMMAND_LIST_ITEM_SELECTED, list->GetId() );
bool isSingle = list->GetWindowStyle() | wxLC_SINGLE_SEL;
event.SetEventObject( list );
event.m_itemIndex = owner->GetLineFromItem( this ) ;
if ( !list->IsVirtual() )
{
lb->MacGetColumnInfo(event.m_itemIndex,0,event.m_item);
}
switch (message)
{
case kDataBrowserItemDeselected:
@ -1293,18 +1300,25 @@ void wxMacListCtrlItem::Notification(wxMacDataItemBrowserControl *owner ,
trigger = true;
break;
case kDataBrowserEditStarted :
// TODO : how to veto ?
event.SetEventType( wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT ) ;
trigger = true ;
break ;
case kDataBrowserEditStopped :
// TODO probably trigger only upon the value store callback, because
// here IIRC we cannot veto
event.SetEventType( wxEVT_COMMAND_LIST_END_LABEL_EDIT ) ;
trigger = true ;
break ;
default:
break;
}
if ( trigger )
{
event.SetEventObject( list );
event.m_itemIndex = owner->GetLineFromItem( this ) ;
if ( !list->IsVirtual() )
{
lb->MacGetColumnInfo(event.m_itemIndex,0,event.m_item);
}
// direct notification is not always having the listbox GetSelection() having in synch with event
wxPostEvent( list->GetEventHandler(), event );
}
@ -1525,8 +1539,19 @@ OSStatus wxMacListCtrlItem::GetSetData( wxMacDataItemBrowserControl *owner ,
{
OSStatus err = errDataBrowserPropertyNotSupported;
wxListCtrl* list = wxDynamicCast( owner->GetPeer() , wxListCtrl );
if ( !changeValue )
{
switch (property)
{
case kDataBrowserItemIsEditableProperty :
if ( list && list->HasFlag( wxLC_EDIT_LABELS ) )
{
verify_noerr(SetDataBrowserItemDataBooleanValue( itemData, true ));
err = noErr ;
}
break ;
default :
if ( property >= kMinColumnId ){
short listColumn = property - kMinColumnId;
@ -1542,7 +1567,6 @@ OSStatus wxMacListCtrlItem::GetSetData( wxMacDataItemBrowserControl *owner ,
int imgIndex = item->GetImage();
if ( (item->GetMask() & wxLIST_MASK_IMAGE) ){
wxListCtrl* list = wxDynamicCast( owner->GetPeer() , wxListCtrl );
wxImageList* imageList = list->GetImageList(wxIMAGE_LIST_SMALL);
if (imageList && imageList->GetImageCount() > 0){
wxBitmap bmp = imageList->GetBitmap(imgIndex);
@ -1553,13 +1577,27 @@ OSStatus wxMacListCtrlItem::GetSetData( wxMacDataItemBrowserControl *owner ,
}
}
break ;
}
}
else
{
switch (property)
{
// no editable props here
default:
if ( property >= kMinColumnId ){
short listColumn = property - kMinColumnId;
if (HasColumnInfo(listColumn)){
// TODO probably send the 'end edit' from here, as we
// can then deal with the veto
CFStringRef sr ;
verify_noerr( GetDataBrowserItemDataText( itemData , &sr ) ) ;
wxMacCFStringHolder cfStr(sr) ;;
list->SetItem( owner->GetLineFromItem(this) , listColumn, cfStr.AsString() ) ;
err = noErr ;
}
}
break;
}
}