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 glib::{prelude::*, translate::*};
6use std::fmt;
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
43mod sealed {
44 pub trait Sealed {}
45 impl<T: super::IsA<super::StreamableContent>> Sealed for T {}
46}
47
48/// Trait containing all [`struct@StreamableContent`] methods.
49///
50/// # Implementors
51///
52/// [`StreamableContent`][struct@crate::StreamableContent]
53pub trait StreamableContentExt: IsA<StreamableContent> + sealed::Sealed + 'static {
54 /// Gets the character string of the specified mime type. The first mime
55 /// type is at position 0, the second at position 1, and so on.
56 /// ## `i`
57 /// a gint representing the position of the mime type starting from 0
58 ///
59 /// # Returns
60 ///
61 /// a gchar* representing the specified mime type; the caller
62 /// should not free the character string.
63 #[doc(alias = "atk_streamable_content_get_mime_type")]
64 #[doc(alias = "get_mime_type")]
65 fn mime_type(&self, i: i32) -> Option<glib::GString> {
66 unsafe {
67 from_glib_none(ffi::atk_streamable_content_get_mime_type(
68 self.as_ref().to_glib_none().0,
69 i,
70 ))
71 }
72 }
73
74 /// Gets the number of mime types supported by this object.
75 ///
76 /// # Returns
77 ///
78 /// a gint which is the number of mime types supported by the object.
79 #[doc(alias = "atk_streamable_content_get_n_mime_types")]
80 #[doc(alias = "get_n_mime_types")]
81 fn n_mime_types(&self) -> i32 {
82 unsafe { ffi::atk_streamable_content_get_n_mime_types(self.as_ref().to_glib_none().0) }
83 }
84
85 //#[doc(alias = "atk_streamable_content_get_stream")]
86 //#[doc(alias = "get_stream")]
87 //fn stream(&self, mime_type: &str) -> /*Ignored*/Option<glib::IOChannel> {
88 // unsafe { TODO: call ffi:atk_streamable_content_get_stream() }
89 //}
90
91 /// Get a string representing a URI in IETF standard format
92 /// (see http://www.ietf.org/rfc/rfc2396.txt) from which the object's content
93 /// may be streamed in the specified mime-type, if one is available.
94 /// If mime_type is NULL, the URI for the default (and possibly only) mime-type is
95 /// returned.
96 ///
97 /// Note that it is possible for get_uri to return NULL but for
98 /// get_stream to work nonetheless, since not all GIOChannels connect to URIs.
99 /// ## `mime_type`
100 /// a gchar* representing the mime type, or NULL to request a URI
101 /// for the default mime type.
102 ///
103 /// # Returns
104 ///
105 /// Returns a string representing a URI, or [`None`]
106 /// if no corresponding URI can be constructed.
107 #[doc(alias = "atk_streamable_content_get_uri")]
108 #[doc(alias = "get_uri")]
109 fn uri(&self, mime_type: &str) -> Option<glib::GString> {
110 unsafe {
111 from_glib_none(ffi::atk_streamable_content_get_uri(
112 self.as_ref().to_glib_none().0,
113 mime_type.to_glib_none().0,
114 ))
115 }
116 }
117}
118
119impl<O: IsA<StreamableContent>> StreamableContentExt for O {}
120
121impl fmt::Display for StreamableContent {
122 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
123 f.write_str("StreamableContent")
124 }
125}