コード例 #1
0
ファイル: SamplesTreeCtrl.cpp プロジェクト: rainChu/ytp-king
wxTreeItemId
SamplesTreeCtrl::changeSpeaker( const wxTreeItemId &speech,
                                const wxTreeItemId &currentSpeaker,
                                const wxTreeItemId &newSpeaker )
{
	// Do be sure that these aren't made invalid when the item is deleted.
	std::string name     = GetItemText( speech );
	wxTreeItemData *data = GetItemData( speech );

	SetItemData( speech, NULL ); // replace the data with NULL; speech will not delete it now!
	Delete( speech );

	// Delete the speaker, if this was the only speech in it.
	if ( GetChildrenCount( currentSpeaker ) == 0 )
		Delete( currentSpeaker );

	return AppendItem( newSpeaker, name.c_str(), -1, -1, data );
}
コード例 #2
0
//---------------------------------------------------------
wxTreeItemId CData_Source_PgSQL::Find_Source(const wxString &Server)
{
	wxTreeItemId	Item	= Get_Server_Item(Server, false);

	if( Item.IsOk() )
	{
		wxTreeItemIdValue Cookie; Item = GetFirstChild(Item, Cookie);

		wxString	Name	= Server.BeforeLast('['); Name.Trim(true);

		while( Item.IsOk() && Name.Cmp(GetItemText(Item)) )
		{
			Item	= GetNextChild(Item, Cookie);
		}
	}

	return( Item );
}
コード例 #3
0
ファイル: DirTreeCtrl.cpp プロジェクト: neil-yi/ffsource
CString CDirTreeCtrl::GetFullPath(HTREEITEM hItem)
{
	CString strReturn;
	CString strTemp;
	HTREEITEM hParent = hItem;
	strReturn = "";
	while ( hParent )
	{ 
		strTemp  = GetItemText( hParent );
		if(strTemp != _T("project"))   {
			if ( strTemp.Right(1) !=  _T("\\"))
				strTemp += _T("\\");
			strReturn = strTemp + strReturn;
		} 
		hParent = GetParentItem( hParent );
	}
	return strReturn;
}
コード例 #4
0
void CLightTree::OnTvnSelchanged(NMHDR *pNMHDR, LRESULT *pResult)
{
	
	LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR);
	// TODO:  在此添加控件通知处理程序代码
	CString obj_name = GetItemText(pNMTreeView->itemNew.hItem);
	CMainFrame *pFrame = (CMainFrame*)(AfxGetApp()->m_pMainWnd);
	pFrame->draw_property(obj_name, DRAW_LIGHT);
	pFrame->m_obj_or_light_name = obj_name;
	pFrame->m_draw_type = DRAW_LIGHT;
	CSceneEditorView* pView = (CSceneEditorView*)pFrame->GetActiveView();
	/*取消另外的选中
	HTREEITEM hItem = pFrame->m_wndFileView.m_wndFileView.GetSelectedItem();
	pFrame->m_wndFileView.m_wndFileView.SetItemState(hItem, 0, TVIS_SELECTED);
	*/
	pView->Invalidate(FALSE);
	*pResult = 0;
}
コード例 #5
0
ファイル: DirTreeCtrl.cpp プロジェクト: neil-yi/ffsource
CString CDirTreeCtrl::GetFullPath1(HTREEITEM hItem)
{
	CString path, temp;

	HTREEITEM hParent = GetParentItem(hItem);
	while ( hParent )
	{ 
		temp  = GetItemText( hParent );
		if(temp != m_RootName){
			temp =  temp + _T("\\");
			path = temp + path;
		}
		hParent = GetParentItem(hParent);
	}
	path = _T("\\") + path;
	path = m_RootPath + path;
	return path;
}
コード例 #6
0
void
JXStringCompletionMenu::HandleSelection
	(
	const JIndex index
	)
{
	if (itsAllowTabChar && index == kInsertTabCmd)
		{
		// tab may insert spaces
		itsTE->JXTEBase::HandleKeyPress('\t', JXKeyModifiers(GetDisplay()));
		}
	else if (index - (itsAllowTabChar ? kSpecialCmdCount : 0) <= kMaxItemCount)
		{
		JString s = GetItemText(index);
		s.RemoveSubstring(1, kItemPrefixLength + itsPrefixLength);
		itsTE->Paste(s);
		}
}
コード例 #7
0
ファイル: LocalTreeView.cpp プロジェクト: idgaf/FileZilla3
void CLocalTreeView::RemoveDrive(wxChar drive)
{
	wxString driveName = drive;
	driveName += _T(":");
	wxTreeItemIdValue value;
	wxTreeItemId driveItem = GetFirstChild(m_drives, value);
	while (driveItem)
	{
		if (!GetItemText(driveItem).Left(2).CmpNoCase(driveName))
			break;

		driveItem = GetNextSibling(driveItem);
	}
	if (!driveItem)
		return;

	Delete(driveItem);
}
コード例 #8
0
void CSourcesListBox::DelSel()
{
	//-----------------------------------------------------//
	//--- the EVT_LIST_ITEM_SELECTED will check this	---//
	//--- as there is no need to update the sel until	---//
	//--- we're done									---//
	//-----------------------------------------------------//
    SuppressListItemStateEventsWrapper(*this);
    m_Deleting = true;

	//--- where are we selected? ---//
	int nIndex = - 1;
	nIndex = GetNextItem( nIndex, wxLIST_NEXT_ALL , wxLIST_STATE_SELECTED );

	int nType = GetType( nIndex );

	//--- no item selected? bail ---//
	if ( nIndex == - 1 || nType == MUSIK_SOURCES_LIBRARY || nType == MUSIK_SOURCES_NOW_PLAYING )
		return;

	//--- if we have a standard or dynamic playlist, delete the file ---//
	if ( nType == MUSIK_SOURCES_PLAYLIST_STANDARD || nType == MUSIK_SOURCES_PLAYLIST_DYNAMIC || MUSIK_SOURCES_NETSTREAM)
	{
		wxString sFilename = GetItemText( nIndex );
		SourcesToFilename( &sFilename, nType );

		if ( wxFileExists( sFilename ) )
			wxRemoveFile( sFilename );
	}
	
	//--- remove item from list ---//
	m_SourcesList.RemoveAt( nIndex );
	Update();


	int nNextSel = nIndex;
	if ( nNextSel != 0 )
		nNextSel -= 1;

	SetItemState( nNextSel, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
	UpdateSel( nNextSel );

	m_Deleting = false;
}
コード例 #9
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;
}
コード例 #10
0
ファイル: StatisticsTree.cpp プロジェクト: brolee/EMule-GIFC
CString CStatisticsTree::GetText(bool onlyVisible, HTREEITEM theItem, int theItemLevel, bool firstItem)
{
	bool bPrintHeader = firstItem;
	HTREEITEM hCurrent;
	if (theItem == NULL)
	{
		hCurrent = GetRootItem(); // Copy All Vis or Copy All
	}
	else
	{
		if (bPrintHeader && (!ItemHasChildren(theItem) || !IsExpanded(theItem)))
			bPrintHeader = false;
		hCurrent = theItem;
	}

	CString	strBuffer;
	if (bPrintHeader)
		//Xman // Maella -Support for tag ET_MOD_VERSION 0x55
		/*
		strBuffer.Format(_T("eMule v%s %s [%s]\r\n\r\n"), theApp.m_strCurVersionLong, GetResString(IDS_SF_STATISTICS) ,thePrefs.GetUserNick());
		*/
		// ==> ModID [itsonlyme/SiRoB] - Stulle
		/*
		strBuffer.Format(_T("eMule v%s %s [%s]\r\n\r\n"), theApp.m_strCurVersionLong + _T(" ") + MOD_VERSION, GetResString(IDS_SF_STATISTICS) ,thePrefs.GetUserNick()); //Xman // Maella -Support for tag ET_MOD_VERSION 0x55
		*/
		strBuffer.Format(_T("eMule v%s [%s] %s [%s]\r\n\r\n"), theApp.m_strCurVersionLong,theApp.m_strModLongVersion, GetResString(IDS_SF_STATISTICS) ,thePrefs.GetUserNick());
		// <== ModID [itsonlyme/SiRoB] - Stulle
		//Xman end

	while (hCurrent != NULL)
	{
		for (int i = 0; i < theItemLevel; i++)
			strBuffer += _T("   ");
		strBuffer += GetItemText(hCurrent);
		if (bPrintHeader || !firstItem)
			strBuffer += _T("\r\n");
		if (ItemHasChildren(hCurrent) && (!onlyVisible || IsExpanded(hCurrent)))
			strBuffer += GetText(onlyVisible, GetChildItem(hCurrent), theItemLevel+1, false);
		hCurrent = GetNextItem(hCurrent, TVGN_NEXT);
		if (firstItem && theItem != NULL)
			break; // Copy Selected Branch was used, so we don't want to copy all branches at this level.  Only the one that was selected.
	}
	return strBuffer;
}
コード例 #11
0
//绘画数据
VOID CEasySkinListCtrl::DrawReportItem(CDC * pDC, INT nItem, CRect & rcSubItem, INT nColumnIndex)
{
	//获取文字
	TCHAR szString[256]=TEXT("");
	GetItemText(nItem,nColumnIndex,szString,CountArray(szString));

	//绘画文字
	rcSubItem.left+=5;

	//绘制CheckButton
	if( nColumnIndex == 0 )
	{
		if ((m_pCheckImg != NULL && !m_pCheckImg->IsNull()) && (m_pUnCheckImg != NULL && !m_pUnCheckImg->IsNull()))
		{
			if( GetCheck(nItem) )
				m_pCheckImg->DrawImage(pDC,rcSubItem.left+2,rcSubItem.top+(rcSubItem.Height()-m_pCheckImg->GetHeight())/2);
			else
				m_pUnCheckImg->DrawImage(pDC,rcSubItem.left+2,rcSubItem.top+(rcSubItem.Height()-m_pUnCheckImg->GetHeight())/2);

			rcSubItem.left+=(8+m_pCheckImg->GetWidth());
		}

		CItemImgArray::iterator iter = m_ItemImgArray.begin();

		for (;iter != m_ItemImgArray.end(); ++iter )
		{
			if ( iter->nItem == nItem )
			{
				CImageEx *pImage = iter->pImage;

				if (pImage != NULL && !pImage->IsNull())
				{
					pImage->DrawImage(pDC,rcSubItem.left+2,rcSubItem.top+(rcSubItem.Height()-pImage->GetHeight())/2);
					rcSubItem.left+=(8+pImage->GetWidth());
				}
				break;
			}
		}
	}

	pDC->DrawText(szString,lstrlen(szString),&rcSubItem,DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);

	return;
}
コード例 #12
0
void WIDGET_HOTKEY_LIST::OnSize( wxSizeEvent& aEvent )
{
    // Handle this manually - wxTreeListCtrl screws up the width of the first column
    wxDataViewCtrl* view = GetDataView();

    if( !view )
        return;

    wxRect rect = GetClientRect();
    view->SetSize( rect );

#ifdef wxHAS_GENERIC_DATAVIEWCTRL
    {
        wxWindow* view = GetView();
        view->Refresh();
        view->Update();
    }
#endif

    // Find the maximum width of the hotkey column
    int hk_column_width = 0;

    for( wxTreeListItem item = GetFirstItem(); item.IsOk(); item = GetNextItem( item ) )
    {
        const wxString& text = GetItemText( item, 1 );
        int width = WidthFor( text );

        if( width > hk_column_width )
            hk_column_width = width;
    }

    if( hk_column_width < HOTKEY_MIN_WIDTH )
        hk_column_width = HOTKEY_MIN_WIDTH;
    else if( hk_column_width <= 0 )
        hk_column_width = 1;

    int name_column_width = rect.width - hk_column_width - HORIZ_MARGIN;

    if( name_column_width <= 0 )
        name_column_width = 1;

    SetColumnWidth( 1, hk_column_width );
    SetColumnWidth( 0, name_column_width );
}
コード例 #13
0
void CListControlEx::DrawItem( LPDRAWITEMSTRUCT lpDrawItemStruct )
{
	// TODO:  添加您的代码以绘制指定项
	CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);

	LVITEM lvi = {0};
	lvi.mask = LVIF_STATE;
	lvi.stateMask = LVIS_FOCUSED | LVIS_SELECTED ;
	lvi.iItem = lpDrawItemStruct->itemID;
	BOOL bGet = GetItem(&lvi);

	BOOL bHighlight =((lvi.state & LVIS_DROPHILITED)||((lvi.state & LVIS_SELECTED) && ((GetFocus() == this)|| (GetStyle() & LVS_SHOWSELALWAYS))));

	CRect rcBack = lpDrawItemStruct->rcItem;

	if( bHighlight ) //高亮显示
	{
		pDC->SetTextColor(::GetSysColor(COLOR_HIGHLIGHTTEXT));
		pDC->SetBkColor(::GetSysColor(COLOR_HIGHLIGHT));
		pDC->FillRect(rcBack, &CBrush(::GetSysColor(COLOR_HIGHLIGHT)));
	}
	else
	{

		pDC->SetTextColor(::GetSysColor(COLOR_WINDOWTEXT));
		pDC->FillRect(rcBack, &CBrush(::GetSysColor(COLOR_WINDOW)));


	}
	//绘制文本
	CString strText=L"";
	CRect rcItem;
	if (lpDrawItemStruct->itemAction & ODA_DRAWENTIRE)
	{
		for (int i = 0; i < GetHeaderCtrl()-> GetItemCount();i++)
		{            
			if ( !GetSubItemRect(lpDrawItemStruct->itemID, i, LVIR_LABEL, rcItem ))
				continue;
			strText = GetItemText( lpDrawItemStruct->itemID, i );

			pDC->DrawText(strText,strText.GetLength(), &rcItem, DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_BOTTOM);
		}
	}
}
コード例 #14
0
bool browsers::CellBrowser::findItem(const wxString name, wxTreeItemId& item, const wxTreeItemId parent) 
{
   wxTreeItemIdValue cookie;
   wxTreeItemId child = GetFirstChild(parent,cookie);
   while (child.IsOk()) 
   {
      if (item.IsOk()) 
      {
         if (child == item) item = wxTreeItemId();
      }
      else if (name == GetItemText(child)) 
      {
         item = child; return true;
      }   
      if (findItem(name, item, child)) return true;
      child = GetNextChild(parent,cookie);
   }
   return false;
}   
コード例 #15
0
/**
 *
 * \param *pNMHDR 
 * \param *pResult 
 */
