gtk4/auto/app_chooser.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#![allow(deprecated)]
5
6use crate::{ffi, Accessible, Buildable, ConstraintTarget, Widget};
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10 /// The application selection widgets should be
11 /// implemented according to the design of each platform and/or
12 /// application requiring them.
13 /// [`AppChooser`][crate::AppChooser] is an interface for widgets which allow the user to
14 /// choose an application.
15 ///
16 /// The main objects that implement this interface are
17 /// [`AppChooserWidget`][crate::AppChooserWidget],
18 /// [`AppChooserDialog`][crate::AppChooserDialog] and [`AppChooserButton`][crate::AppChooserButton].
19 ///
20 /// Applications are represented by GIO `GAppInfo` objects here.
21 /// GIO has a concept of recommended and fallback applications for a
22 /// given content type. Recommended applications are those that claim
23 /// to handle the content type itself, while fallback also includes
24 /// applications that handle a more generic content type. GIO also
25 /// knows the default and last-used application for a given content
26 /// type. The [`AppChooserWidget`][crate::AppChooserWidget] provides detailed control over
27 /// whether the shown list of applications should include default,
28 /// recommended or fallback applications.
29 ///
30 /// To obtain the application that has been selected in a [`AppChooser`][crate::AppChooser],
31 /// use [`AppChooserExt::app_info()`][crate::prelude::AppChooserExt::app_info()].
32 ///
33 /// ## Properties
34 ///
35 ///
36 /// #### `content-type`
37 /// The content type of the [`AppChooser`][crate::AppChooser] object.
38 ///
39 /// See `GContentType` for more information about content types.
40 ///
41 /// Readable | Writeable | Construct Only
42 /// <details><summary><h4>Widget</h4></summary>
43 ///
44 ///
45 /// #### `can-focus`
46 /// Whether the widget or any of its descendents can accept
47 /// the input focus.
48 ///
49 /// This property is meant to be set by widget implementations,
50 /// typically in their instance init function.
51 ///
52 /// Readable | Writeable
53 ///
54 ///
55 /// #### `can-target`
56 /// Whether the widget can receive pointer events.
57 ///
58 /// Readable | Writeable
59 ///
60 ///
61 /// #### `css-classes`
62 /// A list of css classes applied to this widget.
63 ///
64 /// Readable | Writeable
65 ///
66 ///
67 /// #### `css-name`
68 /// The name of this widget in the CSS tree.
69 ///
70 /// This property is meant to be set by widget implementations,
71 /// typically in their instance init function.
72 ///
73 /// Readable | Writeable | Construct Only
74 ///
75 ///
76 /// #### `cursor`
77 /// The cursor used by @widget.
78 ///
79 /// Readable | Writeable
80 ///
81 ///
82 /// #### `focus-on-click`
83 /// Whether the widget should grab focus when it is clicked with the mouse.
84 ///
85 /// This property is only relevant for widgets that can take focus.
86 ///
87 /// Readable | Writeable
88 ///
89 ///
90 /// #### `focusable`
91 /// Whether this widget itself will accept the input focus.
92 ///
93 /// Readable | Writeable
94 ///
95 ///
96 /// #### `halign`
97 /// How to distribute horizontal space if widget gets extra space.
98 ///
99 /// Readable | Writeable
100 ///
101 ///
102 /// #### `has-default`
103 /// Whether the widget is the default widget.
104 ///
105 /// Readable
106 ///
107 ///
108 /// #### `has-focus`
109 /// Whether the widget has the input focus.
110 ///
111 /// Readable
112 ///
113 ///
114 /// #### `has-tooltip`
115 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
116 /// signal on @widget.
117 ///
118 /// A true value indicates that @widget can have a tooltip, in this case
119 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
120 /// determine whether it will provide a tooltip or not.
121 ///
122 /// Readable | Writeable
123 ///
124 ///
125 /// #### `height-request`
126 /// Overrides for height request of the widget.
127 ///
128 /// If this is -1, the natural request will be used.
129 ///
130 /// Readable | Writeable
131 ///
132 ///
133 /// #### `hexpand`
134 /// Whether to expand horizontally.
135 ///
136 /// Readable | Writeable
137 ///
138 ///
139 /// #### `hexpand-set`
140 /// Whether to use the `hexpand` property.
141 ///
142 /// Readable | Writeable
143 ///
144 ///
145 /// #### `layout-manager`
146 /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
147 /// the preferred size of the widget, and allocate its children.
148 ///
149 /// This property is meant to be set by widget implementations,
150 /// typically in their instance init function.
151 ///
152 /// Readable | Writeable
153 ///
154 ///
155 /// #### `limit-events`
156 /// Makes this widget act like a modal dialog, with respect to
157 /// event delivery.
158 ///
159 /// Global event controllers will not handle events with targets
160 /// inside the widget, unless they are set up to ignore propagation
161 /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
162 ///
163 /// Readable | Writeable
164 ///
165 ///
166 /// #### `margin-bottom`
167 /// Margin on bottom side of widget.
168 ///
169 /// This property adds margin outside of the widget's normal size
170 /// request, the margin will be added in addition to the size from
171 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
172 ///
173 /// Readable | Writeable
174 ///
175 ///
176 /// #### `margin-end`
177 /// Margin on end of widget, horizontally.
178 ///
179 /// This property supports left-to-right and right-to-left text
180 /// directions.
181 ///
182 /// This property adds margin outside of the widget's normal size
183 /// request, the margin will be added in addition to the size from
184 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
185 ///
186 /// Readable | Writeable
187 ///
188 ///
189 /// #### `margin-start`
190 /// Margin on start of widget, horizontally.
191 ///
192 /// This property supports left-to-right and right-to-left text
193 /// directions.
194 ///
195 /// This property adds margin outside of the widget's normal size
196 /// request, the margin will be added in addition to the size from
197 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
198 ///
199 /// Readable | Writeable
200 ///
201 ///
202 /// #### `margin-top`
203 /// Margin on top side of widget.
204 ///
205 /// This property adds margin outside of the widget's normal size
206 /// request, the margin will be added in addition to the size from
207 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
208 ///
209 /// Readable | Writeable
210 ///
211 ///
212 /// #### `name`
213 /// The name of the widget.
214 ///
215 /// Readable | Writeable
216 ///
217 ///
218 /// #### `opacity`
219 /// The requested opacity of the widget.
220 ///
221 /// Readable | Writeable
222 ///
223 ///
224 /// #### `overflow`
225 /// How content outside the widget's content area is treated.
226 ///
227 /// This property is meant to be set by widget implementations,
228 /// typically in their instance init function.
229 ///
230 /// Readable | Writeable
231 ///
232 ///
233 /// #### `parent`
234 /// The parent widget of this widget.
235 ///
236 /// Readable
237 ///
238 ///
239 /// #### `receives-default`
240 /// Whether the widget will receive the default action when it is focused.
241 ///
242 /// Readable | Writeable
243 ///
244 ///
245 /// #### `root`
246 /// The [`Root`][crate::Root] widget of the widget tree containing this widget.
247 ///
248 /// This will be `NULL` if the widget is not contained in a root widget.
249 ///
250 /// Readable
251 ///
252 ///
253 /// #### `scale-factor`
254 /// The scale factor of the widget.
255 ///
256 /// Readable
257 ///
258 ///
259 /// #### `sensitive`
260 /// Whether the widget responds to input.
261 ///
262 /// Readable | Writeable
263 ///
264 ///
265 /// #### `tooltip-markup`
266 /// Sets the text of tooltip to be the given string, which is marked up
267 /// with Pango markup.
268 ///
269 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
270 ///
271 /// This is a convenience property which will take care of getting the
272 /// tooltip shown if the given string is not `NULL`:
273 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
274 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
275 /// the default signal handler.
276 ///
277 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
278 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
279 ///
280 /// Readable | Writeable
281 ///
282 ///
283 /// #### `tooltip-text`
284 /// Sets the text of tooltip to be the given string.
285 ///
286 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
287 ///
288 /// This is a convenience property which will take care of getting the
289 /// tooltip shown if the given string is not `NULL`:
290 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
291 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
292 /// the default signal handler.
293 ///
294 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
295 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
296 ///
297 /// Readable | Writeable
298 ///
299 ///
300 /// #### `valign`
301 /// How to distribute vertical space if widget gets extra space.
302 ///
303 /// Readable | Writeable
304 ///
305 ///
306 /// #### `vexpand`
307 /// Whether to expand vertically.
308 ///
309 /// Readable | Writeable
310 ///
311 ///
312 /// #### `vexpand-set`
313 /// Whether to use the `vexpand` property.
314 ///
315 /// Readable | Writeable
316 ///
317 ///
318 /// #### `visible`
319 /// Whether the widget is visible.
320 ///
321 /// Readable | Writeable
322 ///
323 ///
324 /// #### `width-request`
325 /// Overrides for width request of the widget.
326 ///
327 /// If this is -1, the natural request will be used.
328 ///
329 /// Readable | Writeable
330 /// </details>
331 /// <details><summary><h4>Accessible</h4></summary>
332 ///
333 ///
334 /// #### `accessible-role`
335 /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
336 ///
337 /// The accessible role cannot be changed once set.
338 ///
339 /// Readable | Writeable
340 /// </details>
341 ///
342 /// # Implements
343 ///
344 /// [`AppChooserExt`][trait@crate::prelude::AppChooserExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual]
345 #[doc(alias = "GtkAppChooser")]
346 pub struct AppChooser(Interface<ffi::GtkAppChooser>) @requires Widget, Accessible, Buildable, ConstraintTarget;
347
348 match fn {
349 type_ => || ffi::gtk_app_chooser_get_type(),
350 }
351}
352
353impl AppChooser {
354 pub const NONE: Option<&'static AppChooser> = None;
355}
356
357mod sealed {
358 pub trait Sealed {}
359 impl<T: super::IsA<super::AppChooser>> Sealed for T {}
360}
361
362/// Trait containing all [`struct@AppChooser`] methods.
363///
364/// # Implementors
365///
366/// [`AppChooserButton`][struct@crate::AppChooserButton], [`AppChooserDialog`][struct@crate::AppChooserDialog], [`AppChooserWidget`][struct@crate::AppChooserWidget], [`AppChooser`][struct@crate::AppChooser]
367pub trait AppChooserExt: IsA<AppChooser> + sealed::Sealed + 'static {
368 /// Returns the currently selected application.
369 ///
370 /// # Deprecated since 4.10
371 ///
372 /// This widget will be removed in GTK 5
373 ///
374 /// # Returns
375 ///
376 /// a `GAppInfo` for the
377 /// currently selected application
378 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
379 #[allow(deprecated)]
380 #[doc(alias = "gtk_app_chooser_get_app_info")]
381 #[doc(alias = "get_app_info")]
382 fn app_info(&self) -> Option<gio::AppInfo> {
383 unsafe {
384 from_glib_full(ffi::gtk_app_chooser_get_app_info(
385 self.as_ref().to_glib_none().0,
386 ))
387 }
388 }
389
390 /// Returns the content type for which the [`AppChooser`][crate::AppChooser]
391 /// shows applications.
392 ///
393 /// # Deprecated since 4.10
394 ///
395 /// This widget will be removed in GTK 5
396 ///
397 /// # Returns
398 ///
399 /// the content type of @self. Free with g_free()
400 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
401 #[allow(deprecated)]
402 #[doc(alias = "gtk_app_chooser_get_content_type")]
403 #[doc(alias = "get_content_type")]
404 #[doc(alias = "content-type")]
405 fn content_type(&self) -> glib::GString {
406 unsafe {
407 from_glib_full(ffi::gtk_app_chooser_get_content_type(
408 self.as_ref().to_glib_none().0,
409 ))
410 }
411 }
412
413 /// Reloads the list of applications.
414 ///
415 /// # Deprecated since 4.10
416 ///
417 /// This widget will be removed in GTK 5
418 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
419 #[allow(deprecated)]
420 #[doc(alias = "gtk_app_chooser_refresh")]
421 fn refresh(&self) {
422 unsafe {
423 ffi::gtk_app_chooser_refresh(self.as_ref().to_glib_none().0);
424 }
425 }
426}
427
428impl<O: IsA<AppChooser>> AppChooserExt for O {}