Esempio n. 1
0
	void contextpath_from_guid(const GUID & p_guid, const GUID & p_subcommand, pfc::string_base & p_out, bool b_short)
	{
		p_out.reset();
		service_enum_t<contextmenu_item> e;
		service_ptr_t<contextmenu_item> ptr;

		unsigned p_service_item_index;
		while (e.next(ptr))
		{
			unsigned p_service_item_count = ptr->get_num_items();
			for (p_service_item_index = 0; p_service_item_index < p_service_item_count; p_service_item_index++)
			{
				if (p_guid == ptr->get_item_guid(p_service_item_index))
				{
					pfc::string8 name;
					ptr->get_item_name(p_service_item_index, name);
					if (!b_short)
					{
						ptr->get_item_default_path(p_service_item_index, p_out);
						if (p_out.get_length() && p_out[p_out.get_length() - 1] != '/')
							p_out.add_byte('/');
					}
					p_out.add_string(name);

					if (p_subcommand != pfc::guid_null)
					{
						pfc::ptrholder_t<contextmenu_item_node_root> p_node(ptr->instantiate_item(p_service_item_index, metadb_handle_list(), contextmenu_item::caller_keyboard_shortcut_list));

						if (p_node.is_valid())
							if (__contextpath_from_guid_recur(p_node.get_ptr(), p_subcommand, p_out, b_short, true))
								return;
					}
				}

			}
		}
	}