atk/auto/streamable_content.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// DO NOT EDIT
4
5use crate::ffi;
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9 /// The ATK interface which provides access to streamable content.
10 ///
11 /// An interface whereby an object allows its backing content to be
12 /// streamed to clients. Typical implementors would be images or
13 /// icons, HTML content, or multimedia display/rendering widgets.
14 ///
15 /// Negotiation of content type is allowed. Clients may examine the
16 /// backing data and transform, convert, or parse the content in order
17 /// to present it in an alternate form to end-users.
18 ///
19 /// The AtkStreamableContent interface is particularly useful for
20 /// saving, printing, or post-processing entire documents, or for
21 /// persisting alternate views of a document. If document content
22 /// itself is being serialized, stored, or converted, then use of the
23 /// AtkStreamableContent interface can help address performance
24 /// issues. Unlike most ATK interfaces, this interface is not strongly
25 /// tied to the current user-agent view of the a particular document,
26 /// but may in some cases give access to the underlying model data.
27 ///
28 /// # Implements
29 ///
30 /// [`StreamableContentExt`][trait@crate::prelude::StreamableContentExt]
31 #[doc(alias = "AtkStreamableContent")]
32 pub struct StreamableContent(Interface<ffi::AtkStreamableContent, ffi::AtkStreamableContentIface>);
33
34 match fn {
35 type_ => || ffi::atk_streamable_content_get_type(),
36 }
37}
38
39impl StreamableContent {
40 pub const NONE: Option<&'static StreamableContent> = None;
41}
42
43/// Trait containing all [`struct@StreamableContent`] methods.
44///
45/// # Implementors
46///
47/// [`StreamableContent`][struct@crate::StreamableContent]
48pub trait StreamableContentExt: IsA<StreamableContent> + 'static {
49 /// Gets the character string of the specified mime type. The first mime
50 /// type is at position 0, the second at position 1, and so on.
51 /// ## `i`
52 /// a gint representing the position of the mime type starting from 0
53 ///
54 /// # Returns
55 ///
56 /// a gchar* representing the specified mime type; the caller
57 /// should not free the character string.
58 #[doc(alias = "atk_streamable_content_get_mime_type")]
59 #[doc(alias = "get_mime_type")]
60 fn mime_type(&self, i: i32) -> Option<glib::GString> {
61 unsafe {
62 from_glib_none(ffi::atk_streamable_content_get_mime_type(
63 self.as_ref().to_glib_none().0,
64 i,
65 ))
66 }
67 }
68
69 /// Gets the number of mime types supported by this object.
70 ///
71 /// # Returns
72 ///
73 /// a gint which is the number of mime types supported by the object.
74 #[doc(alias = "atk_streamable_content_get_n_mime_types")]
75 #[doc(alias = "get_n_mime_types")]
76 fn n_mime_types(&self) -> i32 {
77 unsafe { ffi::atk_streamable_content_get_n_mime_types(self.as_ref().to_glib_none().0) }
78 }
79
80 //#[doc(alias = "atk_streamable_content_get_stream")]
81 //#[doc(alias = "get_stream")]
82 //fn stream(&self, mime_type: &str) -> /*Ignored*/Option<glib::IOChannel> {
83 // unsafe { TODO: call ffi:atk_streamable_content_get_stream() }
84 //}
85
86 /// Get a string representing a URI in IETF standard format
87 /// (see http://www.ietf.org/rfc/rfc2396.txt) from which the object's content
88 /// may be streamed in the specified mime-type, if one is available.
89 /// If mime_type is NULL, the URI for the default (and possibly only) mime-type is
90 /// returned.
91 ///
92 /// Note that it is possible for get_uri to return NULL but for
93 /// get_stream to work nonetheless, since not all GIOChannels connect to URIs.
94 /// ## `mime_type`
95 /// a gchar* representing the mime type, or NULL to request a URI
96 /// for the default mime type.
97 ///
98 /// # Returns
99 ///
100 /// Returns a string representing a URI, or [`None`]
101 /// if no corresponding URI can be constructed.
102 #[doc(alias = "atk_streamable_content_get_uri")]
103 #[doc(alias = "get_uri")]
104 fn uri(&self, mime_type: &str) -> Option<glib::GString> {
105 unsafe {
106 from_glib_none(ffi::atk_streamable_content_get_uri(
107 self.as_ref().to_glib_none().0,
108 mime_type.to_glib_none().0,
109 ))
110 }
111 }
112}
113
114impl<O: IsA<StreamableContent>> StreamableContentExt for O {}