当前位置: 首页>>代码示例>>C++>>正文


C++ ITfContext::GetProperty方法代码示例

本文整理汇总了C++中ITfContext::GetProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ ITfContext::GetProperty方法的具体用法?C++ ITfContext::GetProperty怎么用?C++ ITfContext::GetProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ITfContext的用法示例。


在下文中一共展示了ITfContext::GetProperty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: _ClearCompositionDisplayAttributes

void CMarkTextService::_ClearCompositionDisplayAttributes(TfEditCookie ec)
{
    ITfRange *pRangeComposition;
    ITfContext *pContext;
    ITfProperty *pDisplayAttributeProperty;

    // we need a range and the context it lives in
    if (_pComposition->GetRange(&pRangeComposition) != S_OK)
        return;

    if (pRangeComposition->GetContext(&pContext) != S_OK)
    {
        pContext = NULL;
        goto Exit;
    }

    // get our the display attribute property
    if (pContext->GetProperty(GUID_PROP_ATTRIBUTE, &pDisplayAttributeProperty) != S_OK)
        goto Exit;

    // clear the value over the range
    pDisplayAttributeProperty->Clear(ec, pRangeComposition);

    pDisplayAttributeProperty->Release();

Exit:
    pRangeComposition->Release();
    SafeRelease(pContext);
}
开发者ID:Ippei-Murofushi,项目名称:WindowsSDK7-Samples,代码行数:29,代码来源:compose.cpp

示例2: setCompositionString

void TextService::setCompositionString(EditSession* session, const wchar_t* str, int len) {
	ITfContext* context = session->context();
	if(context) {
		TfEditCookie editCookie = session->editCookie();
		TF_SELECTION selection;
		ULONG selectionNum;
		// get current selection/insertion point
		if(context->GetSelection(editCookie, TF_DEFAULT_SELECTION, 1, &selection, &selectionNum) == S_OK) {
			ComPtr<ITfRange> compositionRange;
			if(composition_->GetRange(&compositionRange) == S_OK) {
				bool selPosInComposition = true;
				// if current insertion point is not covered by composition, we cannot insert text here.
				if(selPosInComposition) {
					// replace context of composion area with the new string.
					compositionRange->SetText(editCookie, TF_ST_CORRECTION, str, len);

					// move the insertion point to end of the composition string
					selection.range->Collapse(editCookie, TF_ANCHOR_END);
					context->SetSelection(editCookie, 1, &selection);
				}

				// set display attribute to the composition range
				ComPtr<ITfProperty> dispAttrProp;
				if(context->GetProperty(GUID_PROP_ATTRIBUTE, &dispAttrProp) == S_OK) {
					VARIANT val;
					val.vt = VT_I4;
					val.lVal = module_->inputAttrib()->atom();
					dispAttrProp->SetValue(editCookie, compositionRange, &val);
				}
			}
			selection.range->Release();
		}
	}
}
开发者ID:Java2ByteCode,项目名称:PIME,代码行数:34,代码来源:TextService.cpp

示例3: _SetCompositionDisplayAttributes

BOOL CMarkTextService::_SetCompositionDisplayAttributes(TfEditCookie ec)
{
    ITfRange *pRangeComposition;
    ITfContext *pContext;
    ITfProperty *pDisplayAttributeProperty;
    VARIANT var;
    HRESULT hr;

    // we need a range and the context it lives in
    if (_pComposition->GetRange(&pRangeComposition) != S_OK)
        return FALSE;

    hr = E_FAIL;

    if (pRangeComposition->GetContext(&pContext) != S_OK)
    {
        pContext = NULL;
        goto Exit;
    }

    // get our the display attribute property
    if (pContext->GetProperty(GUID_PROP_ATTRIBUTE, &pDisplayAttributeProperty) != S_OK)
        goto Exit;

    // set the value over the range
    // the application will use this guid atom to lookup the acutal rendering information
    var.vt = VT_I4; // we're going to set a TfGuidAtom
    var.lVal = _gaDisplayAttribute; // our cached guid atom for c_guidMarkDisplayAttribute

    hr = pDisplayAttributeProperty->SetValue(ec, pRangeComposition, &var);

    pDisplayAttributeProperty->Release();

Exit:
    pRangeComposition->Release();
    SafeRelease(pContext);
    return (hr == S_OK);
}
开发者ID:Ippei-Murofushi,项目名称:WindowsSDK7-Samples,代码行数:38,代码来源:compose.cpp


注:本文中的ITfContext::GetProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。