Skip to main content

gtk/auto/
link_button.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::{
6    Actionable, Align, Bin, Buildable, Button, Container, PositionType, ReliefStyle, ResizeMode,
7    Widget, ffi,
8};
9use glib::{
10    object::ObjectType as _,
11    prelude::*,
12    signal::{SignalHandlerId, connect_raw},
13    translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18    /// A GtkLinkButton is a [`Button`][crate::Button] with a hyperlink, similar to the one
19    /// used by web browsers, which triggers an action when clicked. It is useful
20    /// to show quick links to resources.
21    ///
22    /// A link button is created by calling either [`new()`][Self::new()] or
23    /// [`with_label()`][Self::with_label()]. If using the former, the URI you pass
24    /// to the constructor is used as a label for the widget.
25    ///
26    /// The URI bound to a GtkLinkButton can be set specifically using
27    /// [`LinkButtonExt::set_uri()`][crate::prelude::LinkButtonExt::set_uri()], and retrieved using [`LinkButtonExt::uri()`][crate::prelude::LinkButtonExt::uri()].
28    ///
29    /// By default, GtkLinkButton calls [`show_uri_on_window()`][crate::show_uri_on_window()] when the button is
30    /// clicked. This behaviour can be overridden by connecting to the
31    /// [`activate-link`][struct@crate::LinkButton#activate-link] signal and returning [`true`] from the
32    /// signal handler.
33    ///
34    /// # CSS nodes
35    ///
36    /// GtkLinkButton has a single CSS node with name button. To differentiate
37    /// it from a plain [`Button`][crate::Button], it gets the .link style class.
38    ///
39    /// ## Properties
40    ///
41    ///
42    /// #### `uri`
43    ///  The URI bound to this button.
44    ///
45    /// Readable | Writable
46    ///
47    ///
48    /// #### `visited`
49    ///  The 'visited' state of this button. A visited link is drawn in a
50    /// different color.
51    ///
52    /// Readable | Writable
53    /// <details><summary><h4>Button</h4></summary>
54    ///
55    ///
56    /// #### `always-show-image`
57    ///  If [`true`], the button will ignore the [`gtk-button-images`][struct@crate::Settings#gtk-button-images]
58    /// setting and always show the image, if available.
59    ///
60    /// Use this property if the button would be useless or hard to use
61    /// without the image.
62    ///
63    /// Readable | Writable | Construct
64    ///
65    ///
66    /// #### `image`
67    ///  The child widget to appear next to the button text.
68    ///
69    /// Readable | Writable
70    ///
71    ///
72    /// #### `image-position`
73    ///  The position of the image relative to the text inside the button.
74    ///
75    /// Readable | Writable
76    ///
77    ///
78    /// #### `label`
79    ///  Readable | Writable | Construct
80    ///
81    ///
82    /// #### `relief`
83    ///  Readable | Writable
84    ///
85    ///
86    /// #### `use-stock`
87    ///  Readable | Writable | Construct
88    ///
89    ///
90    /// #### `use-underline`
91    ///  Readable | Writable | Construct
92    ///
93    ///
94    /// #### `xalign`
95    ///  If the child of the button is a [`Misc`][crate::Misc] or `GtkAlignment`, this property
96    /// can be used to control its horizontal alignment. 0.0 is left aligned,
97    /// 1.0 is right aligned.
98    ///
99    /// Readable | Writable
100    ///
101    ///
102    /// #### `yalign`
103    ///  If the child of the button is a [`Misc`][crate::Misc] or `GtkAlignment`, this property
104    /// can be used to control its vertical alignment. 0.0 is top aligned,
105    /// 1.0 is bottom aligned.
106    ///
107    /// Readable | Writable
108    /// </details>
109    /// <details><summary><h4>Container</h4></summary>
110    ///
111    ///
112    /// #### `border-width`
113    ///  Readable | Writable
114    ///
115    ///
116    /// #### `child`
117    ///  Writable
118    ///
119    ///
120    /// #### `resize-mode`
121    ///  Readable | Writable
122    /// </details>
123    /// <details><summary><h4>Widget</h4></summary>
124    ///
125    ///
126    /// #### `app-paintable`
127    ///  Readable | Writable
128    ///
129    ///
130    /// #### `can-default`
131    ///  Readable | Writable
132    ///
133    ///
134    /// #### `can-focus`
135    ///  Readable | Writable
136    ///
137    ///
138    /// #### `composite-child`
139    ///  Readable
140    ///
141    ///
142    /// #### `double-buffered`
143    ///  Whether the widget is double buffered.
144    ///
145    /// Readable | Writable
146    ///
147    ///
148    /// #### `events`
149    ///  Readable | Writable
150    ///
151    ///
152    /// #### `expand`
153    ///  Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
154    ///
155    /// Readable | Writable
156    ///
157    ///
158    /// #### `focus-on-click`
159    ///  Whether the widget should grab focus when it is clicked with the mouse.
160    ///
161    /// This property is only relevant for widgets that can take focus.
162    ///
163    /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
164    /// GtkComboBox) implemented this property individually.
165    ///
166    /// Readable | Writable
167    ///
168    ///
169    /// #### `halign`
170    ///  How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
171    ///
172    /// Readable | Writable
173    ///
174    ///
175    /// #### `has-default`
176    ///  Readable | Writable
177    ///
178    ///
179    /// #### `has-focus`
180    ///  Readable | Writable
181    ///
182    ///
183    /// #### `has-tooltip`
184    ///  Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
185    /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
186    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
187    /// whether it will provide a tooltip or not.
188    ///
189    /// Note that setting this property to [`true`] for the first time will change
190    /// the event masks of the GdkWindows of this widget to include leave-notify
191    /// and motion-notify events. This cannot and will not be undone when the
192    /// property is set to [`false`] again.
193    ///
194    /// Readable | Writable
195    ///
196    ///
197    /// #### `height-request`
198    ///  Readable | Writable
199    ///
200    ///
201    /// #### `hexpand`
202    ///  Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
203    ///
204    /// Readable | Writable
205    ///
206    ///
207    /// #### `hexpand-set`
208    ///  Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
209    ///
210    /// Readable | Writable
211    ///
212    ///
213    /// #### `is-focus`
214    ///  Readable | Writable
215    ///
216    ///
217    /// #### `margin`
218    ///  Sets all four sides' margin at once. If read, returns max
219    /// margin on any side.
220    ///
221    /// Readable | Writable
222    ///
223    ///
224    /// #### `margin-bottom`
225    ///  Margin on bottom side of widget.
226    ///
227    /// This property adds margin outside of the widget's normal size
228    /// request, the margin will be added in addition to the size from
229    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
230    ///
231    /// Readable | Writable
232    ///
233    ///
234    /// #### `margin-end`
235    ///  Margin on end of widget, horizontally. This property supports
236    /// left-to-right and right-to-left text directions.
237    ///
238    /// This property adds margin outside of the widget's normal size
239    /// request, the margin will be added in addition to the size from
240    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
241    ///
242    /// Readable | Writable
243    ///
244    ///
245    /// #### `margin-left`
246    ///  Margin on left side of widget.
247    ///
248    /// This property adds margin outside of the widget's normal size
249    /// request, the margin will be added in addition to the size from
250    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
251    ///
252    /// Readable | Writable
253    ///
254    ///
255    /// #### `margin-right`
256    ///  Margin on right side of widget.
257    ///
258    /// This property adds margin outside of the widget's normal size
259    /// request, the margin will be added in addition to the size from
260    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
261    ///
262    /// Readable | Writable
263    ///
264    ///
265    /// #### `margin-start`
266    ///  Margin on start of widget, horizontally. This property supports
267    /// left-to-right and right-to-left text directions.
268    ///
269    /// This property adds margin outside of the widget's normal size
270    /// request, the margin will be added in addition to the size from
271    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
272    ///
273    /// Readable | Writable
274    ///
275    ///
276    /// #### `margin-top`
277    ///  Margin on top side of widget.
278    ///
279    /// This property adds margin outside of the widget's normal size
280    /// request, the margin will be added in addition to the size from
281    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
282    ///
283    /// Readable | Writable
284    ///
285    ///
286    /// #### `name`
287    ///  Readable | Writable
288    ///
289    ///
290    /// #### `no-show-all`
291    ///  Readable | Writable
292    ///
293    ///
294    /// #### `opacity`
295    ///  The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
296    /// more details about window opacity.
297    ///
298    /// Before 3.8 this was only available in GtkWindow
299    ///
300    /// Readable | Writable
301    ///
302    ///
303    /// #### `parent`
304    ///  Readable | Writable
305    ///
306    ///
307    /// #### `receives-default`
308    ///  Readable | Writable
309    ///
310    ///
311    /// #### `scale-factor`
312    ///  The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
313    /// more details about widget scaling.
314    ///
315    /// Readable
316    ///
317    ///
318    /// #### `sensitive`
319    ///  Readable | Writable
320    ///
321    ///
322    /// #### `style`
323    ///  The style of the widget, which contains information about how it will look (colors, etc).
324    ///
325    /// Readable | Writable
326    ///
327    ///
328    /// #### `tooltip-markup`
329    ///  Sets the text of tooltip to be the given string, which is marked up
330    /// with the [Pango text markup language][PangoMarkupFormat].
331    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
332    ///
333    /// This is a convenience property which will take care of getting the
334    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
335    /// will automatically be set to [`true`] and there will be taken care of
336    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
337    ///
338    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
339    /// are set, the last one wins.
340    ///
341    /// Readable | Writable
342    ///
343    ///
344    /// #### `tooltip-text`
345    ///  Sets the text of tooltip to be the given string.
346    ///
347    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
348    ///
349    /// This is a convenience property which will take care of getting the
350    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
351    /// will automatically be set to [`true`] and there will be taken care of
352    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
353    ///
354    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
355    /// are set, the last one wins.
356    ///
357    /// Readable | Writable
358    ///
359    ///
360    /// #### `valign`
361    ///  How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
362    ///
363    /// Readable | Writable
364    ///
365    ///
366    /// #### `vexpand`
367    ///  Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
368    ///
369    /// Readable | Writable
370    ///
371    ///
372    /// #### `vexpand-set`
373    ///  Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
374    ///
375    /// Readable | Writable
376    ///
377    ///
378    /// #### `visible`
379    ///  Readable | Writable
380    ///
381    ///
382    /// #### `width-request`
383    ///  Readable | Writable
384    ///
385    ///
386    /// #### `window`
387    ///  The widget's window if it is realized, [`None`] otherwise.
388    ///
389    /// Readable
390    /// </details>
391    /// <details><summary><h4>Actionable</h4></summary>
392    ///
393    ///
394    /// #### `action-name`
395    ///  Readable | Writable
396    ///
397    ///
398    /// #### `action-target`
399    ///  Readable | Writable
400    /// </details>
401    /// <details><summary><h4>Activatable</h4></summary>
402    ///
403    ///
404    /// #### `related-action`
405    ///   call `gtk_activatable_do_set_related_action()` when it changes.
406    ///
407    /// Readable | Writable
408    ///
409    ///
410    /// #### `use-action-appearance`
411    ///   widget when it changes.
412    ///
413    /// Readable | Writable
414    /// </details>
415    ///
416    /// ## Signals
417    ///
418    ///
419    /// #### `activate-link`
420    ///  The ::activate-link signal is emitted each time the [`LinkButton`][crate::LinkButton]
421    /// has been clicked.
422    ///
423    /// The default handler will call [`show_uri_on_window()`][crate::show_uri_on_window()] with the URI stored inside
424    /// the [`uri`][struct@crate::LinkButton#uri] property.
425    ///
426    /// To override the default behavior, you can connect to the ::activate-link
427    /// signal and stop the propagation of the signal by returning [`true`] from
428    /// your handler.
429    ///
430    ///
431    /// <details><summary><h4>Button</h4></summary>
432    ///
433    ///
434    /// #### `activate`
435    ///  The ::activate signal on GtkButton is an action signal and
436    /// emitting it causes the button to animate press then release.
437    /// Applications should never connect to this signal, but use the
438    /// [`clicked`][struct@crate::Button#clicked] signal.
439    ///
440    /// Action
441    ///
442    ///
443    /// #### `clicked`
444    ///  Emitted when the button has been activated (pressed and released).
445    ///
446    /// Action
447    ///
448    ///
449    /// #### `enter`
450    ///  Emitted when the pointer enters the button.
451    ///
452    ///
453    ///
454    ///
455    /// #### `leave`
456    ///  Emitted when the pointer leaves the button.
457    ///
458    ///
459    ///
460    ///
461    /// #### `pressed`
462    ///  Emitted when the button is pressed.
463    ///
464    ///
465    ///
466    ///
467    /// #### `released`
468    ///  Emitted when the button is released.
469    ///
470    ///
471    /// </details>
472    /// <details><summary><h4>Container</h4></summary>
473    ///
474    ///
475    /// #### `add`
476    ///
477    ///
478    ///
479    /// #### `check-resize`
480    ///
481    ///
482    ///
483    /// #### `remove`
484    ///
485    ///
486    ///
487    /// #### `set-focus-child`
488    ///
489    /// </details>
490    /// <details><summary><h4>Widget</h4></summary>
491    ///
492    ///
493    /// #### `accel-closures-changed`
494    ///
495    ///
496    ///
497    /// #### `button-press-event`
498    ///  The ::button-press-event signal will be emitted when a button
499    /// (typically from a mouse) is pressed.
500    ///
501    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
502    /// widget needs to enable the [`gdk::EventMask::BUTTON_PRESS_MASK`][crate::gdk::EventMask::BUTTON_PRESS_MASK] mask.
503    ///
504    /// This signal will be sent to the grab widget if there is one.
505    ///
506    ///
507    ///
508    ///
509    /// #### `button-release-event`
510    ///  The ::button-release-event signal will be emitted when a button
511    /// (typically from a mouse) is released.
512    ///
513    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
514    /// widget needs to enable the [`gdk::EventMask::BUTTON_RELEASE_MASK`][crate::gdk::EventMask::BUTTON_RELEASE_MASK] mask.
515    ///
516    /// This signal will be sent to the grab widget if there is one.
517    ///
518    ///
519    ///
520    ///
521    /// #### `can-activate-accel`
522    ///  Determines whether an accelerator that activates the signal
523    /// identified by `signal_id` can currently be activated.
524    /// This signal is present to allow applications and derived
525    /// widgets to override the default [`Widget`][crate::Widget] handling
526    /// for determining whether an accelerator can be activated.
527    ///
528    ///
529    ///
530    ///
531    /// #### `child-notify`
532    ///  The ::child-notify signal is emitted for each
533    /// [child property][child-properties] that has
534    /// changed on an object. The signal's detail holds the property name.
535    ///
536    /// Detailed
537    ///
538    ///
539    /// #### `composited-changed`
540    ///  The ::composited-changed signal is emitted when the composited
541    /// status of `widgets` screen changes.
542    /// See [`Screen::is_composited()`][crate::gdk::Screen::is_composited()].
543    ///
544    /// Action
545    ///
546    ///
547    /// #### `configure-event`
548    ///  The ::configure-event signal will be emitted when the size, position or
549    /// stacking of the `widget`'s window has changed.
550    ///
551    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
552    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
553    /// automatically for all new windows.
554    ///
555    ///
556    ///
557    ///
558    /// #### `damage-event`
559    ///  Emitted when a redirected window belonging to `widget` gets drawn into.
560    /// The region/area members of the event shows what area of the redirected
561    /// drawable was drawn into.
562    ///
563    ///
564    ///
565    ///
566    /// #### `delete-event`
567    ///  The ::delete-event signal is emitted if a user requests that
568    /// a toplevel window is closed. The default handler for this signal
569    /// destroys the window. Connecting [`WidgetExtManual::hide_on_delete()`][crate::prelude::WidgetExtManual::hide_on_delete()] to
570    /// this signal will cause the window to be hidden instead, so that
571    /// it can later be shown again without reconstructing it.
572    ///
573    ///
574    ///
575    ///
576    /// #### `destroy`
577    ///  Signals that all holders of a reference to the widget should release
578    /// the reference that they hold. May result in finalization of the widget
579    /// if all references are released.
580    ///
581    /// This signal is not suitable for saving widget state.
582    ///
583    ///
584    ///
585    ///
586    /// #### `destroy-event`
587    ///  The ::destroy-event signal is emitted when a [`gdk::Window`][crate::gdk::Window] is destroyed.
588    /// You rarely get this signal, because most widgets disconnect themselves
589    /// from their window before they destroy it, so no widget owns the
590    /// window at destroy time.
591    ///
592    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
593    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
594    /// automatically for all new windows.
595    ///
596    ///
597    ///
598    ///
599    /// #### `direction-changed`
600    ///  The ::direction-changed signal is emitted when the text direction
601    /// of a widget changes.
602    ///
603    ///
604    ///
605    ///
606    /// #### `drag-begin`
607    ///  The ::drag-begin signal is emitted on the drag source when a drag is
608    /// started. A typical reason to connect to this signal is to set up a
609    /// custom drag icon with e.g. [`WidgetExt::drag_source_set_icon_pixbuf()`][crate::prelude::WidgetExt::drag_source_set_icon_pixbuf()].
610    ///
611    /// Note that some widgets set up a drag icon in the default handler of
612    /// this signal, so you may have to use `g_signal_connect_after()` to
613    /// override what the default handler did.
614    ///
615    ///
616    ///
617    ///
618    /// #### `drag-data-delete`
619    ///  The ::drag-data-delete signal is emitted on the drag source when a drag
620    /// with the action [`gdk::DragAction::MOVE`][crate::gdk::DragAction::MOVE] is successfully completed. The signal
621    /// handler is responsible for deleting the data that has been dropped. What
622    /// "delete" means depends on the context of the drag operation.
623    ///
624    ///
625    ///
626    ///
627    /// #### `drag-data-get`
628    ///  The ::drag-data-get signal is emitted on the drag source when the drop
629    /// site requests the data which is dragged. It is the responsibility of
630    /// the signal handler to fill `data` with the data in the format which
631    /// is indicated by `info`. See [`SelectionData::set()`][crate::SelectionData::set()] and
632    /// [`SelectionData::set_text()`][crate::SelectionData::set_text()].
633    ///
634    ///
635    ///
636    ///
637    /// #### `drag-data-received`
638    ///  format == 8))
639    ///  {
640    ///  GdkDragAction action;
641    ///
642    ///  // handle data here
643    ///
644    ///  action = gdk_drag_context_get_selected_action (context);
645    ///  if (action == GDK_ACTION_ASK)
646    ///  {
647    ///  GtkWidget *dialog;
648    ///  gint response;
649    ///
650    ///  dialog = gtk_message_dialog_new (NULL,
651    ///  GTK_DIALOG_MODAL |
652    ///  GTK_DIALOG_DESTROY_WITH_PARENT,
653    ///  GTK_MESSAGE_INFO,
654    ///  GTK_BUTTONS_YES_NO,
655    ///  "Move the data ?\n");
656    ///  response = gtk_dialog_run (GTK_DIALOG (dialog));
657    ///  gtk_widget_destroy (dialog);
658    ///
659    ///  if (response == GTK_RESPONSE_YES)
660    ///  action = GDK_ACTION_MOVE;
661    ///  else
662    ///  action = GDK_ACTION_COPY;
663    ///  }
664    ///
665    ///  gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
666    ///  }
667    ///  else
668    ///  gtk_drag_finish (context, FALSE, FALSE, time);
669    ///  }
670    /// ]|
671    ///
672    ///
673    ///
674    ///
675    /// #### `drag-drop`
676    ///  The ::drag-drop signal is emitted on the drop site when the user drops
677    /// the data onto the widget. The signal handler must determine whether
678    /// the cursor position is in a drop zone or not. If it is not in a drop
679    /// zone, it returns [`false`] and no further processing is necessary.
680    /// Otherwise, the handler returns [`true`]. In this case, the handler must
681    /// ensure that `gtk_drag_finish()` is called to let the source know that
682    /// the drop is done. The call to `gtk_drag_finish()` can be done either
683    /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
684    /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
685    /// or more of the supported targets.
686    ///
687    ///
688    ///
689    ///
690    /// #### `drag-end`
691    ///  The ::drag-end signal is emitted on the drag source when a drag is
692    /// finished. A typical reason to connect to this signal is to undo
693    /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
694    ///
695    ///
696    ///
697    ///
698    /// #### `drag-failed`
699    ///  The ::drag-failed signal is emitted on the drag source when a drag has
700    /// failed. The signal handler may hook custom code to handle a failed DnD
701    /// operation based on the type of error, it returns [`true`] is the failure has
702    /// been already handled (not showing the default "drag operation failed"
703    /// animation), otherwise it returns [`false`].
704    ///
705    ///
706    ///
707    ///
708    /// #### `drag-leave`
709    ///  The ::drag-leave signal is emitted on the drop site when the cursor
710    /// leaves the widget. A typical reason to connect to this signal is to
711    /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
712    /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
713    ///
714    ///
715    /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
716    /// ::drag-drop signal, for instance to allow cleaning up of a preview item
717    /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
718    ///
719    ///
720    ///
721    ///
722    /// #### `drag-motion`
723    ///  suggested_action,
724    ///  time);
725    ///  }
726    ///  else
727    ///  {
728    ///  // accept the drop
729    ///  }
730    /// }
731    /// ]|
732    ///
733    ///
734    ///
735    ///
736    /// #### `draw`
737    ///  This signal is emitted when a widget is supposed to render itself.
738    /// The `widget`'s top left corner must be painted at the origin of
739    /// the passed in context and be sized to the values returned by
740    /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
741    /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
742    ///
743    /// Signal handlers connected to this signal can modify the cairo
744    /// context passed as `cr` in any way they like and don't need to
745    /// restore it. The signal emission takes care of calling `cairo_save()`
746    /// before and `cairo_restore()` after invoking the handler.
747    ///
748    /// The signal handler will get a `cr` with a clip region already set to the
749    /// widget's dirty region, i.e. to the area that needs repainting. Complicated
750    /// widgets that want to avoid redrawing themselves completely can get the full
751    /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
752    /// get a finer-grained representation of the dirty region with
753    /// `cairo_copy_clip_rectangle_list()`.
754    ///
755    ///
756    ///
757    ///
758    /// #### `enter-notify-event`
759    ///  The ::enter-notify-event will be emitted when the pointer enters
760    /// the `widget`'s window.
761    ///
762    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
763    /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
764    ///
765    /// This signal will be sent to the grab widget if there is one.
766    ///
767    ///
768    ///
769    ///
770    /// #### `event`
771    ///  The GTK+ main loop will emit three signals for each GDK event delivered
772    /// to a widget: one generic ::event signal, another, more specific,
773    /// signal that matches the type of event delivered (e.g.
774    /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
775    /// [`event-after`][struct@crate::Widget#event-after] signal.
776    ///
777    ///
778    ///
779    ///
780    /// #### `event-after`
781    ///  After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
782    /// the second more specific signal, ::event-after will be emitted
783    /// regardless of the previous two signals handlers return values.
784    ///
785    ///
786    ///
787    ///
788    /// #### `focus`
789    ///
790    ///
791    ///
792    /// #### `focus-in-event`
793    ///  The ::focus-in-event signal will be emitted when the keyboard focus
794    /// enters the `widget`'s window.
795    ///
796    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
797    /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
798    ///
799    ///
800    ///
801    ///
802    /// #### `focus-out-event`
803    ///  The ::focus-out-event signal will be emitted when the keyboard focus
804    /// leaves the `widget`'s window.
805    ///
806    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
807    /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
808    ///
809    ///
810    ///
811    ///
812    /// #### `grab-broken-event`
813    ///  Emitted when a pointer or keyboard grab on a window belonging
814    /// to `widget` gets broken.
815    ///
816    /// On X11, this happens when the grab window becomes unviewable
817    /// (i.e. it or one of its ancestors is unmapped), or if the same
818    /// application grabs the pointer or keyboard again.
819    ///
820    ///
821    ///
822    ///
823    /// #### `grab-focus`
824    ///  Action
825    ///
826    ///
827    /// #### `grab-notify`
828    ///  The ::grab-notify signal is emitted when a widget becomes
829    /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
830    /// another widget, or when it becomes unshadowed due to a grab
831    /// being removed.
832    ///
833    /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
834    /// grab widget in the grab stack of its window group is not
835    /// its ancestor.
836    ///
837    ///
838    ///
839    ///
840    /// #### `hide`
841    ///  The ::hide signal is emitted when `widget` is hidden, for example with
842    /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
843    ///
844    ///
845    ///
846    ///
847    /// #### `hierarchy-changed`
848    ///  The ::hierarchy-changed signal is emitted when the
849    /// anchored state of a widget changes. A widget is
850    /// “anchored” when its toplevel
851    /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
852    /// a widget changes from un-anchored to anchored or vice-versa.
853    ///
854    ///
855    ///
856    ///
857    /// #### `key-press-event`
858    ///  The ::key-press-event signal is emitted when a key is pressed. The signal
859    /// emission will reoccur at the key-repeat rate when the key is kept pressed.
860    ///
861    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
862    /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
863    ///
864    /// This signal will be sent to the grab widget if there is one.
865    ///
866    ///
867    ///
868    ///
869    /// #### `key-release-event`
870    ///  The ::key-release-event signal is emitted when a key is released.
871    ///
872    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
873    /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
874    ///
875    /// This signal will be sent to the grab widget if there is one.
876    ///
877    ///
878    ///
879    ///
880    /// #### `keynav-failed`
881    ///  Gets emitted if keyboard navigation fails.
882    /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
883    ///
884    ///
885    ///
886    ///
887    /// #### `leave-notify-event`
888    ///  The ::leave-notify-event will be emitted when the pointer leaves
889    /// the `widget`'s window.
890    ///
891    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
892    /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
893    ///
894    /// This signal will be sent to the grab widget if there is one.
895    ///
896    ///
897    ///
898    ///
899    /// #### `map`
900    ///  The ::map signal is emitted when `widget` is going to be mapped, that is
901    /// when the widget is visible (which is controlled with
902    /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
903    /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
904    /// be emitted.
905    ///
906    /// The ::map signal can be used to determine whether a widget will be drawn,
907    /// for instance it can resume an animation that was stopped during the
908    /// emission of [`unmap`][struct@crate::Widget#unmap].
909    ///
910    ///
911    ///
912    ///
913    /// #### `map-event`
914    ///  The ::map-event signal will be emitted when the `widget`'s window is
915    /// mapped. A window is mapped when it becomes visible on the screen.
916    ///
917    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
918    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
919    /// automatically for all new windows.
920    ///
921    ///
922    ///
923    ///
924    /// #### `mnemonic-activate`
925    ///  The default handler for this signal activates `widget` if `group_cycling`
926    /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
927    ///
928    ///
929    ///
930    ///
931    /// #### `motion-notify-event`
932    ///  The ::motion-notify-event signal is emitted when the pointer moves
933    /// over the widget's [`gdk::Window`][crate::gdk::Window].
934    ///
935    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
936    /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
937    ///
938    /// This signal will be sent to the grab widget if there is one.
939    ///
940    ///
941    ///
942    ///
943    /// #### `move-focus`
944    ///  Action
945    ///
946    ///
947    /// #### `parent-set`
948    ///  The ::parent-set signal is emitted when a new parent
949    /// has been set on a widget.
950    ///
951    ///
952    ///
953    ///
954    /// #### `popup-menu`
955    ///  This signal gets emitted whenever a widget should pop up a context
956    /// menu. This usually happens through the standard key binding mechanism;
957    /// by pressing a certain key while a widget is focused, the user can cause
958    /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
959    /// a menu with clipboard commands. See the
960    /// [Popup Menu Migration Checklist][checklist-popup-menu]
961    /// for an example of how to use this signal.
962    ///
963    /// Action
964    ///
965    ///
966    /// #### `property-notify-event`
967    ///  The ::property-notify-event signal will be emitted when a property on
968    /// the `widget`'s window has been changed or deleted.
969    ///
970    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
971    /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
972    ///
973    ///
974    ///
975    ///
976    /// #### `proximity-in-event`
977    ///  To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
978    /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
979    ///
980    /// This signal will be sent to the grab widget if there is one.
981    ///
982    ///
983    ///
984    ///
985    /// #### `proximity-out-event`
986    ///  To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
987    /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
988    ///
989    /// This signal will be sent to the grab widget if there is one.
990    ///
991    ///
992    ///
993    ///
994    /// #### `query-tooltip`
995    ///  Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
996    /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
997    /// focus in keyboard mode.
998    ///
999    /// Using the given coordinates, the signal handler should determine
1000    /// whether a tooltip should be shown for `widget`. If this is the case
1001    /// [`true`] should be returned, [`false`] otherwise. Note that if
1002    /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
1003    /// should not be used.
1004    ///
1005    /// The signal handler is free to manipulate `tooltip` with the therefore
1006    /// destined function calls.
1007    ///
1008    ///
1009    ///
1010    ///
1011    /// #### `realize`
1012    ///  The ::realize signal is emitted when `widget` is associated with a
1013    /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
1014    /// widget has been mapped (that is, it is going to be drawn).
1015    ///
1016    ///
1017    ///
1018    ///
1019    /// #### `screen-changed`
1020    ///  The ::screen-changed signal gets emitted when the
1021    /// screen of a widget has changed.
1022    ///
1023    ///
1024    ///
1025    ///
1026    /// #### `scroll-event`
1027    ///  The ::scroll-event signal is emitted when a button in the 4 to 7
1028    /// range is pressed. Wheel mice are usually configured to generate
1029    /// button press events for buttons 4 and 5 when the wheel is turned.
1030    ///
1031    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1032    /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
1033    ///
1034    /// This signal will be sent to the grab widget if there is one.
1035    ///
1036    ///
1037    ///
1038    ///
1039    /// #### `selection-clear-event`
1040    ///  The ::selection-clear-event signal will be emitted when the
1041    /// the `widget`'s window has lost ownership of a selection.
1042    ///
1043    ///
1044    ///
1045    ///
1046    /// #### `selection-get`
1047    ///
1048    ///
1049    ///
1050    /// #### `selection-notify-event`
1051    ///
1052    ///
1053    ///
1054    /// #### `selection-received`
1055    ///
1056    ///
1057    ///
1058    /// #### `selection-request-event`
1059    ///  The ::selection-request-event signal will be emitted when
1060    /// another client requests ownership of the selection owned by
1061    /// the `widget`'s window.
1062    ///
1063    ///
1064    ///
1065    ///
1066    /// #### `show`
1067    ///  The ::show signal is emitted when `widget` is shown, for example with
1068    /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
1069    ///
1070    ///
1071    ///
1072    ///
1073    /// #### `show-help`
1074    ///  Action
1075    ///
1076    ///
1077    /// #### `size-allocate`
1078    ///
1079    ///
1080    ///
1081    /// #### `state-changed`
1082    ///  The ::state-changed signal is emitted when the widget state changes.
1083    /// See `gtk_widget_get_state()`.
1084    ///
1085    ///
1086    ///
1087    ///
1088    /// #### `state-flags-changed`
1089    ///  The ::state-flags-changed signal is emitted when the widget state
1090    /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
1091    ///
1092    ///
1093    ///
1094    ///
1095    /// #### `style-set`
1096    ///  The ::style-set signal is emitted when a new style has been set
1097    /// on a widget. Note that style-modifying functions like
1098    /// `gtk_widget_modify_base()` also cause this signal to be emitted.
1099    ///
1100    /// Note that this signal is emitted for changes to the deprecated
1101    /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
1102    /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
1103    ///
1104    ///
1105    ///
1106    ///
1107    /// #### `style-updated`
1108    ///  The ::style-updated signal is a convenience signal that is emitted when the
1109    /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
1110    /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
1111    ///
1112    /// Note that style-modifying functions like `gtk_widget_override_color()` also
1113    /// cause this signal to be emitted.
1114    ///
1115    ///
1116    ///
1117    ///
1118    /// #### `touch-event`
1119    ///
1120    ///
1121    ///
1122    /// #### `unmap`
1123    ///  The ::unmap signal is emitted when `widget` is going to be unmapped, which
1124    /// means that either it or any of its parents up to the toplevel widget have
1125    /// been set as hidden.
1126    ///
1127    /// As ::unmap indicates that a widget will not be shown any longer, it can be
1128    /// used to, for example, stop an animation on the widget.
1129    ///
1130    ///
1131    ///
1132    ///
1133    /// #### `unmap-event`
1134    ///  The ::unmap-event signal will be emitted when the `widget`'s window is
1135    /// unmapped. A window is unmapped when it becomes invisible on the screen.
1136    ///
1137    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1138    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1139    /// automatically for all new windows.
1140    ///
1141    ///
1142    ///
1143    ///
1144    /// #### `unrealize`
1145    ///  The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
1146    /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
1147    /// called or the widget has been unmapped (that is, it is going to be
1148    /// hidden).
1149    ///
1150    ///
1151    ///
1152    ///
1153    /// #### `visibility-notify-event`
1154    ///  The ::visibility-notify-event will be emitted when the `widget`'s
1155    /// window is obscured or unobscured.
1156    ///
1157    /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1158    /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
1159    ///
1160    ///
1161    ///
1162    ///
1163    /// #### `window-state-event`
1164    ///  The ::window-state-event will be emitted when the state of the
1165    /// toplevel window associated to the `widget` changes.
1166    ///
1167    /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
1168    /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
1169    /// this mask automatically for all new windows.
1170    ///
1171    ///
1172    /// </details>
1173    ///
1174    /// # Implements
1175    ///
1176    /// [`LinkButtonExt`][trait@crate::prelude::LinkButtonExt], [`ButtonExt`][trait@crate::prelude::ButtonExt], [`BinExt`][trait@crate::prelude::BinExt], [`ContainerExt`][trait@crate::prelude::ContainerExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ActionableExt`][trait@crate::prelude::ActionableExt], [`ContainerExtManual`][trait@crate::prelude::ContainerExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
1177    #[doc(alias = "GtkLinkButton")]
1178    pub struct LinkButton(Object<ffi::GtkLinkButton, ffi::GtkLinkButtonClass>) @extends Button, Bin, Container, Widget, @implements Buildable, Actionable;
1179
1180    match fn {
1181        type_ => || ffi::gtk_link_button_get_type(),
1182    }
1183}
1184
1185impl LinkButton {
1186    pub const NONE: Option<&'static LinkButton> = None;
1187
1188    /// Creates a new [`LinkButton`][crate::LinkButton] with the URI as its text.
1189    /// ## `uri`
1190    /// a valid URI
1191    ///
1192    /// # Returns
1193    ///
1194    /// a new link button widget.
1195    #[doc(alias = "gtk_link_button_new")]
1196    pub fn new(uri: &str) -> LinkButton {
1197        assert_initialized_main_thread!();
1198        unsafe {
1199            Widget::from_glib_none(ffi::gtk_link_button_new(uri.to_glib_none().0)).unsafe_cast()
1200        }
1201    }
1202
1203    /// Creates a new [`LinkButton`][crate::LinkButton] containing a label.
1204    /// ## `uri`
1205    /// a valid URI
1206    /// ## `label`
1207    /// the text of the button
1208    ///
1209    /// # Returns
1210    ///
1211    /// a new link button widget.
1212    #[doc(alias = "gtk_link_button_new_with_label")]
1213    #[doc(alias = "new_with_label")]
1214    pub fn with_label(uri: &str, label: &str) -> LinkButton {
1215        assert_initialized_main_thread!();
1216        unsafe {
1217            Widget::from_glib_none(ffi::gtk_link_button_new_with_label(
1218                uri.to_glib_none().0,
1219                label.to_glib_none().0,
1220            ))
1221            .unsafe_cast()
1222        }
1223    }
1224
1225    // rustdoc-stripper-ignore-next
1226    /// Creates a new builder-pattern struct instance to construct [`LinkButton`] objects.
1227    ///
1228    /// This method returns an instance of [`LinkButtonBuilder`](crate::builders::LinkButtonBuilder) which can be used to create [`LinkButton`] objects.
1229    pub fn builder() -> LinkButtonBuilder {
1230        LinkButtonBuilder::new()
1231    }
1232}
1233
1234impl Default for LinkButton {
1235    fn default() -> Self {
1236        glib::object::Object::new::<Self>()
1237    }
1238}
1239
1240// rustdoc-stripper-ignore-next
1241/// A [builder-pattern] type to construct [`LinkButton`] objects.
1242///
1243/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1244#[must_use = "The builder must be built to be used"]
1245pub struct LinkButtonBuilder {
1246    builder: glib::object::ObjectBuilder<'static, LinkButton>,
1247}
1248
1249impl LinkButtonBuilder {
1250    fn new() -> Self {
1251        Self {
1252            builder: glib::object::Object::builder(),
1253        }
1254    }
1255
1256    /// The URI bound to this button.
1257    pub fn uri(self, uri: impl Into<glib::GString>) -> Self {
1258        Self {
1259            builder: self.builder.property("uri", uri.into()),
1260        }
1261    }
1262
1263    /// The 'visited' state of this button. A visited link is drawn in a
1264    /// different color.
1265    pub fn visited(self, visited: bool) -> Self {
1266        Self {
1267            builder: self.builder.property("visited", visited),
1268        }
1269    }
1270
1271    /// If [`true`], the button will ignore the [`gtk-button-images`][struct@crate::Settings#gtk-button-images]
1272    /// setting and always show the image, if available.
1273    ///
1274    /// Use this property if the button would be useless or hard to use
1275    /// without the image.
1276    pub fn always_show_image(self, always_show_image: bool) -> Self {
1277        Self {
1278            builder: self
1279                .builder
1280                .property("always-show-image", always_show_image),
1281        }
1282    }
1283
1284    /// The child widget to appear next to the button text.
1285    pub fn image(self, image: &impl IsA<Widget>) -> Self {
1286        Self {
1287            builder: self.builder.property("image", image.clone().upcast()),
1288        }
1289    }
1290
1291    /// The position of the image relative to the text inside the button.
1292    pub fn image_position(self, image_position: PositionType) -> Self {
1293        Self {
1294            builder: self.builder.property("image-position", image_position),
1295        }
1296    }
1297
1298    pub fn label(self, label: impl Into<glib::GString>) -> Self {
1299        Self {
1300            builder: self.builder.property("label", label.into()),
1301        }
1302    }
1303
1304    pub fn relief(self, relief: ReliefStyle) -> Self {
1305        Self {
1306            builder: self.builder.property("relief", relief),
1307        }
1308    }
1309
1310    pub fn use_underline(self, use_underline: bool) -> Self {
1311        Self {
1312            builder: self.builder.property("use-underline", use_underline),
1313        }
1314    }
1315
1316    pub fn border_width(self, border_width: u32) -> Self {
1317        Self {
1318            builder: self.builder.property("border-width", border_width),
1319        }
1320    }
1321
1322    pub fn child(self, child: &impl IsA<Widget>) -> Self {
1323        Self {
1324            builder: self.builder.property("child", child.clone().upcast()),
1325        }
1326    }
1327
1328    pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
1329        Self {
1330            builder: self.builder.property("resize-mode", resize_mode),
1331        }
1332    }
1333
1334    pub fn app_paintable(self, app_paintable: bool) -> Self {
1335        Self {
1336            builder: self.builder.property("app-paintable", app_paintable),
1337        }
1338    }
1339
1340    pub fn can_default(self, can_default: bool) -> Self {
1341        Self {
1342            builder: self.builder.property("can-default", can_default),
1343        }
1344    }
1345
1346    pub fn can_focus(self, can_focus: bool) -> Self {
1347        Self {
1348            builder: self.builder.property("can-focus", can_focus),
1349        }
1350    }
1351
1352    pub fn events(self, events: gdk::EventMask) -> Self {
1353        Self {
1354            builder: self.builder.property("events", events),
1355        }
1356    }
1357
1358    /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
1359    pub fn expand(self, expand: bool) -> Self {
1360        Self {
1361            builder: self.builder.property("expand", expand),
1362        }
1363    }
1364
1365    /// Whether the widget should grab focus when it is clicked with the mouse.
1366    ///
1367    /// This property is only relevant for widgets that can take focus.
1368    ///
1369    /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
1370    /// GtkComboBox) implemented this property individually.
1371    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1372        Self {
1373            builder: self.builder.property("focus-on-click", focus_on_click),
1374        }
1375    }
1376
1377    /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
1378    pub fn halign(self, halign: Align) -> Self {
1379        Self {
1380            builder: self.builder.property("halign", halign),
1381        }
1382    }
1383
1384    pub fn has_default(self, has_default: bool) -> Self {
1385        Self {
1386            builder: self.builder.property("has-default", has_default),
1387        }
1388    }
1389
1390    pub fn has_focus(self, has_focus: bool) -> Self {
1391        Self {
1392            builder: self.builder.property("has-focus", has_focus),
1393        }
1394    }
1395
1396    /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
1397    /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
1398    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
1399    /// whether it will provide a tooltip or not.
1400    ///
1401    /// Note that setting this property to [`true`] for the first time will change
1402    /// the event masks of the GdkWindows of this widget to include leave-notify
1403    /// and motion-notify events. This cannot and will not be undone when the
1404    /// property is set to [`false`] again.
1405    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1406        Self {
1407            builder: self.builder.property("has-tooltip", has_tooltip),
1408        }
1409    }
1410
1411    pub fn height_request(self, height_request: i32) -> Self {
1412        Self {
1413            builder: self.builder.property("height-request", height_request),
1414        }
1415    }
1416
1417    /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1418    pub fn hexpand(self, hexpand: bool) -> Self {
1419        Self {
1420            builder: self.builder.property("hexpand", hexpand),
1421        }
1422    }
1423
1424    /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1425    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1426        Self {
1427            builder: self.builder.property("hexpand-set", hexpand_set),
1428        }
1429    }
1430
1431    pub fn is_focus(self, is_focus: bool) -> Self {
1432        Self {
1433            builder: self.builder.property("is-focus", is_focus),
1434        }
1435    }
1436
1437    /// Sets all four sides' margin at once. If read, returns max
1438    /// margin on any side.
1439    pub fn margin(self, margin: i32) -> Self {
1440        Self {
1441            builder: self.builder.property("margin", margin),
1442        }
1443    }
1444
1445    /// Margin on bottom side of widget.
1446    ///
1447    /// This property adds margin outside of the widget's normal size
1448    /// request, the margin will be added in addition to the size from
1449    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1450    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1451        Self {
1452            builder: self.builder.property("margin-bottom", margin_bottom),
1453        }
1454    }
1455
1456    /// Margin on end of widget, horizontally. This property supports
1457    /// left-to-right and right-to-left text directions.
1458    ///
1459    /// This property adds margin outside of the widget's normal size
1460    /// request, the margin will be added in addition to the size from
1461    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1462    pub fn margin_end(self, margin_end: i32) -> Self {
1463        Self {
1464            builder: self.builder.property("margin-end", margin_end),
1465        }
1466    }
1467
1468    /// Margin on start of widget, horizontally. This property supports
1469    /// left-to-right and right-to-left text directions.
1470    ///
1471    /// This property adds margin outside of the widget's normal size
1472    /// request, the margin will be added in addition to the size from
1473    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1474    pub fn margin_start(self, margin_start: i32) -> Self {
1475        Self {
1476            builder: self.builder.property("margin-start", margin_start),
1477        }
1478    }
1479
1480    /// Margin on top side of widget.
1481    ///
1482    /// This property adds margin outside of the widget's normal size
1483    /// request, the margin will be added in addition to the size from
1484    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1485    pub fn margin_top(self, margin_top: i32) -> Self {
1486        Self {
1487            builder: self.builder.property("margin-top", margin_top),
1488        }
1489    }
1490
1491    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1492        Self {
1493            builder: self.builder.property("name", name.into()),
1494        }
1495    }
1496
1497    pub fn no_show_all(self, no_show_all: bool) -> Self {
1498        Self {
1499            builder: self.builder.property("no-show-all", no_show_all),
1500        }
1501    }
1502
1503    /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
1504    /// more details about window opacity.
1505    ///
1506    /// Before 3.8 this was only available in GtkWindow
1507    pub fn opacity(self, opacity: f64) -> Self {
1508        Self {
1509            builder: self.builder.property("opacity", opacity),
1510        }
1511    }
1512
1513    pub fn parent(self, parent: &impl IsA<Container>) -> Self {
1514        Self {
1515            builder: self.builder.property("parent", parent.clone().upcast()),
1516        }
1517    }
1518
1519    pub fn receives_default(self, receives_default: bool) -> Self {
1520        Self {
1521            builder: self.builder.property("receives-default", receives_default),
1522        }
1523    }
1524
1525    pub fn sensitive(self, sensitive: bool) -> Self {
1526        Self {
1527            builder: self.builder.property("sensitive", sensitive),
1528        }
1529    }
1530
1531    /// Sets the text of tooltip to be the given string, which is marked up
1532    /// with the [Pango text markup language][PangoMarkupFormat].
1533    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1534    ///
1535    /// This is a convenience property which will take care of getting the
1536    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1537    /// will automatically be set to [`true`] and there will be taken care of
1538    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1539    ///
1540    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1541    /// are set, the last one wins.
1542    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1543        Self {
1544            builder: self
1545                .builder
1546                .property("tooltip-markup", tooltip_markup.into()),
1547        }
1548    }
1549
1550    /// Sets the text of tooltip to be the given string.
1551    ///
1552    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1553    ///
1554    /// This is a convenience property which will take care of getting the
1555    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1556    /// will automatically be set to [`true`] and there will be taken care of
1557    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1558    ///
1559    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1560    /// are set, the last one wins.
1561    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1562        Self {
1563            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1564        }
1565    }
1566
1567    /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
1568    pub fn valign(self, valign: Align) -> Self {
1569        Self {
1570            builder: self.builder.property("valign", valign),
1571        }
1572    }
1573
1574    /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
1575    pub fn vexpand(self, vexpand: bool) -> Self {
1576        Self {
1577            builder: self.builder.property("vexpand", vexpand),
1578        }
1579    }
1580
1581    /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
1582    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1583        Self {
1584            builder: self.builder.property("vexpand-set", vexpand_set),
1585        }
1586    }
1587
1588    pub fn visible(self, visible: bool) -> Self {
1589        Self {
1590            builder: self.builder.property("visible", visible),
1591        }
1592    }
1593
1594    pub fn width_request(self, width_request: i32) -> Self {
1595        Self {
1596            builder: self.builder.property("width-request", width_request),
1597        }
1598    }
1599
1600    pub fn action_name(self, action_name: impl Into<glib::GString>) -> Self {
1601        Self {
1602            builder: self.builder.property("action-name", action_name.into()),
1603        }
1604    }
1605
1606    pub fn action_target(self, action_target: &glib::Variant) -> Self {
1607        Self {
1608            builder: self
1609                .builder
1610                .property("action-target", action_target.clone()),
1611        }
1612    }
1613
1614    // rustdoc-stripper-ignore-next
1615    /// Build the [`LinkButton`].
1616    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1617    pub fn build(self) -> LinkButton {
1618        assert_initialized_main_thread!();
1619        self.builder.build()
1620    }
1621}
1622
1623/// Trait containing all [`struct@LinkButton`] methods.
1624///
1625/// # Implementors
1626///
1627/// [`LinkButton`][struct@crate::LinkButton]
1628pub trait LinkButtonExt: IsA<LinkButton> + 'static {
1629    /// Retrieves the URI set using [`set_uri()`][Self::set_uri()].
1630    ///
1631    /// # Returns
1632    ///
1633    /// a valid URI. The returned string is owned by the link button
1634    ///  and should not be modified or freed.
1635    #[doc(alias = "gtk_link_button_get_uri")]
1636    #[doc(alias = "get_uri")]
1637    fn uri(&self) -> Option<glib::GString> {
1638        unsafe { from_glib_none(ffi::gtk_link_button_get_uri(self.as_ref().to_glib_none().0)) }
1639    }
1640
1641    /// Retrieves the “visited” state of the URI where the [`LinkButton`][crate::LinkButton]
1642    /// points. The button becomes visited when it is clicked. If the URI
1643    /// is changed on the button, the “visited” state is unset again.
1644    ///
1645    /// The state may also be changed using [`set_visited()`][Self::set_visited()].
1646    ///
1647    /// # Returns
1648    ///
1649    /// [`true`] if the link has been visited, [`false`] otherwise
1650    #[doc(alias = "gtk_link_button_get_visited")]
1651    #[doc(alias = "get_visited")]
1652    #[doc(alias = "visited")]
1653    fn is_visited(&self) -> bool {
1654        unsafe {
1655            from_glib(ffi::gtk_link_button_get_visited(
1656                self.as_ref().to_glib_none().0,
1657            ))
1658        }
1659    }
1660
1661    /// Sets `uri` as the URI where the [`LinkButton`][crate::LinkButton] points. As a side-effect
1662    /// this unsets the “visited” state of the button.
1663    /// ## `uri`
1664    /// a valid URI
1665    #[doc(alias = "gtk_link_button_set_uri")]
1666    #[doc(alias = "uri")]
1667    fn set_uri(&self, uri: &str) {
1668        unsafe {
1669            ffi::gtk_link_button_set_uri(self.as_ref().to_glib_none().0, uri.to_glib_none().0);
1670        }
1671    }
1672
1673    /// Sets the “visited” state of the URI where the [`LinkButton`][crate::LinkButton]
1674    /// points. See [`is_visited()`][Self::is_visited()] for more details.
1675    /// ## `visited`
1676    /// the new “visited” state
1677    #[doc(alias = "gtk_link_button_set_visited")]
1678    #[doc(alias = "visited")]
1679    fn set_visited(&self, visited: bool) {
1680        unsafe {
1681            ffi::gtk_link_button_set_visited(self.as_ref().to_glib_none().0, visited.into_glib());
1682        }
1683    }
1684
1685    /// The ::activate-link signal is emitted each time the [`LinkButton`][crate::LinkButton]
1686    /// has been clicked.
1687    ///
1688    /// The default handler will call [`show_uri_on_window()`][crate::show_uri_on_window()] with the URI stored inside
1689    /// the [`uri`][struct@crate::LinkButton#uri] property.
1690    ///
1691    /// To override the default behavior, you can connect to the ::activate-link
1692    /// signal and stop the propagation of the signal by returning [`true`] from
1693    /// your handler.
1694    #[doc(alias = "activate-link")]
1695    fn connect_activate_link<F: Fn(&Self) -> glib::Propagation + 'static>(
1696        &self,
1697        f: F,
1698    ) -> SignalHandlerId {
1699        unsafe extern "C" fn activate_link_trampoline<
1700            P: IsA<LinkButton>,
1701            F: Fn(&P) -> glib::Propagation + 'static,
1702        >(
1703            this: *mut ffi::GtkLinkButton,
1704            f: glib::ffi::gpointer,
1705        ) -> glib::ffi::gboolean {
1706            unsafe {
1707                let f: &F = &*(f as *const F);
1708                f(LinkButton::from_glib_borrow(this).unsafe_cast_ref()).into_glib()
1709            }
1710        }
1711        unsafe {
1712            let f: Box_<F> = Box_::new(f);
1713            connect_raw(
1714                self.as_ptr() as *mut _,
1715                c"activate-link".as_ptr(),
1716                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1717                    activate_link_trampoline::<Self, F> as *const (),
1718                )),
1719                Box_::into_raw(f),
1720            )
1721        }
1722    }
1723
1724    #[doc(alias = "uri")]
1725    fn connect_uri_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1726        unsafe extern "C" fn notify_uri_trampoline<P: IsA<LinkButton>, F: Fn(&P) + 'static>(
1727            this: *mut ffi::GtkLinkButton,
1728            _param_spec: glib::ffi::gpointer,
1729            f: glib::ffi::gpointer,
1730        ) {
1731            unsafe {
1732                let f: &F = &*(f as *const F);
1733                f(LinkButton::from_glib_borrow(this).unsafe_cast_ref())
1734            }
1735        }
1736        unsafe {
1737            let f: Box_<F> = Box_::new(f);
1738            connect_raw(
1739                self.as_ptr() as *mut _,
1740                c"notify::uri".as_ptr(),
1741                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1742                    notify_uri_trampoline::<Self, F> as *const (),
1743                )),
1744                Box_::into_raw(f),
1745            )
1746        }
1747    }
1748
1749    #[doc(alias = "visited")]
1750    fn connect_visited_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1751        unsafe extern "C" fn notify_visited_trampoline<P: IsA<LinkButton>, F: Fn(&P) + 'static>(
1752            this: *mut ffi::GtkLinkButton,
1753            _param_spec: glib::ffi::gpointer,
1754            f: glib::ffi::gpointer,
1755        ) {
1756            unsafe {
1757                let f: &F = &*(f as *const F);
1758                f(LinkButton::from_glib_borrow(this).unsafe_cast_ref())
1759            }
1760        }
1761        unsafe {
1762            let f: Box_<F> = Box_::new(f);
1763            connect_raw(
1764                self.as_ptr() as *mut _,
1765                c"notify::visited".as_ptr(),
1766                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1767                    notify_visited_trampoline::<Self, F> as *const (),
1768                )),
1769                Box_::into_raw(f),
1770            )
1771        }
1772    }
1773}
1774
1775impl<O: IsA<LinkButton>> LinkButtonExt for O {}