gtkmm 3.24.9

Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Symbols | List of all members
Gtk::NativeDialog Class Reference

Integrate with native dialogs. More...

`#include <gtkmm/nativedialog.h>`

Inheritance diagram for Gtk::NativeDialog:
[legend]

## Public Member Functions
| NativeDialog (NativeDialog &&src) noexcept
NativeDialog & | operator= (NativeDialog &&src) noexcept
| ~NativeDialog () noexcept override
GtkNativeDialog * | gobj ()
| Provides access to the underlying C GObject.
const GtkNativeDialog * | gobj () const
| Provides access to the underlying C GObject.
GtkNativeDialog * | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
void | show ()
| Shows the dialog on the display, allowing the user to interact with it.
void | hide ()
| Hides the dialog if it is visilbe, aborting any interaction.
bool | get_visible () const
| Determines whether the dialog is visible.
void | set_modal (bool modal=true)
| Sets a dialog modal or non-modal.
bool | get_modal () const
| Returns whether the dialog is modal.
void | set_title (const Glib::ustring &title)
| Sets the title of the Gtk::NativeDialog.
Glib::ustring | get_title () const
| Gets the title of the Gtk::NativeDialog.
void | set_transient_for (Window & parent)
| Dialog windows should be set transient for the main application window they were spawned from.
void | unset_transient_for ()
| Unsets the current transient window.
Window * | get_transient_for ()
| Fetches the transient parent for this window.
const Window * | get_transient_for () const
| Fetches the transient parent for this window.
int | run ()
| Blocks in a recursive main loop until self emits the Gtk::NativeDialog::signal_response() signal.
Glib::PropertyProxy< Glib::ustring > | property_title ()
| The title of the dialog window.
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_title () const
| The title of the dialog window.
Glib::PropertyProxy< bool > | property_modal ()
| Whether the window should be modal with respect to its transient parent.
Glib::PropertyProxy_ReadOnly< bool > | property_modal () const
| Whether the window should be modal with respect to its transient parent.
Glib::PropertyProxy< bool > | property_visible ()
| Whether the window is currenlty visible.
Glib::PropertyProxy_ReadOnly< bool > | property_visible () const
| Whether the window is currenlty visible.
Glib::PropertyProxy< Window * > | property_transient_for ()
| The transient parent of the dialog, or `nullptr` for none.
Glib::PropertyProxy_ReadOnly< Window * > | property_transient_for () const
| The transient parent of the dialog, or `nullptr` for none.
Glib::SignalProxy< void, int > | signal_response ()
Public Member Functions inherited from Glib::Object
| Object (const Object &)=delete
Object & | operator= (const Object &)=delete
| Object (Object &&src) noexcept
Object & | operator= (Object &&src) noexcept
void * | get_data (const QueryQuark &key)
void | set_data (const Quark &key, void *data)
void | set_data (const Quark &key, void *data, DestroyNotify notify)
void | remove_data (const QueryQuark &quark)
void * | steal_data (const QueryQuark &quark)
Glib::RefPtr< Glib::Object > | wrap (GObject *object, bool take_copy=false)
Public Member Functions inherited from Glib::ObjectBase
| ObjectBase (const ObjectBase &)=delete
ObjectBase & | operator= (const ObjectBase &)=delete
void | set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
void | get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
void | set_property (const Glib::ustring &property_name, const PropertyType &value)
void | get_property (const Glib::ustring &property_name, PropertyType &value) const
void | connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void > &slot)
void | connect_property_changed (const Glib::ustring &property_name, sigc::slot< void > &&slot)
sigc::connection | connect_property_changed_with_return (const Glib::ustring &property_name, const sigc::slot< void > &slot)
sigc::connection | connect_property_changed_with_return (const Glib::ustring &property_name, sigc::slot< void > &&slot)
void | freeze_notify ()
void | thaw_notify ()
virtual void | reference () const
virtual void | unreference () const
GObject * | gobj ()
const GObject * | gobj () const
GObject * | gobj_copy () const
Public Member Functions inherited from sigc::trackable
| trackable () noexcept
| trackable (const trackable &src) noexcept
| trackable (trackable &&src)
| ~trackable ()
void | add_destroy_notify_callback (void *data, func_destroy_notify func) const
void | notify_callbacks ()
trackable & | operator= (const trackable &src)
trackable & | operator= (trackable &&src)
void | remove_destroy_notify_callback (void *data) const

## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system.