void	CUnitListBox::OnLvnBegindrag(NMHDR *pNMHDR, LRESULT *pResult)
{
	LPNMLISTVIEW pNMLV	= reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
	if (pNMLV->iItem >= 0)
	{
		// 获取文件名
		m_szFileName		= GetItemText(pNMLV->iItem, pNMLV->iSubItem);

		POINT pt ={
			0, 0
		};

		int nOffset = 0;
		int nCount	= GetSelectedCount();
		if (nCount >= 1)
		{
			pt.x = nOffset;
			pt.y = nOffset;
		}

		m_pDragImage = CreateDragImage(pNMLV->iItem, &pt);
		if (m_pDragImage)
		{
			IMAGEINFO img;
			m_ImageList.GetImageInfo(pNMLV->iItem, &img);

			CBitmap* pBitmap = CBitmap::FromHandle(img.hbmImage);
			if (pBitmap)
			{
				m_pDragImage->Replace(0, pBitmap, NULL);
				m_pDragImage->BeginDrag(0, 
					CPoint(nOffset, nOffset));
				m_pDragImage->DragEnter(GetDesktopWindow(), pNMLV->ptAction);

				m_bDragging = TRUE;

				SetCapture ();
			}
		}
	}

	*pResult = 0;
}
コード例 #16
0
/**
 * Method to find the node with the input text, given a base node
 * 
 * @param str   The text of the desired node
 * @param root  The base node
 */
