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