Пример #1
0
        wxTreeItemId HierTreeCtrl::MoveItem(wxTreeItemId& source, wxTreeItemId& destination, wxTreeItemId& parent)
        {
            wxTreeItemId newItem;
            if (parent != destination)
            {
                newItem = InsertItem(parent, destination, GetItemText(source), GetItemImage(source), -1,
                                    new HierTreeItemData(*(HierTreeItemData*)GetItemData(source)));
            }
            else
            {
                newItem = AppendItem(parent, GetItemText(source), GetItemImage(source), -1,
                                    new HierTreeItemData(*(HierTreeItemData*)GetItemData(source)));
            }

            // Move all the children from the old parent to the new one recursively
            wxTreeItemIdValue cookie;
            wxTreeItemId oldChild = GetFirstChild(source, cookie);
            while (GetChildrenCount(source, false) > 0)
            {
                MoveItem(oldChild, newItem, newItem);
                oldChild = GetFirstChild(source, cookie);
            }

            Delete(source);
            return newItem;
        }
Пример #2
0
void MyTreeCtrl::DoToggleIcon(const wxTreeItemId& item)
{
    int image = (GetItemImage(item) == TreeCtrlIcon_Folder)
                    ? TreeCtrlIcon_File
                    : TreeCtrlIcon_Folder;
    SetItemImage(item, image, wxTreeItemIcon_Normal);

    image = (GetItemImage(item) == TreeCtrlIcon_FolderSelected)
                    ? TreeCtrlIcon_FileSelected
                    : TreeCtrlIcon_FolderSelected;
    SetItemImage(item, image, wxTreeItemIcon_Selected);
}
Пример #3
0
void browsers::CellBrowser::copyItem(const wxTreeItemId item, const wxTreeItemId newparent) {
   wxTreeItemId newitem = AppendItem(newparent, GetItemText(item));
   SetItemImage(newitem, GetItemImage(item,wxTreeItemIcon_Normal), wxTreeItemIcon_Normal);
   SetItemImage(newitem, GetItemImage(item,wxTreeItemIcon_Expanded), wxTreeItemIcon_Expanded);
   SetItemImage(newparent,0,wxTreeItemIcon_Normal);
   SetItemImage(newparent,1,wxTreeItemIcon_Expanded);
   SetItemTextColour(newitem, GetItemTextColour(newparent));
   wxTreeItemIdValue cookie;
   wxTreeItemId child = GetFirstChild(item,cookie);
   while (child.IsOk()) {
      copyItem(child, newitem);
      child = GetNextChild(item,cookie);
   }
}
Пример #4
0
int SymbolTree::OnCompareItems(const wxTreeItemId& item1, const wxTreeItemId& item2)
{
	// Get the items and compare their icons
	int img1, img2;
	img1 = GetItemImage(item1);
	img2 = GetItemImage(item2);
	if (img1 > img2)
		return 1;
	else if (img1 < img2)
		return -1;
	else {
		// Items  has the same icons, compare text
		return wxTreeCtrl::OnCompareItems(item1, item2);
	}
}
Пример #5
0
void CZoneTree::ConvertMobToIndex(HTREEITEM &hItem, HTREEITEM &hNewItem, HTREEITEM &htiNewParent)
{
	int x;
	HTREEITEM par;

	GetItemImage(htiNewParent, x, x);

	switch(x) {
	case PEOPLE:
		room_data *room;
		mob_index *mob;
					
		par = GetParentItem(htiNewParent);
		room = (room_data*)GetItemData(par);
					
		if(room) {
			mob = room->AddPerson((mob_data*)GetItemData(hItem));
			mob->m_tThis = hNewItem;
		}
					
		SetItemImage(hNewItem, MOB_INDEX, MOB_INDEX);
		SetItemData(hNewItem, (DWORD)mob);
		break;
	}
}
Пример #6
0
VOID CEasySkinTreeCtrl::DrawListImage( CDC * pDC, CRect rcRect, HTREEITEM hTreeItem, bool bSelected )
{
	CMapItemInfo::iterator iter= m_MapItemInfo.find(hTreeItem);
	if( iter == m_MapItemInfo.end() )
	{
		CImageList *pImageList = GetImageList(TVSIL_NORMAL);
		if( pImageList == NULL ) return;

		//获取属性
		INT nImage,nSelectedImage;
		GetItemImage(hTreeItem,nImage,nSelectedImage);

		//获取信息
		IMAGEINFO ImageInfo;
		pImageList->GetImageInfo(bSelected?nSelectedImage:nImage,&ImageInfo);

		//绘画图标
		INT nImageWidth=ImageInfo.rcImage.right-ImageInfo.rcImage.left;
		INT nImageHeight=ImageInfo.rcImage.bottom-ImageInfo.rcImage.top;

		pImageList->Draw(pDC,bSelected?nSelectedImage:nImage,CPoint(rcRect.left-nImageWidth-3,rcRect.top+(rcRect.Height()-nImageHeight)/2+1),ILD_TRANSPARENT);
	}
	else
	{
		CImageEx *pImage = iter->second.pImage;
		pImage->DrawImage(pDC,rcRect.left-pImage->GetWidth()-3,rcRect.top+(rcRect.Height()-pImage->GetHeight())/2+1);
	}
}
Пример #7
0
void SymbolTree::UpdateGuiItem(TagEntry& data, const wxString& key)
{
	if (!m_tree)
		return;

	TagNode* node = m_tree->Find(key);
	if ( node ) {
		// Update the new data with the gui tree item id
		data.SetTreeItemId( node->GetData().GetTreeItemId() );
		node->SetData(data);

		// Update Icon if needed
		int iconIndex = GetItemIconIndex(data.GetKind(), data.GetAccess());
		int curIconIndex = -1;
		wxTreeItemId itemId = node->GetData().GetTreeItemId();
		if (itemId.IsOk()) {
			curIconIndex = GetItemImage(itemId);
			if (curIconIndex != iconIndex ) {
				// Need to update the image as well
				SetItemImage(node->GetData().GetTreeItemId(), iconIndex);
				SetItemImage(node->GetData().GetTreeItemId(), iconIndex, wxTreeItemIcon_Selected);

			} // if(curIconIndex != iconIndex )
			//update the linenumber and file
			MyTreeItemData *item_data = new MyTreeItemData(data.GetFile(), data.GetPattern());
			wxTreeItemData *old_data = GetItemData(itemId);
			if (old_data)
				delete old_data;
			SetItemData(itemId, item_data);
		}
	}
}
Пример #8
0
TBWidget *TBSelectItemSource::CreateItemWidget(int index, TBSelectItemViewer *viewer)
{
	const char *string = GetItemString(index);
	TBSelectItemSource *sub_source = GetItemSubSource(index);
	TBID image = GetItemImage(index);
	if (sub_source || image)
	{
		if (TBSimpleLayoutItemWidget *itemwidget = new TBSimpleLayoutItemWidget(image, sub_source, string))
			return itemwidget;
	}
	else if (string && *string == '-')
	{
		if (TBSeparator *separator = new TBSeparator)
		{
			separator->SetGravity(WIDGET_GRAVITY_ALL);
			separator->SetSkinBg(TBIDC("TBSelectItem.separator"));
			return separator;
		}
	}
	else if (TBTextField *textfield = new TBTextField)
	{
		textfield->SetSkinBg("TBSelectItem");
		textfield->SetText(string);
		textfield->SetTextAlign(TB_TEXT_ALIGN_LEFT);
		return textfield;
	}
	return nullptr;
}
Пример #9
0
void CHostList::OnLButtonDblClk(UINT nFlags, CPoint point)
{
	// TODO: Add your message handler code here and/or call default
	do 
	{
		POSITION pos = GetFirstSelectedItemPosition();
		int index = GetNextSelectedItem(pos);

		if (index < 0)
		{
			break;
		}

		if (GetItemData(index) == 0)
		{
			int nImage = GetItemImage(index,0);
			CString szGName = GetItemText(index,0);

			if (nImage == 1)
			{
				SetItemImage(index,0,2);
				InsertGroupsClient(index,m_GroupsMap[(LPCTSTR)szGName]);
			}
			else
			{
				SetItemImage(index,0,1);
				DeleteGroupsClient(index,m_GroupsMap[(LPCTSTR)szGName]);
			}
		}
	} while (FALSE);

	_MouseClkMonitor(WM_LBUTTONDBLCLK, nFlags, point, TRUE);
}
Пример #10
0
void MyTreeCtrl::DoToggleIcon(const wxTreeItemId& item)
{
    int image = GetItemImage(item) == TreeCtrlIcon_Folder ? TreeCtrlIcon_File
                                                          : TreeCtrlIcon_Folder;

    SetItemImage(item, image);
}
Пример #11
0
void CZoneTree::CopyMobIndex(HTREEITEM &hItem, HTREEITEM &hNewItem, HTREEITEM &htiNewParent)
{
	int x;
	HTREEITEM it, par;
	
	GetItemImage(htiNewParent, x, x);
	
	switch(x){
	case PEOPLE:
		room_data *room;
		mob_index *mob;
			
		par = GetParentItem(hItem);
		it = GetParentItem(par);

		room = (room_data*)GetItemData(it);
		mob = (mob_index*)GetItemData(hItem);
					
		room->RemovePerson(mob);

		par = GetParentItem(htiNewParent);
		room = (room_data*)GetItemData(par);
					
		room->AddPerson(mob);
		mob->m_tThis = hNewItem;

		SetItemData(hNewItem, (DWORD)mob);
		DeleteItem(hItem);
		break;
	}	
}
Пример #12
0
void CAnimDialog::OnGetdispinfoIconres(NMHDR* pNMHDR, LRESULT* pResult) 
{
	LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
	// TODO: Add your control notification handler code here
	
  if(pDispInfo->item.mask&LVIF_TEXT) {
    int idx=determinetype(m_restype);
    POSITION pos=resources[idx]->GetStartPosition();
    CString key;
    loc_entry fileloc;
    int i = pDispInfo->item.iItem;
    do {
      resources[idx]->GetNextAssoc(pos,key,fileloc);
      if (m_filter.IsEmpty() || (key.Find(m_filter)!=-1))
      {
        if (!i) break;
        i--;
      }
    }
    while(pos);

    pDispInfo->item.pszText = 
    strncpy(pDispInfo->item.pszText,key,pDispInfo->item.cchTextMax);
  }
  if(pDispInfo->item.mask&LVIF_IMAGE) {
    GetItemImage(pDispInfo);
  }
	*pResult = 0;
}
TBWidget *MenubarItemSource::CreateItemWidget(int index, TBSelectItemViewer *viewer)
{
    const char *string = GetItemString(index);

    TBSelectItemSource *sub_source = GetItemSubSource(index);
    TBID image = GetItemImage(index);

    if (sub_source || image)
    {
        if (TBSimpleLayoutItemWidget *itemwidget = new TBSimpleLayoutItemWidget(image, sub_source, string))
        {
            itemwidget->SetID(GetItem(index)->id);
            return itemwidget;
        }
    }
    else if (string && *string == '-')
    {
        if (TBSeparator *separator = new TBSeparator)
        {
            separator->SetGravity(WIDGET_GRAVITY_ALL);
            separator->SetSkinBg(TBIDC("AESeparator"));
            return separator;
        }
    }
    else if (TBLayout *layout = new MenubarItemWidget(GetItem(index), this, viewer, index))
    {
        layout->SetID(GetItem(index)->id);
        return layout;
    }

    return NULL;
}
Пример #14
0
BOOL CReportCtrlEx2::StartEdit(int nItem, int nSubItem)
{
	// Get the grid width and height
	if (!m_bAllowEdit || /*!_IsValidIndex(nItem) ||*/ nSubItem < 0 || nSubItem >= GetColumnCount())
		return FALSE;

	if (m_ptEditting.x == nItem && m_ptEditting.y == nSubItem)
		return TRUE;

	EndItem(TRUE);
		
	m_ptEditting.x = nItem;
	m_ptEditting.y = nSubItem;
	SetAllItemStates(RC_ITEM_SELECTED, RC_ITEM_UNSELECTED); // unselect all
	//SetItemStates(m_ptEditting.x, RC_ITEM_SELECTED | RC_ITEM_FOCUSED);

	// determine editbox font and alignment
	const DWORD FMT = _GetHeaderTextFormat(nSubItem);
	if (FMT != m_dwPrevEditFmt)
	{
		m_dwPrevEditFmt = FMT;

		// Funny thing:
		// Changing CEdit style among ES_LEFT, ES_CENTER, ES_RIGHT at runtime works
		// sometimes and fails other times. It just cannot guarantee to be succeed.
		// So I decided to destroy and recreate the CEdit every time when the text
		// format changes.
		if (m_pWndEdit->GetSafeHwnd() != NULL)
			m_pWndEdit->DestroyWindow();

		if (!m_pWndEdit->Create(ES_AUTOHSCROLL | ES_NOHIDESEL | WS_CHILD | WS_BORDER | FMT, CRect(0, 0, 1, 1), this, 0))
			return FALSE;
	}
	else
	{
		if (m_pWndEdit->GetSafeHwnd() == NULL
			&& !m_pWndEdit->Create(ES_AUTOHSCROLL | ES_NOHIDESEL | WS_CHILD | WS_BORDER | FMT, CRect(0, 0, 1, 1), this, 0))
		{
			return FALSE;
		}
	}

	m_pWndEdit->SetFont(GetFont());

	CRect rcEdit;
	ListView_GetSubItemRect(GetSafeHwnd(), m_ptEditting.x, m_ptEditting.y, LVIR_LABEL, &rcEdit);
	if (m_ptEditting.y > 0 && GetImageList() != NULL && GetItemImage(m_ptEditting.x, m_ptEditting.y) >= 0)
		rcEdit.DeflateRect(16, 0, 0, 0);

	// Move the editbox to that grid, obtain text from the grid, display the
	// editbox, and, finally, highlights all text in the editbox and set the
	// windows focus to the editbox.
	m_pWndEdit->MoveWindow(&rcEdit);
	m_pWndEdit->SetWindowText(GetItemText(m_ptEditting.x, m_ptEditting.y));
	m_pWndEdit->ShowWindow(SW_SHOW);
	m_pWndEdit->SetSel(0, -1);
	m_pWndEdit->SetFocus();

	return TRUE;
}
Пример #15
0
void
JXCurrentPathMenu::SetPath
	(
	const JCharacter* path
	)
{
	RemoveAllItems();

	JString p = path;
	JCleanPath(&p);

	JString p1, n;
	while (!JIsRootDirectory(p))
		{
		JStripTrailingDirSeparator(&p);
		JSplitPathAndName(p, &p1, &n);
		PrependItem(n);
		SetItemImage(1, GetIcon(p), kJFalse);
		p = p1;
		}

	PrependItem(p);
	SetItemImage(1, GetIcon(p), kJFalse);

	const JXImage* image = NULL;
	GetItemImage(GetItemCount(), &image);
	SetTitle(GetItemText(GetItemCount()), const_cast<JXImage*>(image), kJFalse);
	SetUpdateAction(kDisableNone);
}
Пример #16
0
void
JXTextMenu::AdjustPopupChoiceTitle
	(
	const JIndex index
	)
{
	const JString& origTitle = GetTitleText();
	if (origTitle.IsEmpty())
		{
		return;
		}

	JString newTitle;
	JIndex colonIndex;
	const JBoolean foundColon = origTitle.LocateSubstring(":", &colonIndex);
	if (foundColon && colonIndex > 1)
		{
		newTitle = origTitle.GetSubstring(1, colonIndex-1);
		}
	// not empty but no colon => title was empty originally, so replace it

	if (!newTitle.IsEmpty())
		{
		newTitle += ":  ";
		}
	newTitle += GetItemText(index);

	const JXImage* image = NULL;
	GetItemImage(index, &image);

	SetTitle(newTitle, const_cast<JXImage*>(image), kJFalse);
}
Пример #17
0
bool CCWTreeCtrl::IsLeaf(HTREEITEM hItem) const
{
  // ItemHasChildren() won't work in the general case
  int i, dummy;
  BOOL status = GetItemImage(hItem, i, dummy);
  ASSERT(status);
  return (i != GROUP);
}
Пример #18
0
void CDownloads_Groups::UpdateDeletedIcon()
{
	int img = _DldsMgr.Get_DeletedDownloadCount () ? 7 : 6;
	int imgold;
	GetItemImage (m_hDeleted, imgold, imgold);
	if (img != imgold)
		SetItemImage (m_hDeleted, img, img);
}
Пример #19
0
void CIMMain::LocalListChange(int dwUserId, char* pNick, int nGroupID)
{
	//本地处理
	int nImg = 3;
	CString sname;
	HTREEITEM hti=FindUserITEM(dwUserId + 1000);

	if(pNick == NULL && hti)
	{
		sname=GetItemText(hti);
	}

	if(hti)
	{
		if(nGroupID==0)
		{
			DeleteItem(hti);
			return;
		}
		GetItemImage(hti,nImg,nImg);
		DeleteItem(hti);
	}

	
	else if(pNick == NULL && !hti)
	{
		sname = CString("陌生人");
	}
	else
	{
		sname = CString(pNick);
	}


	HTREEITEM insertAfter=TVI_LAST;
// 	if(nImg==3 || nImg==5)
// 		insertAfter=TVI_FIRST;

	if(nGroupID==1)
	{
		hti=InsertItem(sname,nImg,nImg,htiFamilier,insertAfter);
		Expand(htiFamilier,TVE_EXPAND);
		//SetItemImage(htiFamilier,1,1);
	}
	else if(nGroupID==2)
	{
		hti=InsertItem(sname,nImg,nImg,htiUnfamilier,insertAfter);
		Expand(htiUnfamilier,TVE_EXPAND);
		//SetItemImage(htiBlack,1,1);
	}
	else
	{
		hti=InsertItem(sname,nImg,nImg,htiBlack,insertAfter);
		Expand(htiBlack,TVE_EXPAND);
		//SetItemImage(htiBlack,1,1);
	}
	SetItemData(hti,dwUserId + 1000);
}
BOOL CImageTreeCtrl::Retofline( HTREEITEM hItem )//tree0412
{
	int brother_nImage,brother_nSelectedImage;
	GetItemImage(hItem,brother_nImage,brother_nSelectedImage);
	return is_connection_by_image(brother_nImage,brother_nSelectedImage);



}
Пример #21
0
BOOL CReportCtrl::SwapItems(int nItem1, int nItem2)
{
	EndEdit(TRUE);
	if(!_IsValidIndex(nItem1) || !_IsValidIndex(nItem2))
	{
		return(FALSE);
	}

	if(nItem1 == nItem2)
	{
		return(TRUE);
	}

	_UnsetSortedColumn();

	// record previous states first
	const DWORD STATES1 = GetItemStates(nItem1);
	const DWORD STATES2 = GetItemStates(nItem2);
	const DWORD DATA1 = CListCtrl :: GetItemData(nItem1);
	const DWORD DATA2 = CListCtrl :: GetItemData(nItem2);

	// swap item texts and images
	for(int i = 0; i < GetColumnCount(); i++)
	{
		CString str = GetItemText(nItem1, i);
		CListCtrl :: SetItemText(nItem1, i, GetItemText(nItem2, i));
		CListCtrl :: SetItemText(nItem2, i, str);

		UINT	nImg = GetItemImage(nItem1, i);
		SetItemImage(nItem1, i, GetItemImage(nItem2, i));
		SetItemImage(nItem2, i, nImg);
	}

	// swap item data
	CListCtrl :: SetItemData(nItem1, DATA2);
	CListCtrl :: SetItemData(nItem2, DATA1);

	// restore states
	SetItemStates(nItem1, STATES2);
	SetItemStates(nItem2, STATES1);

	return(TRUE);
}
Пример #22
0
void CZoneTree::OnLButtonDblClk(UINT nFlags, CPoint point) 
{
	HTREEITEM it;
	int i;

	it = GetSelectedItem();
	GetItemImage(it, i, i);
	
	switch(i) {
		case AREA_DATA: {
			((CWinDEDlg*)GetParent())->OnAreaProperties();
			break;
		}
		case MOB_DATA: {
			mob_data *mob;
			mob = (mob_data*)GetItemData(it);
			((CWinDEDlg*)GetParent())->OnEditMob(mob->vnum);
			break;
		}
		case OBJECT_DATA:{
			object_data *obj;
			obj = (object_data*)GetItemData(it);
			((CWinDEDlg*)GetParent())->OnEditObject(obj->vnum);
			break;
		}
		case ROOM_DATA: {
			room_data *room;
			room = (room_data*)GetItemData(it);
			
			((CWinDEDlg*)GetParent())->OnEditRoom(room->vnum);
			
			if(((CWinDEDlg*)GetParent())->in_room != room)
			{
				((CWinDEDlg*)GetParent())->in_room = room;
				((CWinDEDlg*)GetParent())->ShowRoom();
			}
			break;
		}
		case MOB_INDEX: {
			mob_index *m_index;
			m_index = (mob_index*)GetItemData(it);
			((CWinDEDlg*)GetParent())->OnEditMob(m_index->vnum);
			break;
		}
		case OBJ_INDEX:{
			obj_index *o_index;
			o_index = (obj_index*)GetItemData(it);
			((CWinDEDlg*)GetParent())->OnEditObject(o_index->vnum);
			break;
		}
	
	}
	
	GetParent()->SetFocus();
}
Пример #23
0
void CLocalTreeView::OnSelectionChanging(wxTreeEvent& event)
{
	// On-demand open icon for selected items
	wxTreeItemId item = event.GetItem();
	if (GetItemImage(item, wxTreeItemIcon_Selected) == -1)
	{
		int icon = GetIconIndex(opened_dir, GetDirFromItem(item));
		SetItemImage(item, icon, wxTreeItemIcon_Selected);
		SetItemImage(item, icon, wxTreeItemIcon_SelectedExpanded);
	}
}
Пример #24
0
void CTreeCtrlEx::OnTvnItemexpanded(NMHDR *pNMHDR, LRESULT *pResult)
{
	LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR);
    HTREEITEM hti=pNMTreeView->itemNew.hItem;
    int y1=0,y2=0;

	UINT state=GetItemState(hti,TVIS_EXPANDED);
    GetItemImage(hti,y1,y2);
    if (/*y1==0*/state&TVIS_EXPANDED) CTreeCtrl::SetItemImage(hti,1,1); else CTreeCtrl::SetItemImage(hti,0,0);
    *pResult = 0;
}
Пример #25
0
void ctlCheckTreeView::OnLeftClick(wxMouseEvent &evt)
{
    int flags;
    wxTreeItemId node = HitTest(evt.GetPosition(), flags);
    int newimage = 0;

    if ((flags & wxTREE_HITTEST_ONITEMLABEL) || (flags & wxTREE_HITTEST_ONITEMICON))
    {
        if (GetItemImage(node) == 0)
            newimage = 1;
        else if (GetItemImage(node) == 1)
            newimage = 0;

        if (GetItemImage(node) == 0 || GetItemImage(node) == 1)
        {
            SetParentAndChildImage(node, newimage);
        }
    }

    evt.Skip();
}
Пример #26
0
HTREEITEM CZoneTree::MoveChildItem(HTREEITEM hItem, HTREEITEM htiNewParent, HTREEITEM htiAfter)
{
	TV_INSERTSTRUCT tvstruct;
	HTREEITEM hNewItem;
    CString sText;
	int i;

    // get information of the source item
    tvstruct.item.hItem = hItem;
    tvstruct.item.mask = TVIF_CHILDREN | TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
    GetItem(&tvstruct.item);  
    sText = GetItemText( hItem );
        
    tvstruct.item.cchTextMax = sText.GetLength();
    tvstruct.item.pszText = sText.LockBuffer();

    //insert the item at proper location
    tvstruct.hParent = htiNewParent;
    tvstruct.hInsertAfter = htiAfter;
    tvstruct.item.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT;
    hNewItem = InsertItem(&tvstruct);
    sText.ReleaseBuffer();
	
	GetItemImage(hNewItem, i, i);

	switch(i) {
	case OBJECT_DATA:
		ConvertObjToIndex(hItem, hNewItem, htiNewParent);
		break;
	case OBJ_INDEX:
		CopyObjIndex(hItem, hNewItem, htiNewParent);
		break;
	case MOB_DATA:
		ConvertMobToIndex(hItem, hNewItem, htiNewParent);
		break;
	case MOB_INDEX:
		CopyMobIndex(hItem, hNewItem, htiNewParent);
		break;
	}

    SetItemState(hNewItem,GetItemState(hItem,TVIS_STATEIMAGEMASK),TVIS_STATEIMAGEMASK);

	HTREEITEM hItemChild = GetChildItem(hItem);
	
	while (hItemChild != NULL)
	{
		HTREEITEM hItemNextChild = GetNextSiblingItem(hItemChild);
		MoveChildItem(hItemChild, hNewItem, TVI_LAST);
		hItemChild = hItemNextChild;
	}
	
    return hNewItem;
}
Пример #27
0
void
JXImageMenu::AdjustPopupChoiceTitle
	(
	const JIndex index
	)
{
	const JXImage* titleImage = NULL;
	if (GetTitleImage(&titleImage))
		{
		JXImage* image = const_cast<JXImage*>(GetItemImage(index));
		SetTitle(NULL, image, kJFalse);
		}
}
Пример #28
0
int CReportCtrl::MoveTo(int nItem, int nNewPosition)
{
	if(!_IsValidIndex(nItem))
	{
		return(-1);
	}

	EndEdit(TRUE);

	const int	ITEMS = CListCtrl :: GetItemCount();
	nNewPosition = max(0, nNewPosition);
	nNewPosition = min(ITEMS - 1, nNewPosition);

	if(nItem == nNewPosition)
	{
		return(nNewPosition);
	}

	_UnsetSortedColumn();

	// Backup all states and attributes
	const int			COLS = GetColumnCount();
	const DWORD			STATES = GetItemStates(nItem);
	const DWORD			DATA = CListCtrl :: GetItemData(nItem);
	CArray<int, int>	aImages;
	CStringArray		aTexts;
	aImages.SetSize(COLS);
	aTexts.SetSize(COLS);
	for(int i = 0; i < COLS; i++)
	{
		aImages[i] = GetItemImage(nItem, i);
		aTexts[i] = GetItemText(nItem, i);
	}

	// Delete the item
	CListCtrl :: DeleteItem(nItem);

	// Insert a new item to the new position
	const int	IDX = CListCtrl :: InsertItem(nNewPosition, _T(""));

	// Restore all states & attributes to the newly inserted item
	for(int j = 0; j < COLS; j++)
	{
		CListCtrl :: SetItemText(IDX, j, aTexts[j]);
		SetItemImage(IDX, j, aImages[j]);
	}

	CListCtrl :: SetItemData(IDX, DATA);
	SetItemStates(IDX, STATES);
	return(IDX);
}
Пример #29
0
BOOL CReportCtrl::_PartialSort(int nStart, int nEnd)
{
	if(nStart >= nEnd || !_IsValidIndex(nStart) || !_IsValidIndex(nEnd))
	{
		return(FALSE);
	}

	const int	COUNT = nEnd - nStart + 1;
	int			i = 0;
	int			*aIndices = new int[COUNT];
	for(i = 0; i < COUNT; i++)
	{
		aIndices[i] = nStart + i;
	}

	_QuickSortRecursive(aIndices, 0, COUNT - 1);

	// rearrange items
	const int	COLS = GetColumnCount();
	ROWINFO		*aRows = new ROWINFO[COUNT];
	for(i = 0; i < COUNT; i++)
	{
		//int n = aIndices[i];
		aRows[i].dwStates = GetItemStates(aIndices[i]);
		aRows[i].dwData = CListCtrl :: GetItemData(aIndices[i]);
		aRows[i].aImages.SetSize(COLS);
		aRows[i].aTexts.SetSize(COLS);
		for(int j = 0; j < COLS; j++)
		{
			aRows[i].aImages[j] = GetItemImage(aIndices[i], j);
			aRows[i].aTexts[j] = GetItemText(aIndices[i], j);
		}
	}

	for(i = 0; i < COUNT; i++)
	{
		SetItemStates(nStart + i, aRows[i].dwStates);
		CListCtrl :: SetItemData(nStart + i, aRows[i].dwData);
		for(int j = 0; j < COLS; j++)
		{
			SetItemImage(nStart + i, j, aRows[i].aImages[j]);
			CListCtrl :: SetItemText(nStart + i, j, aRows[i].aTexts[j]);
		}
	}

	delete[] aRows;
	delete[] aIndices;
	return(TRUE);
}
Пример #30
0
Bitmap* ListBox::GetItemImage(int index, int column)
{
    if (column == 0) {
        return GetItemImage(index);
    }

    if (index >= 0 && index < items.size()) {
        ListBoxItem* item = items[index];
        
        column--;
        if (column >= 0 && column < item->subitems.size())
        return item->subitems[column]->image;
    }

    return 0;
}