class Adw::MessageDialog
Overview
A dialog presenting a message or a question.
Message dialogs have a heading, a body, an optional child widget, and one or multiple responses, each presented as a button.
Each response has a unique string ID, and a button label. Additionally, each response can be enabled or disabled, and can have a suggested or destructive appearance.
When one of the responses is activated, or the dialog is closed, the
MessageDialog::#response
signal will be emitted. This signal is
detailed, and the detail, as well as the #response
parameter will be set to
the ID of the activated response, or to the value of the
[property@MessageDialog:close-response] property if the dialog had been
closed without activating any of the responses.
Response buttons can be presented horizontally or vertically depending on available space.
When a response is activated, Adw::MessageDialog
is closed automatically.
An example of using a message dialog:
WARNING ⚠️ The following code is in c ⚠️
Gtk::Widget *dialog;
dialog = adw_message_dialog_new (parent, _("Replace File?"), NULL);
adw_message_dialog_format_body (ADW_MESSAGE_DIALOG (dialog),
_("A file named “%s” already exists. Do you want to replace it?"),
filename);
adw_message_dialog_add_responses (ADW_MESSAGE_DIALOG (dialog),
"cancel", _("_Cancel"),
"replace", _("_Replace"),
NULL);
adw_message_dialog_set_response_appearance (ADW_MESSAGE_DIALOG (dialog), "replace", ADW_RESPONSE_DESTRUCTIVE);
adw_message_dialog_set_default_response (ADW_MESSAGE_DIALOG (dialog), "cancel");
adw_message_dialog_set_close_response (ADW_MESSAGE_DIALOG (dialog), "cancel");
g_signal_connect (dialog, "response", G_CALLBACK (response_cb), self);
gtk_window_present (GTK_WINDOW (dialog));
Adw::MessageDialog as Gtk::Buildable
Adw::MessageDialog
supports adding responses in UI definitions by via the
<responses>
element that may contain multiple <response>
elements, each
respresenting a response.
Each of the <response>
elements must have the id
attribute specifying the
response ID. The contents of the element are used as the response label.
Response labels can be translated with the usual translatable
, context
and comments
attributes.
The <response>
elements can also have enabled
and/or appearance
attributes. See MessageDialog#response_enabled=
and
MessageDialog#response_appearance=
for details.
Example of an Adw::MessageDialog
UI definition:
WARNING ⚠️ The following code is in xml ⚠️
<object class="Adw::MessageDialog" id="dialog">
<property name="heading" translatable="yes">Save Changes?</property>
<property name="body" translatable="yes">Open documents contain unsaved changes. Changes which are not saved will be permanently lost.</property>
<property name="default-response">save</property>
<property name="close-response">cancel</property>
<signal name="response" handler="response_cb"/>
<responses>
<response id="cancel" translatable="yes">_Cancel</response>
<response id="discard" translatable="yes" appearance="destructive">_Discard</response>
<response id="save" translatable="yes" appearance="suggested" enabled="false">_Save</response>
</responses>
</object>
Accessibility
Adw::MessageDialog
uses the GTK_ACCESSIBLE_ROLE_DIALOG
role.
Included Modules
Defined in:
lib/gi-crystal/src/auto/adw-1/message_dialog.crConstructors
-
.new(parent : Gtk::Window?, heading : String?, body : String?) : self
Creates a new
Adw::MessageDialog
. -
.new
Initialize a new
MessageDialog
. - .new(*, accessible_role : Gtk::AccessibleRole? = nil, application : Gtk::Application? = nil, body : String? = nil, body_use_markup : Bool? = nil, can_focus : Bool? = nil, can_target : Bool? = nil, child : Gtk::Widget? = nil, close_response : String? = nil, css_classes : Enumerable(String)? = nil, css_name : String? = nil, cursor : Gdk::Cursor? = nil, decorated : Bool? = nil, default_height : Int32? = nil, default_response : String? = nil, default_widget : Gtk::Widget? = nil, default_width : Int32? = nil, deletable : Bool? = nil, destroy_with_parent : Bool? = nil, display : Gdk::Display? = nil, extra_child : Gtk::Widget? = nil, focus_on_click : Bool? = nil, focus_visible : Bool? = nil, focus_widget : Gtk::Widget? = nil, focusable : Bool? = nil, fullscreened : Bool? = nil, halign : Gtk::Align? = nil, handle_menubar_accel : Bool? = nil, has_default : Bool? = nil, has_focus : Bool? = nil, has_tooltip : Bool? = nil, heading : String? = nil, heading_use_markup : Bool? = nil, height_request : Int32? = nil, hexpand : Bool? = nil, hexpand_set : Bool? = nil, hide_on_close : Bool? = nil, icon_name : String? = nil, is_active : Bool? = nil, layout_manager : Gtk::LayoutManager? = nil, margin_bottom : Int32? = nil, margin_end : Int32? = nil, margin_start : Int32? = nil, margin_top : Int32? = nil, maximized : Bool? = nil, mnemonics_visible : Bool? = nil, modal : Bool? = nil, name : String? = nil, opacity : Float64? = nil, overflow : Gtk::Overflow? = nil, parent : Gtk::Widget? = nil, receives_default : Bool? = nil, resizable : Bool? = nil, root : Gtk::Root? = nil, scale_factor : Int32? = nil, sensitive : Bool? = nil, startup_id : String? = nil, title : String? = nil, titlebar : Gtk::Widget? = nil, tooltip_markup : String? = nil, tooltip_text : String? = nil, transient_for : Gtk::Window? = nil, valign : Gtk::Align? = nil, vexpand : Bool? = nil, vexpand_set : Bool? = nil, visible : Bool? = nil, width_request : Int32? = nil)
Class Method Summary
-
.g_type : UInt64
Returns the type id (GType) registered in GLib type system.
Instance Method Summary
-
#add_response(id : String, label : String) : Nil
Adds a response with @id and @label to @self.
-
#body : String
Gets the body text of @self.
-
#body=(body : String) : Nil
Sets the body text of @self.
-
#body_use_markup : Bool
Gets whether the body text of @self includes Pango markup.
-
#body_use_markup=(use_markup : Bool) : Nil
Sets whether the body text of @self includes Pango markup.
- #body_use_markup? : Bool
-
#close_response : String
Gets the ID of the close response of @self.
-
#close_response=(response : String) : Nil
Sets the ID of the close response of @self.
-
#default_response : String?
Gets the ID of the default response of @self.
- #default_response=(value : String) : String
-
#default_response=(response : String?) : Nil
Sets the ID of the default response of @self.
-
#extra_child : Gtk::Widget?
Gets the child widget of @self.
-
#extra_child=(child : Gtk::Widget?) : Nil
Sets the child widget of @self.
-
#has_response(response : String) : Bool
Gets whether @self has a response with the ID @response.
-
#heading : String?
Gets the heading of @self.
- #heading=(value : String) : String
-
#heading=(heading : String?) : Nil
Sets the heading of @self.
-
#heading_use_markup : Bool
Gets whether the heading of @self includes Pango markup.
-
#heading_use_markup=(use_markup : Bool) : Nil
Sets whether the heading of @self includes Pango markup.
- #heading_use_markup? : Bool
-
#response(response : String) : Nil
Emits the
MessageDialog::#response
signal with the given response ID. -
#response_appearance(response : String) : Adw::ResponseAppearance
Gets the appearance of @response.
-
#response_enabled(response : String) : Bool
Gets whether @response is enabled.
-
#response_label(response : String) : String
Gets the label of @response.
- #response_signal
-
#set_response_appearance(response : String, appearance : Adw::ResponseAppearance) : Nil
Sets the appearance for @response.
-
#set_response_enabled(response : String, enabled : Bool) : Nil
Sets whether @response is enabled.
-
#set_response_label(response : String, label : String) : Nil
Sets the label of @response to @label.
Instance methods inherited from module Gtk::ShortcutManager
to_unsafe
to_unsafe
Class methods inherited from module Gtk::ShortcutManager
g_type : UInt64
g_type
Instance methods inherited from module Gtk::Root
display : Gdk::Display
display,
focus : Gtk::Widget?
focus,
focus=(focus : Gtk::Widget?) : Nil
focus=,
to_unsafe
to_unsafe
Class methods inherited from module Gtk::Root
g_type : UInt64
g_type
Instance methods inherited from module Gtk::Native
realize : Nil
realize,
renderer : Gsk::Renderer
renderer,
surface : Gdk::Surface
surface,
surface_transform(x : Float64, y : Float64) : Nil
surface_transform,
to_unsafe
to_unsafe,
unrealize : Nil
unrealize
Class methods inherited from module Gtk::Native
for_surface(surface : Gdk::Surface) : Gtk::Native?
for_surface,
g_type : UInt64
g_type
Instance methods inherited from module Gtk::ConstraintTarget
to_unsafe
to_unsafe
Class methods inherited from module Gtk::ConstraintTarget
g_type : UInt64
g_type
Instance methods inherited from module Gtk::Buildable
buildable_id : String?
buildable_id,
to_unsafe
to_unsafe
Class methods inherited from module Gtk::Buildable
g_type : UInt64
g_type
Instance methods inherited from module Gtk::Accessible
accessible_role : Gtk::AccessibleRole
accessible_role,
accessible_role=(value : Gtk::AccessibleRole) : Gtk::AccessibleRole
accessible_role=,
reset_property(property : Gtk::AccessibleProperty) : Nil
reset_property,
reset_relation(relation : Gtk::AccessibleRelation) : Nil
reset_relation,
reset_state(state : Gtk::AccessibleState) : Nil
reset_state,
to_unsafe
to_unsafe,
update_property(properties : Enumerable(Gtk::AccessibleProperty), values : Enumerable(_)) : Nil
update_property,
update_relation(relations : Enumerable(Gtk::AccessibleRelation), values : Enumerable(_)) : Nil
update_relation,
update_state(states : Enumerable(Gtk::AccessibleState), values : Enumerable(_)) : Nil
update_state
Class methods inherited from module Gtk::Accessible
g_type : UInt64
g_type
Instance methods inherited from class Gtk::Window
activate_default_signal
activate_default_signal,
activate_focus_signal
activate_focus_signal,
application : Gtk::Application?
application,
application=(application : Gtk::Application?) : Nil
application=,
child : Gtk::Widget?
child,
child=(child : Gtk::Widget?) : Nil
child=,
close : Nil
close,
close_request_signal
close_request_signal,
decorated : Bool
decorated,
decorated=(setting : Bool) : Nil
decorated=,
decorated? : Bool
decorated?,
default_height : Int32
default_height,
default_height=(value : Int32) : Int32
default_height=,
default_size : Nil
default_size,
default_widget : Gtk::Widget?
default_widget,
default_widget=(default_widget : Gtk::Widget?) : Nil
default_widget=,
default_width : Int32
default_width,
default_width=(value : Int32) : Int32
default_width=,
deletable : Bool
deletable,
deletable=(setting : Bool) : Nil
deletable=,
deletable? : Bool
deletable?,
destroy : Nil
destroy,
destroy_with_parent : Bool
destroy_with_parent,
destroy_with_parent=(setting : Bool) : Nil
destroy_with_parent=,
destroy_with_parent? : Bool
destroy_with_parent?,
display : Gdk::Display?
display,
display=(display : Gdk::Display) : Nildisplay=(value : Gdk::Display?) : Gdk::Display? display=, enable_debugging_signal enable_debugging_signal, focus : Gtk::Widget? focus, focus=(focus : Gtk::Widget?) : Nil focus=, focus_visible : Bool focus_visible, focus_visible=(setting : Bool) : Nil focus_visible=, focus_visible? : Bool focus_visible?, focus_widget : Gtk::Widget? focus_widget, focus_widget=(value : Gtk::Widget?) : Gtk::Widget? focus_widget=, fullscreen : Nil fullscreen, fullscreen_on_monitor(monitor : Gdk::Monitor) : Nil fullscreen_on_monitor, fullscreened=(value : Bool) : Bool fullscreened=, fullscreened? : Bool fullscreened?, group : Gtk::WindowGroup group, handle_menubar_accel : Bool handle_menubar_accel, handle_menubar_accel=(handle_menubar_accel : Bool) : Nil handle_menubar_accel=, handle_menubar_accel? : Bool handle_menubar_accel?, has_group : Bool has_group, hide_on_close : Bool hide_on_close, hide_on_close=(setting : Bool) : Nil hide_on_close=, hide_on_close? : Bool hide_on_close?, icon_name : String? icon_name, icon_name=(value : String) : String
icon_name=(name : String?) : Nil icon_name=, is_active? : Bool is_active?, is_fullscreen : Bool is_fullscreen, is_maximized : Bool is_maximized, keys_changed_signal keys_changed_signal, maximize : Nil maximize, maximized=(value : Bool) : Bool maximized=, maximized? : Bool maximized?, minimize : Nil minimize, mnemonics_visible : Bool mnemonics_visible, mnemonics_visible=(setting : Bool) : Nil mnemonics_visible=, mnemonics_visible? : Bool mnemonics_visible?, modal : Bool modal, modal=(modal : Bool) : Nil modal=, modal? : Bool modal?, present : Nil present, present_with_time(timestamp : UInt32) : Nil present_with_time, resizable : Bool resizable, resizable=(resizable : Bool) : Nil resizable=, resizable? : Bool resizable?, set_default_size(width : Int32, height : Int32) : Nil set_default_size, startup_id=(startup_id : String) : Nil startup_id=, title : String? title, title=(value : String) : String
title=(title : String?) : Nil title=, titlebar : Gtk::Widget? titlebar, titlebar=(titlebar : Gtk::Widget?) : Nil titlebar=, transient_for : Gtk::Window? transient_for, transient_for=(parent : Gtk::Window?) : Nil transient_for=, unfullscreen : Nil unfullscreen, unmaximize : Nil unmaximize, unminimize : Nil unminimize
Constructor methods inherited from class Gtk::Window
new : selfnew(*, accessible_role : Gtk::AccessibleRole? = nil, application : Gtk::Application? = nil, can_focus : Bool? = nil, can_target : Bool? = nil, child : Gtk::Widget? = nil, css_classes : Enumerable(String)? = nil, css_name : String? = nil, cursor : Gdk::Cursor? = nil, decorated : Bool? = nil, default_height : Int32? = nil, default_widget : Gtk::Widget? = nil, default_width : Int32? = nil, deletable : Bool? = nil, destroy_with_parent : Bool? = nil, display : Gdk::Display? = nil, focus_on_click : Bool? = nil, focus_visible : Bool? = nil, focus_widget : Gtk::Widget? = nil, focusable : Bool? = nil, fullscreened : Bool? = nil, halign : Gtk::Align? = nil, handle_menubar_accel : Bool? = nil, has_default : Bool? = nil, has_focus : Bool? = nil, has_tooltip : Bool? = nil, height_request : Int32? = nil, hexpand : Bool? = nil, hexpand_set : Bool? = nil, hide_on_close : Bool? = nil, icon_name : String? = nil, is_active : Bool? = nil, layout_manager : Gtk::LayoutManager? = nil, margin_bottom : Int32? = nil, margin_end : Int32? = nil, margin_start : Int32? = nil, margin_top : Int32? = nil, maximized : Bool? = nil, mnemonics_visible : Bool? = nil, modal : Bool? = nil, name : String? = nil, opacity : Float64? = nil, overflow : Gtk::Overflow? = nil, parent : Gtk::Widget? = nil, receives_default : Bool? = nil, resizable : Bool? = nil, root : Gtk::Root? = nil, scale_factor : Int32? = nil, sensitive : Bool? = nil, startup_id : String? = nil, title : String? = nil, titlebar : Gtk::Widget? = nil, tooltip_markup : String? = nil, tooltip_text : String? = nil, transient_for : Gtk::Window? = nil, valign : Gtk::Align? = nil, vexpand : Bool? = nil, vexpand_set : Bool? = nil, visible : Bool? = nil, width_request : Int32? = nil) new
Class methods inherited from class Gtk::Window
auto_startup_notification=(setting : Bool) : Nil
auto_startup_notification=,
default_icon_name : String?
default_icon_name,
default_icon_name=(name : String) : Nil
default_icon_name=,
g_type : UInt64
g_type,
interactive_debugging=(enable : Bool) : Nil
interactive_debugging=,
list_toplevels : GLib::List
list_toplevels,
toplevels : Gio::ListModel
toplevels
Instance methods inherited from module Gtk::ShortcutManager
to_unsafe
to_unsafe
Class methods inherited from module Gtk::ShortcutManager
g_type : UInt64
g_type
Instance methods inherited from module Gtk::Root
display : Gdk::Display
display,
focus : Gtk::Widget?
focus,
focus=(focus : Gtk::Widget?) : Nil
focus=,
to_unsafe
to_unsafe
Class methods inherited from module Gtk::Root
g_type : UInt64
g_type
Instance methods inherited from module Gtk::Native
realize : Nil
realize,
renderer : Gsk::Renderer
renderer,
surface : Gdk::Surface
surface,
surface_transform(x : Float64, y : Float64) : Nil
surface_transform,
to_unsafe
to_unsafe,
unrealize : Nil
unrealize
Class methods inherited from module Gtk::Native
for_surface(surface : Gdk::Surface) : Gtk::Native?
for_surface,
g_type : UInt64
g_type
Instance methods inherited from module Gtk::ConstraintTarget
to_unsafe
to_unsafe
Class methods inherited from module Gtk::ConstraintTarget
g_type : UInt64
g_type
Instance methods inherited from module Gtk::Buildable
buildable_id : String?
buildable_id,
to_unsafe
to_unsafe
Class methods inherited from module Gtk::Buildable
g_type : UInt64
g_type
Instance methods inherited from module Gtk::Accessible
accessible_role : Gtk::AccessibleRole
accessible_role,
accessible_role=(value : Gtk::AccessibleRole) : Gtk::AccessibleRole
accessible_role=,
reset_property(property : Gtk::AccessibleProperty) : Nil
reset_property,
reset_relation(relation : Gtk::AccessibleRelation) : Nil
reset_relation,
reset_state(state : Gtk::AccessibleState) : Nil
reset_state,
to_unsafe
to_unsafe,
update_property(properties : Enumerable(Gtk::AccessibleProperty), values : Enumerable(_)) : Nil
update_property,
update_relation(relations : Enumerable(Gtk::AccessibleRelation), values : Enumerable(_)) : Nil
update_relation,
update_state(states : Enumerable(Gtk::AccessibleState), values : Enumerable(_)) : Nil
update_state
Class methods inherited from module Gtk::Accessible
g_type : UInt64
g_type
Instance methods inherited from class Gtk::Widget
action_set_enabled(action_name : String, enabled : Bool) : Nil
action_set_enabled,
activate : Bool
activate,
activate_action(name : String, args : _?) : Bool
activate_action,
activate_default : Nil
activate_default,
add_controller(controller : Gtk::EventController) : Nil
add_controller,
add_css_class(css_class : String) : Nil
add_css_class,
add_mnemonic_label(label : Gtk::Widget) : Nil
add_mnemonic_label,
add_tick_callback(callback : Gtk::TickCallback) : UInt32
add_tick_callback,
allocate(width : Int32, height : Int32, baseline : Int32, transform : Gsk::Transform?) : Nil
allocate,
allocated_baseline : Int32
allocated_baseline,
allocated_height : Int32
allocated_height,
allocated_width : Int32
allocated_width,
allocation : Gdk::Rectangle
allocation,
ancestor(widget_type : UInt64) : Gtk::Widget?
ancestor,
can_focus : Bool
can_focus,
can_focus=(can_focus : Bool) : Nil
can_focus=,
can_focus? : Bool
can_focus?,
can_target : Bool
can_target,
can_target=(can_target : Bool) : Nil
can_target=,
can_target? : Bool
can_target?,
child_focus(direction : Gtk::DirectionType) : Bool
child_focus,
child_visible : Bool
child_visible,
child_visible=(child_visible : Bool) : Nil
child_visible=,
clipboard : Gdk::Clipboard
clipboard,
compute_bounds(target : Gtk::Widget) : Graphene::Rect
compute_bounds,
compute_expand(orientation : Gtk::Orientation) : Bool
compute_expand,
compute_point(target : Gtk::Widget, point : Graphene::Point) : Graphene::Point
compute_point,
compute_transform(target : Gtk::Widget) : Graphene::Matrix
compute_transform,
contains(x : Float64, y : Float64) : Bool
contains,
create_pango_context : Pango::Context
create_pango_context,
create_pango_layout(text : String?) : Pango::Layout
create_pango_layout,
css_classes : Enumerable(String)
css_classes,
css_classes=(classes : Enumerable(String)) : Nil
css_classes=,
css_name : String
css_name,
css_name=(value : String) : String
css_name=,
cursor : Gdk::Cursor?
cursor,
cursor=(cursor : Gdk::Cursor?) : Nil
cursor=,
cursor_from_name=(name : String?) : Nil
cursor_from_name=,
destroy_signal
destroy_signal,
direction : Gtk::TextDirection
direction,
direction=(dir : Gtk::TextDirection) : Nil
direction=,
direction_changed_signal
direction_changed_signal,
display : Gdk::Display
display,
dispose_template(widget_type : UInt64) : Nil
dispose_template,
drag_check_threshold(start_x : Int32, start_y : Int32, current_x : Int32, current_y : Int32) : Bool
drag_check_threshold,
error_bell : Nil
error_bell,
first_child : Gtk::Widget?
first_child,
focus_child : Gtk::Widget?
focus_child,
focus_child=(child : Gtk::Widget?) : Nil
focus_child=,
focus_on_click : Bool
focus_on_click,
focus_on_click=(focus_on_click : Bool) : Nil
focus_on_click=,
focus_on_click? : Bool
focus_on_click?,
focusable : Bool
focusable,
focusable=(focusable : Bool) : Nil
focusable=,
focusable? : Bool
focusable?,
font_map : Pango::FontMap?
font_map,
font_map=(font_map : Pango::FontMap?) : Nil
font_map=,
font_options : Cairo::FontOptions?
font_options,
font_options=(options : Cairo::FontOptions?) : Nil
font_options=,
frame_clock : Gdk::FrameClock?
frame_clock,
grab_focus : Bool
grab_focus,
halign : Gtk::Align
halign,
halign=(align : Gtk::Align) : Nil
halign=,
has_css_class(css_class : String) : Bool
has_css_class,
has_default : Bool
has_default,
has_default? : Bool
has_default?,
has_focus : Bool
has_focus,
has_focus? : Bool
has_focus?,
has_tooltip : Bool
has_tooltip,
has_tooltip=(has_tooltip : Bool) : Nil
has_tooltip=,
has_tooltip? : Bool
has_tooltip?,
has_visible_focus : Bool
has_visible_focus,
height : Int32
height,
height_request : Int32
height_request,
height_request=(value : Int32) : Int32
height_request=,
hexpand : Bool
hexpand,
hexpand=(expand : Bool) : Nil
hexpand=,
hexpand? : Bool
hexpand?,
hexpand_set : Bool
hexpand_set,
hexpand_set=(set : Bool) : Nil
hexpand_set=,
hexpand_set? : Bool
hexpand_set?,
hide : Nil
hide,
hide_signal
hide_signal,
in_destruction : Bool
in_destruction,
init_template : Nil
init_template,
insert_action_group(name : String, group : Gio::ActionGroup?) : Nil
insert_action_group,
insert_after(parent : Gtk::Widget, previous_sibling : Gtk::Widget?) : Nil
insert_after,
insert_before(parent : Gtk::Widget, next_sibling : Gtk::Widget?) : Nil
insert_before,
is_ancestor(ancestor : Gtk::Widget) : Bool
is_ancestor,
is_drawable : Bool
is_drawable,
is_focus : Bool
is_focus,
is_sensitive : Bool
is_sensitive,
is_visible : Bool
is_visible,
keynav_failed(direction : Gtk::DirectionType) : Bool
keynav_failed,
keynav_failed_signal
keynav_failed_signal,
last_child : Gtk::Widget?
last_child,
layout_manager : Gtk::LayoutManager?
layout_manager,
layout_manager=(layout_manager : Gtk::LayoutManager?) : Nil
layout_manager=,
list_mnemonic_labels : GLib::List
list_mnemonic_labels,
map : Nil
map,
map_signal
map_signal,
mapped : Bool
mapped,
margin_bottom : Int32
margin_bottom,
margin_bottom=(margin : Int32) : Nil
margin_bottom=,
margin_end : Int32
margin_end,
margin_end=(margin : Int32) : Nil
margin_end=,
margin_start : Int32
margin_start,
margin_start=(margin : Int32) : Nil
margin_start=,
margin_top : Int32
margin_top,
margin_top=(margin : Int32) : Nil
margin_top=,
measure(orientation : Gtk::Orientation, for_size : Int32) : Nil
measure,
mnemonic_activate(group_cycling : Bool) : Bool
mnemonic_activate,
mnemonic_activate_signal
mnemonic_activate_signal,
move_focus_signal
move_focus_signal,
name : String
name,
name=(name : String) : Nil
name=,
native : Gtk::Native?
native,
next_sibling : Gtk::Widget?
next_sibling,
observe_children : Gio::ListModel
observe_children,
observe_controllers : Gio::ListModel
observe_controllers,
opacity : Float64
opacity,
opacity=(opacity : Float64) : Nil
opacity=,
overflow : Gtk::Overflow
overflow,
overflow=(overflow : Gtk::Overflow) : Nil
overflow=,
pango_context : Pango::Context
pango_context,
parent : Gtk::Widget?
parent,
parent=(parent : Gtk::Widget) : Nil
parent=,
pick(x : Float64, y : Float64, flags : Gtk::PickFlags) : Gtk::Widget?
pick,
preferred_size : Gtk::Requisition
preferred_size,
prev_sibling : Gtk::Widget?
prev_sibling,
primary_clipboard : Gdk::Clipboard
primary_clipboard,
query_tooltip_signal
query_tooltip_signal,
queue_allocate : Nil
queue_allocate,
queue_draw : Nil
queue_draw,
queue_resize : Nil
queue_resize,
realize : Nil
realize,
realize_signal
realize_signal,
realized : Bool
realized,
receives_default : Bool
receives_default,
receives_default=(receives_default : Bool) : Nil
receives_default=,
receives_default? : Bool
receives_default?,
remove_controller(controller : Gtk::EventController) : Nil
remove_controller,
remove_css_class(css_class : String) : Nil
remove_css_class,
remove_mnemonic_label(label : Gtk::Widget) : Nil
remove_mnemonic_label,
remove_tick_callback(id : UInt32) : Nil
remove_tick_callback,
request_mode : Gtk::SizeRequestMode
request_mode,
root : Gtk::Root?
root,
scale_factor : Int32
scale_factor,
sensitive : Bool
sensitive,
sensitive=(sensitive : Bool) : Nil
sensitive=,
sensitive? : Bool
sensitive?,
set_size_request(width : Int32, height : Int32) : Nil
set_size_request,
set_state_flags(flags : Gtk::StateFlags, clear : Bool) : Nil
set_state_flags,
settings : Gtk::Settings
settings,
should_layout : Bool
should_layout,
show : Nil
show,
show_signal
show_signal,
size(orientation : Gtk::Orientation) : Int32
size,
size_allocate(allocation : Gdk::Rectangle, baseline : Int32) : Nil
size_allocate,
size_request : Nil
size_request,
snapshot_child(child : Gtk::Widget, snapshot : Gtk::Snapshot) : Nil
snapshot_child,
state_flags : Gtk::StateFlags
state_flags,
state_flags_changed_signal
state_flags_changed_signal,
style_context : Gtk::StyleContext
style_context,
tooltip_markup : String?
tooltip_markup,
tooltip_markup=(value : String) : Stringtooltip_markup=(markup : String?) : Nil tooltip_markup=, tooltip_text : String? tooltip_text, tooltip_text=(value : String) : String
tooltip_text=(text : String?) : Nil tooltip_text=, translate_coordinates(dest_widget : Gtk::Widget, src_x : Float64, src_y : Float64) : Bool translate_coordinates, trigger_tooltip_query : Nil trigger_tooltip_query, unmap : Nil unmap, unmap_signal unmap_signal, unparent : Nil unparent, unrealize : Nil unrealize, unrealize_signal unrealize_signal, unset_state_flags(flags : Gtk::StateFlags) : Nil unset_state_flags, valign : Gtk::Align valign, valign=(align : Gtk::Align) : Nil valign=, vexpand : Bool vexpand, vexpand=(expand : Bool) : Nil vexpand=, vexpand? : Bool vexpand?, vexpand_set : Bool vexpand_set, vexpand_set=(set : Bool) : Nil vexpand_set=, vexpand_set? : Bool vexpand_set?, visible : Bool visible, visible=(visible : Bool) : Nil visible=, visible? : Bool visible?, width : Int32 width, width_request : Int32 width_request, width_request=(value : Int32) : Int32 width_request=
Constructor methods inherited from class Gtk::Widget
newnew(*, accessible_role : Gtk::AccessibleRole? = nil, can_focus : Bool? = nil, can_target : Bool? = nil, css_classes : Enumerable(String)? = nil, css_name : String? = nil, cursor : Gdk::Cursor? = nil, focus_on_click : Bool? = nil, focusable : Bool? = nil, halign : Gtk::Align? = nil, has_default : Bool? = nil, has_focus : Bool? = nil, has_tooltip : Bool? = nil, height_request : Int32? = nil, hexpand : Bool? = nil, hexpand_set : Bool? = nil, layout_manager : Gtk::LayoutManager? = nil, margin_bottom : Int32? = nil, margin_end : Int32? = nil, margin_start : Int32? = nil, margin_top : Int32? = nil, name : String? = nil, opacity : Float64? = nil, overflow : Gtk::Overflow? = nil, parent : Gtk::Widget? = nil, receives_default : Bool? = nil, root : Gtk::Root? = nil, scale_factor : Int32? = nil, sensitive : Bool? = nil, tooltip_markup : String? = nil, tooltip_text : String? = nil, valign : Gtk::Align? = nil, vexpand : Bool? = nil, vexpand_set : Bool? = nil, visible : Bool? = nil, width_request : Int32? = nil) new
Class methods inherited from class Gtk::Widget
default_direction : Gtk::TextDirection
default_direction,
default_direction=(dir : Gtk::TextDirection) : Nil
default_direction=,
g_type : UInt64
g_type
Instance methods inherited from module Gtk::ConstraintTarget
to_unsafe
to_unsafe
Class methods inherited from module Gtk::ConstraintTarget
g_type : UInt64
g_type
Instance methods inherited from module Gtk::Buildable
buildable_id : String?
buildable_id,
to_unsafe
to_unsafe
Class methods inherited from module Gtk::Buildable
g_type : UInt64
g_type
Instance methods inherited from module Gtk::Accessible
accessible_role : Gtk::AccessibleRole
accessible_role,
accessible_role=(value : Gtk::AccessibleRole) : Gtk::AccessibleRole
accessible_role=,
reset_property(property : Gtk::AccessibleProperty) : Nil
reset_property,
reset_relation(relation : Gtk::AccessibleRelation) : Nil
reset_relation,
reset_state(state : Gtk::AccessibleState) : Nil
reset_state,
to_unsafe
to_unsafe,
update_property(properties : Enumerable(Gtk::AccessibleProperty), values : Enumerable(_)) : Nil
update_property,
update_relation(relations : Enumerable(Gtk::AccessibleRelation), values : Enumerable(_)) : Nil
update_relation,
update_state(states : Enumerable(Gtk::AccessibleState), values : Enumerable(_)) : Nil
update_state
Class methods inherited from module Gtk::Accessible
g_type : UInt64
g_type
Constructor methods inherited from class GObject::InitiallyUnowned
new
new
Class methods inherited from class GObject::InitiallyUnowned
g_type : UInt64
g_type
Instance methods inherited from class GObject::Object
bind_property(source_property : String, target : GObject::Object, target_property : String, flags : GObject::BindingFlags) : GObject::Binding
bind_property,
bind_property_full(source_property : String, target : GObject::Object, target_property : String, flags : GObject::BindingFlags, transform_to : GObject::Closure, transform_from : GObject::Closure) : GObject::Binding
bind_property_full,
data(key : String) : Pointer(Void)?
data,
finalize
finalize,
freeze_notify : Nil
freeze_notify,
getv(names : Enumerable(String), values : Enumerable(_)) : Nil
getv,
notify(property_name : String) : Nil
notify,
notify_by_pspec(pspec : GObject::ParamSpec) : Nil
notify_by_pspec,
notify_signal
notify_signal,
property(property_name : String, value : _) : Nil
property,
qdata(quark : UInt32) : Pointer(Void)?
qdata,
ref_count : UInt32
ref_count,
run_dispose : Nil
run_dispose,
set_data(key : String, data : Pointer(Void)?) : Nil
set_data,
set_property(property_name : String, value : _) : Nil
set_property,
steal_data(key : String) : Pointer(Void)?
steal_data,
steal_qdata(quark : UInt32) : Pointer(Void)?
steal_qdata,
thaw_notify : Nil
thaw_notify,
to_unsafe : Pointer(Void)
to_unsafe,
watch_closure(closure : GObject::Closure) : Nil
watch_closure
Constructor methods inherited from class GObject::Object
cast(obj : GObject::Object) : self
cast,
cast?(obj : GObject::Object) : self?
cast?,
new(pointer : Pointer(Void), transfer : GICrystal::Transfer)new new, newv(object_type : UInt64, parameters : Enumerable(GObject::Parameter)) : self newv
Class methods inherited from class GObject::Object
compat_control(what : UInt64, data : Pointer(Void)?) : UInt64
compat_control,
g_type : UInt64
g_type,
interface_find_property(g_iface : GObject::TypeInterface, property_name : String) : GObject::ParamSpec
interface_find_property,
interface_list_properties(g_iface : GObject::TypeInterface) : Enumerable(GObject::ParamSpec)
interface_list_properties
Constructor Detail
Creates a new Adw::MessageDialog
.
@heading and @body can be set to NULL
. This can be useful if they need to
be formatted or use markup. In that case, set them to NULL
and call
MessageDialog::format_body
or similar methods afterwards:
WARNING ⚠️ The following code is in c ⚠️
Gtk::Widget *dialog;
dialog = adw_message_dialog_new (parent, _("Replace File?"), NULL);
adw_message_dialog_format_body (ADW_MESSAGE_DIALOG (dialog),
_("A file named “%s” already exists. Do you want to replace it?"),
filename);
Class Method Detail
Instance Method Detail
Adds a response with @id and @label to @self.
Responses are represented as buttons in the dialog.
Response ID must be unique. It will be used in
MessageDialog::#response
to tell which response had been activated,
as well as to inspect and modify the response later.
An embedded underline in @label indicates a mnemonic.
MessageDialog#response_label=
can be used to change the response
label after it had been added.
MessageDialog#response_enabled=
and
MessageDialog#response_appearance=
can be used to customize the
responses further.
Sets the ID of the close response of @self.
It will be passed to MessageDialog::#response
if the window is
closed by pressing Escape or with a system action.
It doesn't have to correspond to any of the responses in the dialog.
The default close response is close
.
Sets the ID of the default response of @self.
If set, pressing Enter will activate the corresponding button.
If set to NULL
or to a non-existent response ID, pressing Enter
will do nothing.
Sets the child widget of @self.
The child widget is displayed below the heading and body.
Gets whether @self has a response with the ID @response.
Emits the MessageDialog::#response
signal with the given response ID.
Used to indicate that the user has responded to the dialog in some way.
Gets the appearance of @response.
See MessageDialog#response_appearance=
.
Gets whether @response is enabled.
See MessageDialog#response_enabled=
.
Gets the label of @response.
See MessageDialog#response_label=
.
Sets the appearance for @response.
Use ADW_RESPONSE_SUGGESTED
to mark important responses such as the
affirmative action, like the Save button in the example.
Use ADW_RESPONSE_DESTRUCTIVE
to draw attention to the potentially damaging
consequences of using @response. This appearance acts as a warning to the
user. The Discard button in the example is using this appearance.
The default appearance is ADW_RESPONSE_DEFAULT
.
Negative responses like Cancel or Close should use the default appearance.
Sets whether @response is enabled.
If @response is not enabled, the corresponding button will have
Gtk::Widget#sensitive
set to FALSE
and it can't be activated as
a default response.
@response can still be used as [property@MessageDialog:close-response] while it's not enabled.
Responses are enabled by default.