Copy as Markdown

Other Tools

//
// DO NOT EDIT. THIS FILE IS GENERATED FROM $SRCDIR/widget/nsITouchBarInput.idl
//
/// `interface nsITouchBarInputCallback : 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 nsITouchBarInputCallback {
vtable: &'static nsITouchBarInputCallbackVTable,
/// 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 nsITouchBarInputCallback.
unsafe impl XpCom for nsITouchBarInputCallback {
const IID: nsIID = nsID(0x001ab07c, 0x1b3a, 0x4dbf,
[0xa6, 0x57, 0xfa, 0xda, 0x00, 0x65, 0xff, 0x55]);
}
// 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 nsITouchBarInputCallback {
#[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 nsITouchBarInputCallback.
// 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 nsITouchBarInputCallbackCoerce {
/// Cheaply cast a value of this type from a `nsITouchBarInputCallback`.
fn coerce_from(v: &nsITouchBarInputCallback) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsITouchBarInputCallbackCoerce for nsITouchBarInputCallback {
#[inline]
fn coerce_from(v: &nsITouchBarInputCallback) -> &Self {
v
}
}
impl nsITouchBarInputCallback {
/// Cast this `nsITouchBarInputCallback` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsITouchBarInputCallbackCoerce>(&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 nsITouchBarInputCallback {
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> nsITouchBarInputCallbackCoerce for T {
#[inline]
fn coerce_from(v: &nsITouchBarInputCallback) -> &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 nsITouchBarInputCallback
// 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 nsITouchBarInputCallbackVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* void onCommand (); */
pub OnCommand: unsafe extern "system" fn (this: *const nsITouchBarInputCallback) -> ::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 nsITouchBarInputCallback {
/// `void onCommand ();`
#[inline]
pub unsafe fn OnCommand(&self, ) -> ::nserror::nsresult {
((*self.vtable).OnCommand)(self, )
}
}
/// `interface nsITouchBarInput : nsISupports`
///
/// ```text
/// /**
/// * Implements an input to be registered on the Mac Touch Bar.
/// */
/// ```
///
// 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 nsITouchBarInput {
vtable: &'static nsITouchBarInputVTable,
/// 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 nsITouchBarInput.
unsafe impl XpCom for nsITouchBarInput {
const IID: nsIID = nsID(0x77441d17, 0xf29c, 0x49d7,
[0x98, 0x2f, 0xf2, 0x0a, 0x5a, 0xb5, 0xa9, 0x00]);
}
// 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 nsITouchBarInput {
#[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 nsITouchBarInput.
// 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 nsITouchBarInputCoerce {
/// Cheaply cast a value of this type from a `nsITouchBarInput`.
fn coerce_from(v: &nsITouchBarInput) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsITouchBarInputCoerce for nsITouchBarInput {
#[inline]
fn coerce_from(v: &nsITouchBarInput) -> &Self {
v
}
}
impl nsITouchBarInput {
/// Cast this `nsITouchBarInput` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsITouchBarInputCoerce>(&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 nsITouchBarInput {
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> nsITouchBarInputCoerce for T {
#[inline]
fn coerce_from(v: &nsITouchBarInput) -> &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 nsITouchBarInput
// 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 nsITouchBarInputVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsISupportsVTable,
/* readonly attribute AString key; */
pub GetKey: unsafe extern "system" fn (this: *const nsITouchBarInput, aKey: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* attribute AString title; */
pub GetTitle: unsafe extern "system" fn (this: *const nsITouchBarInput, aTitle: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* attribute AString title; */
pub SetTitle: unsafe extern "system" fn (this: *const nsITouchBarInput, aTitle: *const ::nsstring::nsAString) -> ::nserror::nsresult,
/* attribute nsIURI image; */
pub GetImage: unsafe extern "system" fn (this: *const nsITouchBarInput, aImage: *mut *const nsIURI) -> ::nserror::nsresult,
/* attribute nsIURI image; */
pub SetImage: unsafe extern "system" fn (this: *const nsITouchBarInput, aImage: *const nsIURI) -> ::nserror::nsresult,
/* attribute AString type; */
pub GetType: unsafe extern "system" fn (this: *const nsITouchBarInput, aType: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* attribute AString type; */
pub SetType: unsafe extern "system" fn (this: *const nsITouchBarInput, aType: *const ::nsstring::nsAString) -> ::nserror::nsresult,
/* attribute nsITouchBarInputCallback callback; */
pub GetCallback: unsafe extern "system" fn (this: *const nsITouchBarInput, aCallback: *mut *const nsITouchBarInputCallback) -> ::nserror::nsresult,
/* attribute nsITouchBarInputCallback callback; */
pub SetCallback: unsafe extern "system" fn (this: *const nsITouchBarInput, aCallback: *const nsITouchBarInputCallback) -> ::nserror::nsresult,
/* attribute uint32_t color; */
pub GetColor: unsafe extern "system" fn (this: *const nsITouchBarInput, aColor: *mut u32) -> ::nserror::nsresult,
/* attribute uint32_t color; */
pub SetColor: unsafe extern "system" fn (this: *const nsITouchBarInput, aColor: u32) -> ::nserror::nsresult,
/* attribute boolean disabled; */
pub GetDisabled: unsafe extern "system" fn (this: *const nsITouchBarInput, aDisabled: *mut bool) -> ::nserror::nsresult,
/* attribute boolean disabled; */
pub SetDisabled: unsafe extern "system" fn (this: *const nsITouchBarInput, aDisabled: bool) -> ::nserror::nsresult,
/* attribute nsIArray children; */
pub GetChildren: unsafe extern "system" fn (this: *const nsITouchBarInput, aChildren: *mut *const nsIArray) -> ::nserror::nsresult,
/* attribute nsIArray children; */
pub SetChildren: unsafe extern "system" fn (this: *const nsITouchBarInput, aChildren: *const nsIArray) -> ::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 nsITouchBarInput {
/// `readonly attribute AString key;`
#[inline]
pub unsafe fn GetKey(&self, aKey: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).GetKey)(self, aKey)
}
/// ```text
/// /**
/// * The lookup key for the button's localized text title.
/// */
/// ```
///
/// `attribute AString title;`
#[inline]
pub unsafe fn GetTitle(&self, aTitle: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).GetTitle)(self, aTitle)
}
/// ```text
/// /**
/// * The lookup key for the button's localized text title.
/// */
/// ```
///
/// `attribute AString title;`
#[inline]
pub unsafe fn SetTitle(&self, aTitle: *const ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).SetTitle)(self, aTitle)
}
/// ```text
/// /**
/// * The URI of an icon file.
/// */
/// ```
///
/// `attribute nsIURI image;`
#[inline]
pub unsafe fn GetImage(&self, aImage: *mut *const nsIURI) -> ::nserror::nsresult {
((*self.vtable).GetImage)(self, aImage)
}
/// ```text
/// /**
/// * The URI of an icon file.
/// */
/// ```
///
/// `attribute nsIURI image;`
#[inline]
pub unsafe fn SetImage(&self, aImage: *const nsIURI) -> ::nserror::nsresult {
((*self.vtable).SetImage)(self, aImage)
}
/// ```text
/// /**
/// * The type of the input.
/// * Takes one of:
/// * `button`:
/// * A standard button.
/// * If an image is available, only the image is displayed.
/// * `mainButton`:
/// * An extra-wide button. Displays both the image and title.
/// * `scrubber`:
/// * A Scrubber element. Not yet implemented, except in the case of Apple's
/// * pre-built Share scrubber.
/// * `popover`:
/// * An element that displays a new instance of nsTouchBar when tapped.
/// * The elements in the new Touch Bar should be defined in the
/// * input's `children` property.
/// * `label`:
/// * A text label.
/// * `scrollView`:
/// * Contains several buttons, defined in the input's `children` property.
/// * The user can scroll through the buttons.
/// */
/// ```
///
/// `attribute AString type;`
#[inline]
pub unsafe fn GetType(&self, aType: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).GetType)(self, aType)
}
/// ```text
/// /**
/// * The type of the input.
/// * Takes one of:
/// * `button`:
/// * A standard button.
/// * If an image is available, only the image is displayed.
/// * `mainButton`:
/// * An extra-wide button. Displays both the image and title.
/// * `scrubber`:
/// * A Scrubber element. Not yet implemented, except in the case of Apple's
/// * pre-built Share scrubber.
/// * `popover`:
/// * An element that displays a new instance of nsTouchBar when tapped.
/// * The elements in the new Touch Bar should be defined in the
/// * input's `children` property.
/// * `label`:
/// * A text label.
/// * `scrollView`:
/// * Contains several buttons, defined in the input's `children` property.
/// * The user can scroll through the buttons.
/// */
/// ```
///
/// `attribute AString type;`
#[inline]
pub unsafe fn SetType(&self, aType: *const ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).SetType)(self, aType)
}
/// ```text
/// /**
/// * A callback function to be invoked when an element is touched.
/// */
/// ```
///
/// `attribute nsITouchBarInputCallback callback;`
#[inline]
pub unsafe fn GetCallback(&self, aCallback: *mut *const nsITouchBarInputCallback) -> ::nserror::nsresult {
((*self.vtable).GetCallback)(self, aCallback)
}
/// ```text
/// /**
/// * A callback function to be invoked when an element is touched.
/// */
/// ```
///
/// `attribute nsITouchBarInputCallback callback;`
#[inline]
pub unsafe fn SetCallback(&self, aCallback: *const nsITouchBarInputCallback) -> ::nserror::nsresult {
((*self.vtable).SetCallback)(self, aCallback)
}
/// ```text
/// /**
/// * A hexadecimal uint32_t specifying the input's
/// * background color. If omitted, the default background color is used.
/// */
/// ```
///
/// `attribute uint32_t color;`
#[inline]
pub unsafe fn GetColor(&self, aColor: *mut u32) -> ::nserror::nsresult {
((*self.vtable).GetColor)(self, aColor)
}
/// ```text
/// /**
/// * A hexadecimal uint32_t specifying the input's
/// * background color. If omitted, the default background color is used.
/// */
/// ```
///
/// `attribute uint32_t color;`
#[inline]
pub unsafe fn SetColor(&self, aColor: u32) -> ::nserror::nsresult {
((*self.vtable).SetColor)(self, aColor)
}
/// ```text
/// /**
/// * If `true`, the Touch Bar input is greyed out and inoperable.
/// */
/// ```
///
/// `attribute boolean disabled;`
#[inline]
pub unsafe fn GetDisabled(&self, aDisabled: *mut bool) -> ::nserror::nsresult {
((*self.vtable).GetDisabled)(self, aDisabled)
}
/// ```text
/// /**
/// * If `true`, the Touch Bar input is greyed out and inoperable.
/// */
/// ```
///
/// `attribute boolean disabled;`
#[inline]
pub unsafe fn SetDisabled(&self, aDisabled: bool) -> ::nserror::nsresult {
((*self.vtable).SetDisabled)(self, aDisabled)
}
/// ```text
/// /**
/// * An array containing an input's children.
/// * Available for type = ("scrollView" || "popover").
/// */
/// ```
///
/// `attribute nsIArray children;`
#[inline]
pub unsafe fn GetChildren(&self, aChildren: *mut *const nsIArray) -> ::nserror::nsresult {
((*self.vtable).GetChildren)(self, aChildren)
}
/// ```text
/// /**
/// * An array containing an input's children.
/// * Available for type = ("scrollView" || "popover").
/// */
/// ```
///
/// `attribute nsIArray children;`
#[inline]
pub unsafe fn SetChildren(&self, aChildren: *const nsIArray) -> ::nserror::nsresult {
((*self.vtable).SetChildren)(self, aChildren)
}
}