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
62/// Trait containing all [`struct@Navigation`] methods.
63///
64/// # Implementors
65///
66/// [`Navigation`][struct@crate::Navigation]
67pub trait NavigationExt: IsA<Navigation> + 'static {
68 /// Sends the indicated command to the navigation interface.
69 /// ## `command`
70 /// The command to issue
71 #[doc(alias = "gst_navigation_send_command")]
72 fn send_command(&self, command: NavigationCommand) {
73 unsafe {
74 ffi::gst_navigation_send_command(self.as_ref().to_glib_none().0, command.into_glib());
75 }
76 }
77
78 #[doc(alias = "gst_navigation_send_event")]
79 fn send_event(&self, structure: gst::Structure) {
80 unsafe {
81 ffi::gst_navigation_send_event(
82 self.as_ref().to_glib_none().0,
83 structure.into_glib_ptr(),
84 );
85 }
86 }
87
88 /// Sends an event to the navigation interface.
89 /// ## `event`
90 /// The event to send
91 #[cfg(feature = "v1_22")]
92 #[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
93 #[doc(alias = "gst_navigation_send_event_simple")]
94 fn send_event_simple(&self, event: gst::Event) {
95 unsafe {
96 ffi::gst_navigation_send_event_simple(
97 self.as_ref().to_glib_none().0,
98 event.into_glib_ptr(),
99 );
100 }
101 }
102
103 /// ## `event`
104 /// The type of the key event. Recognised values are "key-press" and
105 /// "key-release"
106 /// ## `key`
107 /// Character representation of the key. This is typically as produced
108 /// by XKeysymToString.
109 #[doc(alias = "gst_navigation_send_key_event")]
110 fn send_key_event(&self, event: &str, key: &str) {
111 unsafe {
112 ffi::gst_navigation_send_key_event(
113 self.as_ref().to_glib_none().0,
114 event.to_glib_none().0,
115 key.to_glib_none().0,
116 );
117 }
118 }
119
120 /// Sends a mouse event to the navigation interface. Mouse event coordinates
121 /// are sent relative to the display space of the related output area. This is
122 /// usually the size in pixels of the window associated with the element
123 /// implementing the [`Navigation`][crate::Navigation] interface.
124 /// ## `event`
125 /// The type of mouse event, as a text string. Recognised values are
126 /// "mouse-button-press", "mouse-button-release", "mouse-move" and "mouse-double-click".
127 /// ## `button`
128 /// The button number of the button being pressed or released. Pass 0
129 /// for mouse-move events.
130 /// ## `x`
131 /// The x coordinate of the mouse event.
132 /// ## `y`
133 /// The y coordinate of the mouse event.
134 #[doc(alias = "gst_navigation_send_mouse_event")]
135 fn send_mouse_event(&self, event: &str, button: i32, x: f64, y: f64) {
136 unsafe {
137 ffi::gst_navigation_send_mouse_event(
138 self.as_ref().to_glib_none().0,
139 event.to_glib_none().0,
140 button,
141 x,
142 y,
143 );
144 }
145 }
146
147 /// Sends a mouse scroll event to the navigation interface. Mouse event coordinates
148 /// are sent relative to the display space of the related output area. This is
149 /// usually the size in pixels of the window associated with the element
150 /// implementing the [`Navigation`][crate::Navigation] interface.
151 /// ## `x`
152 /// The x coordinate of the mouse event.
153 /// ## `y`
154 /// The y coordinate of the mouse event.
155 /// ## `delta_x`
156 /// The delta_x coordinate of the mouse event.
157 /// ## `delta_y`
158 /// The delta_y coordinate of the mouse event.
159 #[cfg(feature = "v1_18")]
160 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
161 #[doc(alias = "gst_navigation_send_mouse_scroll_event")]
162 fn send_mouse_scroll_event(&self, x: f64, y: f64, delta_x: f64, delta_y: f64) {
163 unsafe {
164 ffi::gst_navigation_send_mouse_scroll_event(
165 self.as_ref().to_glib_none().0,
166 x,
167 y,
168 delta_x,
169 delta_y,
170 );
171 }
172 }
173}
174
175impl<O: IsA<Navigation>> NavigationExt for O {}