wxTreeItemId DecoratedTree::Find(wxString str, wxTreeItemId root)
{
   //long cookie;
   wxTreeItemIdValue  cookie;
   wxTreeItemId current = GetFirstChild(root, cookie), item;

   while (current > (wxTreeItemId)0) {
      if (str == GetItemText(current))
         return current;
        
      item = Find(str, current);
      if (item > (wxTreeItemId)0)
         return item;
        
      current = GetNextChild(root, cookie);
   }

   return current;
}
コード例 #17
0
void browsers::CellBrowser::ShowMenu(wxTreeItemId id, const wxPoint& pt) {
    wxMenu menu;
    RBcellID = id;
    if ( id.IsOk() && (id != GetRootItem()))   {
      wxString RBcellname = GetItemText(id);
      menu.Append(CELLTREEOPENCELL, wxT("Open " + RBcellname));
      menu.Append(tui::TMCELL_REF_B , wxT("Add reference to " + RBcellname));
      menu.Append(tui::TMCELL_AREF_B, wxT("Add array of " + RBcellname));
      wxString ost;
      ost << wxT("export ") << RBcellname << wxT(" to GDS");
      menu.Append(tui::TMGDS_EXPORTC, ost);
      menu.Append(tui::TMCELL_REPORTLAY, wxT("Report layers used in " + RBcellname));
    }
    else {
      menu.Append(tui::TMCELL_NEW, wxT("New cell")); // will be catched up in toped.cpp
      menu.Append(tui::TMGDS_EXPORTL, wxT("GDS export"));
    }
    PopupMenu(&menu, pt);
}
コード例 #18
0
ファイル: ListCtrlSock.cpp プロジェクト: ruglcc/gbnx31_tool
// 终端登录 将列表中的信息更新
void CListCtrlSock::setItemLogIn( CTerminal *pTml, UINT32 ulAddress )
{
	CString strObjID, strObjIDList;
	CString strAddress;
	strAddress.Format("%d",ulAddress );
	strObjID.Format("%X",(unsigned long)pTml);
	pTml->m_address = ulAddress;
	int nItem = 0;
	int i = 0;
	for(i = 0; i < GetItemCount(); i++)
	{
		strObjIDList = GetItemText(i, 5);
		if(strObjID.Compare(strObjIDList) == 0)
		{
			SetItemText(i, 1, strAddress);
			SetItemText(i, 4,"上线-已登录");
		}
	}
}
コード例 #19
0
ファイル: PropertiesList.cpp プロジェクト: Robertysc/ecos
void CPropertiesList::OnDblclk(NMHDR* pNMHDR, LRESULT* pResult) 
{

  // Double-clicked the item	
  
  // We do not use the parameters on the OnDblClk handlers in order to preserve compatibility
  // between pre- and post-4.71 comctrl32.dll versions.
  
  int pos=GetMessagePos();
  CPoint pt(GET_X_LPARAM(pos),GET_Y_LPARAM(pos));
  ScreenToClient(&pt);
  int nItem=HitTest(pt,NULL);
  
  if(GetItemData(nItem)>1){
    // This is a property row
    const CdlGoalExpression goal = dynamic_cast<CdlGoalExpression> ((CdlProperty) GetItemData (nItem));
    if (goal){
      // This is a rule row
      const CdlExpression expression = goal->get_expression ();
      if (1 == expression->references.size ()) // if the property contains a single reference
      {
        // assume that the reference is to another user visible node and try to find it
        std::string macro_name = expression->references [0].get_destination_name ();
        CConfigItem * pItem = CConfigTool::GetConfigToolDoc ()->Find (CString (macro_name.c_str ()));
        if (pItem) // the referenced node was found so select it
        {
          CConfigTool::GetControlView()->GetTreeCtrl().SelectItem(pItem->HItem());
        }
      }
    }
  } else {
    const CString strText(GetItemText(nItem,0));
    if(strText==FieldTypeImage[File]){
      m_pti->ViewHeader();
    } else if (strText==FieldTypeImage[URL]) {
      m_pti->ViewURL();
    }
  }

	UNUSED_ALWAYS(pResult);
	UNUSED_ALWAYS(pNMHDR);
}
コード例 #20
0
void CListBoxEx::CreateEditControl()
{
    if(IsWindow(EditCtrl.m_hWnd))
        return;

    // create edit control
    int iItem = GetCurSel();
    if(iItem == LB_ERR)
        return;

    LBEXTITEMSTRUCT& lbis = Items[iItem];

    if(lbis.iEditType != lbeString &&
            lbis.iEditType != lbeInteger &&
            lbis.iEditType != lbeTexture)
        return;

    CRect r;
    GetItemRect(iItem, r);
    r.InflateRect(-1, -1);
    r.left += iCaptionWidthPixels;

    // create edit ctrl
    EditCtrl.Create(ES_LEFT | ES_LOWERCASE | WS_VISIBLE | WS_TABSTOP, r, this,
                    IDC_EDITPARAMETER);
    // set font
    HFONT hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
    if (hFont == NULL)
        hFont = (HFONT)GetStockObject(ANSI_VAR_FONT);
    EditCtrl.SendMessage(WM_SETFONT, (WPARAM)hFont);

    // set current text in edit ctrl
    char szBuf[128];
    GetItemText(iItem, szBuf);
    EditCtrl.SetWindowText(szBuf);

    EditCtrl.SetForegroundWindow();
    EditCtrl.SetSel(0, -1);

    bControlActive = TRUE;
    iControlItem = iItem;
}
コード例 #21
0
void CRemoteTreeView::OnMenuDelete(wxCommandEvent&)
{
	if (!m_pState->IsRemoteIdle())
		return;

	if (!m_contextMenuItem)
		return;

	const CServerPath& path = GetPathFromItem(m_contextMenuItem);
	if (path.empty())
		return;

	if (wxMessageBoxEx(_("Really delete all selected files and/or directories from the server?"), _("Confirmation needed"), wxICON_QUESTION | wxYES_NO, this) != wxYES)
		return;

	const bool hasParent = path.HasParent();

	CRecursiveOperation* pRecursiveOperation = m_pState->GetRecursiveOperationHandler();

	CServerPath startDir;
	if (hasParent)
	{
		const wxString& name = GetItemText(m_contextMenuItem);
		startDir = path.GetParent();
		pRecursiveOperation->AddDirectoryToVisit(startDir, name);
	}
	else
	{
		startDir = path;
		pRecursiveOperation->AddDirectoryToVisit(startDir, _T(""));
	}

	CServerPath currentPath;
	const wxTreeItemId selected = GetSelection();
	if (selected)
		currentPath = GetPathFromItem(selected);
	if (!currentPath.empty() && (path == currentPath || path.IsParentOf(currentPath, false)))
		currentPath = startDir;

	CFilterManager filter;
	pRecursiveOperation->StartRecursiveOperation(CRecursiveOperation::recursive_delete, startDir, filter.GetActiveFilters(false), !hasParent, currentPath);
}
コード例 #22
0
ファイル: CWndImageList.cpp プロジェクト: LaoZhongGu/RushGame
void CWndImageList::UpdateImageList()
{
	SQRWnd* pEditWnd = m_pWndGroup->GetEditWnd();
	if( pEditWnd == NULL )
		return;

	IMAGE_PARAM IP ( SM_BS_BK, m_nImageType );	
	WND_IMAGE_LIST* pImageList = pEditWnd->GetWndBkImage( IP );
	if( pImageList == NULL )
		return;

	m_pWndGroup->Check();
	int n1 = GetItemCount();
	int n2 = pImageList->GetImageCount();
	for( int i = 0; i < GetItemCount(); i++ )
	{
		IMAGE& Image = pImageList->GetImage( i );
		CString szImageName = Image.pTexture ? gbk_to_utf16(Image.pTexture->GetName()).c_str() : L"";
		CString itemText = GetItemText(i, 0);
		if(itemText == szImageName )
			continue;
		Image.dwColor = 0xffffffff;
		SafeRelease( Image.pTexture );
		HRESULT hr = pEditWnd->GetGraphic()->CreateTexture( L"", utf16_to_gbk(itemText.GetString() ).c_str(), &Image.pTexture);
		if (FAILED(hr))
			OutputDebugString(itemText);

		if ( Image.pTexture )
		{
			Image.texName = utf16_to_gbk(itemText.GetString() ).c_str();
		}
		// 对于 tree 和 list 需要即时更新
		if ( pEditWnd->GetClassName() == string( "CListCtrl" ))
		{
			SQRListCtrl* pListCtrl = (SQRListCtrl*)pEditWnd;
			pListCtrl->UpdateItemImage();
		}
	}
	IMAGE& Image = pImageList->GetImage( m_nEditItem );
	m_ImageProp->ResetImageProp( &Image, m_pWndGroup );
	m_pWndGroup->ReCheck();
}
コード例 #23
0
ファイル: ListCtrlEx.cpp プロジェクト: chengpenghui/UGame
void CListCtrlEx::OnPaint()
{
  int i;
  int Top = GetTopIndex();
  int Total = GetItemCount();
  int PerPage = GetCountPerPage();
  int Last = ((Top+PerPage) > Total)? Total : Top+PerPage;
  int Count = m_ProgressList.GetSize();
  CProgressCtrl* pCtrl;
  if ((Last-Top) > Count)
  {
    for (i = Count; i < Last-Top; i++)
    {
      pCtrl = new CProgressCtrl();
      CRect rt(1,1,1,1);
      pCtrl->Create(NULL, rt, this, IDC_PROGRESS_LIST+i);
      m_ProgressList.Add(pCtrl);
    }
  }
  
  CHeaderCtrl* pHeader = GetHeaderCtrl();
  for (i = Top; i < Last; i++)
  {
    CRect ColRt;
    pHeader->GetItemRect(m_ProgressColumn, &ColRt);
    
    CRect rt;
    GetItemRect(i, &rt, LVIR_LABEL);
    rt.top += 1;
    rt.bottom -= 1;
    rt.left += ColRt.left;
    rt.right = rt.left + ColRt.Width() - 4;
    
    pCtrl = m_ProgressList.GetAt(i-Top);
    CString strPercent = GetItemText(i, m_ProgressColumn);
    int nPercent = atoi(strPercent);
    pCtrl->SetPos(nPercent);
    pCtrl->MoveWindow(&rt);
    pCtrl->ShowWindow(SW_SHOWNORMAL);
  }
  CListCtrl::OnPaint();
}
コード例 #24
0
void
WizChatShortcutMenu::CheckForShortcut()
{
	JString nmShortcut;
	const JString& text = itsMessage->GetText();

	const JSize count = GetItemCount();
	for (JIndex i=1; i<=count; i++)
		{
		if (GetItemNMShortcut(i, &nmShortcut))
			{
			nmShortcut.TrimWhitespace();
			if (nmShortcut == text)
				{
				itsMessage->SetText(GetItemText(i));
				return;
				}
			}
		}
}
コード例 #25
0
void wxWebUpdateListCtrl::OnCacheSizeComplete(wxCommandEvent &ev)
{
    wxArrayLong *arr = (wxArrayLong *)ev.GetClientData();

    for (int i=0; i<(int)m_arrRemotePackages.GetCount(); i++)
        m_arrRemotePackages[i].GetDownload().SetDownloadSize(arr->Item(i));
    delete arr;

    // modify the items currently shown
    for (int j=0; j < GetItemCount(); j++) {

        const wxWebUpdatePackage &p = GetRemotePackage(GetItemText(j));
        wxASSERT_MSG(p.GetDownload().IsDownloadSizeCached(),
                    wxS("Why does this item has not a cached size ?"));
        unsigned long bytesize = p.GetDownload().GetDownloadSize();
        SetItem(j, 3, wxGetSizeStr(bytesize));
    }

    wxLogAdvMsg(wxS("wxWebUpdateListCtrl::OnCacheSizeComplete - sizes cached"));
}
コード例 #26
0
LPTSTR CClonePairListCtrl::GetToolTipText(int nRow, int nCol)
{
	if (nRow!=-1 && nCol!=-1)
	{
		CString text(GetItemText(nRow, nCol));	// Cell-ToolTip
		std::map<CString,CString>::iterator itr = m_toolTipTexts.find(text);
		if( itr != m_toolTipTexts.end())
		{
			return itr->second.GetBuffer();
		}
		else
		{
			return _T("");
		}
	}
	else
	{
		return _T("");
	}
}
コード例 #27
0
BOOL CReportCtrl::EndEdit(BOOL bCommit)
{
	if (!_IsEditVisible())
		return FALSE;

	CString str;
	m_pWndEdit->GetWindowText(str);
	BOOL bChanged = bCommit && str.Compare(GetItemText(m_ptEditting.x, m_ptEditting.y)) != 0;
	if (bChanged)
	{
		// update the list item
		CListCtrl::SetItemText(m_ptEditting.x, m_ptEditting.y, str);
		_UnsetSortedColumn();
		GetParent()->SendMessage(WM_EDIT_COMMITTED, (WPARAM)m_ptEditting.x, (LPARAM)m_ptEditting.y);
	}
	m_pWndEdit->ShowWindow(SW_HIDE);
	m_ptEditting.x = -1;
	m_ptEditting.y = -1;
	return bChanged;
}
コード例 #28
0
ファイル: RecorderDlg.cpp プロジェクト: takashi310/VVD_Viewer
void KeyListCtrl::DeleteSel()
{
	long item = GetNextItem(-1,
		wxLIST_NEXT_ALL,
		wxLIST_STATE_SELECTED);
	if (item == -1)
		return;
	wxString str = GetItemText(item);
	long id;
	str.ToLong(&id);

	VRenderFrame* vr_frame = (VRenderFrame*)m_frame;
	if (!vr_frame)
		return;
	Interpolator* interpolator = vr_frame->GetInterpolator();
	if (!interpolator)
		return;
	interpolator->RemoveKey(id);
	Update();
}
コード例 #29
0
ファイル: SamplesTreeCtrl.cpp プロジェクト: rainChu/ytp-king
wxTreeItemId
SamplesTreeCtrl::getSpeaker( const char *speakerName ) const
{
	wxTreeItemId root, speakerItem;
	
	root = GetRootItem();

	wxTreeItemIdValue cookie;
	
	speakerItem = GetFirstChild( root, cookie );
	while( speakerItem.IsOk() )
	{
		if ( strcmp( GetItemText( speakerItem ), speakerName ) == 0 )
			return speakerItem;

		speakerItem = GetNextChild( root, cookie );
	}

	return speakerItem;
}
コード例 #30
0
wxTreeItemId PHPFileLayoutTree::FindItemIdByName(const wxTreeItemId& parent, const wxString& name)
{
    if(parent.IsOk() == false) return wxTreeItemId();

    if(!ItemHasChildren(parent)) {
        return AppendItem(parent, name, 7, 7, NULL);
    }

    wxTreeItemIdValue cookie;
    wxTreeItemId child = GetFirstChild(parent, cookie);
    while(child.IsOk()) {
        if(GetItemText(child) == name) {
            return child;
        }
        child = GetNextChild(parent, cookie);
    }

    // No match? add it
    return AppendItem(parent, name, 7, 7, NULL);
}