GtkWidget::accel-closures-changed
No description available.
GtkWidget::button-press-event
The ::button-press-event signal will be emitted when a button
(typically from a mouse) is pressed.
GtkWidget::button-release-event
The ::button-release-event signal will be emitted when a button
(typically from a mouse) is released.
GtkWidget::can-activate-accel
Determines whether an accelerator that activates the signal
identified by signal_id
can currently be activated.
This signal is present to allow applications and derived
widgets to override the default GtkWidget
handling
for determining whether an accelerator can be activated.
GtkWidget::child-notify
The ::child-notify signal is emitted for each
[child property][child-properties] that has
changed on an object. The signal’s detail holds the property name.
GtkWidget::composited-changed
The ::composited-changed signal is emitted when the composited
status of widgets
screen changes.
See gdk_screen_is_composited().
deprecated: 3.22
GtkWidget::configure-event
The ::configure-event signal will be emitted when the size, position or
stacking of the widget
‘s window has changed.
GtkWidget::damage-event
Emitted when a redirected window belonging to widget
gets drawn into.
The region/area members of the event shows what area of the redirected
drawable was drawn into.
since: 2.14
GtkWidget::delete-event
The ::delete-event signal is emitted if a user requests that
a toplevel window is closed. The default handler for this signal
destroys the window. Connecting gtk_widget_hide_on_delete()
to
this signal will cause the window to be hidden instead, so that
it can later be shown again without reconstructing it.
GtkWidget::destroy
Signals that all holders of a reference to the widget should release
the reference that they hold. May result in finalization of the widget
if all references are released.
GtkWidget::destroy-event
The ::destroy-event signal is emitted when a GdkWindow
is destroyed.
You rarely get this signal, because most widgets disconnect themselves
from their window before they destroy it, so no widget owns the
window at destroy time.
GtkWidget::direction-changed
The ::direction-changed signal is emitted when the text direction
of a widget changes.
GtkWidget::drag-begin
The ::drag-begin signal is emitted on the drag source when a drag is
started. A typical reason to connect to this signal is to set up a
custom drag icon with e.g. gtk_drag_source_set_icon_pixbuf().
GtkWidget::drag-data-delete
The ::drag-data-delete signal is emitted on the drag source when a drag
with the action GDK_ACTION_MOVE
is successfully completed. The signal
handler is responsible for deleting the data that has been dropped. What
“delete” means depends on the context of the drag operation.
GtkWidget::drag-data-get
The ::drag-data-get signal is emitted on the drag source when the drop
site requests the data which is dragged. It is the responsibility of
the signal handler to fill data
with the data in the format which
is indicated by info
. See gtk_selection_data_set()
and gtk_selection_data_set_text().
GtkWidget::drag-data-received
The ::drag-data-received signal is emitted on the drop site when the
dragged data has been received. If the data was received in order to
determine whether the drop will be accepted, the handler is expected
to call gdk_drag_status()
and not finish the drag.
If the data was received in response to a GtkWidget::drag-drop
signal
(and this is the last target to be received), the handler for this
signal is expected to process the received data and then call
gtk_drag_finish(), setting the success
parameter depending on
whether the data was processed successfully.
GtkWidget::drag-drop
The ::drag-drop signal is emitted on the drop site when the user drops
the data onto the widget. The signal handler must determine whether
the cursor position is in a drop zone or not. If it is not in a drop
zone, it returns FALSE
and no further processing is necessary.
Otherwise, the handler returns TRUE
. In this case, the handler must
ensure that gtk_drag_finish()
is called to let the source know that
the drop is done. The call to gtk_drag_finish()
can be done either
directly or in a GtkWidget::drag-data-received
handler which gets
triggered by calling gtk_drag_get_data()
to receive the data for one
or more of the supported targets.
GtkWidget::drag-end
The ::drag-end signal is emitted on the drag source when a drag is
finished. A typical reason to connect to this signal is to undo
things done in GtkWidget::drag-begin
.
GtkWidget::drag-failed
The ::drag-failed signal is emitted on the drag source when a drag has
failed. The signal handler may hook custom code to handle a failed DnD
operation based on the type of error, it returns TRUE
is the failure has
been already handled (not showing the default “drag operation failed”
animation), otherwise it returns FALSE
.
since: 2.12
GtkWidget::drag-leave
The ::drag-leave signal is emitted on the drop site when the cursor
leaves the widget. A typical reason to connect to this signal is to
undo things done in GtkWidget::drag-motion
, e.g. undo highlighting
with gtk_drag_unhighlight().
GtkWidget::drag-motion
The ::drag-motion signal is emitted on the drop site when the user
moves the cursor over the widget during a drag. The signal handler
must determine whether the cursor position is in a drop zone or not.
If it is not in a drop zone, it returns FALSE
and no further processing
is necessary. Otherwise, the handler returns TRUE
. In this case, the
handler is responsible for providing the necessary information for
displaying feedback to the user, by calling gdk_drag_status().
GtkWidget::draw
This signal is emitted when a widget is supposed to render itself.
The widget
‘s top left corner must be painted at the origin of
the passed in context and be sized to the values returned by
gtk_widget_get_allocated_width()
and gtk_widget_get_allocated_height().
since: 3.0
GtkWidget::enter-notify-event
The ::enter-notify-event will be emitted when the pointer enters
the widget
‘s window.
GtkWidget::event
The GTK+ main loop will emit three signals for each GDK event delivered
to a widget: one generic ::event signal, another, more specific,
signal that matches the type of event delivered (e.g.
GtkWidget::key-press-event
) and finally a generic
GtkWidget::event-after
signal.
GtkWidget::event-after
After the emission of the GtkWidget::event
signal and (optionally)
the second more specific signal, ::event-after will be emitted
regardless of the previous two signals handlers return values.
GtkWidget::focus
No description available.
GtkWidget::focus-in-event
The ::focus-in-event signal will be emitted when the keyboard focus
enters the widget
‘s window.
GtkWidget::focus-out-event
The ::focus-out-event signal will be emitted when the keyboard focus
leaves the widget
‘s window.
GtkWidget::grab-broken-event
Emitted when a pointer or keyboard grab on a window belonging
to widget
gets broken.
since: 2.8
GtkWidget::grab-focus
No description available.
GtkWidget::grab-notify
The ::grab-notify signal is emitted when a widget becomes
shadowed by a GTK+ grab (not a pointer or keyboard grab) on
another widget, or when it becomes unshadowed due to a grab
being removed.
GtkWidget::hide
The ::hide signal is emitted when widget
is hidden, for example with gtk_widget_hide().
GtkWidget::hierarchy-changed
The ::hierarchy-changed signal is emitted when the
anchored state of a widget changes. A widget is
“anchored” when its toplevel
ancestor is a GtkWindow
. This signal is emitted when
a widget changes from un-anchored to anchored or vice-versa.
GtkWidget::key-press-event
The ::key-press-event signal is emitted when a key is pressed. The signal
emission will reoccur at the key-repeat rate when the key is kept pressed.
GtkWidget::key-release-event
The ::key-release-event signal is emitted when a key is released.
GtkWidget::keynav-failed
Gets emitted if keyboard navigation fails.
See gtk_widget_keynav_failed()
for details.
since: 2.12
GtkWidget::leave-notify-event
The ::leave-notify-event will be emitted when the pointer leaves
the widget
‘s window.
GtkWidget::map
The ::map signal is emitted when widget
is going to be mapped, that is
when the widget is visible (which is controlled with
gtk_widget_set_visible()) and all its parents up to the toplevel widget
are also visible. Once the map has occurred, GtkWidget::map-event
will
be emitted.
GtkWidget::map-event
The ::map-event signal will be emitted when the widget
‘s window is
mapped. A window is mapped when it becomes visible on the screen.
GtkWidget::mnemonic-activate
The default handler for this signal activates widget
if group_cycling
is FALSE
, or just makes widget
grab focus if group_cycling
is TRUE
.
GtkWidget::motion-notify-event
The ::motion-notify-event signal is emitted when the pointer moves
over the widget’s GdkWindow
.
GtkWidget::move-focus
No description available.
GtkWidget::parent-set
The ::parent-set signal is emitted when a new parent
has been set on a widget.
GtkWidget::popup-menu
This signal gets emitted whenever a widget should pop up a context
menu. This usually happens through the standard key binding mechanism;
by pressing a certain key while a widget is focused, the user can cause
the widget to pop up a menu. For example, the GtkEntry
widget creates
a menu with clipboard commands. See the
[Popup Menu Migration Checklist][checklist-popup-menu]
for an example of how to use this signal.
GtkWidget::property-notify-event
The ::property-notify-event signal will be emitted when a property on
the widget
‘s window has been changed or deleted.
GtkWidget::proximity-in-event
To receive this signal the GdkWindow
associated to the widget needs
to enable the #GDK_PROXIMITY_IN_MASK mask.
GtkWidget::proximity-out-event
To receive this signal the GdkWindow
associated to the widget needs
to enable the #GDK_PROXIMITY_OUT_MASK mask.
GtkWidget::query-tooltip
Emitted when GtkWidget:has-tooltip
is TRUE
and the hover timeout
has expired with the cursor hovering “above” widget
; or emitted when widget
got
focus in keyboard mode.
since: 2.12
GtkWidget::realize
The ::realize signal is emitted when widget
is associated with a
GdkWindow
, which means that gtk_widget_realize()
has been called or the
widget has been mapped (that is, it is going to be drawn).
GtkWidget::screen-changed
The ::screen-changed signal gets emitted when the
screen of a widget has changed.
GtkWidget::scroll-event
The ::scroll-event signal is emitted when a button in the 4 to 7
range is pressed. Wheel mice are usually configured to generate
button press events for buttons 4 and 5 when the wheel is turned.
GtkWidget::selection-clear-event
The ::selection-clear-event signal will be emitted when the
the widget
‘s window has lost ownership of a selection.
GtkWidget::selection-get
No description available.
GtkWidget::selection-notify-event
No description available.
GtkWidget::selection-received
No description available.
GtkWidget::selection-request-event
The ::selection-request-event signal will be emitted when
another client requests ownership of the selection owned by
the widget
‘s window.
GtkWidget::show
The ::show signal is emitted when widget
is shown, for example with gtk_widget_show().
GtkWidget::show-help
No description available.
GtkWidget::size-allocate
No description available.
GtkWidget::state-changed
The ::state-changed signal is emitted when the widget state changes.
See gtk_widget_get_state().
deprecated: 3.0
GtkWidget::state-flags-changed
The ::state-flags-changed signal is emitted when the widget state
changes, see gtk_widget_get_state_flags().
since: 3.0
GtkWidget::style-set
The ::style-set signal is emitted when a new style has been set
on a widget. Note that style-modifying functions like
gtk_widget_modify_base()
also cause this signal to be emitted.
deprecated: 3.0
GtkWidget::style-updated
The ::style-updated signal is a convenience signal that is emitted when the
GtkStyleContext::changed
signal is emitted on the widget
‘s associated
GtkStyleContext
as returned by gtk_widget_get_style_context().
since: 3.0
GtkWidget::touch-event
No description available.
GtkWidget::unmap
The ::unmap signal is emitted when widget
is going to be unmapped, which
means that either it or any of its parents up to the toplevel widget have
been set as hidden.
GtkWidget::unmap-event
The ::unmap-event signal will be emitted when the widget
‘s window is
unmapped. A window is unmapped when it becomes invisible on the screen.
GtkWidget::unrealize
The ::unrealize signal is emitted when the GdkWindow
associated with
widget
is destroyed, which means that gtk_widget_unrealize()
has been
called or the widget has been unmapped (that is, it is going to be hidden).
GtkWidget::visibility-notify-event
The ::visibility-notify-event will be emitted when the widget
‘s
window is obscured or unobscured.
deprecated: 3.12
GtkWidget::window-state-event
The ::window-state-event will be emitted when the state of the
toplevel window associated to the widget
changes.
g
Atk.ImplementorIface
Atk.ImplementorIface
Gtk.Widget
Gtk.Widget
Atk.ImplementorIface->Gtk.Widget
GObject.GInterface
GObject.GInterface
GObject.GInterface->Atk.ImplementorIface
Gtk.Buildable
Gtk.Buildable
GObject.GInterface->Gtk.Buildable
GObject.InitiallyUnowned
GObject.InitiallyUnowned
GObject.InitiallyUnowned->Gtk.Widget
GObject.Object
GObject.Object
GObject.Object->GObject.InitiallyUnowned
Gtk.Bin
Gtk.Bin
Gtk.Window
Gtk.Window
Gtk.Bin->Gtk.Window
Gtk.Buildable->Gtk.Widget
Gtk.Container
Gtk.Container
Gtk.Container->Gtk.Bin
Gtk.Dialog
Gtk.Dialog
Gtk.MessageDialog
Gtk.MessageDialog
Gtk.Dialog->Gtk.MessageDialog
Gtk.Widget->Gtk.Container
Gtk.Window->Gtk.Dialog
Example¶
Subclasses: | None |
---|
Class Details¶
-
class
Gtk.
MessageDialog
(*args, **kwargs)¶ -
Bases: Gtk.Dialog
Abstract: No Structure: Gtk.MessageDialogClass
Gtk.MessageDialog
presents a dialog with some message text. It’s simply a
convenience widget; you could construct the equivalent ofGtk.MessageDialog
fromGtk.Dialog
without too much effort, butGtk.MessageDialog
saves typing.One difference from
Gtk.Dialog
is thatGtk.MessageDialog
sets the
Gtk.Window
:skip-taskbar-hint
property toTrue
, so that the dialog is hidden
from the taskbar by default.The easiest way to do a modal message dialog is to use
Gtk.Dialog.run
(), though
you can also pass in theGtk.DialogFlags.MODAL
flag,Gtk.Dialog.run
() automatically
makes the dialog modal and waits for the user to respond to it.Gtk.Dialog.run
()
returns when any dialog button is clicked.An example for using a modal dialog:
GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; dialog = gtk_message_dialog_new (parent_window, flags, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "Error reading “%s”: %s", filename, g_strerror (errno)); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog);
You might do a non-modal
Gtk.MessageDialog
as follows:An example for a non-modal dialog:
GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT; dialog = gtk_message_dialog_new (parent_window, flags, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "Error reading “%s”: %s", filename, g_strerror (errno)); // Destroy the dialog when the user responds to it // (e.g. clicks a button) g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog);
Gtk.MessageDialog
asGtk.Buildable
The
Gtk.MessageDialog
implementation of theGtk.Buildable
interface exposes
the message area as an internal child with the name “message_area”.-
format_secondary_markup
(message_format)[source]¶ -
Sets the secondary text of the message dialog to be message_format (with
printf()-style), which is marked up with the
Pango text markup language.Due to an oversight, this function does not escape special XML characters
like gtk_message_dialog_new_with_markup() does. Thus, if the arguments
may contain special XML characters, you should use g_markup_printf_escaped()
to escape it.gchar *msg; msg = g_markup_printf_escaped (message_format, ...); gtk_message_dialog_format_secondary_markup (message_dialog, "%s", msg); g_free (msg);
New in version 2.6.
-
format_secondary_text
(message_format)[source]¶ -
Sets the secondary text of the message dialog to be message_format
(with printf()-style).New in version 2.6.
-
get_image
()[source]¶ -
Returns: the dialog’s image Return type: Gtk.Widget
Gets the dialog’s image.
New in version 2.14.
Deprecated since version 3.12: Use
Gtk.Dialog
for dialogs with images
-
get_message_area
()[source]¶ -
Returns: A Gtk.Box
corresponding to the
“message area” in the self.Return type: Gtk.Widget
Returns the message area of the dialog. This is the box where the
dialog’s primary and secondary labels are packed. You can add your
own extra content to that box and it will appear below those labels.
SeeGtk.Dialog.get_content_area
() for the corresponding
function in the parentGtk.Dialog
.New in version 2.22.
-
set_image
(image)[source]¶ -
Parameters: image ( Gtk.Widget
) – the imageSets the dialog’s image to image.
New in version 2.10.
Deprecated since version 3.12: Use
Gtk.Dialog
to create dialogs with images
-
set_markup
(str)[source]¶ -
Parameters: str ( str
) – markup string (see Pango markup format)Sets the text of the message dialog to be str, which is marked
up with the Pango text markup language.New in version 2.4.
Property Details¶
-
Gtk.MessageDialog.props.
buttons
¶ -
Name: buttons
Type: Gtk.ButtonsType
Default Value: Gtk.ButtonsType.NONE
Flags: WRITABLE
,CONSTRUCT_ONLY
The buttons shown in the message dialog
-
Gtk.MessageDialog.props.
image
¶ -
Name: image
Type: Gtk.Widget
Default Value: None
Flags: DEPRECATED
,READABLE
,WRITABLE
The image for this dialog.
New in version 2.10.
Deprecated since version 3.12: Use
Gtk.Dialog
to create dialogs with images
-
Gtk.MessageDialog.props.
message_area
¶ -
Name: message-area
Type: Gtk.Widget
Default Value: None
Flags: READABLE
The
Gtk.Box
that corresponds to the message area of this dialog. See
Gtk.MessageDialog.get_message_area
() for a detailed description of this
area.New in version 2.22.
-
Gtk.MessageDialog.props.
message_type
¶ -
Name: message-type
Type: Gtk.MessageType
Default Value: Gtk.MessageType.INFO
Flags: READABLE
,WRITABLE
,CONSTRUCT
,EXPLICIT_NOTIFY
The type of the message.
-
Gtk.MessageDialog.props.
secondary_text
¶ -
Name: secondary-text
Type: str
Default Value: None
Flags: READABLE
,WRITABLE
The secondary text of the message dialog.
New in version 2.10.
-
Gtk.MessageDialog.props.
secondary_use_markup
¶ -
Name: secondary-use-markup
Type: bool
Default Value: False
Flags: READABLE
,WRITABLE
,EXPLICIT_NOTIFY
True
if the secondary text of the dialog includes Pango markup.
SeePango.parse_markup
().New in version 2.10.
-
Gtk.MessageDialog.props.
text
¶ -
Name: text
Type: str
Default Value: ''
Flags: READABLE
,WRITABLE
The primary text of the message dialog. If the dialog has
a secondary text, this will appear as the title.New in version 2.10.
-
Gtk.MessageDialog.props.
use_markup
¶ -
Name: use-markup
Type: bool
Default Value: False
Flags: READABLE
,WRITABLE
,EXPLICIT_NOTIFY
True
if the primary text of the dialog includes Pango markup.
SeePango.parse_markup
().New in version 2.10.
Description
GtkMessageDialog представляет собой диалоговое окно с текстом сообщения. Это просто удобный виджет; вы можете создать эквивалент GtkMessageDialog из GtkDialog без особых усилий, но GtkMessageDialog экономит ввод текста.
Самый простой способ создать диалоговое окно модального сообщения — использовать флаг GTK_DIALOG_MODAL
, который будет вызывать gtk_window_set_modal()
внутри. Диалог предотвратит взаимодействие с родительским окном, пока оно не будет скрыто или уничтожено. Вы можете использовать сигнал «ответ» , чтобы узнать, когда пользователь закрыл диалог.
Пример использования модального диалога:
Вы можете сделать немодальный GtkMessageDialog , просто опуская флаг GTK_DIALOG_MODAL
:
GtkMessageDialog как GtkBuildable
Реализация GtkMessageDialog интерфейса GtkBuildable раскрывает область сообщений в качестве внутреннего дочернего элемента с именем «message_area».
Functions
gtk_message_dialog_new ()
GtkWidget *
gtk_message_dialog_new (GtkWindow *parent,
GtkDialogFlags flags,
GtkMessageType type,
GtkButtonsType buttons,
const char *message_format,
...);
Создает новое диалоговое окно сообщения, которое представляет собой простое диалоговое окно с некоторым текстом, который пользователь может захотеть увидеть. Когда пользователь нажимает кнопку, выдается сигнал «ответ» с идентификаторами ответа из GtkResponseType . См. GtkDialog для более подробной информации.
Parameters
parent |
временный родительский |
[allow-none] |
flags |
flags |
|
type |
тип сообщения |
|
buttons |
набор кнопок для использования |
|
message_format |
printf () — строка формата стиля или |
[allow-none] |
… |
аргументы для |
gtk_message_dialog_new_with_markup ()
GtkWidget *
gtk_message_dialog_new_with_markup (GtkWindow *parent,
GtkDialogFlags flags,
GtkMessageType type,
GtkButtonsType buttons,
const char *message_format,
...);
Создает новое диалоговое окно сообщения, которое представляет собой простое диалоговое окно с некоторым текстом, размеченным с помощью языка разметки текста Pango. Когда пользователь нажимает кнопку, выдается сигнал «ответ» с идентификаторами ответа из GtkResponseType . См. GtkDialog для более подробной информации.
Специальные символы XML в аргументах printf()
, передаваемых этой функции, при необходимости будут автоматически экранированы. (О том, как это реализовано, см. g_markup_printf_escaped()
.) Обычно это то, что вам нужно, но если у вас есть существующая строка разметки Pango, которую вы хотите использовать буквально как метку, вам нужно вместо этого использовать gtk_message_dialog_set_markup(), gtk_message_dialog_set_markup()
вы не может передать строку разметки ни в виде формата (она может содержать символы «%»), ни в виде строкового аргумента.
Parameters
parent |
временный родительский |
[allow-none] |
flags |
flags |
|
type |
тип сообщения |
|
buttons |
набор кнопок для использования |
|
message_format |
printf () — строка формата стиля или |
[allow-none] |
… |
аргументы для |
gtk_message_dialog_set_markup ()
void
gtk_message_dialog_set_markup (GtkMessageDialog *message_dialog,
const char *str);
Устанавливает текст диалогового окна сообщения как str
, который размечен языком разметки текста Pango.
Parameters
message_dialog |
a GtkMessageDialog |
|
str |
строка разметки (см.формат разметки Pango) |
gtk_message_dialog_format_secondary_text ()
void
gtk_message_dialog_format_secondary_text
(GtkMessageDialog *message_dialog,
const char *message_format,
...);
Устанавливает вторичный текст диалогового окна сообщения как message_format
(со printf()
).
Parameters
message_dialog |
a GtkMessageDialog |
|
message_format |
printf () — строка формата стиля или |
[allow-none] |
… |
аргументы для |
gtk_message_dialog_format_secondary_markup ()
void
gtk_message_dialog_format_secondary_markup
(GtkMessageDialog *message_dialog,
const char *message_format,
...);
Устанавливает вторичный текст диалогового окна сообщения как message_format
(со printf()
), который размечен языком разметки текста Pango.
По недосмотру эта функция не экранирует специальные символы XML, такие как gtk_message_dialog_new_with_markup()
. Таким образом, если аргументы могут содержать специальные символы XML, вы должны использовать g_markup_printf_escaped()
чтобы избежать этого.
GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL; dialog = gtk_message_dialog_new (parent_window, flags, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "Error reading “%s”: %s", filename, g_strerror (errno)); g_signal_connect (dialog, "response", G_CALLBACK (gtk_window_destroy), NULL);
Parameters
message_dialog |
a GtkMessageDialog |
|
message_format |
printf () — строка разметки стиля (см. формат разметки Pango) или |
|
… |
аргументы для |
gtk_message_dialog_get_message_area ()
GtkWidget *
gtk_message_dialog_get_message_area (GtkMessageDialog *message_dialog);
Возвращает область сообщений диалога. Это поле, в котором упакованы первичная и вторичная метки диалогового окна. Вы можете добавить в это поле свой собственный дополнительный контент, и он появится под этими метками. См. gtk_dialog_get_content_area()
для соответствующей функции в родительском GtkDialog .
Parameters
Returns
GtkBox , соответствующий «области сообщений» в message_dialog
.
[transfer none]
Property Details
Свойство « кнопки “buttons”
“buttons” GtkButtonsType
Кнопки,отображаемые в диалоге сообщений.
Owner: GtkMessageDialog
Флаги:Только запись/конструирование
Значение по умолчанию:GTK_BUTTONS_NONE
Свойство « message “message-area”
“message-area” GtkWidget *
GtkBox , что соответствует области сообщений этого диалога. См. gtk_message_dialog_get_message_area()
для подробного описания этой области.
Owner: GtkMessageDialog
Flags: Read
Свойство “message-type”
»
“message-type” GtkMessageType
Тип сообщения.
Owner: GtkMessageDialog
Флаги:Чтение/Запись/Конструкция
Значение по умолчанию:GTK_MESSAGE_INFO
Свойство “secondary-text”
»
“secondary-text” char *
Вторичный текст диалога сообщения.
Owner: GtkMessageDialog
Флаги:Чтение/запись
Значение по умолчанию:NULL
Свойство вторичной “secondary-use-markup”
“secondary-use-markup” gboolean
TRUE
, если вторичный текст диалогового окна содержит разметку Pango. См. pango_parse_markup()
.
Owner: GtkMessageDialog
Флаги:Чтение/запись
Значение по умолчанию:FALSE
Свойство « текст “text”
“text” char *
Основной текст диалога сообщения.Если у диалога есть вторичный текст,он будет отображаться в качестве заголовка.
Owner: GtkMessageDialog
Флаги:Чтение/запись
Значение по умолчанию:»»
Свойство « “use-markup”
“use-markup” gboolean
TRUE
, если основной текст диалогового окна содержит разметку Pango. См. pango_parse_markup()
.
Owner: GtkMessageDialog
Флаги:Чтение/запись
Значение по умолчанию:FALSE
GtkMessageDialog — A convenient message window
Functions
Properties
Types and Values
Includes
#include <gtk/gtk.h>
Description
GtkMessageDialog presents a dialog with some message text. It’s simply a convenience widget; you could construct the equivalent of GtkMessageDialog from GtkDialog without too much effort, but GtkMessageDialog saves typing.
The easiest way to do a modal message dialog is to use the GTK_DIALOG_MODAL
flag, which will call gtk_window_set_modal()
internally. The dialog will prevent interaction with the parent window until it’s hidden or destroyed. You can use the “response” signal to know when the user dismissed the dialog.
An example for using a modal dialog:
You might do a non-modal GtkMessageDialog simply by omitting the GTK_DIALOG_MODAL
flag:
GtkMessageDialog as GtkBuildable
The GtkMessageDialog implementation of the GtkBuildable interface exposes the message area as an internal child with the name “message_area”.
Functions
gtk_message_dialog_new ()
GtkWidget * gtk_message_dialog_new (GtkWindow *parent
,GtkDialogFlags flags
,GtkMessageType type
,GtkButtonsType buttons
,const char *message_format
,...
);
Creates a new message dialog, which is a simple dialog with some text the user may want to see. When the user clicks a button a “response” signal is emitted with response IDs from GtkResponseType. See GtkDialog for more details.
Parameters
parent |
transient parent, or |
[allow-none] |
flags |
flags |
|
type |
type of message |
|
buttons |
set of buttons to use |
|
message_format |
printf()-style format string, or |
[allow-none] |
… |
arguments for |
gtk_message_dialog_new_with_markup ()
GtkWidget * gtk_message_dialog_new_with_markup (GtkWindow *parent
,GtkDialogFlags flags
,GtkMessageType type
,GtkButtonsType buttons
,const char *message_format
,...
);
Creates a new message dialog, which is a simple dialog with some text that is marked up with the Pango text markup language. When the user clicks a button a “response” signal is emitted with response IDs from GtkResponseType. See GtkDialog for more details.
Special XML characters in the printf()
arguments passed to this function will automatically be escaped as necessary. (See g_markup_printf_escaped()
for how this is implemented.) Usually this is what you want, but if you have an existing Pango markup string that you want to use literally as the label, then you need to use gtk_message_dialog_set_markup()
instead, since you can’t pass the markup string either as the format (it might contain “%” characters) or as a string argument.
Parameters
parent |
transient parent, or |
[allow-none] |
flags |
flags |
|
type |
type of message |
|
buttons |
set of buttons to use |
|
message_format |
printf()-style format string, or |
[allow-none] |
… |
arguments for |
gtk_message_dialog_set_markup ()
void gtk_message_dialog_set_markup (GtkMessageDialog *message_dialog
,const char *str
);
Sets the text of the message dialog to be str
, which is marked up with the Pango text markup language.
Parameters
gtk_message_dialog_format_secondary_text ()
void gtk_message_dialog_format_secondary_text (GtkMessageDialog *message_dialog
,const char *message_format
,...
);
Sets the secondary text of the message dialog to be message_format
(with printf()
-style).
Parameters
message_dialog |
a GtkMessageDialog |
|
message_format |
printf()-style format string, or |
[allow-none] |
… |
arguments for |
gtk_message_dialog_format_secondary_markup ()
void gtk_message_dialog_format_secondary_markup (GtkMessageDialog *message_dialog
,const char *message_format
,...
);
Sets the secondary text of the message dialog to be message_format
(with printf()
-style), which is marked up with the Pango text markup language.
Due to an oversight, this function does not escape special XML characters like gtk_message_dialog_new_with_markup()
does. Thus, if the arguments may contain special XML characters, you should use g_markup_printf_escaped()
to escape it.
GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL; dialog = gtk_message_dialog_new (parent_window, flags, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "Error reading “%s”: %s", filename, g_strerror (errno)); // Destroy the dialog when the user responds to it // (e.g. clicks a button) g_signal_connect (dialog, "response", G_CALLBACK (gtk_window_destroy), NULL);
Parameters
message_dialog |
a GtkMessageDialog |
|
message_format |
printf()-style markup string (see Pango markup format), or |
|
… |
arguments for |
gtk_message_dialog_get_message_area ()
GtkWidget *
gtk_message_dialog_get_message_area (GtkMessageDialog *message_dialog
);
Returns the message area of the dialog. This is the box where the dialog’s primary and secondary labels are packed. You can add your own extra content to that box and it will appear below those labels. See gtk_dialog_get_content_area()
for the corresponding function in the parent GtkDialog.
Parameters
Returns
A GtkBox corresponding to the “message area” in the message_dialog
.
[transfer none]
Types and Values
struct GtkMessageDialog
struct GtkMessageDialog;
enum GtkMessageType
The type of message being displayed in the dialog.
Members
GTK_MESSAGE_INFO |
Informational message |
|
GTK_MESSAGE_WARNING |
Non-fatal warning message |
|
GTK_MESSAGE_QUESTION |
Question requiring a choice |
|
GTK_MESSAGE_ERROR |
Fatal error message |
|
GTK_MESSAGE_OTHER |
None of the above |
enum GtkButtonsType
Prebuilt sets of buttons for the dialog. If none of these choices are appropriate, simply use GTK_BUTTONS_NONE
then call gtk_dialog_add_buttons()
.
Members
GTK_BUTTONS_NONE |
no buttons at all |
|
GTK_BUTTONS_OK |
an OK button |
|
GTK_BUTTONS_CLOSE |
a Close button |
|
GTK_BUTTONS_CANCEL |
a Cancel button |
|
GTK_BUTTONS_YES_NO |
Yes and No buttons |
|
GTK_BUTTONS_OK_CANCEL |
OK and Cancel buttons |
Property Details
The “buttons”
property
“buttons” GtkButtonsType
The buttons shown in the message dialog.
Owner: GtkMessageDialog
Flags: Write / Construct Only
Default value: GTK_BUTTONS_NONE
The “message-type”
property
“message-type” GtkMessageType
The type of the message.
Owner: GtkMessageDialog
Flags: Read / Write / Construct
Default value: GTK_MESSAGE_INFO
The “secondary-text”
property
“secondary-text” char *
The secondary text of the message dialog.
Owner: GtkMessageDialog
Flags: Read / Write
Default value: NULL
The “secondary-use-markup”
property
“secondary-use-markup” gboolean
TRUE
if the secondary text of the dialog includes Pango markup. See pango_parse_markup()
.
Owner: GtkMessageDialog
Flags: Read / Write
Default value: FALSE
The “text”
property
“text” char *
The primary text of the message dialog. If the dialog has a secondary text, this will appear as the title.
Owner: GtkMessageDialog
Flags: Read / Write
Default value: «»
The “use-markup”
property
“use-markup” gboolean
TRUE
if the primary text of the dialog includes Pango markup. See pango_parse_markup()
.
Owner: GtkMessageDialog
Flags: Read / Write
Default value: FALSE