EXPORT_C TBool CEikListBoxTextEditor::UpdateModelL() // virtual - needs to be rewritten if editing other than single column text list { _AKNTRACE_FUNC_ENTER; if (!Editor()) { _AKNTRACE_FUNC_EXIT; return EFalse; // quit if editing is not currently on } const MDesCArray* matchableTextArray=ListBoxModel()->MatchableTextArray(); CDesCArray* textArray=(CDesCArray*)matchableTextArray; TPtrC itemtext = ItemText(); if ( iItemPos ) // partly editable item? { HBufC* itemBuffer= HBufC::New(itemtext.Length()); CleanupStack::PushL( itemBuffer ); TPtr itemPointer = itemBuffer->Des(); itemPointer.Append( itemtext.Left( iItemPos ) ); HBufC* ptr=iEditor->GetTextInHBufL(); TPtrC newText; if (ptr) { newText.Set(ptr->Des()); } TInt addSpaces = iItemLen - newText.Length(); for (TInt index=0; ((addSpaces>0) && (index<addSpaces)); index++) itemPointer.Append(_L(" ")); itemPointer.Append( newText ); itemPointer.Append( itemtext.Right( itemtext.Length()-iItemPos-iItemLen ) ); delete ptr; textArray->InsertL( ItemIndex(), *itemBuffer ); CleanupStack::PopAndDestroy(); // itemBuffer textArray->Delete( ItemIndex()+1 ); } else // replace the whole list item { HBufC* newText = iEditor->GetTextInHBufL(); if (!newText) return ETrue; // if user tries to insert an empty text... CleanupStack::PushL(newText); textArray->InsertL(ItemIndex(),*newText); CleanupStack::PopAndDestroy(); // newText textArray->Delete( ItemIndex() + 1 ); } _AKNTRACE_FUNC_EXIT; return ETrue; }
/** * Moves an array of items * * This function must be entered with the playlist lock * * \param p_playlist the playlist * \param i_items the number of indexes to move * \param pp_items the array of indexes to move * \param p_node the target node * \param i_newpos the target position under this node * \return VLC_SUCCESS or an error */ int playlist_TreeMoveMany( playlist_t *p_playlist, int i_items, playlist_item_t **pp_items, playlist_item_t *p_node, int i_newpos ) { PL_ASSERT_LOCKED; if ( p_node->i_children == -1 ) return VLC_EGENERIC; int i; for( i = 0; i < i_items; i++ ) { playlist_item_t *p_item = pp_items[i]; int i_index = ItemIndex( p_item ); playlist_item_t *p_parent = p_item->p_parent; REMOVE_ELEM( p_parent->pp_children, p_parent->i_children, i_index ); if ( p_parent == p_node && i_index < i_newpos ) i_newpos--; } for( i = i_items - 1; i >= 0; i-- ) { playlist_item_t *p_item = pp_items[i]; INSERT_ELEM( p_node->pp_children, p_node->i_children, i_newpos, p_item ); p_item->p_parent = p_node; } pl_priv( p_playlist )->b_reset_currently_playing = true; vlc_cond_signal( &pl_priv( p_playlist )->signal ); return VLC_SUCCESS; }
bool CTestListCtrl::OnItemButtonClicked( CRhinoUiOptionsListCtrlCheckBox& item ) { CRhinoUiOptionsListCtrl::OnItemButtonClicked( item ); CTestOptionsListCtrlDialog* pDlg = static_cast<CTestOptionsListCtrlDialog*>( GetParent()); if( item.ItemID() == m_VerticalCheckBox.ItemID()) { //pDlg->GetTabCtrl()->SetExpandableTabFlag( CRhinoUiExpandableTabCtrl::etf_vertical_tabs, BST_CHECKED != m_VerticalCheckBox.GetCheck()); } else if( item.ItemID() == m_HideTabCheckBox.ItemID()) { bool bHide = BST_UNCHECKED == m_HideTabCheckBox.GetCheck(); //CRhinoUiExpandableTabCtrl* pTabCtrl = pDlg->GetTabCtrl(); //if( pTabCtrl) //{ // pTabCtrl->HideTab( 1, bHide); //} } else if( item.ItemID() == m_HasIsoCurves.ItemID()) { bool bEnable = BST_UNCHECKED != m_HasIsoCurves.GetCheck(); m_ShowIsoCurves.SetIsEnabled( bEnable); m_IsoCurveDinsity.SetIsEnabled( bEnable); RedrawItem( ItemIndex( m_ShowIsoCurves)); RedrawItem( m_IsoCurveDinsity); } return true; }
AbstractTreeModel::ItemIndex FileSystemModel::index(const AbstractItem* item) const { assert(item != nullptr); auto fileItem = static_cast<const FileItem*>(item); auto parentItem = fileItem->parent_; auto& items = impl_->getItems(parentItem); auto findIt = std::find_if(items.begin(), items.end(), [&](const std::unique_ptr<FileItem>& value) { return value.get() == fileItem; }); if (findIt != items.end()) { return ItemIndex(static_cast<int>(std::distance(items.begin(), findIt)), parentItem); } return ItemIndex(); }
/** * Moves an item * * This function must be entered with the playlist lock * * \param p_playlist the playlist * \param p_item the item to move * \param p_node the new parent of the item * \param i_newpos the new position under this new parent * \return VLC_SUCCESS or an error */ int playlist_TreeMove( playlist_t * p_playlist, playlist_item_t *p_item, playlist_item_t *p_node, int i_newpos ) { PL_ASSERT_LOCKED; if( p_node->i_children == -1 ) return VLC_EGENERIC; playlist_item_t *p_detach = p_item->p_parent; int i_index = ItemIndex( p_item ); REMOVE_ELEM( p_detach->pp_children, p_detach->i_children, i_index ); if( p_detach == p_node && i_index < i_newpos ) i_newpos--; INSERT_ELEM( p_node->pp_children, p_node->i_children, i_newpos, p_item ); p_item->p_parent = p_node; pl_priv( p_playlist )->b_reset_currently_playing = true; vlc_cond_signal( &pl_priv( p_playlist )->signal ); return VLC_SUCCESS; }
EXPORT_C TPtrC CEikListBoxTextEditor::ItemText() { return static_cast<MTextListBoxModel*>(ListBoxModel())->ItemText(ItemIndex()); }