## Protected Member Functions
| NativeDialog ()
| There is no create() method that corresponds to this constructor, because only derived classes shall be created.
virtual void | on_response (int response_id)
| This is a default handler for the signal signal_response().
Protected Member Functions inherited from Glib::Object
| Object ()
| Object (const Glib::ConstructParams &construct_params)
| Object (GObject *castitem)
| ~Object () noexcept override
Protected Member Functions inherited from Glib::ObjectBase
| ObjectBase ()
| ObjectBase (const char *custom_type_name)
| ObjectBase (const std::type_info &custom_type_info)
| ObjectBase (ObjectBase &&src) noexcept
ObjectBase & | operator= (ObjectBase &&src) noexcept
virtual | ~ObjectBase () noexcept=0
void | initialize (GObject *castitem)
void | initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)

## Related Symbols
(Note that these are not member symbols.)
Glib::RefPtr< Gtk::NativeDialog > | wrap (GtkNativeDialog *object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Additional Inherited Members
Public Types inherited from Glib::Object
typedef void(*)(gpointer data | DestroyNotify)
Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify | func_destroy_notify

## Detailed Description

Integrate with native dialogs.

Native dialogs are platform dialogs that don't use Gtk::Dialog or Gtk::Window. They are used in order to integrate better with a platform, by looking the same as other native applications and supporting platform specific features.

The Gtk::Dialog functions cannot be used on such objects, but we need a similar API in order to drive them. The NativeDialog object is an API that allows you to do this. It allows you to set various common properties on the dialog, as well as show and hide it and get a response signal when the user finished with the dialog.

There is also a run() helper that makes it easy to run any native dialog in a modal way with a recursive mainloop, similar to Dialog::run().

See also
  Gtk::FileChooserNative, Gtk::Dialog

Since gtkmm 3.24

## Constructor & Destructor Documentation

## ◆ NativeDialog() [1/2]

Gtk::NativeDialog::NativeDialog | ( | NativeDialog && | src | ) |
| noexcept

## ◆ ~NativeDialog()

Gtk::NativeDialog::~NativeDialog | ( |  | ) |
| override noexcept

## ◆ NativeDialog() [2/2]

Gtk::NativeDialog::NativeDialog | ( |  | ) |
| protected

There is no create() method that corresponds to this constructor, because only derived classes shall be created.

## Member Function Documentation

## ◆ get_modal()

bool Gtk::NativeDialog::get_modal | ( |  | ) | const

Returns whether the dialog is modal.

See set_modal().

Since gtkmm 3.24

Returns
  `true` if the dialog is set to be modal.

## ◆ get_title()

Glib::ustring Gtk::NativeDialog::get_title | ( |  | ) | const

Gets the title of the Gtk::NativeDialog.

Since gtkmm 3.24

Returns
  The title of the dialog, or `nullptr` if none has been set explicitly. The returned string is owned by the widget and must not be modified or freed.

## ◆ get_transient_for() [1/2]

Window * Gtk::NativeDialog::get_transient_for | ( |  | ) |

Fetches the transient parent for this window.

See set_transient_for().

Since gtkmm 3.24

Returns
  The transient parent for this window, or `nullptr` if no transient parent has been set.

## ◆ get_transient_for() [2/2]

const Window * Gtk::NativeDialog::get_transient_for | ( |  | ) | const

Fetches the transient parent for this window.

See set_transient_for().

Since gtkmm 3.24

Returns
  The transient parent for this window, or `nullptr` if no transient parent has been set.

## ◆ get_type()

static GType Gtk::NativeDialog::get_type | ( |  | ) |
| static

Get the GType for this class, for use with the underlying GObject type system.

## ◆ get_visible()

bool Gtk::NativeDialog::get_visible | ( |  | ) | const

Determines whether the dialog is visible.

Since gtkmm 3.24

Returns
  `true` if the dialog is visible.

## ◆ gobj() [1/2]

GtkNativeDialog * Gtk::NativeDialog::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

## ◆ gobj() [2/2]

const GtkNativeDialog * Gtk::NativeDialog::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

## ◆ gobj_copy()

GtkNativeDialog * Gtk::NativeDialog::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

## ◆ hide()

void Gtk::NativeDialog::hide | ( |  | ) |

Hides the dialog if it is visilbe, aborting any interaction.

Once this is called the Gtk::NativeDialog::signal_response() signal will not be emitted until after the next call to show().

If the dialog is not visible this does nothing.

Since gtkmm 3.24

## ◆ on_response()

virtual void Gtk::NativeDialog::on_response | ( | int | response_id | ) |
| protected virtual

This is a default handler for the signal signal_response().

## ◆ operator=()

NativeDialog & Gtk::NativeDialog::operator= | ( | NativeDialog && | src | ) |
| noexcept

## ◆ property_modal() [1/2]

Glib::PropertyProxy< bool > Gtk::NativeDialog::property_modal | ( |  | ) |

Whether the window should be modal with respect to its transient parent.

Since gtkmm 3.24

Default value: `false`

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_modal() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::NativeDialog::property_modal | ( |  | ) | const

Whether the window should be modal with respect to its transient parent.

Since gtkmm 3.24

Default value: `false`

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_title() [1/2]

Glib::PropertyProxy< Glib::ustring > Gtk::NativeDialog::property_title | ( |  | ) |

The title of the dialog window.

Since gtkmm 3.24

Default value: ""

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_title() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::NativeDialog::property_title | ( |  | ) | const

The title of the dialog window.

Since gtkmm 3.24

Default value: ""

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_transient_for() [1/2]

Glib::PropertyProxy< Window * > Gtk::NativeDialog::property_transient_for | ( |  | ) |

The transient parent of the dialog, or `nullptr` for none.

Since gtkmm 3.24

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_transient_for() [2/2]

Glib::PropertyProxy_ReadOnly< Window * > Gtk::NativeDialog::property_transient_for | ( |  | ) | const

The transient parent of the dialog, or `nullptr` for none.

Since gtkmm 3.24

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_visible() [1/2]

Glib::PropertyProxy< bool > Gtk::NativeDialog::property_visible | ( |  | ) |

Whether the window is currenlty visible.

Since gtkmm 3.24

Default value: `false`

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_visible() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::NativeDialog::property_visible | ( |  | ) | const

Whether the window is currenlty visible.

Since gtkmm 3.24

Default value: `false`

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ run()

int Gtk::NativeDialog::run | ( |  | ) |

Blocks in a recursive main loop until self emits the Gtk::NativeDialog::signal_response() signal.

It then returns the response ID from the signal_response() signal emission.

Before entering the recursive main loop, run() calls show() on the dialog for you.

After run() returns, then dialog will be hidden.

Typical usage of this function might be:

[C example ellipted]

Note that even though the recursive main loop gives the effect of a modal dialog (it prevents the user from interacting with other windows in the same window group while the dialog is run), callbacks such as timeouts, IO channel watches, DND drops, etc, will be triggered during a gtk_nautilus_dialog_run() call.

Since gtkmm 3.24

Returns
  Response ID.

## ◆ set_modal()

void Gtk::NativeDialog::set_modal | ( | bool | modal = true | ) |

Sets a dialog modal or non-modal.

Modal dialogs prevent interaction with other windows in the same application. To keep modal dialogs on top of main application windows, use set_transient_for() to make the dialog transient for the parent; most [window managers][gtk-X11-arch] will then disallow lowering the dialog below the parent.

Since gtkmm 3.24

Parameters

  modal | Whether the window is modal.

## ◆ set_title()

void Gtk::NativeDialog::set_title | ( | const Glib::ustring & | title | ) |

Sets the title of the Gtk::NativeDialog.

Since gtkmm 3.24

Parameters

  title | Title of the dialog.

## ◆ set_transient_for()

void Gtk::NativeDialog::set_transient_for | ( | Window & | parent | ) |

Dialog windows should be set transient for the main application window they were spawned from.

This allows [window managers][gtk-X11-arch] to e.g. keep the dialog on top of the main window, or center the dialog over the main window.

Passing `nullptr` for parent unsets the current transient window.

Since gtkmm 3.24

Parameters

  parent | Parent window, or `nullptr`.

## ◆ show()

void Gtk::NativeDialog::show | ( |  | ) |

Shows the dialog on the display, allowing the user to interact with it.

When the user accepts the state of the dialog the dialog will be automatically hidden and the Gtk::NativeDialog::signal_response() signal will be emitted.

Multiple calls while the dialog is visible will be ignored.

Since gtkmm 3.24

## ◆ signal_response()

Glib::SignalProxy< void, int > Gtk::NativeDialog::signal_response | ( |  | ) |

Slot Prototype:
  `void on_my_response(int response_id)`

Flags: Run Last

Emitted when the user responds to the dialog.

When this is called the dialog has been hidden.

If you call Gtk::NativeDialog::hide() before the user responds to the dialog this signal will not be emitted.

Since gtkmm 3.24

Parameters

  response_id | The response ID.

## ◆ unset_transient_for()

void Gtk::NativeDialog::unset_transient_for | ( |  | ) |

Unsets the current transient window.

See also
  set_transient_for().

Since gtkmm 3.24

## Friends And Related Symbol Documentation

## ◆ wrap()

Glib::RefPtr< Gtk::NativeDialog > wrap | ( | GtkNativeDialog * | object,
|  | bool | take_copy = false )
| related

A Glib::wrap() method for this object.

Parameters

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns
  A C++ instance that wraps this C instance.