Copy as Markdown

Other Tools

//
// DO NOT EDIT. THIS FILE IS GENERATED FROM $SRCDIR/widget/nsILegacyJumpListBuilder.idl
//
/// `interface nsILegacyJumpListCommittedCallback : nsISupports`
///
// The actual type definition for the interface. This struct has methods
// declared on it which will call through its vtable. You never want to pass
// this type around by value, always pass it behind a reference.
#[repr(C)]
pub struct nsILegacyJumpListCommittedCallback {
vtable: &'static nsILegacyJumpListCommittedCallbackVTable,
/// This field is a phantomdata to ensure that the VTable type and any
/// struct containing it is not safe to send across threads by default, as
/// XPCOM is generally not threadsafe.
///
/// If this type is marked as [rust_sync], there will be explicit `Send` and
/// `Sync` implementations on this type, which will override the inherited
/// negative impls from `Rc`.
__nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>,
// Make the rust compiler aware that there might be interior mutability
// in what actually implements the interface. This works around UB
// that a rust lint would make blatantly obvious, but doesn't exist.
// This prevents optimizations, but those optimizations weren't available
// before rustc switched to LLVM 16, and they now cause problems because
// of the UB.
// Until there's a lint available to find all our UB, it's simpler to
// avoid the UB in the first place, at the cost of preventing optimizations
// in places that don't cause UB. But again, those optimizations weren't
// available before.
__maybe_interior_mutability: ::std::cell::UnsafeCell<[u8; 0]>,
}
// Implementing XpCom for an interface exposes its IID, which allows for easy
// use of the `.query_interface<T>` helper method. This also defines that
// method for nsILegacyJumpListCommittedCallback.
unsafe impl XpCom for nsILegacyJumpListCommittedCallback {
const IID: nsIID = nsID(0x5131a62a, 0xe99f, 0x4631,
[0x91, 0x38, 0x75, 0x1f, 0x8a, 0xad, 0x1a, 0xe4]);
}
// We need to implement the RefCounted trait so we can be used with `RefPtr`.
// This trait teaches `RefPtr` how to manage our memory.
unsafe impl RefCounted for nsILegacyJumpListCommittedCallback {
#[inline]
unsafe fn addref(&self) {
self.AddRef();
}
#[inline]
unsafe fn release(&self) {
self.Release();
}
}
// This trait is implemented on all types which can be coerced to from nsILegacyJumpListCommittedCallback.
// It is used in the implementation of `fn coerce<T>`. We hide it from the
// documentation, because it clutters it up a lot.
#[doc(hidden)]
pub trait nsILegacyJumpListCommittedCallbackCoerce {
/// Cheaply cast a value of this type from a `nsILegacyJumpListCommittedCallback`.
fn coerce_from(v: &nsILegacyJumpListCommittedCallback) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsILegacyJumpListCommittedCallbackCoerce for nsILegacyJumpListCommittedCallback {
#[inline]
fn coerce_from(v: &nsILegacyJumpListCommittedCallback) -> &Self {
v
}
}
impl nsILegacyJumpListCommittedCallback {
/// Cast this `nsILegacyJumpListCommittedCallback` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsILegacyJumpListCommittedCallbackCoerce>(&self) -> &T {
T::coerce_from(self)
}
}
// Every interface struct type implements `Deref` to its base interface. This
// causes methods on the base interfaces to be directly avaliable on the
// object. For example, you can call `.AddRef` or `.QueryInterface` directly
// on any interface which inherits from `nsISupports`.
impl ::std::ops::Deref for nsILegacyJumpListCommittedCallback {
type Target = nsISupports;
#[inline]
fn deref(&self) -> &nsISupports {
unsafe {
::std::mem::transmute(self)
}
}
}
// Ensure we can use .coerce() to cast to our base types as well. Any type which
// our base interface can coerce from should be coercable from us as well.
impl<T: nsISupportsCoerce> nsILegacyJumpListCommittedCallbackCoerce for T {
#[inline]
fn coerce_from(v: &nsILegacyJumpListCommittedCallback) -> &Self {
T::coerce_from(v)
}
}
// This struct represents the interface's VTable. A pointer to a statically
// allocated version of this struct is at the beginning of every nsILegacyJumpListCommittedCallback
// object. It contains one pointer field for each method in the interface. In
// the case where we can't generate a binding for a method, we include a void
// pointer.
#[doc(hidden)]
#[repr(C)]
pub struct nsILegacyJumpListCommittedCallbackVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* void done (in boolean result); */
pub Done: unsafe extern "system" fn (this: *const nsILegacyJumpListCommittedCallback, result: bool) -> ::nserror::nsresult,
}
// The implementations of the function wrappers which are exposed to rust code.
// Call these methods rather than manually calling through the VTable struct.
impl nsILegacyJumpListCommittedCallback {
/// `void done (in boolean result);`
#[inline]
pub unsafe fn Done(&self, result: bool) -> ::nserror::nsresult {
((*self.vtable).Done)(self, result)
}
}
/// `interface nsILegacyJumpListBuilder : nsISupports`
///
// The actual type definition for the interface. This struct has methods
// declared on it which will call through its vtable. You never want to pass
// this type around by value, always pass it behind a reference.
#[repr(C)]
pub struct nsILegacyJumpListBuilder {
vtable: &'static nsILegacyJumpListBuilderVTable,
/// This field is a phantomdata to ensure that the VTable type and any
/// struct containing it is not safe to send across threads by default, as
/// XPCOM is generally not threadsafe.
///
/// If this type is marked as [rust_sync], there will be explicit `Send` and
/// `Sync` implementations on this type, which will override the inherited
/// negative impls from `Rc`.
__nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>,
// Make the rust compiler aware that there might be interior mutability
// in what actually implements the interface. This works around UB
// that a rust lint would make blatantly obvious, but doesn't exist.
// This prevents optimizations, but those optimizations weren't available
// before rustc switched to LLVM 16, and they now cause problems because
// of the UB.
// Until there's a lint available to find all our UB, it's simpler to
// avoid the UB in the first place, at the cost of preventing optimizations
// in places that don't cause UB. But again, those optimizations weren't
// available before.
__maybe_interior_mutability: ::std::cell::UnsafeCell<[u8; 0]>,
}
// Implementing XpCom for an interface exposes its IID, which allows for easy
// use of the `.query_interface<T>` helper method. This also defines that
// method for nsILegacyJumpListBuilder.
unsafe impl XpCom for nsILegacyJumpListBuilder {
const IID: nsIID = nsID(0x1fe6a9cd, 0x2b18, 0x4dd5,
[0xa1, 0x76, 0xc2, 0xb3, 0x2f, 0xa4, 0xf6, 0x83]);
}
// We need to implement the RefCounted trait so we can be used with `RefPtr`.
// This trait teaches `RefPtr` how to manage our memory.
unsafe impl RefCounted for nsILegacyJumpListBuilder {
#[inline]
unsafe fn addref(&self) {
self.AddRef();
}
#[inline]
unsafe fn release(&self) {
self.Release();
}
}
// This trait is implemented on all types which can be coerced to from nsILegacyJumpListBuilder.
// It is used in the implementation of `fn coerce<T>`. We hide it from the
// documentation, because it clutters it up a lot.
#[doc(hidden)]
pub trait nsILegacyJumpListBuilderCoerce {
/// Cheaply cast a value of this type from a `nsILegacyJumpListBuilder`.
fn coerce_from(v: &nsILegacyJumpListBuilder) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsILegacyJumpListBuilderCoerce for nsILegacyJumpListBuilder {
#[inline]
fn coerce_from(v: &nsILegacyJumpListBuilder) -> &Self {
v
}
}
impl nsILegacyJumpListBuilder {
/// Cast this `nsILegacyJumpListBuilder` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsILegacyJumpListBuilderCoerce>(&self) -> &T {
T::coerce_from(self)
}
}
// Every interface struct type implements `Deref` to its base interface. This
// causes methods on the base interfaces to be directly avaliable on the
// object. For example, you can call `.AddRef` or `.QueryInterface` directly
// on any interface which inherits from `nsISupports`.
impl ::std::ops::Deref for nsILegacyJumpListBuilder {
type Target = nsISupports;
#[inline]
fn deref(&self) -> &nsISupports {
unsafe {
::std::mem::transmute(self)
}
}
}
// Ensure we can use .coerce() to cast to our base types as well. Any type which
// our base interface can coerce from should be coercable from us as well.
impl<T: nsISupportsCoerce> nsILegacyJumpListBuilderCoerce for T {
#[inline]
fn coerce_from(v: &nsILegacyJumpListBuilder) -> &Self {
T::coerce_from(v)
}
}
// This struct represents the interface's VTable. A pointer to a statically
// allocated version of this struct is at the beginning of every nsILegacyJumpListBuilder
// object. It contains one pointer field for each method in the interface. In
// the case where we can't generate a binding for a method, we include a void
// pointer.
#[doc(hidden)]
#[repr(C)]
pub struct nsILegacyJumpListBuilderVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* readonly attribute short available; */
pub GetAvailable: unsafe extern "system" fn (this: *const nsILegacyJumpListBuilder, aAvailable: *mut i16) -> ::nserror::nsresult,
/* readonly attribute boolean isListCommitted; */
pub GetIsListCommitted: unsafe extern "system" fn (this: *const nsILegacyJumpListBuilder, aIsListCommitted: *mut bool) -> ::nserror::nsresult,
/* readonly attribute short maxListItems; */
pub GetMaxListItems: unsafe extern "system" fn (this: *const nsILegacyJumpListBuilder, aMaxListItems: *mut i16) -> ::nserror::nsresult,
/* [implicit_jscontext] Promise initListBuild (); */
/// Unable to generate binding because `jscontext is unsupported`
pub InitListBuild: *const ::libc::c_void,
/* boolean addListToBuild (in short aCatType, [optional] in nsIArray items, [optional] in AString catName); */
pub AddListToBuild: unsafe extern "system" fn (this: *const nsILegacyJumpListBuilder, aCatType: i16, items: *const nsIArray, catName: *const ::nsstring::nsAString, _retval: *mut bool) -> ::nserror::nsresult,
/* void abortListBuild (); */
pub AbortListBuild: unsafe extern "system" fn (this: *const nsILegacyJumpListBuilder) -> ::nserror::nsresult,
/* void commitListBuild ([optional] in nsILegacyJumpListCommittedCallback callback); */
pub CommitListBuild: unsafe extern "system" fn (this: *const nsILegacyJumpListBuilder, callback: *const nsILegacyJumpListCommittedCallback) -> ::nserror::nsresult,
/* boolean deleteActiveList (); */
pub DeleteActiveList: unsafe extern "system" fn (this: *const nsILegacyJumpListBuilder, _retval: *mut bool) -> ::nserror::nsresult,
/* void setAppUserModelID (in AString aAppUserModelId); */
pub SetAppUserModelID: unsafe extern "system" fn (this: *const nsILegacyJumpListBuilder, aAppUserModelId: *const ::nsstring::nsAString) -> ::nserror::nsresult,
}
// The implementations of the function wrappers which are exposed to rust code.
// Call these methods rather than manually calling through the VTable struct.
impl nsILegacyJumpListBuilder {
/// ```text
/// /**
/// * JumpLists
/// *
/// * Jump lists are built and then applied. Modifying an applied jump list is not
/// * permitted. Callers should begin the creation of a new jump list using
/// * initListBuild, add sub lists using addListToBuild, then commit the jump list
/// * using commitListBuild. Lists are built in real-time during the sequence of
/// * build calls, make sure to check for errors on each individual step.
/// *
/// * The default number of allowed items in a jump list is ten. Users can change
/// * the number through system preferences. User may also pin items to jump lists,
/// * which take up additional slots. Applications do not have control over the
/// * number of items allowed in jump lists; excess items added are dropped by the
/// * system. Item insertion priority is defined as first to last added.
/// *
/// * Users may remove items from jump lists after they are commited. The system
/// * tracks removed items between commits. A list of these items is returned by
/// * a call to initListBuild. nsILegacyJumpListBuilder does not filter entries added that
/// * have been removed since the last commit. To prevent repeatedly adding entries
/// * users have removed, applications are encoraged to track removed items
/// * internally.
/// *
/// * Each list is made up of an array of nsILegacyJumpListItem representing items
/// * such as shortcuts, links, and separators. See nsILegacyJumpListItem for information
/// * on adding additional jump list types.
/// */
/// /**
/// * List Types
/// */
/// /**
/// * Task List
/// *
/// * Tasks are common actions performed by users within the application. A task
/// * can be represented by an application shortcut and associated command line
/// * parameters or a URI. Task lists should generally be static lists that do not
/// * change often, if at all - similar to an application menu.
/// *
/// * Tasks are given the highest priority of all lists when space is limited.
/// */
/// ```
///
pub const JUMPLIST_CATEGORY_TASKS: i16 = 0;
/// ```text
/// /**
/// * Recent or Frequent list
/// *
/// * Recent and frequent lists are based on Window's recent document lists. The
/// * lists are generated automatically by Windows. Applications that use recent
/// * or frequent lists should keep document use tracking up to date by calling
/// * the SHAddToRecentDocs shell api.
/// */
/// ```
///
pub const JUMPLIST_CATEGORY_RECENT: i16 = 1;
pub const JUMPLIST_CATEGORY_FREQUENT: i16 = 2;
/// ```text
/// /**
/// * Custom Lists
/// *
/// * Custom lists can be made up of tasks, links, and separators. The title of
/// * of the list is passed through the optional string parameter of addBuildList.
/// */
/// ```
///
pub const JUMPLIST_CATEGORY_CUSTOMLIST: i16 = 3;
/// ```text
/// /**
/// * Indicates whether jump list taskbar features are supported by the current
/// * host.
/// */
/// ```
///
/// `readonly attribute short available;`
#[inline]
pub unsafe fn GetAvailable(&self, aAvailable: *mut i16) -> ::nserror::nsresult {
((*self.vtable).GetAvailable)(self, aAvailable)
}
/// ```text
/// /**
/// * JumpList management
/// *
/// * @throw NS_ERROR_NOT_AVAILABLE on all calls if taskbar functionality
/// * is not supported by the operating system.
/// */
/// /**
/// * Indicates if a commit has already occurred in this session.
/// */
/// ```
///
/// `readonly attribute boolean isListCommitted;`
#[inline]
pub unsafe fn GetIsListCommitted(&self, aIsListCommitted: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetIsListCommitted)(self, aIsListCommitted)
}
/// ```text
/// /**
/// * The maximum number of jump list items the current desktop can support.
/// */
/// ```
///
/// `readonly attribute short maxListItems;`
#[inline]
pub unsafe fn GetMaxListItems(&self, aMaxListItems: *mut i16) -> ::nserror::nsresult {
((*self.vtable).GetMaxListItems)(self, aMaxListItems)
}
/// ```text
/// /**
/// * Initializes a jump list build and returns a promise with the list of
/// * items the user removed since the last time a jump list was committed.
/// * Removed items can become state after initListBuild is called, lists
/// * should be built in single-shot fasion.
/// *
/// * @returns a promise with the list of items that were removed by the user
/// * since the last commit.
/// */
/// ```
///
/// `[implicit_jscontext] Promise initListBuild ();`
const _InitListBuild: () = ();
/// ```text
/// /**
/// * Adds a list and if required, a set of items for the list.
/// *
/// * @param aCatType
/// * The type of list to add.
/// * @param items
/// * An array of nsILegacyJumpListItem items to add to the list.
/// * @param catName
/// * For custom lists, the title of the list.
/// *
/// * @returns true if the operation completed successfully.
/// *
/// * @throw NS_ERROR_INVALID_ARG if incorrect parameters are passed for
/// * a particular category or item type.
/// * @throw NS_ERROR_ILLEGAL_VALUE if an item is added that was removed
/// * since the last commit.
/// * @throw NS_ERROR_UNEXPECTED on internal errors.
/// */
/// ```
///
/// `boolean addListToBuild (in short aCatType, [optional] in nsIArray items, [optional] in AString catName);`
#[inline]
pub unsafe fn AddListToBuild(&self, aCatType: i16, items: *const nsIArray, catName: *const ::nsstring::nsAString, _retval: *mut bool) -> ::nserror::nsresult {
((*self.vtable).AddListToBuild)(self, aCatType, items, catName, _retval)
}
/// ```text
/// /**
/// * Aborts and clears the current jump list build.
/// */
/// ```
///
/// `void abortListBuild ();`
#[inline]
pub unsafe fn AbortListBuild(&self, ) -> ::nserror::nsresult {
((*self.vtable).AbortListBuild)(self, )
}
/// ```text
/// /**
/// * Commits the current jump list build to the Taskbar.
/// *
/// * @param callback
/// * Receives one argument, which is true if the operation completed
/// * successfully, otherwise it is false.
/// */
/// ```
///
/// `void commitListBuild ([optional] in nsILegacyJumpListCommittedCallback callback);`
#[inline]
pub unsafe fn CommitListBuild(&self, callback: *const nsILegacyJumpListCommittedCallback) -> ::nserror::nsresult {
((*self.vtable).CommitListBuild)(self, callback)
}
/// ```text
/// /**
/// * Deletes any currently applied taskbar jump list for this application.
/// * Common uses would be the enabling of a privacy mode and uninstallation.
/// *
/// * @returns true if the operation completed successfully.
/// *
/// * @throw NS_ERROR_UNEXPECTED on internal errors.
/// */
/// ```
///
/// `boolean deleteActiveList ();`
#[inline]
pub unsafe fn DeleteActiveList(&self, _retval: *mut bool) -> ::nserror::nsresult {
((*self.vtable).DeleteActiveList)(self, _retval)
}
/// `void setAppUserModelID (in AString aAppUserModelId);`
#[inline]
pub unsafe fn SetAppUserModelID(&self, aAppUserModelId: *const ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).SetAppUserModelID)(self, aAppUserModelId)
}
}