1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT
use crate::{ffi, NavigationCommand};
use glib::{prelude::*, translate::*};
glib::wrapper! {
/// The Navigation interface is used for creating and injecting navigation
/// related events such as mouse button presses, cursor motion and key presses.
/// The associated library also provides methods for parsing received events, and
/// for sending and receiving navigation related bus events. One main usecase is
/// DVD menu navigation.
///
/// The main parts of the API are:
///
/// * The GstNavigation interface, implemented by elements which provide an
/// application with the ability to create and inject navigation events into
/// the pipeline.
/// * GstNavigation event handling API. GstNavigation events are created in
/// response to calls on a GstNavigation interface implementation, and sent in
/// the pipeline. Upstream elements can use the navigation event API functions
/// to parse the contents of received messages.
///
/// * GstNavigation message handling API. GstNavigation messages may be sent on
/// the message bus to inform applications of navigation related changes in the
/// pipeline, such as the mouse moving over a clickable region, or the set of
/// available angles changing.
///
/// The GstNavigation message functions provide functions for creating and
/// parsing custom bus messages for signaling GstNavigation changes.
///
/// # Implements
///
/// [`NavigationExt`][trait@crate::prelude::NavigationExt]
#[doc(alias = "GstNavigation")]
pub struct Navigation(Interface<ffi::GstNavigation, ffi::GstNavigationInterface>);
match fn {
type_ => || ffi::gst_navigation_get_type(),
}
}
impl Navigation {
pub const NONE: Option<&'static Navigation> = None;
//#[doc(alias = "gst_navigation_query_set_commands")]
//pub fn query_set_commands(query: &gst::Query, n_cmds: i32, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) {
// unsafe { TODO: call ffi:gst_navigation_query_set_commands() }
//}
//#[doc(alias = "gst_navigation_query_set_commandsv")]
//pub fn query_set_commandsv(query: &gst::Query, cmds: /*Unimplemented*/&CArray TypeId { ns_id: 1, id: 8 }) {
// unsafe { TODO: call ffi:gst_navigation_query_set_commandsv() }
//}
}
unsafe impl Send for Navigation {}
unsafe impl Sync for Navigation {}
mod sealed {
pub trait Sealed {}
impl<T: super::IsA<super::Navigation>> Sealed for T {}
}
/// Trait containing all [`struct@Navigation`] methods.
///
/// # Implementors
///
/// [`Navigation`][struct@crate::Navigation]
pub trait NavigationExt: IsA<Navigation> + sealed::Sealed + 'static {
/// Sends the indicated command to the navigation interface.
/// ## `command`
/// The command to issue
#[doc(alias = "gst_navigation_send_command")]
fn send_command(&self, command: NavigationCommand) {
unsafe {
ffi::gst_navigation_send_command(self.as_ref().to_glib_none().0, command.into_glib());
}
}
#[doc(alias = "gst_navigation_send_event")]
fn send_event(&self, structure: gst::Structure) {
unsafe {
ffi::gst_navigation_send_event(
self.as_ref().to_glib_none().0,
structure.into_glib_ptr(),
);
}
}
/// Sends an event to the navigation interface.
/// ## `event`
/// The event to send
#[cfg(feature = "v1_22")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
#[doc(alias = "gst_navigation_send_event_simple")]
fn send_event_simple(&self, event: gst::Event) {
unsafe {
ffi::gst_navigation_send_event_simple(
self.as_ref().to_glib_none().0,
event.into_glib_ptr(),
);
}
}
/// ## `event`
/// The type of the key event. Recognised values are "key-press" and
/// "key-release"
/// ## `key`
/// Character representation of the key. This is typically as produced
/// by XKeysymToString.
#[doc(alias = "gst_navigation_send_key_event")]
fn send_key_event(&self, event: &str, key: &str) {
unsafe {
ffi::gst_navigation_send_key_event(
self.as_ref().to_glib_none().0,
event.to_glib_none().0,
key.to_glib_none().0,
);
}
}
/// Sends a mouse event to the navigation interface. Mouse event coordinates
/// are sent relative to the display space of the related output area. This is
/// usually the size in pixels of the window associated with the element
/// implementing the [`Navigation`][crate::Navigation] interface.
/// ## `event`
/// The type of mouse event, as a text string. Recognised values are
/// "mouse-button-press", "mouse-button-release", "mouse-move" and "mouse-double-click".
/// ## `button`
/// The button number of the button being pressed or released. Pass 0
/// for mouse-move events.
/// ## `x`
/// The x coordinate of the mouse event.
/// ## `y`
/// The y coordinate of the mouse event.
#[doc(alias = "gst_navigation_send_mouse_event")]
fn send_mouse_event(&self, event: &str, button: i32, x: f64, y: f64) {
unsafe {
ffi::gst_navigation_send_mouse_event(
self.as_ref().to_glib_none().0,
event.to_glib_none().0,
button,
x,
y,
);
}
}
/// Sends a mouse scroll event to the navigation interface. Mouse event coordinates
/// are sent relative to the display space of the related output area. This is
/// usually the size in pixels of the window associated with the element
/// implementing the [`Navigation`][crate::Navigation] interface.
/// ## `x`
/// The x coordinate of the mouse event.
/// ## `y`
/// The y coordinate of the mouse event.
/// ## `delta_x`
/// The delta_x coordinate of the mouse event.
/// ## `delta_y`
/// The delta_y coordinate of the mouse event.
#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
#[doc(alias = "gst_navigation_send_mouse_scroll_event")]
fn send_mouse_scroll_event(&self, x: f64, y: f64, delta_x: f64, delta_y: f64) {
unsafe {
ffi::gst_navigation_send_mouse_scroll_event(
self.as_ref().to_glib_none().0,
x,
y,
delta_x,
delta_y,
);
}
}
}
impl<O: IsA<Navigation>> NavigationExt for O {}