📄 gtkwidget.sgml
字号:
<!-- ##### SECTION Title ##### -->GtkWidget<!-- ##### SECTION Short_Description ##### -->Base class for all widgets<!-- ##### SECTION Long_Description ##### --><para id="style-properties"><structname>GtkWidget</structname> introduces <firstterm>style properties</firstterm> - these are basically object properties that are storednot on the object, but in the style object associated to the widget. Styleproperties are set in <link linkend="gtk-Resource-Files">resource files</link>.This mechanism is used for configuring such things as the location of thescrollbar arrows through the theme, giving theme authors more control over thelook of applications without the need to write a theme engine in C.</para><para>Use gtk_widget_class_install_style_property() to install style properties for a widget class, gtk_widget_class_find_style_property() orgtk_widget_class_list_style_properties() to get information about existingstyle properties and gtk_widget_style_get_property(), gtk_widget_style_get() orgtk_widget_style_get_valist() to obtain the value of a style property.</para><refsect2 id="GtkWidget-BUILDER-UI"><title>GtkWidget as GtkBuildable</title><para>The GtkWidget implementation of the GtkBuildable interface supports a custom <accelerator> element, which has attributes named key, modifiers and signal and allows to specify accelerators.</para><example><title>A UI definition fragment specifying an accelerator</title><programlisting><![CDATA[<object class="GtkButton"> <accelerator key="q" modifiers="GDK_CONTROL_MASK" signal="clicked"/></object>]]></programlisting></example></refsect2><!-- ##### SECTION See_Also ##### --><para></para><!-- ##### SECTION Stability_Level ##### --><!-- ##### STRUCT GtkWidget ##### --><para></para>@style: The style for the widget. The style contains the colors the widget should be drawn in for each state along with graphics contexts used to draw with and the font to use for text.@requisition: The widget's desired size.@allocation: The widget's allocated size.@window: The widget's window or its parent window if it does not have a window. (Which will be indicated by the #GTK_NO_WINDOW flag being set).@parent: <!-- ##### SIGNAL GtkWidget::accel-closures-changed ##### --><para></para>@widget: the object which received the signal.<!-- ##### SIGNAL GtkWidget::button-press-event ##### --><para></para>@widget: the object which received the signal.@event: @Returns: %TRUE to stop other handlers from being invoked for the event. %FALSE to propagate the event further.<!-- ##### SIGNAL GtkWidget::button-release-event ##### --><para></para>@widget: the object which received the signal.@event: @Returns: %TRUE to stop other handlers from being invoked for the event. %FALSE to propagate the event further.<!-- ##### SIGNAL GtkWidget::can-activate-accel ##### --><para></para>@widget: the object which received the signal.@arg1: @Returns: <!-- ##### SIGNAL GtkWidget::child-notify ##### --><para></para>@widget: the object which received the signal.@arg1: <!-- ##### SIGNAL GtkWidget::client-event ##### --><para></para>@widget: the object which received the signal.@event: @Returns: %TRUE to stop other handlers from being invoked for the event. %FALSE to propagate the event further.<!-- ##### SIGNAL GtkWidget::composited-changed ##### --><para></para>@widget: the object which received the signal.<!-- ##### SIGNAL GtkWidget::configure-event ##### --><para></para>@widget: the object which received the signal.@event: @Returns: %TRUE to stop other handlers from being invoked for the event. %FALSE to propagate the event further.<!-- ##### SIGNAL GtkWidget::delete-event ##### --><para></para>@widget: the object which received the signal.@event: @Returns: %TRUE to stop other handlers from being invoked for the event. %FALSE to propagate the event further.<!-- ##### SIGNAL GtkWidget::destroy-event ##### --><para></para>@widget: the object which received the signal.@event: @Returns: %TRUE to stop other handlers from being invoked for the event. %FALSE to propagate the event further.<!-- ##### SIGNAL GtkWidget::direction-changed ##### --><para></para>@widget: the object which received the signal.@arg1: <!-- ##### SIGNAL GtkWidget::drag-begin ##### --><para></para>@widget: the object which received the signal.@drag_context: <!-- ##### SIGNAL GtkWidget::drag-data-delete ##### --><para></para>@widget: the object which received the signal.@drag_context: <!-- ##### SIGNAL GtkWidget::drag-data-get ##### --><para></para>@widget: the object which received the signal.@drag_context: @data: @info: @time: <!-- ##### SIGNAL GtkWidget::drag-data-received ##### --><para></para>@widget: the object which received the signal.@drag_context: @x: @y: @data: @info: @time: <!-- ##### SIGNAL GtkWidget::drag-drop ##### --><para></para>@widget: the object which received the signal.@drag_context: @x: @y: @time: @Returns: <!-- ##### SIGNAL GtkWidget::drag-end ##### --><para></para>@widget: the object which received the signal.@drag_context: <!-- ##### SIGNAL GtkWidget::drag-failed ##### --><para></para>@widget: the object which received the signal.@arg1: @arg2: @Returns: <!-- ##### SIGNAL GtkWidget::drag-leave ##### --><para></para>@widget: the object which received the signal.@drag_context: @time: <!-- ##### SIGNAL GtkWidget::drag-motion ##### --><para></para>@widget: the object which received the signal.@drag_context: @x: @y: @time: @Returns: <!-- ##### SIGNAL GtkWidget::enter-notify-event ##### --><para></para>@widget: the object which received the signal.@event: @Returns: %TRUE to stop other handlers from being invoked for the event. %FALSE to propagate the event further.<!-- ##### SIGNAL GtkWidget::event ##### --><para></para>@widget: the object which received the signal.@event: @Returns: %TRUE to stop other handlers from being invoked for the event. %FALSE to propagate the event further.<!-- ##### SIGNAL GtkWidget::event-after ##### --><para></para>@widget: the object which received the signal.@event: <!-- ##### SIGNAL GtkWidget::expose-event ##### --><para></para>@widget: the object which received the signal.@event: @Returns: %TRUE to stop other handlers from being invoked for the event. %FALSE to propagate the event further.<!-- ##### SIGNAL GtkWidget::focus ##### --><para></para>@widget: the object which received the signal.@arg1: @Returns: %TRUE to stop other handlers from being invoked for the event. %FALSE to propagate the event further.<!-- ##### SIGNAL GtkWidget::focus-in-event ##### --><para></para>@widget: the object which received the signal.@event: @Returns: %TRUE to stop other handlers from being invoked for the event. %FALSE to propagate the event further.<!-- ##### SIGNAL GtkWidget::focus-out-event ##### --><para></para>@widget: the object which received the signal.@event: @Returns: %TRUE to stop other handlers from being invoked for the event. %FALSE to propagate the event further.<!-- ##### SIGNAL GtkWidget::grab-broken-event ##### --><para></para>@widget: the object which received the signal.@event: @Returns: <!-- ##### SIGNAL GtkWidget::grab-focus ##### --><para></para>@widget: the object which received the signal.<!-- ##### SIGNAL GtkWidget::grab-notify ##### --><para></para>@widget: the object which received the signal.@arg1: <!-- ##### SIGNAL GtkWidget::hide ##### --><para></para>@widget: the object which received the signal.<!-- ##### SIGNAL GtkWidget::hierarchy-changed ##### --><para></para>@widget: @widget2: <!-- ##### SIGNAL GtkWidget::key-press-event ##### --><para></para>@widget: the object which received the signal.@event: @Returns: %TRUE to stop other handlers from being invoked for the event. %FALSE to propagate the event further.<!-- ##### SIGNAL GtkWidget::key-release-event ##### --><para></para>@widget: the object which received the signal.@event: @Returns: %TRUE to stop other handlers from being invoked for the event. %FALSE to propagate the event further.<!-- ##### SIGNAL GtkWidget::keynav-failed ##### --><para></para>@widget: the object which received the signal.@arg1: @Returns: <!-- ##### SIGNAL GtkWidget::leave-notify-event ##### --><para></para>@widget: the object which received the signal.@event: @Returns: %TRUE to stop other handlers from being invoked for the event. %FALSE to propagate the event further.<!-- ##### SIGNAL GtkWidget::map ##### --><para></para>@widget: the object which received the signal.<!-- ##### SIGNAL GtkWidget::map-event ##### --><para></para>@widget: the object which received the signal.@event: @Returns: %TRUE to stop other handlers from being invoked for the event. %FALSE to propagate the event further.<!-- ##### SIGNAL GtkWidget::mnemonic-activate ##### --><para></para>@widget: the object which received the signal.@arg1: @Returns: <!-- ##### SIGNAL GtkWidget::motion-notify-event ##### --><para></para>@widget: the object which received the signal.@event: @Returns: %TRUE to stop other handlers from being invoked for the event. %FALSE to propagate the event further.<!-- ##### SIGNAL GtkWidget::move-focus ##### --><para></para>@widget: the object which received the signal.@arg1: <!-- ##### SIGNAL GtkWidget::no-expose-event ##### --><para></para>@widget: the object which received the signal.@event: @Returns: %TRUE to stop other handlers from being invoked for the event. %FALSE to propagate the event further.<!-- ##### SIGNAL GtkWidget::parent-set ##### --><para></para>@widget: the object which received the signal.@old_parent: <!-- ##### SIGNAL GtkWidget::popup-menu ##### --><para></para>@widget: the object which received the signal.@Returns: <!-- ##### SIGNAL GtkWidget::property-notify-event ##### --><para></para>@widget: the object which received the signal.@event: @Returns: %TRUE to stop other handlers from being invoked for the event. %FALSE to propagate the event further.<!-- ##### SIGNAL GtkWidget::proximity-in-event ##### --><para></para>@widget: the object which received the signal.@event: @Returns: %TRUE to stop other handlers from being invoked for the event. %FALSE to propagate the event further.<!-- ##### SIGNAL GtkWidget::proximity-out-event ##### --><para></para>@widget: the object which received the signal.@event: @Returns: %TRUE to stop other handlers from being invoked for the event. %FALSE to propagate the event further.<!-- ##### SIGNAL GtkWidget::query-tooltip ##### --><para></para>@widget: the object which received the signal.@arg1: @arg2: @arg3: @arg4: @Returns: <!-- ##### SIGNAL GtkWidget::realize ##### --><para></para>@widget: the object which received the signal.<!-- ##### SIGNAL GtkWidget::screen-changed ##### --><para></para>@widget: the object which received the signal.@arg1: <!-- ##### SIGNAL GtkWidget::scroll-event ##### --><para></para>@widget: the object which received the signal.@event: @Returns: %TRUE to stop other handlers from being invoked for the event. %FALSE to propagate the event further.<!-- ##### SIGNAL GtkWidget::selection-clear-event ##### --><para></para>@widget: the object which received the signal.@event: @Returns: %TRUE to stop other handlers from being invoked for the event. %FALSE to propagate the event further.<!-- ##### SIGNAL GtkWidget::selection-get ##### --><para></para>@widget: the object which received the signal.@data: @info: @time: <!-- ##### SIGNAL GtkWidget::selection-notify-event ##### --><para></para>@widget: the object which received the signal.@event: @Returns: %TRUE to stop other handlers from being invoked for the event. %FALSE to propagate the event further.<!-- ##### SIGNAL GtkWidget::selection-received ##### --><para></para>@widget: the object which received the signal.@data: @time: <!-- ##### SIGNAL GtkWidget::selection-request-event ##### --><para></para>@widget: the object which received the signal.@event: @Returns: %TRUE to stop other handlers from being invoked for the event. %FALSE to propagate the event further.<!-- ##### SIGNAL GtkWidget::show ##### --><para></para>@widget: the object which received the signal.<!-- ##### SIGNAL GtkWidget::show-help ##### --><para></para>@widget: the object which received the signal.@arg1: @Returns: <!-- ##### SIGNAL GtkWidget::size-allocate ##### --><para></para>@widget: the object which received the signal.@allocation: <!-- ##### SIGNAL GtkWidget::size-request ##### --><para></para>@widget: the object which received the signal.@requisition: <!-- ##### SIGNAL GtkWidget::state-changed ##### --><para></para>@widget: the object which received the signal.@state: <!-- ##### SIGNAL GtkWidget::style-set ##### --><para></para>@widget: the object which received the signal.@previous_style: <!-- ##### SIGNAL GtkWidget::unmap ##### --><para></para>@widget: the object which received the signal.<!-- ##### SIGNAL GtkWidget::unmap-event ##### --><para></para>@widget: the object which received the signal.@event: @Returns: %TRUE to stop other handlers from being invoked for the event. %FALSE to propagate the event further.<!-- ##### SIGNAL GtkWidget::unrealize ##### --><para></para>@widget: the object which received the signal.<!-- ##### SIGNAL GtkWidget::visibility-notify-event ##### --><para></para>@widget: the object which received the signal.@event: @Returns: %TRUE to stop other handlers from being invoked for the event. %FALSE to propagate the event further.<!-- ##### SIGNAL GtkWidget::window-state-event ##### --><para></para>@widget: the object which received the signal.@event: @Returns: %TRUE to stop other handlers from being invoked for the event. %FALSE to propagate the event further.<!-- ##### ARG GtkWidget:app-paintable ##### --><para></para><!-- ##### ARG GtkWidget:can-default ##### --><para></para><!-- ##### ARG GtkWidget:can-focus ##### --><para></para><!-- ##### ARG GtkWidget:composite-child ##### --><para></para><!-- ##### ARG GtkWidget:events ##### --><para></para><!-- ##### ARG GtkWidget:extension-events ##### --><para></para><!-- ##### ARG GtkWidget:has-default ##### --><para></para><!-- ##### ARG GtkWidget:has-focus ##### --><para></para><!-- ##### ARG GtkWidget:has-tooltip ##### --><para></para><!-- ##### ARG GtkWidget:height-request ##### --><para></para><!-- ##### ARG GtkWidget:is-focus ##### --><para></para><!-- ##### ARG GtkWidget:name ##### --><para></para><!-- ##### ARG GtkWidget:no-show-all ##### --><para></para><!-- ##### ARG GtkWidget:parent ##### --><para></para><!-- ##### ARG GtkWidget:receives-default ##### --><para></para><!-- ##### ARG GtkWidget:sensitive ##### --><para></para><!-- ##### ARG GtkWidget:style ##### --><para></para><!-- ##### ARG GtkWidget:tooltip-markup ##### --><para></para><!-- ##### ARG GtkWidget:tooltip-text ##### --><para></para><!-- ##### ARG GtkWidget:visible ##### --><para></para><!-- ##### ARG GtkWidget:width-request ##### --><para></para><!-- ##### ARG GtkWidget:cursor-aspect-ratio ##### --><para></para><!-- ##### ARG GtkWidget:cursor-color ##### --><para></para><!-- ##### ARG GtkWidget:draw-border ##### --><para></para><!-- ##### ARG GtkWidget:focus-line-pattern ##### --><para></para><!-- ##### ARG GtkWidget:focus-line-width ##### --><para></para><!-- ##### ARG GtkWidget:focus-padding ##### --><para></para><!-- ##### ARG GtkWidget:interior-focus ##### --><para></para><!-- ##### ARG GtkWidget:link-color ##### --><para></para><!-- ##### ARG GtkWidget:scroll-arrow-hlength ##### --><para></para><!-- ##### ARG GtkWidget:scroll-arrow-vlength ##### --><para></para><!-- ##### ARG GtkWidget:secondary-cursor-color ##### --><para></para><!-- ##### ARG GtkWidget:separator-height ##### --><para></para><!-- ##### ARG GtkWidget:separator-width ##### --><para></para><!-- ##### ARG GtkWidget:visited-link-color ##### --><para></para><!-- ##### ARG GtkWidget:wide-separators ##### --><para></para><!-- ##### STRUCT GtkWidgetClass ##### --><para><structfield>activate_signal</structfield>The signal to emit when a widget of this class is activated,gtk_widget_activate() handles the emission. Implementation of thissignal is optional. </para><para><structfield>set_scroll_adjustment_signal</structfield>This signal is emitted when a widget of this class is addedto a scrolling aware parent, gtk_widget_set_scroll_adjustments()handles the emission.Implementation of this signal is optional.</para>@parent_class: @activate_signal: @set_scroll_adjustments_signal: <!-- ##### ENUM GtkWidgetFlags ##### --><para>Tells about certain properties of the widget.</para>@GTK_TOPLEVEL: widgets without a real parent, as there are #GtkWindow<!-- -->s and #GtkMenu<!-- -->s have this flag set throughout their lifetime. Toplevel widgets always contain their own #GdkWindow.@GTK_NO_WINDOW: Indicative for a widget that does not provide its own #GdkWindow. Visible action (e.g. drawing) is performed on the parent's #GdkWindow.@GTK_REALIZED: Set by gtk_widget_realize(), unset by gtk_widget_unrealize(). A realized widget has an associated #GdkWindow.@GTK_MAPPED: Set by gtk_widget_map(), unset by gtk_widget_unmap(). Only realized widgets can be mapped. It means that gdk_window_show() has been called on the widgets window(s).@GTK_VISIBLE:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -