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