Ejemplo n.º 1
0
// @pymethod |PyICustomDestinationList|AppendCategory|Adds a custom category to the jump list
PyObject *PyICustomDestinationList::AppendCategory(PyObject *self, PyObject *args)
{
	ICustomDestinationList *pICDL = GetI(self);
	if ( pICDL == NULL )
		return NULL;
	
	TmpWCHAR Category;
	PyObject *obCategory, *obItems;
	IObjectArray *Items;
	// @pyparm str|Category||Display name of the category, can also be a dll and resource id for localization
	// @pyparm <o PyIObjectArray>|Items||Collection of IShellItem and/or IShellLink interfaces
	if ( !PyArg_ParseTuple(args, "OO:AppendCategory", &obCategory, &obItems))
		return NULL;
	if (!PyWinObject_AsWCHAR(obCategory, &Category, FALSE))
		return NULL;
	if (!PyCom_InterfaceFromPyInstanceOrObject(obItems, IID_IObjectArray, (void **)&Items, FALSE))
		return NULL;
	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pICDL->AppendCategory(Category, Items);
	Items->Release();
	PY_INTERFACE_POSTCALL;

	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pICDL, IID_ICustomDestinationList );
	Py_INCREF(Py_None);
	return Py_None;
}
Ejemplo n.º 2
0
void wxTaskBarJumpListImpl::AddCustomCategoriesToDestionationList()
{
    for ( wxTaskBarJumpListCategories::iterator it = m_customCategories.begin();
          it != m_customCategories.end();
          ++it )
    {
        IObjectCollection* collection = CreateObjectCollection();
        if ( !collection )
            continue;

        const wxTaskBarJumpListItems& tasks = (*it)->GetItems();
        for ( wxTaskBarJumpListItems::const_iterator iter = tasks.begin();
              iter != tasks.end();
              ++iter )
        {
            wxASSERT_MSG(
                (*iter)->GetType() == wxTASKBAR_JUMP_LIST_DESTIONATION,
                "Invalid category item." );
            AddShellLink(collection, *(*iter));
        }
        m_destinationList->AppendCategory((*it)->GetTitle().wc_str(),
                                          collection);
        collection->Release();
    }
}