Ejemplo n.º 1
0
void CBetPoolListBox::InsertStr(int iIndex,HWND hMain)
{
	PoolBox_AppendData * pData = new PoolBox_AppendData;
	pData->nItem = iIndex ;
	CRect rcClient(0 ,0 , 0 , 0);
	DWORD dwStyle =  WS_CHILD | WS_VISIBLE;
	pData->pSta0 = new CStaticTrans;
	pData->pSta0->Create(_T(""),dwStyle, rcClient, this, ++m_uID);
	pData->pSta0->ModifyStyle(SS_LEFT|SS_LEFT,SS_RIGHT,TRUE);

	pData->pBut2 = new CButtonEx(iIndex,1,rcClient,hMain);
	pData->pBut2->Create(_T(""),dwStyle, rcClient, this, ++m_uID);

	CStaticTrans *pSta = new CStaticTrans;
	pSta->Create(_T("") , WS_CHILD | WS_VISIBLE , rcClient, this, ++m_uID) ;
	pSta->ModifyStyle(SS_LEFT|SS_RIGHT,SS_RIGHT,TRUE);
	pData->pSta1 = pSta ;

	pData->pSta2 = new CStaticTrans;
	pData->pSta2->Create(_T(""),dwStyle, rcClient, this, ++m_uID);
	pData->pSta2->ModifyStyle(SS_LEFT|SS_RIGHT,SS_CENTER,TRUE);

	pData->pSta3 = new CStaticTrans;
	pData->pSta3->Create(_T(""),dwStyle, rcClient, this, ++m_uID);
	pData->pSta3->ModifyStyle(SS_LEFT|SS_RIGHT,SS_CENTER,TRUE);

	m_mButton.insert( make_pair( iIndex, pData ) );

	int i = SetItemDataPtr(InsertString(iIndex,_T("")),pData);

	updateListBoxButtonPos();
}
Ejemplo n.º 2
0
int CLogListBox::AddString(LogMsgType Type, const CString& strTitle, const CString& strText, const CString& szInfo)
{
	LogListBoxItem * item = new  LogListBoxItem;
	item->Type = Type;

	SYSTEMTIME st;
	::GetLocalTime(&st);
	CString Data;
	Data.Format(_T("%02d:%02d:%02d"), (int)st.wHour, (int)st.wMinute, (int)st.wSecond);
	
	item->strText = trim(strText);
	item->strTitle = trim(strTitle);
	item->Info = trim(szInfo);
	item->Time = Data;

	SetRedraw(FALSE);
	int nPos = CListBox::AddString((LPCTSTR)item);

   if(nPos < 0) return -1;

   SetItemDataPtr(nPos, item);
	SetTopIndex(nPos-1);
	SetCurSel(nPos);
	SetRedraw(TRUE);
	return nPos;
}
Ejemplo n.º 3
0
int CDropListBox::AddListItem( LIST_ITEM& item )
{
	PLIST_ITEM pItem = new LIST_ITEM;
	*pItem = item;
	int nPos = AddString( pItem->strText.c_str() );
	SetItemDataPtr( nPos, (void*)pItem );
	return nPos;
}
Ejemplo n.º 4
0
int CPPageInternalFiltersListBox::AddFilter(filter_t* filter, bool checked)
{
    int index = AddString(filter->label);
    // SetItemDataPtr must be called before SetCheck
    SetItemDataPtr(index, filter);
    SetCheck(index, checked);

    return index;
}
Ejemplo n.º 5
0
int CPropertyList::AddPropItem(CPropertyItem* pItem) {
	if (pItem->m_nItemType == PIT_VAR) {
		measureItem = pItem;
	} else {
		measureItem = NULL;
	}
	int nIndex = AddString(_T(""));
	measureItem = NULL;
	SetItemDataPtr(nIndex,pItem);
	return nIndex;
}
Ejemplo n.º 6
0
int CCrossfaderBar::CMyComboBox::UpdateString(int nIndex, LPCTSTR lpszString)
{
	PVOID	pCurSel = GetItemDataPtr(GetCurSel());
	PVOID	pData = GetItemDataPtr(nIndex);
	if (DeleteString(nIndex) == CB_ERR)
		return(CB_ERR);
	int	pos = AddString(lpszString);
	SetItemDataPtr(pos, pData);
	SetCurSel(FindItemDataPtr(pCurSel));
	return(pos);
}
Ejemplo n.º 7
0
LRESULT CInPlaceList::OnAddString(WPARAM wParam, LPARAM lParam)
{
    int nIndex = (int)Default();

    POSITION pos = (POSITION)wParam;
    if(NULL == pos)
    {
        CItemData* pData = new CItemData(CB_ERR, (LPCTSTR)lParam, TRUE);
        m_PtrList.AddTail(pData);
        SetItemDataPtr(nIndex, pData);
    }

    return nIndex;
}
Ejemplo n.º 8
0
// Add item in dropdown list
int CInPlaceList::AddItem(CItemData* pData)
{
    if(NULL == pData || TRUE == pData->m_bState)
        return CB_ERR;

    int nIndex = (int)SendMessage(CB_ADDSTRING, (WPARAM)m_PtrList.Find(pData), (LPARAM)(LPCTSTR)pData->m_sItem);
    if(CB_ERR == nIndex || CB_ERRSPACE == nIndex)
        return nIndex;

    pData->m_bState = TRUE;
    SetItemData(nIndex, pData->m_dwItemData);
    SetItemDataPtr(nIndex, pData);

    return nIndex;
}
Ejemplo n.º 9
0
void CWndCommand::OnInitialUpdate() 
{ 
	CWndListBox::OnInitialUpdate(); 

	int nCount = 0, nIndex, nNum = 0;
	while( m_textCmdFunc[ nCount ].m_pFunc )
	{
		TextCmdFunc* pTextCmdFunc = &m_textCmdFunc[nCount];
		if( ::GetLanguage() != LANG_KOR )			// 한국이외에서는 사용제한 
		{
			if( memcmp( pTextCmdFunc->m_pCommand, "open", 4 ) == 0 )
				break;
		}

		if( pTextCmdFunc->m_dwAuthorization <= g_pPlayer->m_dwAuthorization )
		{
			if( ::GetLanguage() != LANG_KOR )
				g_Option.m_nChatCommand = 2;

			switch( g_Option.m_nChatCommand )
			{
			default:
			case 0:
				nIndex = AddString( &(*pTextCmdFunc->m_pKrCommand) );
				break;
			case 1:
				nIndex = AddString( &(*pTextCmdFunc->m_pKrAbbreviation) );
				break;
			case 2:
				nIndex = AddString( &(*pTextCmdFunc->m_pCommand) );
				break;
			case 3:
				nIndex = AddString( &(*pTextCmdFunc->m_pAbbreviation) );
				break;
			}
			SetItemDataPtr( nIndex, pTextCmdFunc );
			nNum++;
		}
		nCount++;
	}
	SortListBox();

	if( nNum > 20 ) nNum = 20;
	if( nNum < 5 ) nNum = 5;
	SetWndRect( CRect( 0, 0, 160, nNum * ( GetFontHeight() + 3 ) + 8 ) );

	m_pWndEdit->SetFocus();
} 
Ejemplo n.º 10
0
int CDropListBox::AtomicInsertListItem(int nIndex, PLIST_ITEM pItem)
{
	int nOldState = pItem->state;

	pItem->state &= ~ACBIS_INVISIBLE;
	int nPos = InsertString(nIndex, pItem->strText);
	if(nPos >= 0)
	{
		SetItemDataPtr( nPos, (void*)pItem );
	}
	else
	{
		pItem->state = nOldState;
	}
	return nPos;
}
void CXTPPropertyGridInplaceList::Create(CXTPPropertyGridItem* pItem, CRect rect)
{
	ASSERT(pItem && pItem->GetGrid());
	if (!pItem)
		return;

	CRect rcValue(rect);
	rcValue.left = pItem->GetGrid()->GetDividerPos() + 1;

	CWnd* pParent = (CWnd*)pItem->GetGrid();
	m_pItem = pItem;

	DestroyWindow();

	if (!m_hWnd)
	{
		CListBox::CreateEx(WS_EX_TOOLWINDOW | (pParent->GetExStyle() & WS_EX_LAYOUTRTL), _T("LISTBOX"), _T(""),
			LBS_NOTIFY | WS_CHILD | WS_VSCROLL | WS_BORDER | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS, CRect(0, 0, 0, 0), pParent, 0);
		SetOwner(pParent);


		if (m_bShowShadow && XTPSystemVersion()->IsWinXPOrGreater())
			SetClassLongPtr(m_hWnd, GCL_STYLE, GetClassLongPtr(m_hWnd, GCL_STYLE) | 0x00020000);
	}
	SetFont(pParent->GetFont());

	ResetContent();

	CXTPPropertyGridItemConstraints* pList = pItem->GetConstraints();


	int dx = rect.right - rcValue.left;

	CWindowDC dc(pParent);
	CXTPFontDC font(&dc, pParent->GetFont());
	int nHeight = dc.GetTextExtent(_T(" "), 1).cy + 3;

	for (int i = 0; i < pList->GetCount(); i++)
	{
		CXTPPropertyGridItemConstraint* pConstraint = pList->GetConstraintAt(i);

		CString str = pConstraint->m_strConstraint;
		int nIndex = AddString(str);
		SetItemDataPtr(nIndex, pConstraint);

		CSize sz = pItem->OnMergeItemConstraint(&dc, pConstraint);

		dx = max(dx, sz.cx);
		nHeight = max(nHeight, sz.cy);

		if (pItem->GetValue() == str)
			SetCurSel(nIndex);
	}

	SetItemHeight(0, nHeight);

	rect.top = rect.bottom;
	rect.bottom += nHeight * __min(pItem->GetDropDownItemCount(), GetCount()) + 2;
	rect.left = rect.right - __min(dx, rect.Width() - XTP_PGI_EXPAND_BORDER);

	pParent->ClientToScreen(&rect);

	CRect rcWork = XTPMultiMonitor()->GetWorkArea(rect);
	if (rect.bottom > rcWork.bottom && rect.top > rcWork.CenterPoint().y)
	{
		rect.OffsetRect(0, - rect.Height() - rcValue.Height() - 1);
	}
	if (rect.left < rcWork.left) rect.OffsetRect(rcWork.left - rect.left, 0);
	if (rect.right > rcWork.right) rect.OffsetRect(rcWork.right - rect.right, 0);


	SetFocus();


	SetWindowLongPtr(m_hWnd, GWLP_HWNDPARENT, 0);
	ModifyStyle(WS_CHILD, WS_POPUP);
	SetWindowLongPtr(m_hWnd, GWLP_HWNDPARENT, (LONG_PTR)pParent->m_hWnd);

	SetWindowPos(&CWnd::wndTopMost, rect.left, rect.top, rect.Width(), rect.Height(), SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOOWNERZORDER);

	CXTPMouseMonitor::SetupHook(this);
}
void CXTPReportInplaceList::Create(XTP_REPORTRECORDITEM_ARGS* pItemArgs, CXTPReportRecordItemConstraints* pConstaints)
{
	SetItemArgs(pItemArgs);

	CRect rect(pItemArgs->rcItem);

	if (!m_hWnd)
	{
		CListBox::CreateEx(WS_EX_TOOLWINDOW | (pControl->GetExStyle() & WS_EX_LAYOUTRTL), _T("LISTBOX"), _T(""), LBS_NOTIFY | WS_CHILD | WS_BORDER | WS_VSCROLL, CRect(0, 0, 0, 0), pControl, 0);
		SetOwner(pControl);
	}

	SetFont(pControl->GetPaintManager()->GetTextFont());
	ResetContent();

	int dx = rect.right - rect.left + 1;

	CWindowDC dc(pControl);
	CXTPFontDC font(&dc, GetFont());
	int nThumbLength = GetSystemMetrics(SM_CXHTHUMB);

	CString strCaption = pItem->GetCaption(pColumn);
	DWORD dwData = pItem->GetSelectedConstraintData(pItemArgs);

	for (int i = 0; i < pConstaints->GetCount(); i++)
	{
		CXTPReportRecordItemConstraint* pConstaint = pConstaints->GetAt(i);
		CString str = pConstaint->m_strConstraint;
		int nIndex = AddString(str);
		SetItemDataPtr(nIndex, pConstaint);

		dx = max(dx, dc.GetTextExtent(str).cx + nThumbLength);

		if ((dwData == (DWORD)-1 && strCaption == str) || (dwData == pConstaint->m_dwData))
			SetCurSel(nIndex);
	}

	int nHeight = GetItemHeight(0);
	rect.top = rect.bottom;
	//rect.bottom += nHeight * min(10, GetCount()) + 2;
	rect.bottom += nHeight * min(m_Items2Show, GetCount()) + 2;
	rect.left = rect.right - dx;

	pControl->ClientToScreen(&rect);

	CRect rcWork = XTPMultiMonitor()->GetWorkArea(rect);
	if (rect.bottom > rcWork.bottom && rect.top > rcWork.CenterPoint().y)
		rect.OffsetRect(0, - rect.Height() - pItemArgs->rcItem.Height());

	if (rect.left < rcWork.left) rect.OffsetRect(rcWork.left - rect.left, 0);
	if (rect.right > rcWork.right) rect.OffsetRect(rcWork.right - rect.right, 0);

	SetFocus();

	if (!m_hWnd) // Can be destroyed after focus set
		return;

	SetWindowLongPtr(m_hWnd, GWLP_HWNDPARENT, 0);
	ModifyStyle(WS_CHILD, WS_POPUP);
	SetWindowLongPtr(m_hWnd, GWLP_HWNDPARENT, (LONG_PTR)pControl->m_hWnd);

	SetWindowPos(&CWnd::wndTopMost, rect.left, rect.top, rect.Width(), rect.Height(), SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOOWNERZORDER);

	CXTPMouseMonitor::SetupHook(this);
}
Ejemplo n.º 13
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CTextureBox::LoadGraphicList(void)
{
	if (g_pGameConfig->GetTextureFormat() == tfNone)
	{
		return;
	}

	SetRedraw(FALSE);
	ResetContent();
	InitStorage(g_Textures.GetActiveTextureCount() + 32, sizeof(PVOID));

	//
	// Add the MRU textures to the list.
	//
	int nStrCount = 0;
	POSITION pos = g_Textures.MRUGetHeadPosition();
	while (pos != NULL)
	{
		IEditorTexture *pTex = g_Textures.MRUGetNext(pos, g_pGameConfig->GetTextureFormat());
		if (pTex != NULL)
		{
			char szStr[MAX_PATH];
			pTex->GetShortName(szStr);
			int err = AddString(szStr);
			SetItemDataPtr(nStrCount, (void *)pTex);
			nStrCount++;
		}	
	}

	//
	// Add the MRU seperator to the list, unless the MRU was empty.
	//
	if (nStrCount > 0)
	{
		AddString("");
		SetItemDataPtr(nStrCount, NULL);
		nStrCount++;
	}

	//
	// Add the rest of the textures to the list.
	//
	int nIndex = 0;
	IEditorTexture *pTex = g_Textures.EnumActiveTextures(&nIndex, g_pGameConfig->GetTextureFormat());
	while (pTex != NULL)
	{
		char szStr[MAX_PATH];
		pTex->GetShortName(szStr);
		int err = AddString(szStr);
		assert( (err != CB_ERR) && (err != CB_ERRSPACE) );
		SetItemDataPtr(nStrCount, (void *)pTex);
		nStrCount++;

		pTex = g_Textures.EnumActiveTextures(&nIndex, g_pGameConfig->GetTextureFormat());
	}

	//
	// Hack: Select one that doesn't start with '+', '!', or '*', and doesn't have "door" in it.
	//
	SetCurSel(0);

	int nSel = GetCount();
	for (int i = 0; i < nSel; i++)
	{
		IEditorTexture *pTexSearch = (IEditorTexture *)GetItemDataPtr(i);
		if (pTexSearch != NULL)
		{
			char szName[MAX_PATH];
			pTexSearch->GetShortName(szName);

			if ((szName[0] != 0) && (szName[0] != '*') && (szName[0] != '+') && (szName[0] != '!') && (strstr(szName, "door") == NULL))
			{
				// this one is ok
				SetCurSel(i);
				break;
			}
		}
	}

	SetRedraw(TRUE);
	Invalidate();
}
Ejemplo n.º 14
0
//-----------------------------------------------------------------------------
// Purpose: Rebuilds the MRU for this texture combo box.
//-----------------------------------------------------------------------------
void CTextureBox::RebuildMRU(void)
{
	SetRedraw(FALSE);

	int nCurSel = GetCurSel();

	//
	// Delete current MRUs from list.
	//
	int nItems = GetCount();
	int nDelimiterIndex = 0;
	while (nDelimiterIndex < nItems)
	{
		//
		// The first item with a NULL item data pointer is the MRU delimiter.
		//
		if (GetItemDataPtr(nDelimiterIndex) == NULL)
		{
			break;
		}

		nDelimiterIndex++;
	}

	//
	// If the MRU delimiter was found, delete everything before it.
	//
	if (nDelimiterIndex != nItems)
	{
		do
		{
			DeleteString(0);
		} while(nDelimiterIndex--);
	}

	//
	// Add each texture from the graphics MRU to this list's MRU.
	//
	int nCount = 0;
	POSITION pos = g_Textures.MRUGetHeadPosition();
	while (pos != NULL)
	{
		IEditorTexture *pTex = g_Textures.MRUGetNext(pos, g_pGameConfig->GetTextureFormat());
		if (pTex != NULL)
		{
			char szBuf[MAX_PATH];
			pTex->GetShortName(szBuf);

			int nIndex = InsertString(nCount, szBuf);
			SetItemDataPtr(nIndex, pTex);

			nCount++;
		}
	}

	//
	// Add the MRU seperator to the list, unless the MRU was empty.
	//
	if (nCount > 0)
	{
		int nIndex = InsertString(nCount, "");
		SetItemDataPtr(nIndex, NULL);
	}

	//
	// Restore the original selection.
	//
	SetCurSel(nCurSel);
	SetRedraw(TRUE);
	Invalidate();
}