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