Exemplo n.º 1
0
bool GUIListBoxAddTextList( a_list *list, unsigned items, void *handle,
                            char *(*getstring)(void*,unsigned) )
{
    int         i;
    char        *curr_str;
    char        **old_data;
    char        **data;
    int         choice;

    old_data = (char **)list->data;
    choice = -1;
    data = ResizeList( list, items, &choice );
    if( data == NULL ) {
        return( FALSE );
    }
    for( i = 0; i < items; ++i ) {
        curr_str = getstring( handle, i );
        if( !AddString( data, curr_str, choice + i ) ) {
            return( FALSE );
        }
    }
    GUIMemFree( old_data );
    list->data = (void *)data;
    uiupdatelistbox( list );
    return( TRUE );
}
Exemplo n.º 2
0
// 根据列表里的内容调整大小
void CTipDlg::Resize()
{
	RECT rc;
	m_list.GetItemRect(0, &rc, LVIR_BOUNDS);
	int height = m_list.GetItemCount() * (rc.bottom - rc.top + 1);
	if (height > 150) height = 150;

	m_list.GetClientRect(&rc);
	m_list.ResizeClient(rc.right - rc.left, height);
	m_list.GetWindowRect(&rc);
	height = rc.bottom - rc.top;

	GetClientRect(&rc);
	ResizeClient(rc.right - rc.left, height);
	ResizeList();
	::SetFocus(m_pair);
}
Exemplo n.º 3
0
bool GUIListBoxAddText( a_list *list, char *text, int choice )
{
    char        **data;
    char        **old_data;

    old_data = (char **)list->data;
    data = ResizeList( list, 1, &choice );
    if( data == NULL ) {
        return( FALSE );
    }
    if( !AddString( data, text, choice ) ) {
        return( FALSE );
    }
    GUIMemFree( old_data );
    list->data = (void *)data;
    uiupdatelistbox( list );
    return( TRUE );
}
Exemplo n.º 4
0
bool GUIListBoxAddText( a_list *list, const char *text, gui_ctl_idx choice )
{
    lb_data     new_data;
    lb_data     old_data;

    old_data = (lb_data)list->data_handle;
    new_data = ResizeList( list, 1, &choice );
    if( new_data == NULL ) {
        return( false );
    }
    if( !AddString( new_data, text, choice ) ) {
        return( false );
    }
    GUIMemFree( (void *)old_data );
    list->data_handle = (const void *)new_data;
    uiupdatelistbox( list );
    return( true );
}
Exemplo n.º 5
0
bool GUIListBoxAddTextList( a_list *list, int items, const void *data_handle, GUIPICKGETTEXT *getstring )
{
    int         item;
    lb_data     old_data;
    lb_data     new_data;
    gui_ctl_idx choice;

    choice = -1;
    old_data = (lb_data)list->data_handle;
    new_data = ResizeList( list, items, &choice );
    if( new_data == NULL ) {
        return( false );
    }
    for( item = 0; item < items; ++item ) {
        if( !AddString( new_data, getstring( data_handle, item ), choice + item ) ) {
            return( false );
        }
    }
    GUIMemFree( (void *)old_data );
    list->data_handle = (const void *)new_data;
    uiupdatelistbox( list );
    return( true );
}
Exemplo n.º 6
0
LRESULT CTipDlg::OnSize(UINT , WPARAM , LPARAM , BOOL &)
{
	ResizeList();
	return TRUE;
}
Exemplo n.º 7
0
_Check_return_ bool CTagArrayEditor::DoListEdit(ULONG ulListNum, int iItem, _In_ SortListData* lpData)
{
	if (!IsValidList(ulListNum)) return false;
	if (!lpData) return false;

	HRESULT	hRes = S_OK;
	ULONG	ulOrigPropTag = lpData->data.Tag.ulPropTag;
	ULONG	ulNewPropTag = ulOrigPropTag;

	CPropertyTagEditor MyPropertyTag(
		NULL, // title
		NULL, // prompt
		ulOrigPropTag,
		m_bIsAB,
		m_lpMAPIProp,
		this);

	WC_H(MyPropertyTag.DisplayDialog());
	if (S_OK != hRes) return false;
	ulNewPropTag = MyPropertyTag.GetPropertyTag();

	if (ulNewPropTag != ulOrigPropTag)
	{
		CString szTmp;
		lpData->data.Tag.ulPropTag = ulNewPropTag;

		szTmp.Format(_T("0x%08X"), ulNewPropTag); // STRING_OK
		SetListString(ulListNum, iItem, 1, szTmp);

		CString PropTag;
		CString PropType;
		LPTSTR szExactMatch = NULL;
		LPTSTR szPartialMatch = NULL;
		LPTSTR szNamedPropName = NULL;
		LPTSTR szNamedPropGUID = NULL;

		InterpretProp(
			NULL,
			ulNewPropTag,
			m_lpMAPIProp,
			NULL,
			NULL,
			m_bIsAB,
			&szExactMatch, // Built from ulPropTag & bIsAB
			&szPartialMatch, // Built from ulPropTag & bIsAB
			&PropType,
			&PropTag,
			NULL,
			NULL,
			&szNamedPropName, // Built from lpProp & lpMAPIProp
			&szNamedPropGUID, // Built from lpProp & lpMAPIProp
			NULL);
		SetListString(ulListNum, iItem, 2, szExactMatch);
		SetListString(ulListNum, iItem, 3, szPartialMatch);
		SetListString(ulListNum, iItem, 4, PropType);
		SetListString(ulListNum, iItem, 5, szNamedPropName);
		SetListString(ulListNum, iItem, 6, szNamedPropGUID);

		delete[] szPartialMatch;
		delete[] szExactMatch;
		FreeNameIDStrings(szNamedPropName, szNamedPropGUID, NULL);

		ResizeList(ulListNum, false);
		return true;
	}
	return false;
} // CTagArrayEditor::DoListEdit
Exemplo n.º 8
0
void CTagArrayEditor::ReadTagArrayToList(ULONG ulListNum)
{
	if (!IsValidList(ulListNum)) return;

	ClearList(ulListNum);

	InsertColumn(ulListNum, 0, IDS_SHARP);
	InsertColumn(ulListNum, 1, IDS_TAG);
	InsertColumn(ulListNum, 2, IDS_PROPERTYNAMES);
	InsertColumn(ulListNum, 3, IDS_OTHERNAMES);
	InsertColumn(ulListNum, 4, IDS_TYPE);
	InsertColumn(ulListNum, 5, IDS_NAMEDPROPNAME);
	InsertColumn(ulListNum, 6, IDS_NAMEDPROPGUID);

	if (m_lpTagArray)
	{
		CString szTmp;
		ULONG iTagCount = 0;
		ULONG cValues = m_lpTagArray->cValues;

		for (iTagCount = 0; iTagCount < cValues; iTagCount++)
		{
			ULONG ulPropTag = m_lpTagArray->aulPropTag[iTagCount];
			SortListData* lpData = NULL;
			szTmp.Format(_T("%u"), iTagCount); // STRING_OK
			lpData = InsertListRow(ulListNum, iTagCount, szTmp);
			if (lpData)
			{
				lpData->ulSortDataType = SORTLIST_TAGARRAY;
				lpData->data.Tag.ulPropTag = ulPropTag;
				lpData->bItemFullyLoaded = true;
			}

			CString PropTag;
			CString PropType;
			LPTSTR szExactMatch = NULL;
			LPTSTR szPartialMatch = NULL;
			LPTSTR szNamedPropName = NULL;
			LPTSTR szNamedPropGUID = NULL;

			InterpretProp(
				NULL,
				ulPropTag,
				m_lpMAPIProp,
				NULL,
				NULL,
				m_bIsAB,
				&szExactMatch, // Built from ulPropTag & bIsAB
				&szPartialMatch, // Built from ulPropTag & bIsAB
				&PropType,
				&PropTag,
				NULL,
				NULL,
				&szNamedPropName, // Built from lpProp & lpMAPIProp
				&szNamedPropGUID, // Built from lpProp & lpMAPIProp
				NULL);
			SetListString(ulListNum, iTagCount, 1, PropTag);
			SetListString(ulListNum, iTagCount, 2, szExactMatch);
			SetListString(ulListNum, iTagCount, 3, szPartialMatch);
			SetListString(ulListNum, iTagCount, 4, PropType);
			SetListString(ulListNum, iTagCount, 5, szNamedPropName);
			SetListString(ulListNum, iTagCount, 6, szNamedPropGUID);
			delete[] szPartialMatch;
			delete[] szExactMatch;
			FreeNameIDStrings(szNamedPropName, szNamedPropGUID, NULL);
		}
	}
	ResizeList(ulListNum, false);
} // CTagArrayEditor::ReadTagArrayToList