예제 #1
0
void CNewsHubDlg::MessageDelivered(NewsHub::ClientQueueThreadLoop* queue, const NewsHub::Socket & socket, const unsigned int messageId, const std::string & message)
{
  CListBox* pSentMessages = (CListBox*)GetDlgItem(IDC_SENT_MESSAGES);
  for (int i = 0; i < pSentMessages->GetCount(); ++i)
  {
    MessageInfo* messageInfo = (MessageInfo*)pSentMessages->GetItemDataPtr(i);
    if ((messageInfo->queue == queue) && (messageInfo->messageId == messageId))
    {
      CString str;
      pSentMessages->GetText(i, str);
      pSentMessages->DeleteString(i);
      pSentMessages->InsertString(i, str + _T(": Delivered"));
      pSentMessages->SetItemDataPtr(i, messageInfo);
      pSentMessages->SetCurSel(i);
      break;
    }
  }
}
예제 #2
0
void CSideWnd::AdjustHorzScroll(CListBox& wndListBox)
{
	CClientDC dc(this);
	CFont* pOldFont = dc.SelectObject(&m_Font);

	int cxExtentMax = 0;

	for (int i = 0; i < wndListBox.GetCount(); i ++)
	{
		CString strItem;
		wndListBox.GetText(i, strItem);

		cxExtentMax = max(cxExtentMax, dc.GetTextExtent(strItem).cx);
	}

	wndListBox.SetHorizontalExtent(cxExtentMax);
	dc.SelectObject(pOldFont);
}
예제 #3
0
void COutputWnd::AdjustHorzScroll(CListBox& wndListBox)
{
	CClientDC dc(this);
	CFont* pOldFont = dc.SelectObject(&afxGlobalData.fontRegular);

	int cxExtentMax = 0;

	for (int i = 0; i < wndListBox.GetCount(); i ++)
	{
		CString strItem;
		wndListBox.GetText(i, strItem);

		cxExtentMax = max(cxExtentMax, (int)dc.GetTextExtent(strItem).cx);
	}

	wndListBox.SetHorizontalExtent(cxExtentMax);
	dc.SelectObject(pOldFont);
}
예제 #4
0
void CDizzyDialog::RecalculateRotation()
{
	CListBox* pListBox = (CListBox*) GetDlgItem(IDC_INPUT_LIST);
	int num = pListBox->GetCount();	
	if (num == 0) {
		CAxisRotation rotResult;
		char* pszResult = rotResult.ToString(m_iPrecision);
		m_strResult = pszResult;
		free(pszResult);
	}
	else if (num == 1) {
		CString strOnly;
		pListBox->GetText(0,strOnly);
		CAxisRotation rotResult;
		rotResult.ParseString(strOnly);
		rotResult = rotResult.Normalise();
		char* pszResult = rotResult.ToString(m_iPrecision);
		m_strResult = pszResult;
		free(pszResult);
	}
	else {
		if (num > 1) {
			CString strFirst;
			pListBox->GetText(0, strFirst);
			CAxisRotation rotFirst;
			rotFirst.ParseString(strFirst);
			CQuaternion quatResult(rotFirst);
			for (int i=1; i<num; i++) {
				CString strData;
				pListBox->GetText(i, strData);
				CAxisRotation rotData;
				rotData.ParseString(strData);
				CQuaternion quatData(rotData);
				quatResult = quatData * quatResult;
			}	
			CAxisRotation rotResult(quatResult);
			char* pszResult = rotResult.ToString(m_iPrecision);
			m_strResult = pszResult;
			free(pszResult);
		}
	}
}
예제 #5
0
CListBox* CPlayerListCtrl::ShowInPlaceListBox(int nItem, int nCol, CAtlList<CString>& lstItems, int nSel)
{
    CRect rect;
    if (!PrepareInPlaceControl(nItem, nCol, rect)) {
        return nullptr;
    }

    DWORD dwStyle = WS_BORDER | WS_CHILD | WS_VISIBLE | WS_VSCROLL/*|WS_HSCROLL*/ | LBS_NOTIFY;
    CListBox* pListBox = DEBUG_NEW CInPlaceListBox(nItem, nCol, lstItems, nSel);
    pListBox->Create(dwStyle, rect, this, IDC_LIST1);

    CRect ir;
    GetItemRect(m_nItemClicked, &ir, LVIR_BOUNDS);

    pListBox->SetItemHeight(-1, ir.Height());

    CDC* pDC = pListBox->GetDC();
    CFont* pWndFont = GetFont();
    pDC->SelectObject(pWndFont);
    int width = GetColumnWidth(nCol);
    POSITION pos = lstItems.GetHeadPosition();
    while (pos) {
        int w = pDC->GetTextExtent(lstItems.GetNext(pos)).cx + 16;
        if (width < w) {
            width = w;
        }
    }
    ReleaseDC(pDC);

    CRect r;
    pListBox->GetWindowRect(r);
    ScreenToClient(r);
    r.top = ir.bottom;
    r.bottom = r.top + pListBox->GetItemHeight(0) * (pListBox->GetCount() + 1);
    r.right = r.left + width;
    pListBox->MoveWindow(r);

    m_fInPlaceDirty = false;

    return pListBox;
}
void CLoadFailedTextureDialog::OnShowWindow(BOOL bShow, UINT nStatus) 
{
	CDialog::OnShowWindow(bShow, nStatus);
	
	CListBox* pListBox = (CListBox*)GetDlgItem(IDC_LOADFAILED_LIST);

	if (NULL != pListBox)
	{
		int i = 0;
		for (i = 0; i < pListBox->GetCount(); i++)
		{
			pListBox->DeleteString(0);
		}

		for (i = 0; i < (int)m_dwLoadFailedTextureTableCount; i++)
		{
			pListBox->InsertString(i, m_pLoadFailedTextureTable[i].szTextureName);
		}	
	}
	
}
void CFirstFollowDlg::OnEnChangeBrowseSave()
{
	// TODO:  如果该控件是 RICHEDIT 控件,它将不
	// 发送此通知,除非重写 CDialogEx::OnInitDialog()
	// 函数并调用 CRichEditCtrl().SetEventMask(),
	// 同时将 ENM_CHANGE 标志“或”运算到掩码中。

	// TODO:  在此添加控件通知处理程序代码
	CListBox *list = (CListBox*)GetDlgItem(IDC_LIST_PROD);
	if (list->GetCount() == 0)
	{
		MessageBox(_T("there is nothing to save!"));
		return;
	}
		

	CString path;
	GetDlgItemText(IDC_BROWSE_SAVE,path);
	if(path.GetLength() == 0) return;
	SetDlgItemText(IDC_BROWSE_SAVE,_T(""));
	StreamHelper::putStreamToFileStream(this->productionList,path.GetBuffer(0));
}
void CFirstFollowDlg::OnBnClickedButtonClear()
{
	// TODO: 在此添加控件通知处理程序代码
	CListBox *listbox = (CListBox *)GetDlgItem(IDC_LIST_PROD);
	if (listbox->GetCount() == 0)
		return;
	CComboBox *combobox = (CComboBox *)GetDlgItem(IDC_COMBO_NONTERM);
	// Delete every other item from the combo box.
	listbox->ResetContent();
	combobox->ResetContent();
	SetDlgItemText(IDC_EDIT_FIRST,_T(""));
	SetDlgItemText(IDC_EDIT_FOLLOW,_T(""));

	this->productionList.swap(vector<string>());
	this->orignProductions.swap(vector<string>());
	this->allFirstGather.swap(vector<string>());
	this->allFollowGather.swap(vector<string>());
	if(this->grammar != NULL)
	{
		delete this->grammar;
		this->grammar = NULL;
	}

}
예제 #9
0
void CDizzyDialog::OnAddButton() 
{
	UpdateData(true);
	CListBox* pListBox = (CListBox*) GetDlgItem(IDC_INPUT_LIST);
	CAxisRotation inputRotation;
	bool bValidString = inputRotation.ParseString(m_strInput);
	if (bValidString) {
		int iOffset = pListBox->GetCurSel();
		if (iOffset != LB_ERR) {
			pListBox->InsertString(iOffset+1,m_strInput);
			pListBox->SetCurSel(iOffset+1);
		}	
		else {
			pListBox->AddString(m_strInput);
			pListBox->SetCurSel(pListBox->GetCount()-1);
		}
		RecalculateRotation();
		m_strInput = "";
		UpdateData(false);
	}
	else {
		::AfxMessageBox("Input must be a valid axis-angle rotation!");
	}
}
예제 #10
0
void ClearListBox(CListBox& box)
{
	while (box.GetCount() > 0)
		box.DeleteString(0);
}
예제 #11
0
파일: project.cpp 프로젝트: AmziLS/apls
int CProjectDoc::GetLibCount()
{
   CListBox* pLB = (CListBox*)GetProjectView()->GetDlgItem(IDP_LIBLIST);
   return pLB->GetCount();
}
예제 #12
0
파일: project.cpp 프로젝트: AmziLS/apls
int CProjectDoc::GetFileCount()
{
   CListBox* pLB = (CListBox*)GetProjectView()->GetDlgItem(IDP_FILELIST);
   return pLB->GetCount();
}
예제 #13
0
void CSpellBaseParmDlg::OnAddTotem() 
{
	CString sTotem;
	CString sLevel;	
	CString sRequires;
	CComboBox *pBox;
	CListBox *pList;

	pBox   = (CComboBox *)GetDlgItem(IDC_TOTEMS);
	pBox->GetWindowText(sTotem);

	pBox   = (CComboBox *)GetDlgItem(IDC_LEVELS);
	pBox->GetWindowText(sLevel);

	pList = (CListBox *)GetDlgItem(IDC_REQUIRESTOTEM);

	if (sLevel == "Any Level")
	{
		sRequires = sTotem;
		sRequires += " of any level";
	}
	else
	{
		sRequires = sTotem;
		sRequires += " level ";
		sRequires += sLevel;
	}

	// Check before we add this totem

	for (int i = 0; i < pList->GetCount(); i ++)
	{
		CString sListString;
		pList->GetText(i, sListString);

		CString sString = sListString;

		BOOL bOkayToAdd = TRUE;
		
		if (sRequires == sString)
		{
			AfxMessageBox("Totem level requirement already exists !!!", MB_ICONEXCLAMATION);
			return;
		}

		CString sCheckTotem = strtok((char *)(LPCSTR)sString, " ");

		if (sCheckTotem == sTotem)
		{
			AfxMessageBox("Totem level requirement already exists !!!", MB_ICONEXCLAMATION);
			return;
		}
	}

	pList->AddString(sRequires);
	
	TOTEM_REQUIREMENT tr;
	tr.m_sRequirement = sRequires;

	m_pSpell->GetTotemRequirements()->AddTail(tr);
}