本文整理汇总了C++中ITfCategoryMgr类的典型用法代码示例。如果您正苦于以下问题:C++ ITfCategoryMgr类的具体用法?C++ ITfCategoryMgr怎么用?C++ ITfCategoryMgr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ITfCategoryMgr类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _InitDisplayAttributeGuidAtom
BOOL CTextService::_InitDisplayAttributeGuidAtom()
{
HRESULT hr = E_FAIL;
const struct {
const GUID guid;
TfGuidAtom *patom;
} displayAttributeAtom[] = {
{c_guidDisplayAttributeInputMark, &_gaDisplayAttributeInputMark},
{c_guidDisplayAttributeInputText, &_gaDisplayAttributeInputText},
{c_guidDisplayAttributeInputOkuri, &_gaDisplayAttributeInputOkuri},
{c_guidDisplayAttributeConvMark, &_gaDisplayAttributeConvMark},
{c_guidDisplayAttributeConvText, &_gaDisplayAttributeConvText},
{c_guidDisplayAttributeConvOkuri, &_gaDisplayAttributeConvOkuri},
{c_guidDisplayAttributeConvAnnot, &_gaDisplayAttributeConvAnnot}
};
ITfCategoryMgr *pCategoryMgr = nullptr;
hr = CoCreateInstance(CLSID_TF_CategoryMgr, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pCategoryMgr));
if(SUCCEEDED(hr) && (pCategoryMgr != nullptr))
{
for(int i = 0; i < _countof(displayAttributeAtom); i++)
{
hr = pCategoryMgr->RegisterGUID(displayAttributeAtom[i].guid, displayAttributeAtom[i].patom);
}
SafeRelease(&pCategoryMgr);
}
return SUCCEEDED(hr);
}
示例2: RegisterCategories
BOOL RegisterCategories()
{
ITfCategoryMgr *pCategoryMgr;
HRESULT hr;
hr = CoCreateInstance(CLSID_TF_CategoryMgr, NULL, CLSCTX_INPROC_SERVER,
IID_ITfCategoryMgr, (void**)&pCategoryMgr);
if (hr != S_OK)
return FALSE;
//
// register this text service to GUID_TFCAT_TIP_KEYBOARD category.
//
hr = pCategoryMgr->RegisterCategory(c_clsidTextService,
GUID_TFCAT_TIP_KEYBOARD,
c_clsidTextService);
//
// register this text service to GUID_TFCAT_DISPLAYATTRIBUTEPROVIDER category.
//
hr = pCategoryMgr->RegisterCategory(c_clsidTextService,
GUID_TFCAT_DISPLAYATTRIBUTEPROVIDER,
c_clsidTextService);
pCategoryMgr->Release();
return (hr == S_OK);
}
示例3: CoCreateInstance
BOOL CMarkTextService::RegisterCategories(BOOL fRegister)
{
ITfCategoryMgr *pCategoryMgr;
int i;
HRESULT hr;
hr = CoCreateInstance(CLSID_TF_CategoryMgr, NULL, CLSCTX_INPROC_SERVER,
IID_ITfCategoryMgr, (void**)&pCategoryMgr);
if (hr != S_OK)
return FALSE;
for (i=0; i<ARRAYSIZE(c_rgCategories); i++)
{
if (fRegister)
{
hr = pCategoryMgr->RegisterCategory(c_clsidMarkTextService,
*c_rgCategories[i].pguidCategory, *c_rgCategories[i].pguid);
}
else
{
hr = pCategoryMgr->UnregisterCategory(c_clsidMarkTextService,
*c_rgCategories[i].pguidCategory, *c_rgCategories[i].pguid);
}
if (hr != S_OK)
break;
}
pCategoryMgr->Release();
return (hr == S_OK);
}
示例4: RegisterCategories
BOOL RegisterCategories()
{
ITfCategoryMgr *pCategoryMgr;
HRESULT hr;
hr = CoCreateInstance(CLSID_TF_CategoryMgr, NULL, CLSCTX_INPROC_SERVER,
IID_ITfCategoryMgr, (void**)&pCategoryMgr);
if (hr != S_OK)
return FALSE;
hr = pCategoryMgr->RegisterCategory(c_clsidTextService,
GUID_TFCAT_PROPSTYLE_CUSTOM,
c_guidPropCustom);
hr = pCategoryMgr->RegisterCategory(c_clsidTextService,
GUID_TFCAT_PROPSTYLE_STATIC,
c_guidPropStatic);
hr = pCategoryMgr->RegisterCategory(c_clsidTextService,
GUID_TFCAT_PROPSTYLE_STATICCOMPACT,
c_guidPropStaticCompact);
pCategoryMgr->Release();
return (hr == S_OK);
}
示例5: UnregisterCategories
void UnregisterCategories()
{
ITfCategoryMgr *pCategoryMgr;
HRESULT hr;
hr = CoCreateInstance(CLSID_TF_CategoryMgr, NULL, CLSCTX_INPROC_SERVER, IID_ITfCategoryMgr, (void **) &pCategoryMgr);
if (FAILED(hr))
return;
hr = pCategoryMgr->UnregisterCategory(c_clsidTextService, GUID_TFCAT_TIP_KEYBOARD, c_clsidTextService);
pCategoryMgr->Release();
}
示例6: RegisterCategories
BOOL RegisterCategories()
{
ITfCategoryMgr* pCategoryMgr = nullptr;
HRESULT hr = S_OK;
hr = CoCreateInstance(CLSID_TF_CategoryMgr, NULL, CLSCTX_INPROC_SERVER, IID_ITfCategoryMgr, (void**)&pCategoryMgr);
if (FAILED(hr))
{
return FALSE;
}
for each(GUID guid in SupportCategories)
{
hr = pCategoryMgr->RegisterCategory(Global::DIMECLSID, guid, Global::DIMECLSID);
}
示例7: unregisterServer
HRESULT ImeModule::unregisterServer(const GUID& profileGuid) {
// unregister the language profile
ITfInputProcessorProfiles *inputProcessProfiles = NULL;
if(CoCreateInstance(CLSID_TF_InputProcessorProfiles, NULL, CLSCTX_INPROC_SERVER, IID_ITfInputProcessorProfiles, (void**)&inputProcessProfiles) == S_OK) {
inputProcessProfiles->Unregister(textServiceClsid_);
inputProcessProfiles->Release();
}
// unregister categories
ITfCategoryMgr *categoryMgr = NULL;
if(CoCreateInstance(CLSID_TF_CategoryMgr, NULL, CLSCTX_INPROC_SERVER, IID_ITfCategoryMgr, (void**)&categoryMgr) == S_OK) {
categoryMgr->UnregisterCategory(textServiceClsid_, GUID_TFCAT_TIP_KEYBOARD, textServiceClsid_);
categoryMgr->UnregisterCategory(textServiceClsid_, GUID_TFCAT_DISPLAYATTRIBUTEPROVIDER, textServiceClsid_);
// UI less mode
categoryMgr->UnregisterCategory(textServiceClsid_, GUID_TFCAT_TIPCAP_INPUTMODECOMPARTMENT, textServiceClsid_);
if(isWindows8Above()) {
// Windows 8 support
categoryMgr->UnregisterCategory(textServiceClsid_, GUID_TFCAT_TIPCAP_IMMERSIVESUPPORT, textServiceClsid_);
categoryMgr->RegisterCategory(textServiceClsid_, GUID_TFCAT_TIPCAP_SYSTRAYSUPPORT, textServiceClsid_);
}
categoryMgr->Release();
}
// delete the registry key
wstring regPath = L"CLSID\\";
LPOLESTR clsidStr = NULL;
if(StringFromCLSID(textServiceClsid_, &clsidStr) == ERROR_SUCCESS) {
regPath += clsidStr;
CoTaskMemFree(clsidStr);
::SHDeleteKey(HKEY_CLASSES_ROOT, regPath.c_str());
}
return S_OK;
}
示例8: _InitDisplayAttributeGuidAtom
BOOL CMarkTextService::_InitDisplayAttributeGuidAtom()
{
ITfCategoryMgr *pCategoryMgr;
HRESULT hr;
if (CoCreateInstance(CLSID_TF_CategoryMgr,
NULL,
CLSCTX_INPROC_SERVER,
IID_ITfCategoryMgr,
(void**)&pCategoryMgr) != S_OK)
{
return FALSE;
}
hr = pCategoryMgr->RegisterGUID(c_guidMarkDisplayAttribute, &_gaDisplayAttribute);
pCategoryMgr->Release();
return (hr == S_OK);
}
示例9: while
CDispAttrProps *GetDispAttrProps()
{
IEnumGUID *pEnumProp = NULL;
CDispAttrProps *pProps = NULL;
ITfCategoryMgr *pcat;
HRESULT hr = E_FAIL;
if (SUCCEEDED(hr = CoCreateInstance(CLSID_TF_CategoryMgr,
NULL,
CLSCTX_INPROC_SERVER,
IID_ITfCategoryMgr,
(void**)&pcat)))
{
hr = pcat->EnumItemsInCategory(GUID_TFCAT_DISPLAYATTRIBUTEPROPERTY, &pEnumProp);
pcat->Release();
}
//
// make a database for Display Attribute Properties.
//
if (SUCCEEDED(hr) && pEnumProp)
{
GUID guidProp;
pProps = new CDispAttrProps;
//
// add System Display Attribute first.
// so no other Display Attribute property overwrite it.
//
pProps->Add(GUID_PROP_ATTRIBUTE);
while(pEnumProp->Next(1, &guidProp, NULL) == S_OK)
{
if (!IsEqualGUID(guidProp, GUID_PROP_ATTRIBUTE))
pProps->Add(guidProp);
}
}
if (pEnumProp)
pEnumProp->Release();
return pProps;
}
示例10: RegisterCategories
BOOL RegisterCategories()
{
ITfCategoryMgr *pCategoryMgr;
HRESULT hr;
hr = CoCreateInstance(CLSID_TF_CategoryMgr, NULL, CLSCTX_INPROC_SERVER, IID_ITfCategoryMgr, (void **) &pCategoryMgr);
if (hr != S_OK)
return FALSE;
hr = pCategoryMgr->RegisterCategory(c_clsidTextService, GUID_TFCAT_TIP_KEYBOARD, c_clsidTextService);
if (hr != S_OK)
goto Exit;
hr = pCategoryMgr->RegisterCategory(c_clsidTextService, GUID_TFCAT_TIPCAP_INPUTMODECOMPARTMENT, c_clsidTextService);
if (hr != S_OK)
goto Exit;
if (IsWindows8OrHigher())
{
hr = pCategoryMgr->RegisterCategory(c_clsidTextService, GUID_TFCAT_TIPCAP_IMMERSIVESUPPORT, c_clsidTextService);
if (hr != S_OK)
goto Exit;
hr = pCategoryMgr->RegisterCategory(c_clsidTextService, GUID_TFCAT_TIPCAP_SYSTRAYSUPPORT, c_clsidTextService);
}
Exit:
pCategoryMgr->Release();
return (hr == S_OK);
}
示例11: _InitDisplayAttributeGuidAtom
BOOL CTextService::_InitDisplayAttributeGuidAtom()
{
ITfCategoryMgr *pCategoryMgr;
HRESULT hr;
if (CoCreateInstance(CLSID_TF_CategoryMgr,
NULL,
CLSCTX_INPROC_SERVER,
IID_ITfCategoryMgr,
(void**)&pCategoryMgr) != S_OK)
{
return FALSE;
}
// register the display attribute for input text.
hr = pCategoryMgr->RegisterGUID(c_guidDisplayAttributeInput, &_gaDisplayAttributeInput);
// register the display attribute for the converted text.
hr = pCategoryMgr->RegisterGUID(c_guidDisplayAttributeConverted, &_gaDisplayAttributeConverted);
pCategoryMgr->Release();
return (hr == S_OK);
}
示例12: GetDisplayAttributeData
HRESULT GetDisplayAttributeData(TfEditCookie ec, ITfReadOnlyProperty *pProp, ITfRange *pRange, TF_DISPLAYATTRIBUTE *pda, TfGuidAtom *pguid)
{
VARIANT var;
IEnumTfPropertyValue *pEnumPropertyVal;
TF_PROPERTYVAL tfPropVal;
GUID guid;
TfGuidAtom gaVal;
ITfDisplayAttributeInfo *pDAI;
HRESULT hr = E_FAIL;
ITfCategoryMgr *pcat = NULL;
if (FAILED(hr = CoCreateInstance(CLSID_TF_CategoryMgr,
NULL,
CLSCTX_INPROC_SERVER,
IID_ITfCategoryMgr,
(void**)&pcat)))
{
return hr;
}
hr = S_FALSE;
if (SUCCEEDED(pProp->GetValue(ec, pRange, &var)))
{
if (SUCCEEDED(var.punkVal->QueryInterface(IID_IEnumTfPropertyValue,
(void **)&pEnumPropertyVal)))
{
while (pEnumPropertyVal->Next(1, &tfPropVal, NULL) == S_OK)
{
if (tfPropVal.varValue.vt == VT_EMPTY)
continue; // prop has no value over this span
gaVal = (TfGuidAtom)tfPropVal.varValue.lVal;
pcat->GetGUID(gaVal, &guid);
if ((g_pdam != NULL) && SUCCEEDED(g_pdam->GetDisplayAttributeInfo(guid, &pDAI, NULL)))
{
//
// Issue: for simple apps.
//
// Small apps can not show multi underline. So
// this helper function returns only one
// DISPLAYATTRIBUTE structure.
//
if (pda)
{
pDAI->GetAttributeInfo(pda);
}
if (pguid)
{
*pguid = gaVal;
}
pDAI->Release();
hr = S_OK;
break;
}
}
pEnumPropertyVal->Release();
}
VariantClear(&var);
}
pcat->Release();
return hr;
}