forked from AuroraMiddleware/gtk
Merge branch 'master' into treeview-refactor
This commit is contained in:
commit
8885320d21
42
NEWS
42
NEWS
@ -1,3 +1,45 @@
|
||||
Overview of Changes from GTK+ 2.91.1 to 2.91.2
|
||||
==============================================
|
||||
|
||||
* GtkApplication has been rewritten. It mostly relies on GApplication
|
||||
API now. Remaining functions include gtk_application_new() and
|
||||
gtk_window_set_application()
|
||||
|
||||
* A GtkScrollable interface has been added and implemented by all
|
||||
scrollable widgets. GtkScrolledWindow has ::min-display-width/height
|
||||
properties to control the minimal size of the content area.
|
||||
|
||||
* GtkComboBox changes:
|
||||
- Popups can be wider than the combo box itself
|
||||
- The deprecated GtkComboBoxEntry subclass has been removed
|
||||
- The deprecated combo box text convenience API has been removed
|
||||
- Numeric IDs can be associated with model values
|
||||
|
||||
* GtkRecentManager changes:
|
||||
- Store xbel file in XDG_USER_DATA
|
||||
- Add gtk_recent_info_create_app_info()
|
||||
- Add gtk_recent_info_get_gicon()
|
||||
- Coalesce multiple changes
|
||||
|
||||
* GtkIconView allows tree models (ignoring anything below the root level)
|
||||
|
||||
* GtkProgressBar, GtkSpinButton and GtkEntry no longer have their own
|
||||
input-output window
|
||||
|
||||
* gtk_widget_hide_all() has been removed
|
||||
|
||||
* GtkGrid: A legacy-free, height-for-width grid container
|
||||
|
||||
* Bugs fixed:
|
||||
632381 438318 632538 632539 632677 632736 324899 524304 617174
|
||||
|
||||
* Translation updates:
|
||||
Japanese
|
||||
Norwegian bokmål
|
||||
Spanish
|
||||
Telugu
|
||||
|
||||
|
||||
Overview of Changes from GTK+ 2.91.0 to 2.91.1
|
||||
==============================================
|
||||
|
||||
|
@ -65,7 +65,7 @@ AM_MAINTAINER_MODE([enable])
|
||||
# Support silent build rules, requires at least automake-1.11. Enable
|
||||
# by either passing --enable-silent-rules to configure or passing V=0
|
||||
# to make
|
||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([no])])
|
||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
||||
|
||||
#
|
||||
# For each of the libraries we build, we define the following
|
||||
|
@ -24,6 +24,7 @@
|
||||
<xi:include href="xml/regions.xml" />
|
||||
<xi:include href="xml/drawing.xml" />
|
||||
<xi:include href="xml/colors.xml" />
|
||||
<xi:include href="xml/rgba_colors.xml" />
|
||||
<xi:include href="xml/visuals.xml" />
|
||||
<xi:include href="xml/cursors.xml" />
|
||||
<xi:include href="xml/windows.xml" />
|
||||
|
@ -259,6 +259,21 @@ GDK_TYPE_COLOR
|
||||
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<TITLE>RGBA Colors</TITLE>
|
||||
<FILE>rgba_colors</FILE>
|
||||
GdkRGBA
|
||||
gdk_rgba_copy
|
||||
gdk_rgba_free
|
||||
gdk_rgba_parse
|
||||
gdk_rgba_equal
|
||||
gdk_rgba_hash
|
||||
gdk_rgba_to_string
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GDK_TYPE_RGBA
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<TITLE>Drawing Primitives</TITLE>
|
||||
<FILE>drawing</FILE>
|
||||
@ -421,6 +436,7 @@ gdk_window_merge_child_input_shapes
|
||||
gdk_window_set_static_gravities
|
||||
gdk_window_set_title
|
||||
gdk_window_set_background
|
||||
gdk_window_set_background_rgba
|
||||
gdk_window_set_background_pattern
|
||||
gdk_window_get_background_pattern
|
||||
GDK_PARENT_RELATIVE
|
||||
@ -595,6 +611,7 @@ gdk_window_create_similar_surface
|
||||
gdk_cairo_create
|
||||
gdk_cairo_get_clip_rectangle
|
||||
gdk_cairo_set_source_color
|
||||
gdk_cairo_set_source_rgba
|
||||
gdk_cairo_set_source_pixbuf
|
||||
gdk_cairo_set_source_window
|
||||
gdk_cairo_rectangle
|
||||
|
@ -203,6 +203,7 @@
|
||||
|
||||
<chapter id="LayoutContainers">
|
||||
<title>Layout Containers</title>
|
||||
<xi:include href="xml/gtkgrid.xml" />
|
||||
<xi:include href="xml/gtkalignment.xml" />
|
||||
<xi:include href="xml/gtkaspectframe.xml" />
|
||||
<xi:include href="xml/gtkbox.xml" />
|
||||
@ -236,6 +237,7 @@
|
||||
<xi:include href="xml/gtkhscrollbar.xml" />
|
||||
<xi:include href="xml/gtkvscrollbar.xml" />
|
||||
<xi:include href="xml/gtkscrolledwindow.xml" />
|
||||
<xi:include href="xml/gtkscrollable.xml" />
|
||||
</chapter>
|
||||
|
||||
<chapter id="Printing">
|
||||
|
@ -672,6 +672,8 @@ gtk_color_button_set_color
|
||||
gtk_color_button_get_color
|
||||
gtk_color_button_set_alpha
|
||||
gtk_color_button_get_alpha
|
||||
gtk_color_button_set_rgba
|
||||
gtk_color_button_get_rgba
|
||||
gtk_color_button_set_use_alpha
|
||||
gtk_color_button_get_use_alpha
|
||||
gtk_color_button_set_title
|
||||
@ -728,6 +730,10 @@ gtk_color_selection_get_previous_alpha
|
||||
gtk_color_selection_set_previous_alpha
|
||||
gtk_color_selection_get_previous_color
|
||||
gtk_color_selection_set_previous_color
|
||||
gtk_color_selection_get_current_rgba
|
||||
gtk_color_selection_set_current_rgba
|
||||
gtk_color_selection_get_previous_rgba
|
||||
gtk_color_selection_set_previous_rgba
|
||||
gtk_color_selection_is_adjusting
|
||||
gtk_color_selection_palette_from_string
|
||||
gtk_color_selection_palette_to_string
|
||||
@ -798,6 +804,8 @@ gtk_combo_box_get_button_sensitivity
|
||||
gtk_combo_box_get_has_entry
|
||||
gtk_combo_box_set_entry_text_column
|
||||
gtk_combo_box_get_entry_text_column
|
||||
gtk_combo_box_set_id_column
|
||||
gtk_combo_box_get_id_column
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_COMBO_BOX
|
||||
GTK_COMBO_BOX
|
||||
@ -817,9 +825,11 @@ GtkComboBoxText
|
||||
gtk_combo_box_text_new
|
||||
gtk_combo_box_text_new_with_entry
|
||||
gtk_combo_box_text_append_text
|
||||
gtk_combo_box_text_insert_text
|
||||
gtk_combo_box_text_prepend_text
|
||||
gtk_combo_box_text_insert_text
|
||||
gtk_combo_box_text_insert_text_with_id
|
||||
gtk_combo_box_text_remove
|
||||
gtk_combo_box_text_remove_all
|
||||
gtk_combo_box_text_get_active_text
|
||||
|
||||
<SUBSECTION Standard>
|
||||
@ -1031,8 +1041,6 @@ gtk_entry_set_icon_tooltip_markup
|
||||
gtk_entry_get_icon_tooltip_markup
|
||||
gtk_entry_set_icon_drag_source
|
||||
gtk_entry_get_current_icon_drag_source
|
||||
gtk_entry_get_icon_window
|
||||
gtk_entry_get_text_window
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_ENTRY
|
||||
@ -2621,10 +2629,12 @@ gtk_recent_info_get_private_hint
|
||||
gtk_recent_info_get_application_info
|
||||
gtk_recent_info_get_applications
|
||||
gtk_recent_info_last_application
|
||||
gtk_recent_info_has_application
|
||||
gtk_recent_info_create_app_info
|
||||
gtk_recent_info_get_groups
|
||||
gtk_recent_info_has_group
|
||||
gtk_recent_info_has_application
|
||||
gtk_recent_info_get_icon
|
||||
gtk_recent_info_get_gicon
|
||||
gtk_recent_info_get_short_name
|
||||
gtk_recent_info_get_uri_display
|
||||
gtk_recent_info_get_age
|
||||
@ -2742,6 +2752,28 @@ GtkScaleButtonPrivate
|
||||
gtk_scale_button_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkscrollable</FILE>
|
||||
<TITLE>GtkScrollable</TITLE>
|
||||
GtkScrollable
|
||||
gtk_scrollable_get_hadjustment
|
||||
gtk_scrollable_set_hadjustment
|
||||
gtk_scrollable_get_vadjustment
|
||||
gtk_scrollable_set_vadjustment
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GtkScrollableIface
|
||||
GTK_IS_SCROLLABLE
|
||||
GTK_IS_SCROLLABLE_CLASS
|
||||
GTK_SCROLLABLE
|
||||
GTK_SCROLLABLE_CLASS
|
||||
GTK_SCROLLABLE_GET_IFACE
|
||||
GTK_TYPE_SCROLLABLE
|
||||
|
||||
<SUBSECTION Private>
|
||||
gtk_scrollable_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkscrollbar</FILE>
|
||||
<TITLE>GtkScrollbar</TITLE>
|
||||
@ -2777,6 +2809,11 @@ gtk_scrolled_window_set_vadjustment
|
||||
gtk_scrolled_window_get_placement
|
||||
gtk_scrolled_window_get_policy
|
||||
gtk_scrolled_window_get_shadow_type
|
||||
gtk_scrolled_window_get_min_content_width
|
||||
gtk_scrolled_window_set_min_content_width
|
||||
gtk_scrolled_window_get_min_content_height
|
||||
gtk_scrolled_window_set_min_content_height
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_SCROLLED_WINDOW
|
||||
GTK_IS_SCROLLED_WINDOW
|
||||
@ -3366,7 +3403,9 @@ gtk_text_view_new
|
||||
gtk_text_view_new_with_buffer
|
||||
gtk_text_view_set_buffer
|
||||
gtk_text_view_get_buffer
|
||||
gtk_text_view_set_hadjustment
|
||||
gtk_text_view_get_hadjustment
|
||||
gtk_text_view_set_vadjustment
|
||||
gtk_text_view_get_vadjustment
|
||||
gtk_text_view_scroll_to_mark
|
||||
gtk_text_view_scroll_to_iter
|
||||
@ -3793,7 +3832,9 @@ gtk_tool_palette_get_drop_item
|
||||
GtkToolPaletteDragTargets
|
||||
gtk_tool_palette_set_drag_source
|
||||
gtk_tool_palette_get_hadjustment
|
||||
gtk_tool_palette_set_hadjustment
|
||||
gtk_tool_palette_get_vadjustment
|
||||
gtk_tool_palette_set_vadjustment
|
||||
<SUBSECTION Standard>
|
||||
GtkToolPaletteClass
|
||||
GTK_TOOL_PALETTE
|
||||
@ -4826,7 +4867,6 @@ gtk_widget_set_app_paintable
|
||||
gtk_widget_set_double_buffered
|
||||
gtk_widget_set_redraw_on_allocate
|
||||
gtk_widget_set_composite_name
|
||||
gtk_widget_set_scroll_adjustments
|
||||
gtk_widget_mnemonic_activate
|
||||
gtk_widget_class_install_style_property
|
||||
gtk_widget_class_install_style_property_parser
|
||||
@ -6320,3 +6360,34 @@ GTK_APPLICATION_GET_CLASS
|
||||
gtk_application_get_type
|
||||
GtkApplicationPrivate
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkgrid</FILE>
|
||||
<TITLE>GtkGrid</TITLE>
|
||||
GtkGrid
|
||||
gtk_grid_new
|
||||
gtk_grid_attach
|
||||
gtk_grid_attach_next_to
|
||||
gtk_grid_set_row_homogeneous
|
||||
gtk_grid_get_row_homogeneous
|
||||
gtk_grid_set_row_spacing
|
||||
gtk_grid_get_row_spacing
|
||||
gtk_grid_set_column_homogeneous
|
||||
gtk_grid_get_column_homogeneous
|
||||
gtk_grid_set_column_spacing
|
||||
gtk_grid_get_column_spacing
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GtkGrid
|
||||
GtkGridClass
|
||||
GTK_TYPE_GRID
|
||||
GTK_GRID
|
||||
GTK_GRID_CLASS
|
||||
GTK_IS_GRID
|
||||
GTK_IS_GRID_CLASS
|
||||
GTK_GRID_GET_CLASS
|
||||
|
||||
<SUBSECTION Private>
|
||||
GtkGridPrivate
|
||||
gtk_grid_get_type
|
||||
</SECTION>
|
||||
|
@ -61,6 +61,7 @@ gtk_font_button_get_type
|
||||
gtk_font_selection_dialog_get_type
|
||||
gtk_font_selection_get_type
|
||||
gtk_frame_get_type
|
||||
gtk_grid_get_type
|
||||
gtk_handle_box_get_type
|
||||
gtk_hbox_get_type
|
||||
gtk_hbutton_box_get_type
|
||||
@ -123,6 +124,7 @@ gtk_recent_manager_get_type
|
||||
gtk_ruler_get_type
|
||||
gtk_scale_button_get_type
|
||||
gtk_scale_get_type
|
||||
gtk_scrollable_get_type
|
||||
gtk_scrollbar_get_type
|
||||
gtk_scrolled_window_get_type
|
||||
gtk_separator_get_type
|
||||
|
7
docs/reference/gtk/tmpl/.gitignore
vendored
7
docs/reference/gtk/tmpl/.gitignore
vendored
@ -1,6 +1,7 @@
|
||||
gtkaccelmap.sgml
|
||||
gtkactiongroup.sgml
|
||||
gtkaboutdialog.sgml
|
||||
gtkadjustment.sgml
|
||||
gtkbbox.sgml
|
||||
gtkbox.sgml
|
||||
gtkbuilder.sgml
|
||||
@ -36,6 +37,7 @@ gtkrecentchooserwidget.sgml
|
||||
gtkrecentmanager.sgml
|
||||
gtkscale.sgml
|
||||
gtkscalebutton.sgml
|
||||
gtkscrollbar.sgml
|
||||
gtkscrolledwindow.sgml
|
||||
gtkseparator.sgml
|
||||
gtkseparatormenuitem.sgml
|
||||
@ -50,5 +52,10 @@ gtktoolbar.sgml
|
||||
gtktoolitem.sgml
|
||||
gtktooltip.sgml
|
||||
gtktreednd.sgml
|
||||
gtktreemodelfilter.sgml
|
||||
gtktreeselection.sgml
|
||||
gtktreesortable.sgml
|
||||
gtktreestore.sgml
|
||||
gtktreeviewcolumn.sgml
|
||||
gtktypeutils.sgml
|
||||
gtkwindow.sgml
|
||||
|
@ -1,310 +0,0 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
GtkAdjustment
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
A representation of an adjustable bounded value
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
The #GtkAdjustment object represents a value which has an associated lower
|
||||
and upper bound, together with step and page increments, and a page size.
|
||||
It is used within several GTK+ widgets, including
|
||||
#GtkSpinButton, #GtkViewport, and #GtkRange (which is a base class for
|
||||
#GtkHScrollbar, #GtkVScrollbar, #GtkHScale, and #GtkVScale).
|
||||
</para>
|
||||
<para>
|
||||
The #GtkAdjustment object does not update the value itself. Instead
|
||||
it is left up to the owner of the #GtkAdjustment to control the value.
|
||||
</para>
|
||||
<para>
|
||||
The owner of the #GtkAdjustment typically calls the
|
||||
gtk_adjustment_value_changed() and gtk_adjustment_changed() functions
|
||||
after changing the value and its bounds. This results in the emission of the
|
||||
"value_changed" or "changed" signal respectively.
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
||||
<!-- ##### SECTION Image ##### -->
|
||||
|
||||
|
||||
<!-- ##### STRUCT GtkAdjustment ##### -->
|
||||
<para>
|
||||
The #GtkAdjustment-struct struct contains the following fields.
|
||||
|
||||
<informaltable pgwide="1" frame="none" role="struct">
|
||||
<tgroup cols="2"><colspec colwidth="2*"/><colspec colwidth="8*"/>
|
||||
<tbody>
|
||||
|
||||
<row>
|
||||
<entry>#gdouble lower;</entry>
|
||||
<entry>the minimum value.</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>#gdouble upper;</entry>
|
||||
<entry>the maximum value.</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>#gdouble value;</entry>
|
||||
<entry>the current value.</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>#gdouble step_increment;</entry>
|
||||
<entry>the increment to use to make minor changes to the value.
|
||||
In a #GtkScrollbar this increment is used when the mouse is clicked on the
|
||||
arrows at the top and bottom of the scrollbar, to scroll by a small amount.
|
||||
</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>#gdouble page_increment;</entry>
|
||||
<entry>the increment to use to make major changes to the value.
|
||||
In a #GtkScrollbar this increment is used when the mouse is clicked in the
|
||||
trough, to scroll by a large amount.
|
||||
</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>#gdouble page_size;</entry>
|
||||
<entry>the page size.
|
||||
In a #GtkScrollbar this is the size of the area which is currently visible.
|
||||
</entry>
|
||||
</row>
|
||||
|
||||
</tbody></tgroup></informaltable>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### SIGNAL GtkAdjustment::changed ##### -->
|
||||
<para>
|
||||
Emitted when one or more of the #GtkAdjustment fields have been changed,
|
||||
other than the value field.
|
||||
</para>
|
||||
|
||||
@adjustment: the object which received the signal.
|
||||
|
||||
<!-- ##### SIGNAL GtkAdjustment::value-changed ##### -->
|
||||
<para>
|
||||
Emitted when the #GtkAdjustment value field has been changed.
|
||||
</para>
|
||||
|
||||
@adjustment: the object which received the signal.
|
||||
|
||||
<!-- ##### ARG GtkAdjustment:lower ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkAdjustment:page-increment ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkAdjustment:page-size ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkAdjustment:step-increment ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkAdjustment:upper ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkAdjustment:value ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### FUNCTION gtk_adjustment_new ##### -->
|
||||
<para>
|
||||
Creates a new #GtkAdjustment.
|
||||
</para>
|
||||
|
||||
@value: the initial value.
|
||||
@lower: the minimum value.
|
||||
@upper: the maximum value.
|
||||
@step_increment: the step increment.
|
||||
@page_increment: the page increment.
|
||||
@page_size: the page size.
|
||||
@Returns: a new #GtkAdjustment.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_adjustment_get_value ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@adjustment:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_adjustment_set_value ##### -->
|
||||
<para>
|
||||
Sets the #GtkAdjustment value. The value is clamped to lie between
|
||||
<literal>adjustment->lower</literal> and
|
||||
<literal>adjustment->upper</literal>.
|
||||
</para>
|
||||
<para>
|
||||
Note that for adjustments which are used in a #GtkScrollbar, the effective
|
||||
range of allowed values goes from <literal>adjustment->lower</literal> to
|
||||
<literal>adjustment->upper - adjustment->page_size</literal>.
|
||||
</para>
|
||||
|
||||
@adjustment: a #GtkAdjustment.
|
||||
@value: the new value.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_adjustment_clamp_page ##### -->
|
||||
<para>
|
||||
Updates the #GtkAdjustment @value to ensure that the range between @lower
|
||||
and @upper is in the current page (i.e. between @value and @value +
|
||||
@page_size).
|
||||
If the range is larger than the page size, then only the start of it will
|
||||
be in the current page.
|
||||
A "changed" signal will be emitted if the value is changed.
|
||||
</para>
|
||||
|
||||
@adjustment: a #GtkAdjustment.
|
||||
@lower: the lower value.
|
||||
@upper: the upper value.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_adjustment_changed ##### -->
|
||||
<para>
|
||||
Emits a "changed" signal from the #GtkAdjustment.
|
||||
This is typically called by the owner of the #GtkAdjustment after it has
|
||||
changed any of the #GtkAdjustment fields other than the value.
|
||||
</para>
|
||||
|
||||
@adjustment: a #GtkAdjustment
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_adjustment_value_changed ##### -->
|
||||
<para>
|
||||
Emits a "value_changed" signal from the #GtkAdjustment.
|
||||
This is typically called by the owner of the #GtkAdjustment after it has
|
||||
changed the #GtkAdjustment value field.
|
||||
</para>
|
||||
|
||||
@adjustment: a #GtkAdjustment
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_adjustment_configure ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@adjustment:
|
||||
@value:
|
||||
@lower:
|
||||
@upper:
|
||||
@step_increment:
|
||||
@page_increment:
|
||||
@page_size:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_adjustment_get_lower ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@adjustment:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_adjustment_get_page_increment ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@adjustment:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_adjustment_get_page_size ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@adjustment:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_adjustment_get_step_increment ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@adjustment:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_adjustment_get_upper ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@adjustment:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_adjustment_set_lower ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@adjustment:
|
||||
@lower:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_adjustment_set_page_increment ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@adjustment:
|
||||
@page_increment:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_adjustment_set_page_size ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@adjustment:
|
||||
@page_size:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_adjustment_set_step_increment ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@adjustment:
|
||||
@step_increment:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_adjustment_set_upper ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@adjustment:
|
||||
@upper:
|
||||
|
||||
|
@ -19,11 +19,13 @@ positioned within its allocated area. Note that if the widget is added to
|
||||
a container in such a way that it expands automatically to fill its
|
||||
allocated area, the alignment settings will not alter the widgets position.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
Note that the desired effect can in most cases be achieved by using the
|
||||
#GtkWidget:halign, #GtkWidget:valign and #GtkWidget:margin properties
|
||||
on the child widget.
|
||||
on the child widget, so GtkMisc should not be used in new code.
|
||||
</para>
|
||||
</note>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
|
@ -1,103 +0,0 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
GtkScrollbar
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
Base class for GtkHScrollbar and GtkVScrollbar
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
The #GtkScrollbar widget is the base class for #GtkHScrollbar and
|
||||
#GtkVScrollbar. It can be used in the same way as these, by setting
|
||||
the "orientation" property appropriately.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The position of the thumb in a scrollbar is controlled by the scroll
|
||||
adjustments. See #GtkAdjustment for the fields in an adjustment - for
|
||||
#GtkScrollbar, the "value" field represents the position of the
|
||||
scrollbar, which must be between the "lower" field and "upper -
|
||||
page_size." The "page_size" field represents the size of the visible
|
||||
scrollable area. The "step_increment" and "page_increment" fields are
|
||||
used when the user asks to step down (using the small stepper arrows)
|
||||
or page down (using for example the PageDown key).
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
<variablelist>
|
||||
|
||||
<varlistentry>
|
||||
<term>#GtkHScrollbar</term>
|
||||
<listitem><para>a horizontal scrollbar.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>#GtkVScrollbar</term>
|
||||
<listitem><para>a vertical scrollbar.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>#GtkAdjustment</term>
|
||||
<listitem><para>connects scrollbars to the widget being scrolled.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>#GtkScrolledWindow</term>
|
||||
<listitem><para>convenient widget for setting up scrolling.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
||||
<!-- ##### SECTION Image ##### -->
|
||||
|
||||
|
||||
<!-- ##### STRUCT GtkScrollbar ##### -->
|
||||
<para>
|
||||
The #GtkScrollbar struct does not contain any public data.
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### ARG GtkScrollbar:fixed-slider-length ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkScrollbar:has-backward-stepper ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkScrollbar:has-forward-stepper ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkScrollbar:has-secondary-backward-stepper ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkScrollbar:has-secondary-forward-stepper ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkScrollbar:min-slider-length ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### FUNCTION gtk_scrollbar_new ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@orientation:
|
||||
@adjustment:
|
||||
@Returns:
|
||||
|
||||
|
@ -32,17 +32,22 @@ either side</emphasis> of the widget it belongs to.
|
||||
gtk_table_set_homogeneous(), can be used to set whether all cells in the
|
||||
table will resize themselves to the size of the largest widget in the table.
|
||||
</para>
|
||||
<para>
|
||||
Note that #GtkGrid provides the same capabilities as GtkTable for arranging
|
||||
widgets in a rectangular grid, and additionally supports height-for-width
|
||||
geometry management.
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>#GtkVBox</term>
|
||||
<listitem><para>For packing widgets vertically only.</para></listitem>
|
||||
<term>#GtkBox</term>
|
||||
<listitem><para>For packing widgets in a single row.</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>#GtkHBox</term>
|
||||
<listitem><para>For packing widgets horizontally only.</para></listitem>
|
||||
<term>#GtkGrid</term>
|
||||
<listitem><para>For packing widgets in a grid with height-for-width geometry management.</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
|
@ -1,198 +0,0 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
GtkTreeModelFilter
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
A GtkTreeModel which hides parts of an underlying tree model
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
A #GtkTreeModelFilter is a tree model which wraps another tree model,
|
||||
and can do the following things:
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
Filter specific rows, based on data from a "visible column", a column
|
||||
storing booleans indicating whether the row should be filtered or not,
|
||||
or based on the return value of a "visible function", which gets a
|
||||
model, iter and user_data and returns a boolean indicating whether the
|
||||
row should be filtered or not.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Modify the "appearance" of the model, using a modify function.
|
||||
This is extremely powerful and allows for just changing
|
||||
some values and also for creating a completely different model based on
|
||||
the given child model.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Set a different root node, also known as a "virtual root". You can pass in
|
||||
a #GtkTreePath indicating the root node for the filter at construction time.
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
#GtkTreeModelSort
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
||||
<!-- ##### SECTION Image ##### -->
|
||||
|
||||
|
||||
<!-- ##### STRUCT GtkTreeModelFilter ##### -->
|
||||
<para>
|
||||
The GtkTreeModelFilter struct contains only private fields.
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### ARG GtkTreeModelFilter:child-model ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTreeModelFilter:virtual-root ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### USER_FUNCTION GtkTreeModelFilterVisibleFunc ##### -->
|
||||
<para>
|
||||
A function which decides whether the row indicated by @iter is visible.
|
||||
</para>
|
||||
|
||||
@model: the child model of the #GtkTreeModelFilter
|
||||
@iter: a #GtkTreeIter pointing to the row in @model whose visibility
|
||||
is determined
|
||||
@data: user data given to gtk_tree_model_filter_set_visible_func()
|
||||
@Returns: Whether the row indicated by @iter is visible.
|
||||
|
||||
|
||||
<!-- ##### USER_FUNCTION GtkTreeModelFilterModifyFunc ##### -->
|
||||
<para>
|
||||
A function which calculates display values from raw values in the model.
|
||||
It must fill @value with the display value for the column @column in the
|
||||
row indicated by @iter.
|
||||
</para>
|
||||
<para>
|
||||
Since this function is called for each data access, it's not a
|
||||
particularly efficient operation.
|
||||
</para>
|
||||
|
||||
@model: the #GtkTreeModelFilter
|
||||
@iter: a #GtkTreeIter pointing to the row whose display values are determined
|
||||
@value: A #GValue which is already initialized for with the correct type for
|
||||
the column @column.
|
||||
@column: the column whose display value is determined
|
||||
@data: user data given to gtk_tree_model_filter_set_modify_func()
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_model_filter_new ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@child_model:
|
||||
@root:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_model_filter_set_visible_func ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@filter:
|
||||
@func:
|
||||
@data:
|
||||
@destroy:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_model_filter_set_modify_func ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@filter:
|
||||
@n_columns:
|
||||
@types:
|
||||
@func:
|
||||
@data:
|
||||
@destroy:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_model_filter_set_visible_column ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@filter:
|
||||
@column:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_model_filter_get_model ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@filter:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_model_filter_convert_child_iter_to_iter ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@filter:
|
||||
@filter_iter:
|
||||
@child_iter:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_model_filter_convert_iter_to_child_iter ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@filter:
|
||||
@child_iter:
|
||||
@filter_iter:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_model_filter_convert_child_path_to_path ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@filter:
|
||||
@child_path:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_model_filter_convert_path_to_child_path ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@filter:
|
||||
@filter_path:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_model_filter_refilter ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@filter:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_model_filter_clear_cache ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@filter:
|
||||
|
||||
|
@ -1,280 +0,0 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
GtkTreeSelection
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
The selection object for GtkTreeView
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
The #GtkTreeSelection object is a helper object to manage the selection
|
||||
for a #GtkTreeView widget. The #GtkTreeSelection object is
|
||||
automatically created when a new #GtkTreeView widget is created, and
|
||||
cannot exist independentally of this widget. The primary reason the
|
||||
#GtkTreeSelection objects exists is for cleanliness of code and API.
|
||||
That is, there is no conceptual reason all these functions could not be
|
||||
methods on the #GtkTreeView widget instead of a separate function.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The #GtkTreeSelection object is gotten from a #GtkTreeView by calling
|
||||
gtk_tree_view_get_selection(). It can be manipulated to check the
|
||||
selection status of the tree, as well as select and deselect individual
|
||||
rows. Selection is done completely view side. As a result, multiple
|
||||
views of the same model can have completely different selections.
|
||||
Additionally, you cannot change the selection of a row on the model that
|
||||
is not currently displayed by the view without expanding its parents
|
||||
first.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
One of the important things to remember when monitoring the selection of
|
||||
a view is that the #GtkTreeSelection::changed signal is mostly a hint. That is, it may
|
||||
only emit one signal when a range of rows is selected. Additionally, it
|
||||
may on occasion emit a ::changed signal when nothing has happened
|
||||
(mostly as a result of programmers calling select_row on an already
|
||||
selected row).
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
#GtkTreeView, #GtkTreeViewColumn, #GtkTreeDnd, #GtkTreeMode, #GtkTreeSortable, #GtkTreeModelSort, #GtkListStore, #GtkTreeStore, #GtkCellRenderer, #GtkCellEditable, #GtkCellRendererPixbuf, #GtkCellRendererText, #GtkCellRendererToggle
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
||||
<!-- ##### SECTION Image ##### -->
|
||||
|
||||
|
||||
<!-- ##### STRUCT GtkTreeSelection ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### SIGNAL GtkTreeSelection::changed ##### -->
|
||||
<para>
|
||||
Emitted whenever the selection has (possibly) changed. Please note that
|
||||
this signal is mostly a hint. It may only be emitted once when a range
|
||||
of rows are selected, and it may occasionally be emitted when nothing
|
||||
has happened.
|
||||
</para>
|
||||
|
||||
@treeselection: the object which received the signal.
|
||||
|
||||
<!-- ##### USER_FUNCTION GtkTreeSelectionFunc ##### -->
|
||||
<para>
|
||||
A function used by gtk_tree_selection_set_select_function() to filter
|
||||
whether or not a row may be selected. It is called whenever a row's
|
||||
state might change. A return value of %TRUE indicates to @selection
|
||||
that it is okay to change the selection.
|
||||
</para>
|
||||
|
||||
@selection: A #GtkTreeSelection
|
||||
@model: A #GtkTreeModel being viewed
|
||||
@path: The #GtkTreePath of the row in question
|
||||
@path_currently_selected: %TRUE, if the path is currently selected
|
||||
@data: user data
|
||||
@Returns: %TRUE, if the selection state of the row can be toggled
|
||||
|
||||
|
||||
<!-- ##### USER_FUNCTION GtkTreeSelectionForeachFunc ##### -->
|
||||
<para>
|
||||
A function used by gtk_tree_selection_selected_foreach() to map all
|
||||
selected rows. It will be called on every selected row in the view.
|
||||
</para>
|
||||
|
||||
@model: The #GtkTreeModel being viewed
|
||||
@path: The #GtkTreePath of a selected row
|
||||
@iter: A #GtkTreeIter pointing to a selected row
|
||||
@data: user data
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_selection_set_mode ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@selection:
|
||||
@type:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_selection_get_mode ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@selection:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_selection_set_select_function ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@selection:
|
||||
@func:
|
||||
@data:
|
||||
@destroy:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_selection_get_select_function ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@selection:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_selection_get_user_data ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@selection:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_selection_get_tree_view ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@selection:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_selection_get_selected ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@selection:
|
||||
@model:
|
||||
@iter:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_selection_selected_foreach ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@selection:
|
||||
@func:
|
||||
@data:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_selection_get_selected_rows ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@selection:
|
||||
@model:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_selection_count_selected_rows ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@selection:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_selection_select_path ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@selection:
|
||||
@path:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_selection_unselect_path ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@selection:
|
||||
@path:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_selection_path_is_selected ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@selection:
|
||||
@path:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_selection_select_iter ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@selection:
|
||||
@iter:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_selection_unselect_iter ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@selection:
|
||||
@iter:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_selection_iter_is_selected ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@selection:
|
||||
@iter:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_selection_select_all ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@selection:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_selection_unselect_all ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@selection:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_selection_select_range ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@selection:
|
||||
@start_path:
|
||||
@end_path:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_selection_unselect_range ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@selection:
|
||||
@start_path:
|
||||
@end_path:
|
||||
|
||||
|
@ -1,135 +0,0 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
GtkTreeSortable
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
The interface for sortable models used by GtkTreeView
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
#GtkTreeSortable is an interface to be implemented by tree models which
|
||||
support sorting. The #GtkTreeView uses the methods provided by this interface
|
||||
to sort the model.
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
#GtkTreeModel, #GtkTreeView
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
||||
<!-- ##### SECTION Image ##### -->
|
||||
|
||||
|
||||
<!-- ##### STRUCT GtkTreeSortable ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### SIGNAL GtkTreeSortable::sort-column-changed ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@treesortable: the object which received the signal.
|
||||
|
||||
<!-- ##### STRUCT GtkTreeSortableIface ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@g_iface:
|
||||
@sort_column_changed:
|
||||
@get_sort_column_id:
|
||||
@set_sort_column_id:
|
||||
@set_sort_func:
|
||||
@set_default_sort_func:
|
||||
@has_default_sort_func:
|
||||
|
||||
<!-- ##### USER_FUNCTION GtkTreeIterCompareFunc ##### -->
|
||||
<para>
|
||||
A GtkTreeIterCompareFunc should return a negative integer, zero, or a positive
|
||||
integer if @a sorts before @b, @a sorts with @b, or @a sorts after @b
|
||||
respectively. If two iters compare as equal, their order in the sorted model
|
||||
is undefined. In order to ensure that the #GtkTreeSortable behaves as
|
||||
expected, the GtkTreeIterCompareFunc must define a partial order on
|
||||
the model, i.e. it must be reflexive, antisymmetric and transitive.
|
||||
</para>
|
||||
<para>
|
||||
For example, if @model is a product catalogue, then a compare function
|
||||
for the "price" column could be one which returns
|
||||
<literal>price_of(@a) - price_of(@b)</literal>.
|
||||
</para>
|
||||
|
||||
@model: The #GtkTreeModel the comparison is within
|
||||
@a: A #GtkTreeIter in @model
|
||||
@b: Another #GtkTreeIter in @model
|
||||
@user_data: Data passed when the compare func is assigned e.g. by
|
||||
gtk_tree_sortable_set_sort_func()
|
||||
@Returns: a negative integer, zero or a positive integer depending on whether
|
||||
@a sorts before, with or after @b
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_sortable_sort_column_changed ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@sortable:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_sortable_get_sort_column_id ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@sortable:
|
||||
@sort_column_id:
|
||||
@order:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_sortable_set_sort_column_id ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@sortable:
|
||||
@sort_column_id:
|
||||
@order:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_sortable_set_sort_func ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@sortable:
|
||||
@sort_column_id:
|
||||
@sort_func:
|
||||
@user_data:
|
||||
@destroy:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_sortable_set_default_sort_func ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@sortable:
|
||||
@sort_func:
|
||||
@user_data:
|
||||
@destroy:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_sortable_has_default_sort_func ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@sortable:
|
||||
@Returns:
|
||||
|
||||
|
@ -1,296 +0,0 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
GtkTreeStore
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
A tree-like data structure that can be used with the GtkTreeView
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
The #GtkTreeStore object is a list model for use with a #GtkTreeView
|
||||
widget. It implements the #GtkTreeModel interface, and consequentialy,
|
||||
can use all of the methods available there. It also implements the
|
||||
#GtkTreeSortable interface so it can be sorted by the view. Finally,
|
||||
it also implements the tree <link linkend="gtktreednd">drag and
|
||||
drop</link> interfaces.
|
||||
</para>
|
||||
|
||||
<refsect2 id="GtkTreeStore-BUILDER-UI">
|
||||
<title>GtkTreeStore as GtkBuildable</title>
|
||||
<para>
|
||||
The GtkTreeStore implementation of the GtkBuildable interface allows
|
||||
to specify the model columns with a <columns> element that may
|
||||
contain multiple <column> elements, each specifying one model
|
||||
column. The "type" attribute specifies the data type for the column.
|
||||
</para>
|
||||
<example>
|
||||
<title>A UI Definition fragment for a tree store</title>
|
||||
<programlisting><![CDATA[
|
||||
<object class="GtkTreeStore">
|
||||
<columns>
|
||||
<column type="gchararray"/>
|
||||
<column type="gchararray"/>
|
||||
<column type="gint"/>
|
||||
</columns>
|
||||
</object>
|
||||
]]></programlisting>
|
||||
</example>
|
||||
</refsect2>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
#GtkTreeModel, #GtkTreeStore
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
||||
<!-- ##### SECTION Image ##### -->
|
||||
|
||||
|
||||
<!-- ##### STRUCT GtkTreeStore ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_store_new ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@n_columns:
|
||||
@Varargs:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_store_newv ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@n_columns:
|
||||
@types:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_store_set_column_types ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_store:
|
||||
@n_columns:
|
||||
@types:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_store_set_value ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_store:
|
||||
@iter:
|
||||
@column:
|
||||
@value:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_store_set ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_store:
|
||||
@iter:
|
||||
@Varargs:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_store_set_valist ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_store:
|
||||
@iter:
|
||||
@var_args:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_store_set_valuesv ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_store:
|
||||
@iter:
|
||||
@columns:
|
||||
@values:
|
||||
@n_values:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_store_remove ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_store:
|
||||
@iter:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_store_insert ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_store:
|
||||
@iter:
|
||||
@parent:
|
||||
@position:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_store_insert_before ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_store:
|
||||
@iter:
|
||||
@parent:
|
||||
@sibling:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_store_insert_after ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_store:
|
||||
@iter:
|
||||
@parent:
|
||||
@sibling:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_store_insert_with_values ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_store:
|
||||
@iter:
|
||||
@parent:
|
||||
@position:
|
||||
@Varargs:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_store_insert_with_valuesv ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_store:
|
||||
@iter:
|
||||
@parent:
|
||||
@position:
|
||||
@columns:
|
||||
@values:
|
||||
@n_values:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_store_prepend ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_store:
|
||||
@iter:
|
||||
@parent:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_store_append ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_store:
|
||||
@iter:
|
||||
@parent:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_store_is_ancestor ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_store:
|
||||
@iter:
|
||||
@descendant:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_store_iter_depth ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_store:
|
||||
@iter:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_store_clear ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_store:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_store_iter_is_valid ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_store:
|
||||
@iter:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_store_reorder ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_store:
|
||||
@parent:
|
||||
@new_order:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_store_swap ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_store:
|
||||
@a:
|
||||
@b:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_store_move_before ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_store:
|
||||
@iter:
|
||||
@position:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_store_move_after ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_store:
|
||||
@iter:
|
||||
@position:
|
||||
|
||||
|
@ -1,624 +0,0 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
GtkTreeViewColumn
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
A visible column in a GtkTreeView widget
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
The GtkTreeViewColumn object represents a visible column in a #GtkTreeView widget.
|
||||
It allows to set properties of the column header, and functions as a holding pen for
|
||||
the cell renderers which determine how the data in the column is displayed.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Please refer to the <link linkend="TreeWidget">tree widget conceptual overview</link>
|
||||
for an overview of all the objects and data types related to the tree widget and how
|
||||
they work together.
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
#GtkTreeView, #GtkTreeSelection, #GtkTreeDnd, #GtkTreeMode, #GtkTreeSortable, #GtkTreeModelSort, #GtkListStore, #GtkTreeStore, #GtkCellRenderer, #GtkCellEditable, #GtkCellRendererPixbuf, #GtkCellRendererText, #GtkCellRendererToggle
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
||||
<!-- ##### SECTION Image ##### -->
|
||||
|
||||
|
||||
<!-- ##### ENUM GtkTreeViewColumnSizing ##### -->
|
||||
<para>
|
||||
The sizing method the column uses to determine its width. Please note
|
||||
that @GTK_TREE_VIEW_COLUMN_AUTOSIZE are inefficient for large views, and
|
||||
can make columns appear choppy.
|
||||
</para>
|
||||
|
||||
@GTK_TREE_VIEW_COLUMN_GROW_ONLY: Columns only get bigger in reaction to changes in the model
|
||||
@GTK_TREE_VIEW_COLUMN_AUTOSIZE: Columns resize to be the optimal size everytime the model changes.
|
||||
@GTK_TREE_VIEW_COLUMN_FIXED: Columns are a fixed numbers of pixels wide.
|
||||
|
||||
<!-- ##### USER_FUNCTION GtkTreeCellDataFunc ##### -->
|
||||
<para>
|
||||
A function to set the properties of a cell instead of just using the
|
||||
straight mapping between the cell and the model. This is useful for
|
||||
customizing the cell renderer. For example, a function might get an
|
||||
integer from the @tree_model, and render it to the "text" attribute of
|
||||
"cell" by converting it to its written equivilent. This is set by
|
||||
calling gtk_tree_view_column_set_cell_data_func()
|
||||
</para>
|
||||
|
||||
@tree_column: A #GtkTreeColumn
|
||||
@cell: The #GtkCellRenderer that is being rendered by @tree_column
|
||||
@tree_model: The #GtkTreeModel being rendered
|
||||
@iter: A #GtkTreeIter of the current row rendered
|
||||
@data: user data
|
||||
|
||||
|
||||
<!-- ##### STRUCT GtkTreeViewColumn ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### SIGNAL GtkTreeViewColumn::clicked ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@treeviewcolumn: the object which received the signal.
|
||||
|
||||
<!-- ##### ARG GtkTreeViewColumn:alignment ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTreeViewColumn:clickable ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTreeViewColumn:expand ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTreeViewColumn:fixed-width ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTreeViewColumn:max-width ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTreeViewColumn:min-width ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTreeViewColumn:reorderable ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTreeViewColumn:resizable ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTreeViewColumn:sizing ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTreeViewColumn:sort-column-id ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTreeViewColumn:sort-indicator ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTreeViewColumn:sort-order ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTreeViewColumn:spacing ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTreeViewColumn:title ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTreeViewColumn:visible ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTreeViewColumn:widget ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTreeViewColumn:width ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_new ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@void:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_new_with_attributes ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@title:
|
||||
@cell:
|
||||
@Varargs:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_pack_start ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@cell:
|
||||
@expand:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_pack_end ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@cell:
|
||||
@expand:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_clear ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_add_attribute ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@cell_renderer:
|
||||
@attribute:
|
||||
@column:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_set_attributes ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@cell_renderer:
|
||||
@Varargs:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_set_cell_data_func ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@cell_renderer:
|
||||
@func:
|
||||
@func_data:
|
||||
@destroy:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_clear_attributes ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@cell_renderer:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_set_spacing ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@spacing:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_get_spacing ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_set_visible ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@visible:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_get_visible ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_set_resizable ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@resizable:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_get_resizable ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_set_sizing ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@type:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_get_sizing ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_get_width ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_get_fixed_width ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_set_fixed_width ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@fixed_width:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_set_min_width ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@min_width:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_get_min_width ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_set_max_width ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@max_width:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_get_max_width ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_clicked ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_set_title ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@title:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_get_title ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_set_expand ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@expand:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_get_expand ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_set_clickable ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@clickable:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_get_clickable ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_set_widget ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@widget:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_get_widget ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_set_alignment ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@xalign:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_get_alignment ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_set_reorderable ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@reorderable:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_get_reorderable ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_set_sort_column_id ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@sort_column_id:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_get_sort_column_id ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_set_sort_indicator ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@setting:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_get_sort_indicator ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_set_sort_order ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@order:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_get_sort_order ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_cell_set_cell_data ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@tree_model:
|
||||
@iter:
|
||||
@is_expander:
|
||||
@is_expanded:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_cell_get_size ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@cell_area:
|
||||
@x_offset:
|
||||
@y_offset:
|
||||
@width:
|
||||
@height:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_cell_get_position ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@cell_renderer:
|
||||
@start_pos:
|
||||
@width:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_cell_is_visible ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_focus_cell ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@cell:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_queue_resize ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_get_tree_view ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@Returns:
|
||||
|
||||
|
@ -91,6 +91,7 @@ gdk_public_h_sources = \
|
||||
gdkprivate.h \
|
||||
gdkproperty.h \
|
||||
gdkrectangle.h \
|
||||
gdkrgba.h \
|
||||
gdkscreen.h \
|
||||
gdkselection.h \
|
||||
gdkspawn.h \
|
||||
@ -130,6 +131,7 @@ gdk_c_sources = \
|
||||
gdkpango.c \
|
||||
gdkpixbuf-drawable.c \
|
||||
gdkrectangle.c \
|
||||
gdkrgba.c \
|
||||
gdkscreen.c \
|
||||
gdkselection.c \
|
||||
gdkvisual.c \
|
||||
|
@ -167,6 +167,20 @@ gdk_cairo_set_source_color (cairo_t *cr,
|
||||
color->blue / 65535.);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_cairo_set_source_rgba (cairo_t *cr,
|
||||
const GdkRGBA *rgba)
|
||||
{
|
||||
g_return_if_fail (cr != NULL);
|
||||
g_return_if_fail (rgba != NULL);
|
||||
|
||||
cairo_set_source_rgba (cr,
|
||||
rgba->red,
|
||||
rgba->green,
|
||||
rgba->blue,
|
||||
rgba->alpha);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_cairo_rectangle:
|
||||
* @cr: a #cairo_t
|
||||
|
@ -25,6 +25,7 @@
|
||||
#define __GDK_CAIRO_H__
|
||||
|
||||
#include <gdk/gdkcolor.h>
|
||||
#include <gdk/gdkrgba.h>
|
||||
#include <gdk/gdkpixbuf.h>
|
||||
#include <pango/pangocairo.h>
|
||||
|
||||
@ -38,6 +39,8 @@ gboolean gdk_cairo_get_clip_rectangle(cairo_t *cr,
|
||||
|
||||
void gdk_cairo_set_source_color (cairo_t *cr,
|
||||
const GdkColor *color);
|
||||
void gdk_cairo_set_source_rgba (cairo_t *cr,
|
||||
const GdkRGBA *rgba);
|
||||
void gdk_cairo_set_source_pixbuf (cairo_t *cr,
|
||||
const GdkPixbuf *pixbuf,
|
||||
double pixbuf_x,
|
||||
|
277
gdk/gdkrgba.c
Normal file
277
gdk/gdkrgba.c
Normal file
@ -0,0 +1,277 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
||||
* file for a list of people on the GTK+ Team. See the ChangeLog
|
||||
* files for a list of changes. These files are distributed with
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "gdkrgba.h"
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
* SECTION:rgba_colors
|
||||
* @Short_description: RGBA colors
|
||||
* @Title: RGBA Colors
|
||||
*/
|
||||
|
||||
G_DEFINE_BOXED_TYPE (GdkRGBA, gdk_rgba,
|
||||
gdk_rgba_copy, gdk_rgba_free)
|
||||
|
||||
/**
|
||||
* gdk_rgba_copy:
|
||||
* @rgba: a #GdkRGBA
|
||||
*
|
||||
* Makes a copy of a #GdkRGBA structure, the result must be freed
|
||||
* through gdk_rgba_free().
|
||||
*
|
||||
* Returns: A newly allocated #GdkRGBA
|
||||
**/
|
||||
GdkRGBA *
|
||||
gdk_rgba_copy (GdkRGBA *rgba)
|
||||
{
|
||||
GdkRGBA *copy;
|
||||
|
||||
copy = g_slice_new (GdkRGBA);
|
||||
copy->red = rgba->red;
|
||||
copy->green = rgba->green;
|
||||
copy->blue = rgba->blue;
|
||||
copy->alpha = rgba->alpha;
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_rgba_free:
|
||||
* @rgba: a #GdkRGBA
|
||||
*
|
||||
* Frees a #GdkRGBA struct created with gdk_rgba_copy()
|
||||
**/
|
||||
void
|
||||
gdk_rgba_free (GdkRGBA *rgba)
|
||||
{
|
||||
g_slice_free (GdkRGBA, rgba);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_rgba_parse:
|
||||
* @spec: the string specifying the color
|
||||
* @rgba: the #GdkRGBA struct to fill in
|
||||
*
|
||||
* Parses a textual representation of a color, filling in
|
||||
* the <structfield>red</structfield>, <structfield>green</structfield>,
|
||||
* <structfield>blue</structfield> and <structfield>alpha</structfield>
|
||||
* fields of the @rgba struct.
|
||||
*
|
||||
* The string can be either one of:
|
||||
* <itemizedlist>
|
||||
* <listitem>
|
||||
* A standard name (Taken from the X11 rgb.txt file).
|
||||
* </listitem>
|
||||
* <listitem>
|
||||
* A hex value in the form '#rgb' '#rrggbb' '#rrrgggbbb' or '#rrrrggggbbbb'
|
||||
* </listitem>
|
||||
* <listitem>
|
||||
* A RGB color in the form 'rgb(r,g,b)' (In this case the color will
|
||||
* have full opacity)
|
||||
* </listitem>
|
||||
* <listitem>
|
||||
* A RGBA color in the form 'rgba(r,g,b,a)'
|
||||
* </listitem>
|
||||
* </itemizedlist>
|
||||
*
|
||||
* Where 'r', 'g', 'b' and 'a' are respectively the red, green, blue and
|
||||
* alpha color values, parsed in the last 2 cases as double numbers in
|
||||
* the range [0..1], any other value out of that range will be clamped.
|
||||
*
|
||||
* Returns: %TRUE if the parsing succeeded
|
||||
**/
|
||||
gboolean
|
||||
gdk_rgba_parse (const gchar *spec,
|
||||
GdkRGBA *rgba)
|
||||
{
|
||||
gboolean has_alpha;
|
||||
gdouble r, g, b, a;
|
||||
gchar *str = (gchar *) spec;
|
||||
|
||||
#define SKIP_WHITESPACES(s) while (*(s) == ' ') (s)++;
|
||||
|
||||
if (strncmp (str, "rgba", 4) == 0)
|
||||
{
|
||||
has_alpha = TRUE;
|
||||
str += 4;
|
||||
}
|
||||
else if (strncmp (str, "rgb", 3) == 0)
|
||||
{
|
||||
has_alpha = FALSE;
|
||||
a = 1;
|
||||
str += 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
PangoColor pango_color;
|
||||
|
||||
/* Resort on PangoColor for rgb.txt color
|
||||
* map and '#' prefixed colors */
|
||||
if (pango_color_parse (&pango_color, str))
|
||||
{
|
||||
if (rgba)
|
||||
{
|
||||
rgba->red = pango_color.red / 65535.;
|
||||
rgba->green = pango_color.green / 65535.;
|
||||
rgba->blue = pango_color.blue / 65535.;
|
||||
rgba->alpha = 1;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
SKIP_WHITESPACES (str);
|
||||
|
||||
if (*str != '(')
|
||||
return FALSE;
|
||||
|
||||
str++;
|
||||
|
||||
/* Parse red */
|
||||
SKIP_WHITESPACES (str);
|
||||
r = g_ascii_strtod (str, &str);
|
||||
SKIP_WHITESPACES (str);
|
||||
|
||||
if (*str != ',')
|
||||
return FALSE;
|
||||
|
||||
str++;
|
||||
|
||||
/* Parse green */
|
||||
SKIP_WHITESPACES (str);
|
||||
g = g_ascii_strtod (str, &str);
|
||||
SKIP_WHITESPACES (str);
|
||||
|
||||
if (*str != ',')
|
||||
return FALSE;
|
||||
|
||||
str++;
|
||||
|
||||
/* Parse blue */
|
||||
SKIP_WHITESPACES (str);
|
||||
b = g_ascii_strtod (str, &str);
|
||||
SKIP_WHITESPACES (str);
|
||||
|
||||
if (has_alpha)
|
||||
{
|
||||
if (*str != ',')
|
||||
return FALSE;
|
||||
|
||||
str++;
|
||||
|
||||
SKIP_WHITESPACES (str);
|
||||
a = g_ascii_strtod (str, &str);
|
||||
SKIP_WHITESPACES (str);
|
||||
}
|
||||
|
||||
if (*str != ')')
|
||||
return FALSE;
|
||||
|
||||
#undef SKIP_WHITESPACES
|
||||
|
||||
if (rgba)
|
||||
{
|
||||
rgba->red = CLAMP (r, 0, 1);
|
||||
rgba->green = CLAMP (g, 0, 1);
|
||||
rgba->blue = CLAMP (b, 0, 1);
|
||||
rgba->alpha = CLAMP (a, 0, 1);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_rgba_hash:
|
||||
* @p: a #GdkRGBA pointer.
|
||||
*
|
||||
* A hash function suitable for using for a hash
|
||||
* table that stores #GdkRGBA<!-- -->s.
|
||||
*
|
||||
* Return value: The hash function applied to @p
|
||||
**/
|
||||
guint
|
||||
gdk_rgba_hash (gconstpointer p)
|
||||
{
|
||||
const GdkRGBA *rgba = p;
|
||||
|
||||
return ((guint) (rgba->red * 65535) +
|
||||
((guint) (rgba->green * 65535) << 11) +
|
||||
((guint) (rgba->blue * 65535) << 22) +
|
||||
((guint) (rgba->alpha * 65535) >> 6));
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_rgba_equal:
|
||||
* @p1: a #GdkRGBA pointer.
|
||||
* @p2: another #GdkRGBA pointer.
|
||||
*
|
||||
* Compares two RGBA colors.
|
||||
*
|
||||
* Return value: %TRUE if the two colors compare equal
|
||||
**/
|
||||
gboolean
|
||||
gdk_rgba_equal (gconstpointer p1,
|
||||
gconstpointer p2)
|
||||
{
|
||||
const GdkRGBA *rgba1, *rgba2;
|
||||
|
||||
rgba1 = p1;
|
||||
rgba2 = p2;
|
||||
|
||||
if (rgba1->red == rgba2->red &&
|
||||
rgba1->green == rgba2->green &&
|
||||
rgba1->blue == rgba2->blue &&
|
||||
rgba1->alpha == rgba2->alpha)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_rgba_to_string:
|
||||
* @rgba: a #GdkRGBA
|
||||
*
|
||||
* Returns a textual specification of @rgba in the form
|
||||
* <literal>rgba (r, g, b, a)</literal>, where 'r', 'g',
|
||||
* 'b' and 'a' represent the red, green, blue and alpha
|
||||
* values respectively.
|
||||
*
|
||||
* Returns: A newly allocated text string
|
||||
**/
|
||||
gchar *
|
||||
gdk_rgba_to_string (GdkRGBA *rgba)
|
||||
{
|
||||
return g_strdup_printf ("rgba(%f,%f,%f,%f)",
|
||||
CLAMP (rgba->red, 0, 1),
|
||||
CLAMP (rgba->green, 0, 1),
|
||||
CLAMP (rgba->blue, 0, 1),
|
||||
CLAMP (rgba->alpha, 0, 1));
|
||||
}
|
65
gdk/gdkrgba.h
Normal file
65
gdk/gdkrgba.h
Normal file
@ -0,0 +1,65 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
||||
* file for a list of people on the GTK+ Team. See the ChangeLog
|
||||
* files for a list of changes. These files are distributed with
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
|
||||
#error "Only <gdk/gdk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __GDK_RGBA_H__
|
||||
#define __GDK_RGBA_H__
|
||||
|
||||
#include <gdk/gdktypes.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
struct _GdkRGBA
|
||||
{
|
||||
gdouble red;
|
||||
gdouble green;
|
||||
gdouble blue;
|
||||
gdouble alpha;
|
||||
};
|
||||
|
||||
#define GDK_TYPE_RGBA (gdk_rgba_get_type ())
|
||||
|
||||
GdkRGBA * gdk_rgba_copy (GdkRGBA *rgba);
|
||||
void gdk_rgba_free (GdkRGBA *rgba);
|
||||
|
||||
gboolean gdk_rgba_parse (const gchar *spec,
|
||||
GdkRGBA *rgba);
|
||||
|
||||
guint gdk_rgba_hash (gconstpointer p);
|
||||
gboolean gdk_rgba_equal (gconstpointer p1,
|
||||
gconstpointer p2);
|
||||
|
||||
gchar * gdk_rgba_to_string (GdkRGBA *rgba);
|
||||
|
||||
GType gdk_rgba_get_type (void) G_GNUC_CONST;
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_RGBA_H__ */
|
@ -96,6 +96,7 @@ typedef guint32 GdkNativeWindow;
|
||||
/* Forward declarations of commonly used types
|
||||
*/
|
||||
typedef struct _GdkColor GdkColor;
|
||||
typedef struct _GdkRGBA GdkRGBA;
|
||||
typedef struct _GdkCursor GdkCursor;
|
||||
typedef struct _GdkVisual GdkVisual;
|
||||
|
||||
|
@ -6669,6 +6669,32 @@ gdk_window_set_background (GdkWindow *window,
|
||||
cairo_pattern_destroy (pattern);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_window_set_background_rgba:
|
||||
* @window: a #GdkWindow
|
||||
* @rgba: a #GdkRGBA color
|
||||
*
|
||||
* Sets the background color of @window.
|
||||
*
|
||||
* See also gdk_window_set_background_pattern().
|
||||
**/
|
||||
void
|
||||
gdk_window_set_background_rgba (GdkWindow *window,
|
||||
GdkRGBA *rgba)
|
||||
{
|
||||
cairo_pattern_t *pattern;
|
||||
|
||||
g_return_if_fail (GDK_IS_WINDOW (window));
|
||||
g_return_if_fail (rgba != NULL);
|
||||
|
||||
pattern = cairo_pattern_create_rgba (rgba->red, rgba->green,
|
||||
rgba->blue, rgba->alpha);
|
||||
|
||||
gdk_window_set_background_pattern (window, pattern);
|
||||
|
||||
cairo_pattern_destroy (pattern);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_window_set_background_pattern:
|
||||
* @window: a #GdkWindow
|
||||
|
@ -697,6 +697,8 @@ void gdk_window_set_transient_for (GdkWindow *window,
|
||||
GdkWindow *parent);
|
||||
void gdk_window_set_background (GdkWindow *window,
|
||||
const GdkColor *color);
|
||||
void gdk_window_set_background_rgba (GdkWindow *window,
|
||||
GdkRGBA *rgba);
|
||||
void gdk_window_set_background_pattern (GdkWindow *window,
|
||||
cairo_pattern_t *pattern);
|
||||
cairo_pattern_t *gdk_window_get_background_pattern (GdkWindow *window);
|
||||
|
@ -210,6 +210,7 @@ gtk_public_h_sources = \
|
||||
gtkfontbutton.h \
|
||||
gtkfontsel.h \
|
||||
gtkframe.h \
|
||||
gtkgrid.h \
|
||||
gtkhandlebox.h \
|
||||
gtkhbbox.h \
|
||||
gtkhbox.h \
|
||||
@ -272,6 +273,7 @@ gtk_public_h_sources = \
|
||||
gtkruler.h \
|
||||
gtkscale.h \
|
||||
gtkscalebutton.h \
|
||||
gtkscrollable.h \
|
||||
gtkscrollbar.h \
|
||||
gtkscrolledwindow.h \
|
||||
gtkselection.h \
|
||||
@ -473,6 +475,7 @@ gtk_base_c_sources = \
|
||||
gtkfontbutton.c \
|
||||
gtkfontsel.c \
|
||||
gtkframe.c \
|
||||
gtkgrid.c \
|
||||
gtkhandlebox.c \
|
||||
gtkhbbox.c \
|
||||
gtkhbox.c \
|
||||
@ -546,6 +549,7 @@ gtk_base_c_sources = \
|
||||
gtkruler.c \
|
||||
gtkscale.c \
|
||||
gtkscalebutton.c \
|
||||
gtkscrollable.c \
|
||||
gtkscrollbar.c \
|
||||
gtkscrolledwindow.c \
|
||||
gtkselection.c \
|
||||
|
@ -93,6 +93,7 @@
|
||||
#include <gtk/gtkfontbutton.h>
|
||||
#include <gtk/gtkfontsel.h>
|
||||
#include <gtk/gtkframe.h>
|
||||
#include <gtk/gtkgrid.h>
|
||||
#include <gtk/gtkhandlebox.h>
|
||||
#include <gtk/gtkhbbox.h>
|
||||
#include <gtk/gtkhbox.h>
|
||||
@ -154,6 +155,7 @@
|
||||
#include <gtk/gtkruler.h>
|
||||
#include <gtk/gtkscale.h>
|
||||
#include <gtk/gtkscalebutton.h>
|
||||
#include <gtk/gtkscrollable.h>
|
||||
#include <gtk/gtkscrollbar.h>
|
||||
#include <gtk/gtkscrolledwindow.h>
|
||||
#include <gtk/gtkselection.h>
|
||||
|
@ -801,6 +801,7 @@ gtk_combo_box_get_column_span_column
|
||||
gtk_combo_box_get_entry_text_column
|
||||
gtk_combo_box_get_focus_on_click
|
||||
gtk_combo_box_get_has_entry
|
||||
gtk_combo_box_get_id_column
|
||||
gtk_combo_box_get_model
|
||||
gtk_combo_box_get_popup_accessible
|
||||
gtk_combo_box_get_popup_fixed_width
|
||||
@ -822,6 +823,7 @@ gtk_combo_box_set_add_tearoffs
|
||||
gtk_combo_box_set_column_span_column
|
||||
gtk_combo_box_set_entry_text_column
|
||||
gtk_combo_box_set_focus_on_click
|
||||
gtk_combo_box_set_id_column
|
||||
gtk_combo_box_set_model
|
||||
gtk_combo_box_set_popup_fixed_width
|
||||
gtk_combo_box_set_row_separator_func
|
||||
@ -838,10 +840,12 @@ gtk_combo_box_text_append_text
|
||||
gtk_combo_box_text_get_active_text
|
||||
gtk_combo_box_text_get_type G_GNUC_CONST
|
||||
gtk_combo_box_text_insert_text
|
||||
gtk_combo_box_text_insert_text_with_id
|
||||
gtk_combo_box_text_new
|
||||
gtk_combo_box_text_new_with_entry
|
||||
gtk_combo_box_text_prepend_text
|
||||
gtk_combo_box_text_remove
|
||||
gtk_combo_box_text_remove_all
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -1074,6 +1078,7 @@ gtk_entry_get_current_icon_drag_source
|
||||
gtk_entry_get_cursor_hadjustment
|
||||
gtk_entry_get_has_frame
|
||||
gtk_entry_get_icon_activatable
|
||||
gtk_entry_get_icon_area
|
||||
gtk_entry_get_icon_at_pos
|
||||
gtk_entry_get_icon_gicon
|
||||
gtk_entry_get_icon_name
|
||||
@ -1083,7 +1088,6 @@ gtk_entry_get_icon_stock
|
||||
gtk_entry_get_icon_storage_type
|
||||
gtk_entry_get_icon_tooltip_markup
|
||||
gtk_entry_get_icon_tooltip_text
|
||||
gtk_entry_get_icon_window
|
||||
gtk_entry_get_inner_border
|
||||
gtk_entry_get_invisible_char
|
||||
gtk_entry_get_layout
|
||||
@ -1093,11 +1097,11 @@ gtk_entry_get_overwrite_mode
|
||||
gtk_entry_get_progress_fraction
|
||||
gtk_entry_get_progress_pulse_step
|
||||
gtk_entry_get_text
|
||||
gtk_entry_get_text_area
|
||||
gtk_entry_get_text_length
|
||||
gtk_entry_get_type G_GNUC_CONST
|
||||
gtk_entry_get_visibility
|
||||
gtk_entry_get_width_chars
|
||||
gtk_entry_get_text_window
|
||||
gtk_entry_im_context_filter_keypress
|
||||
gtk_entry_layout_index_to_text_index
|
||||
gtk_entry_new
|
||||
@ -2794,9 +2798,11 @@ gtk_recent_info_get_application_info
|
||||
gtk_recent_info_get_applications G_GNUC_MALLOC
|
||||
gtk_recent_info_last_application G_GNUC_MALLOC
|
||||
gtk_recent_info_has_application
|
||||
gtk_recent_info_create_app_info
|
||||
gtk_recent_info_get_groups G_GNUC_MALLOC
|
||||
gtk_recent_info_has_group
|
||||
gtk_recent_info_get_icon
|
||||
gtk_recent_info_get_gicon
|
||||
gtk_recent_info_get_short_name G_GNUC_MALLOC
|
||||
gtk_recent_info_get_uri_display G_GNUC_MALLOC
|
||||
gtk_recent_info_get_age
|
||||
@ -2888,6 +2894,16 @@ gtk_scale_button_get_popup
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if IN_HEADER(__GTK_SCROLLABLE_H__)
|
||||
#if IN_FILE(__GTK_SCROLLABLE_C__)
|
||||
gtk_scrollable_get_type G_GNUC_CONST
|
||||
gtk_scrollable_get_hadjustment
|
||||
gtk_scrollable_get_vadjustment
|
||||
gtk_scrollable_set_hadjustment
|
||||
gtk_scrollable_set_vadjustment
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if IN_HEADER(__GTK_SCROLLBAR_H__)
|
||||
#if IN_FILE(__GTK_SCROLLBAR_C__)
|
||||
gtk_scrollbar_get_type G_GNUC_CONST
|
||||
@ -2913,6 +2929,10 @@ gtk_scrolled_window_set_policy
|
||||
gtk_scrolled_window_set_shadow_type
|
||||
gtk_scrolled_window_set_vadjustment
|
||||
gtk_scrolled_window_unset_placement
|
||||
gtk_scrolled_window_get_min_content_width
|
||||
gtk_scrolled_window_set_min_content_width
|
||||
gtk_scrolled_window_get_min_content_height
|
||||
gtk_scrolled_window_set_min_content_height
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -4020,7 +4040,6 @@ gtk_tree_view_set_enable_tree_lines
|
||||
gtk_tree_view_set_expander_column
|
||||
gtk_tree_view_set_fixed_height_mode
|
||||
gtk_tree_view_set_grid_lines
|
||||
gtk_tree_view_set_hadjustment
|
||||
gtk_tree_view_set_headers_clickable
|
||||
gtk_tree_view_set_headers_visible
|
||||
gtk_tree_view_set_hover_expand
|
||||
@ -4039,7 +4058,6 @@ gtk_tree_view_set_show_expanders
|
||||
gtk_tree_view_set_tooltip_row
|
||||
gtk_tree_view_set_tooltip_cell
|
||||
gtk_tree_view_set_tooltip_column
|
||||
gtk_tree_view_set_vadjustment
|
||||
gtk_tree_view_unset_rows_drag_dest
|
||||
gtk_tree_view_unset_rows_drag_source
|
||||
gtk_tree_view_columns_autosize
|
||||
@ -4288,7 +4306,6 @@ gtk_widget_set_parent
|
||||
gtk_widget_set_parent_window
|
||||
gtk_widget_set_receives_default
|
||||
gtk_widget_set_redraw_on_allocate
|
||||
gtk_widget_set_scroll_adjustments
|
||||
gtk_widget_set_sensitive
|
||||
gtk_widget_set_size_request
|
||||
gtk_widget_set_state
|
||||
@ -4514,3 +4531,20 @@ gtk_info_bar_set_message_type
|
||||
gtk_info_bar_get_message_type
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if IN_HEADER(__GTK_GRID_H__)
|
||||
#if IN_FILE(__GTK_GRID_c__)
|
||||
gtk_grid_get_type G_GNUC_CONST
|
||||
gtk_grid_new
|
||||
gtk_grid_attach
|
||||
gtk_grid_attach_next_to
|
||||
gtk_grid_set_row_homogeneous
|
||||
gtk_grid_get_row_homogeneous
|
||||
gtk_grid_set_row_spacing
|
||||
gtk_grid_get_row_spacing
|
||||
gtk_grid_set_column_homogeneous
|
||||
gtk_grid_get_column_homogeneous
|
||||
gtk_grid_set_column_spacing
|
||||
gtk_grid_get_column_spacing
|
||||
#endif
|
||||
#endif
|
||||
|
@ -31,6 +31,27 @@
|
||||
#include "gtkintl.h"
|
||||
|
||||
|
||||
/**
|
||||
* SECTION:gtkadjustment
|
||||
* @Short_description: A representation of an adjustable bounded value
|
||||
* @Title: GtkAdjustment
|
||||
*
|
||||
* The #GtkAdjustment object represents a value which has an associated lower
|
||||
* and upper bound, together with step and page increments, and a page size.
|
||||
* It is used within several GTK+ widgets, including
|
||||
* #GtkSpinButton, #GtkViewport, and #GtkRange (which is a base class for
|
||||
* #GtkHScrollbar, #GtkVScrollbar, #GtkHScale, and #GtkVScale).
|
||||
*
|
||||
* The #GtkAdjustment object does not update the value itself. Instead
|
||||
* it is left up to the owner of the #GtkAdjustment to control the value.
|
||||
*
|
||||
* The owner of the #GtkAdjustment typically calls the
|
||||
* gtk_adjustment_value_changed() and gtk_adjustment_changed() functions
|
||||
* after changing the value and its bounds. This results in the emission of the
|
||||
* #GtkAdjustment::value_changed or #GtkAdjustment::changed signal respectively.
|
||||
*/
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
@ -188,6 +209,13 @@ gtk_adjustment_class_init (GtkAdjustmentClass *class)
|
||||
0.0,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
/**
|
||||
* GtkAdjustment::changed:
|
||||
* @adjustment: the object which received the signal.
|
||||
*
|
||||
* Emitted when one or more of the #GtkAdjustment fields have been changed,
|
||||
* other than the value field.
|
||||
*/
|
||||
adjustment_signals[CHANGED] =
|
||||
g_signal_new (I_("changed"),
|
||||
G_OBJECT_CLASS_TYPE (class),
|
||||
@ -197,6 +225,12 @@ gtk_adjustment_class_init (GtkAdjustmentClass *class)
|
||||
_gtk_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
/**
|
||||
* GtkAdjustment::value-changed:
|
||||
* @adjustment: the object which received the signal.
|
||||
*
|
||||
* Emitted when the #GtkAdjustment value field has been changed.
|
||||
*/
|
||||
adjustment_signals[VALUE_CHANGED] =
|
||||
g_signal_new (I_("value-changed"),
|
||||
G_OBJECT_CLASS_TYPE (class),
|
||||
@ -318,6 +352,19 @@ gtk_adjustment_dispatch_properties_changed (GObject *object,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_adjustment_new:
|
||||
* @value: the initial value.
|
||||
* @lower: the minimum value.
|
||||
* @upper: the maximum value.
|
||||
* @step_increment: the step increment.
|
||||
* @page_increment: the page increment.
|
||||
* @page_size: the page size.
|
||||
*
|
||||
* Creates a new #GtkAdjustment.
|
||||
*
|
||||
* Returns: a new #GtkAdjustment.
|
||||
*/
|
||||
GtkAdjustment *
|
||||
gtk_adjustment_new (gdouble value,
|
||||
gdouble lower,
|
||||
@ -353,6 +400,18 @@ gtk_adjustment_get_value (GtkAdjustment *adjustment)
|
||||
return adjustment->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_adjustment_set_value:
|
||||
* @adjustment: a #GtkAdjustment.
|
||||
* @value: the new value.
|
||||
*
|
||||
* Sets the #GtkAdjustment value. The value is clamped to lie between
|
||||
* #GtkAdjustment.lower and #GtkAdjustment.upper.
|
||||
*
|
||||
* Note that for adjustments which are used in a #GtkScrollbar, the effective
|
||||
* range of allowed values goes from #GtkAdjustment.lower to
|
||||
* #GtkAdjustment.upper - #GtkAdjustment.page_size.
|
||||
*/
|
||||
void
|
||||
gtk_adjustment_set_value (GtkAdjustment *adjustment,
|
||||
gdouble value)
|
||||
@ -656,6 +715,14 @@ gtk_adjustment_configure (GtkAdjustment *adjustment,
|
||||
gtk_adjustment_value_changed (adjustment);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_adjustment_changed:
|
||||
* @adjustment: a #GtkAdjustment
|
||||
*
|
||||
* Emits a #GtkAdjustment::changed signal from the #GtkAdjustment.
|
||||
* This is typically called by the owner of the #GtkAdjustment after it has
|
||||
* changed any of the #GtkAdjustment fields other than the value.
|
||||
*/
|
||||
void
|
||||
gtk_adjustment_changed (GtkAdjustment *adjustment)
|
||||
{
|
||||
@ -664,6 +731,14 @@ gtk_adjustment_changed (GtkAdjustment *adjustment)
|
||||
g_signal_emit (adjustment, adjustment_signals[CHANGED], 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_adjustment_value_changed:
|
||||
* @adjustment: a #GtkAdjustment
|
||||
*
|
||||
* Emits a #GtkAdjustment::value_changed signal from the #GtkAdjustment.
|
||||
* This is typically called by the owner of the #GtkAdjustment after it has
|
||||
* changed the #GtkAdjustment value field.
|
||||
*/
|
||||
void
|
||||
gtk_adjustment_value_changed (GtkAdjustment *adjustment)
|
||||
{
|
||||
@ -673,6 +748,19 @@ gtk_adjustment_value_changed (GtkAdjustment *adjustment)
|
||||
g_object_notify (G_OBJECT (adjustment), "value");
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_adjustment_clamp_page:
|
||||
* @adjustment: a #GtkAdjustment.
|
||||
* @lower: the lower value.
|
||||
* @upper: the upper value.
|
||||
*
|
||||
* Updates the #GtkAdjustment #GtkAdjustment.value to ensure that the range
|
||||
* between @lower and @upper is in the current page (i.e. between
|
||||
* #GtkAdjustment.value and #GtkAdjustment.value + #GtkAdjustment.page_size).
|
||||
* If the range is larger than the page size, then only the start of it will
|
||||
* be in the current page.
|
||||
* A #GtkAdjustment::changed signal will be emitted if the value is changed.
|
||||
*/
|
||||
void
|
||||
gtk_adjustment_clamp_page (GtkAdjustment *adjustment,
|
||||
gdouble lower,
|
||||
|
@ -46,6 +46,22 @@ G_BEGIN_DECLS
|
||||
typedef struct _GtkAdjustment GtkAdjustment;
|
||||
typedef struct _GtkAdjustmentClass GtkAdjustmentClass;
|
||||
|
||||
/**
|
||||
* GtkAdjustment:
|
||||
* @lower: the minimum value.
|
||||
* @upper: the maximum value.
|
||||
* @value: the current value.
|
||||
* @step_increment: the increment to use to make minor changes to the @value.
|
||||
* In a #GtkScrollbar this increment is used when the mouse is clicked on the
|
||||
* arrows at the top and bottom of the scrollbar, to scroll by a small amount.
|
||||
* @page_increment: the increment to use to make major changes to the @value.
|
||||
* In a #GtkScrollbar this increment is used when the mouse is clicked in the
|
||||
* trough, to scroll by a large amount.
|
||||
* @page_size: In a #GtkScrollbar this is the size of the area which is currently
|
||||
* visible.
|
||||
*
|
||||
* The #GtkAdjustment struct contains the following fields.
|
||||
*/
|
||||
struct _GtkAdjustment
|
||||
{
|
||||
GInitiallyUnowned parent_instance;
|
||||
|
@ -42,9 +42,13 @@
|
||||
* Of course, if the scale settings are both set to 1, the alignment settings
|
||||
* have no effect.
|
||||
*
|
||||
* <note>
|
||||
* <para>
|
||||
* Note that the desired effect can in most cases be achieved by using the
|
||||
* #GtkWidget:halign, #GtkWidget:valign and #GtkWidget:margin properties
|
||||
* on the child widget.
|
||||
* on the child widget, so #GtkAlignment should not be used in new code.
|
||||
* </para>
|
||||
* </note>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
@ -28,7 +28,7 @@
|
||||
* SECTION:gtkbox
|
||||
* @Short_description: Base class for box containers
|
||||
* @Title: GtkBox
|
||||
* @See_also:i #GtkHBox, #GtkVBox, #GtkFrame, #GtkTable, #GtkLayout
|
||||
* @See_also: #GtkHBox, #GtkVBox, #GtkFrame, #GtkTable, #GtkLayout
|
||||
*
|
||||
* GtkBox is an widget which encapsulates functionality for a
|
||||
* particular kind of container, one that organizes a variable number of
|
||||
@ -74,6 +74,9 @@
|
||||
* Use gtk_box_set_child_packing() to reset the #GtkBox:expand,
|
||||
* #GtkBox:fill and #GtkBox:padding child properties.
|
||||
* Use gtk_box_query_child_packing() to query these fields.
|
||||
*
|
||||
* Note that a single-row or single-column #GtkGrid provides exactly the
|
||||
* same functionality as #GtkBox.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
@ -1559,6 +1559,22 @@ gtk_builder_value_from_string_type (GtkBuilder *builder,
|
||||
ret = FALSE;
|
||||
}
|
||||
}
|
||||
else if (G_VALUE_HOLDS (value, GDK_TYPE_RGBA))
|
||||
{
|
||||
GdkRGBA rgba = { 0 };
|
||||
|
||||
if (gdk_rgba_parse (string, &rgba))
|
||||
g_value_set_boxed (value, &rgba);
|
||||
else
|
||||
{
|
||||
g_set_error (error,
|
||||
GTK_BUILDER_ERROR,
|
||||
GTK_BUILDER_ERROR_INVALID_VALUE,
|
||||
"Could not parse RGBA color '%s'",
|
||||
string);
|
||||
ret = FALSE;
|
||||
}
|
||||
}
|
||||
else if (G_VALUE_HOLDS (value, G_TYPE_STRV))
|
||||
{
|
||||
gchar **vector = g_strsplit (string, "\n", 0);
|
||||
|
@ -2287,7 +2287,7 @@ gtk_button_screen_changed (GtkWidget *widget,
|
||||
{
|
||||
GtkButton *button;
|
||||
GtkSettings *settings;
|
||||
guint show_image_connection;
|
||||
gulong show_image_connection;
|
||||
|
||||
if (!gtk_widget_has_screen (widget))
|
||||
return;
|
||||
@ -2305,18 +2305,14 @@ gtk_button_screen_changed (GtkWidget *widget,
|
||||
settings = gtk_widget_get_settings (widget);
|
||||
|
||||
show_image_connection =
|
||||
GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (settings),
|
||||
"gtk-button-connection"));
|
||||
g_signal_handler_find (settings, G_SIGNAL_MATCH_FUNC, 0, 0,
|
||||
NULL, gtk_button_setting_changed, NULL);
|
||||
|
||||
if (show_image_connection)
|
||||
return;
|
||||
|
||||
show_image_connection =
|
||||
g_signal_connect (settings, "notify::gtk-button-images",
|
||||
G_CALLBACK (gtk_button_setting_changed), NULL);
|
||||
g_object_set_data (G_OBJECT (settings),
|
||||
I_("gtk-button-connection"),
|
||||
GUINT_TO_POINTER (show_image_connection));
|
||||
g_signal_connect (settings, "notify::gtk-button-images",
|
||||
G_CALLBACK (gtk_button_setting_changed), NULL);
|
||||
|
||||
show_image_change_notify (button);
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ static void gtk_cell_renderer_set_property (GObject *object,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void set_cell_bg_color (GtkCellRenderer *cell,
|
||||
GdkColor *color);
|
||||
GdkRGBA *rgba);
|
||||
|
||||
/* Fallback GtkCellRenderer implementation to use remaining ->get_size() implementations */
|
||||
static void gtk_cell_renderer_real_get_preferred_width (GtkCellRenderer *cell,
|
||||
@ -80,7 +80,7 @@ struct _GtkCellRendererPrivate
|
||||
guint sensitive : 1;
|
||||
guint editing : 1;
|
||||
|
||||
GdkColor cell_background;
|
||||
GdkRGBA cell_background;
|
||||
};
|
||||
|
||||
|
||||
@ -99,6 +99,7 @@ enum {
|
||||
PROP_IS_EXPANDED,
|
||||
PROP_CELL_BACKGROUND,
|
||||
PROP_CELL_BACKGROUND_GDK,
|
||||
PROP_CELL_BACKGROUND_RGBA,
|
||||
PROP_CELL_BACKGROUND_SET,
|
||||
PROP_EDITING
|
||||
};
|
||||
@ -336,6 +337,20 @@ gtk_cell_renderer_class_init (GtkCellRendererClass *class)
|
||||
P_("Cell background color as a GdkColor"),
|
||||
GDK_TYPE_COLOR,
|
||||
GTK_PARAM_READWRITE));
|
||||
/**
|
||||
* GtkCellRenderer:cell-background-rgba:
|
||||
*
|
||||
* Cell background as a #GdkRGBA
|
||||
*
|
||||
* Since: 3.0
|
||||
*/
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_CELL_BACKGROUND_RGBA,
|
||||
g_param_spec_boxed ("cell-background-rgba",
|
||||
P_("Cell background RGBA color"),
|
||||
P_("Cell background color as a GdkRGBA"),
|
||||
GDK_TYPE_RGBA,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_EDITING,
|
||||
@ -406,13 +421,16 @@ gtk_cell_renderer_get_property (GObject *object,
|
||||
{
|
||||
GdkColor color;
|
||||
|
||||
color.red = priv->cell_background.red;
|
||||
color.green = priv->cell_background.green;
|
||||
color.blue = priv->cell_background.blue;
|
||||
color.red = (guint16) (priv->cell_background.red * 65535);
|
||||
color.green = (guint16) (priv->cell_background.green * 65535);
|
||||
color.blue = (guint16) (priv->cell_background.blue * 65535);
|
||||
|
||||
g_value_set_boxed (value, &color);
|
||||
}
|
||||
break;
|
||||
case PROP_CELL_BACKGROUND_RGBA:
|
||||
g_value_set_boxed (value, &priv->cell_background);
|
||||
break;
|
||||
case PROP_CELL_BACKGROUND_SET:
|
||||
g_value_set_boolean (value, priv->cell_background_set);
|
||||
break;
|
||||
@ -473,12 +491,12 @@ gtk_cell_renderer_set_property (GObject *object,
|
||||
break;
|
||||
case PROP_CELL_BACKGROUND:
|
||||
{
|
||||
GdkColor color;
|
||||
GdkRGBA rgba;
|
||||
|
||||
if (!g_value_get_string (value))
|
||||
set_cell_bg_color (cell, NULL);
|
||||
else if (gdk_color_parse (g_value_get_string (value), &color))
|
||||
set_cell_bg_color (cell, &color);
|
||||
else if (gdk_rgba_parse (g_value_get_string (value), &rgba))
|
||||
set_cell_bg_color (cell, &rgba);
|
||||
else
|
||||
g_warning ("Don't know color `%s'", g_value_get_string (value));
|
||||
|
||||
@ -486,6 +504,20 @@ gtk_cell_renderer_set_property (GObject *object,
|
||||
}
|
||||
break;
|
||||
case PROP_CELL_BACKGROUND_GDK:
|
||||
{
|
||||
GdkColor *color;
|
||||
GdkRGBA rgba;
|
||||
|
||||
color = g_value_get_boxed (value);
|
||||
rgba.red = color->red / 65535.;
|
||||
rgba.green = color->green / 65535.;
|
||||
rgba.blue = color->blue / 65535.;
|
||||
rgba.alpha = 1;
|
||||
|
||||
set_cell_bg_color (cell, &rgba);
|
||||
}
|
||||
break;
|
||||
case PROP_CELL_BACKGROUND_RGBA:
|
||||
set_cell_bg_color (cell, g_value_get_boxed (value));
|
||||
break;
|
||||
case PROP_CELL_BACKGROUND_SET:
|
||||
@ -499,11 +531,11 @@ gtk_cell_renderer_set_property (GObject *object,
|
||||
|
||||
static void
|
||||
set_cell_bg_color (GtkCellRenderer *cell,
|
||||
GdkColor *color)
|
||||
GdkRGBA *rgba)
|
||||
{
|
||||
GtkCellRendererPrivate *priv = cell->priv;
|
||||
|
||||
if (color)
|
||||
if (rgba)
|
||||
{
|
||||
if (!priv->cell_background_set)
|
||||
{
|
||||
@ -511,9 +543,7 @@ set_cell_bg_color (GtkCellRenderer *cell,
|
||||
g_object_notify (G_OBJECT (cell), "cell-background-set");
|
||||
}
|
||||
|
||||
priv->cell_background.red = color->red;
|
||||
priv->cell_background.green = color->green;
|
||||
priv->cell_background.blue = color->blue;
|
||||
priv->cell_background = *rgba;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -612,7 +642,7 @@ gtk_cell_renderer_render (GtkCellRenderer *cell,
|
||||
if (priv->cell_background_set && !selected)
|
||||
{
|
||||
gdk_cairo_rectangle (cr, background_area);
|
||||
gdk_cairo_set_source_color (cr, &priv->cell_background);
|
||||
gdk_cairo_set_source_rgba (cr, &priv->cell_background);
|
||||
cairo_fill (cr);
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ struct _GtkCellRendererComboPrivate
|
||||
|
||||
gint text_column;
|
||||
|
||||
guint focus_out_id;
|
||||
gulong focus_out_id;
|
||||
};
|
||||
|
||||
|
||||
|
@ -93,6 +93,8 @@ enum {
|
||||
PROP_FOREGROUND,
|
||||
PROP_BACKGROUND_GDK,
|
||||
PROP_FOREGROUND_GDK,
|
||||
PROP_BACKGROUND_RGBA,
|
||||
PROP_FOREGROUND_RGBA,
|
||||
PROP_FONT,
|
||||
PROP_FONT_DESC,
|
||||
PROP_FAMILY,
|
||||
@ -140,8 +142,8 @@ struct _GtkCellRendererTextPrivate
|
||||
|
||||
PangoAlignment align;
|
||||
PangoAttrList *extra_attrs;
|
||||
PangoColor foreground;
|
||||
PangoColor background;
|
||||
GdkRGBA foreground;
|
||||
GdkRGBA background;
|
||||
PangoEllipsizeMode ellipsize;
|
||||
PangoFontDescription *font;
|
||||
PangoLanguage *language;
|
||||
@ -274,6 +276,20 @@ gtk_cell_renderer_text_class_init (GtkCellRendererTextClass *class)
|
||||
GDK_TYPE_COLOR,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
/**
|
||||
* GtkCellRendererText:background-rgba:
|
||||
*
|
||||
* Background color as a #GdkRGBA
|
||||
*
|
||||
* Since: 3.0
|
||||
*/
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_BACKGROUND_RGBA,
|
||||
g_param_spec_boxed ("background-rgba",
|
||||
P_("Background color as RGBA"),
|
||||
P_("Background color as a GdkRGBA"),
|
||||
GDK_TYPE_RGBA,
|
||||
GTK_PARAM_READWRITE));
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_FOREGROUND,
|
||||
g_param_spec_string ("foreground",
|
||||
@ -290,6 +306,21 @@ gtk_cell_renderer_text_class_init (GtkCellRendererTextClass *class)
|
||||
GDK_TYPE_COLOR,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
/**
|
||||
* GtkCellRendererText:foreground-rgba:
|
||||
*
|
||||
* Foreground color as a #GdkRGBA
|
||||
*
|
||||
* Since: 3.0
|
||||
*/
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_FOREGROUND_RGBA,
|
||||
g_param_spec_boxed ("foreground-rgba",
|
||||
P_("Foreground color as RGBA"),
|
||||
P_("Foreground color as a GdkRGBA"),
|
||||
GDK_TYPE_RGBA,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_EDITABLE,
|
||||
@ -717,11 +748,11 @@ gtk_cell_renderer_text_get_property (GObject *object,
|
||||
case PROP_BACKGROUND_GDK:
|
||||
{
|
||||
GdkColor color;
|
||||
|
||||
color.red = priv->background.red;
|
||||
color.green = priv->background.green;
|
||||
color.blue = priv->background.blue;
|
||||
|
||||
|
||||
color.red = (guint16) (priv->background.red * 65535);
|
||||
color.green = (guint16) (priv->background.green * 65535);
|
||||
color.blue = (guint16) (priv->background.blue * 65535);
|
||||
|
||||
g_value_set_boxed (value, &color);
|
||||
}
|
||||
break;
|
||||
@ -729,15 +760,23 @@ gtk_cell_renderer_text_get_property (GObject *object,
|
||||
case PROP_FOREGROUND_GDK:
|
||||
{
|
||||
GdkColor color;
|
||||
|
||||
color.red = priv->foreground.red;
|
||||
color.green = priv->foreground.green;
|
||||
color.blue = priv->foreground.blue;
|
||||
|
||||
|
||||
color.red = (guint16) (priv->foreground.red * 65535);
|
||||
color.green = (guint16) (priv->foreground.green * 65535);
|
||||
color.blue = (guint16) (priv->foreground.blue * 65535);
|
||||
|
||||
g_value_set_boxed (value, &color);
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_BACKGROUND_RGBA:
|
||||
g_value_set_boxed (value, &priv->background);
|
||||
break;
|
||||
|
||||
case PROP_FOREGROUND_RGBA:
|
||||
g_value_set_boxed (value, &priv->foreground);
|
||||
break;
|
||||
|
||||
case PROP_FONT:
|
||||
g_value_take_string (value, pango_font_description_to_string (priv->font));
|
||||
break;
|
||||
@ -887,21 +926,19 @@ gtk_cell_renderer_text_get_property (GObject *object,
|
||||
|
||||
static void
|
||||
set_bg_color (GtkCellRendererText *celltext,
|
||||
GdkColor *color)
|
||||
GdkRGBA *rgba)
|
||||
{
|
||||
GtkCellRendererTextPrivate *priv = celltext->priv;
|
||||
|
||||
if (color)
|
||||
if (rgba)
|
||||
{
|
||||
if (!priv->background_set)
|
||||
{
|
||||
priv->background_set = TRUE;
|
||||
g_object_notify (G_OBJECT (celltext), "background-set");
|
||||
}
|
||||
|
||||
priv->background.red = color->red;
|
||||
priv->background.green = color->green;
|
||||
priv->background.blue = color->blue;
|
||||
|
||||
priv->background = *rgba;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -916,21 +953,19 @@ set_bg_color (GtkCellRendererText *celltext,
|
||||
|
||||
static void
|
||||
set_fg_color (GtkCellRendererText *celltext,
|
||||
GdkColor *color)
|
||||
GdkRGBA *rgba)
|
||||
{
|
||||
GtkCellRendererTextPrivate *priv = celltext->priv;
|
||||
|
||||
if (color)
|
||||
if (rgba)
|
||||
{
|
||||
if (!priv->foreground_set)
|
||||
{
|
||||
priv->foreground_set = TRUE;
|
||||
g_object_notify (G_OBJECT (celltext), "foreground-set");
|
||||
}
|
||||
|
||||
priv->foreground.red = color->red;
|
||||
priv->foreground.green = color->green;
|
||||
priv->foreground.blue = color->blue;
|
||||
|
||||
priv->foreground = *rgba;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1140,12 +1175,12 @@ gtk_cell_renderer_text_set_property (GObject *object,
|
||||
|
||||
case PROP_BACKGROUND:
|
||||
{
|
||||
GdkColor color;
|
||||
GdkRGBA rgba;
|
||||
|
||||
if (!g_value_get_string (value))
|
||||
set_bg_color (celltext, NULL); /* reset to background_set to FALSE */
|
||||
else if (gdk_color_parse (g_value_get_string (value), &color))
|
||||
set_bg_color (celltext, &color);
|
||||
else if (gdk_rgba_parse (g_value_get_string (value), &rgba))
|
||||
set_bg_color (celltext, &rgba);
|
||||
else
|
||||
g_warning ("Don't know color `%s'", g_value_get_string (value));
|
||||
|
||||
@ -1155,12 +1190,12 @@ gtk_cell_renderer_text_set_property (GObject *object,
|
||||
|
||||
case PROP_FOREGROUND:
|
||||
{
|
||||
GdkColor color;
|
||||
GdkRGBA rgba;
|
||||
|
||||
if (!g_value_get_string (value))
|
||||
set_fg_color (celltext, NULL); /* reset to foreground_set to FALSE */
|
||||
else if (gdk_color_parse (g_value_get_string (value), &color))
|
||||
set_fg_color (celltext, &color);
|
||||
else if (gdk_rgba_parse (g_value_get_string (value), &rgba))
|
||||
set_fg_color (celltext, &rgba);
|
||||
else
|
||||
g_warning ("Don't know color `%s'", g_value_get_string (value));
|
||||
|
||||
@ -1169,11 +1204,39 @@ gtk_cell_renderer_text_set_property (GObject *object,
|
||||
break;
|
||||
|
||||
case PROP_BACKGROUND_GDK:
|
||||
{
|
||||
GdkColor *color;
|
||||
GdkRGBA rgba;
|
||||
|
||||
color = g_value_get_boxed (value);
|
||||
rgba.red = color->red / 65535.;
|
||||
rgba.green = color->green / 65535.;
|
||||
rgba.blue = color->blue / 65535.;
|
||||
|
||||
set_bg_color (celltext, &rgba);
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_FOREGROUND_GDK:
|
||||
{
|
||||
GdkColor *color;
|
||||
GdkRGBA rgba;
|
||||
|
||||
color = g_value_get_boxed (value);
|
||||
rgba.red = color->red / 65535.;
|
||||
rgba.green = color->green / 65535.;
|
||||
rgba.blue = color->blue / 65535.;
|
||||
|
||||
set_fg_color (celltext, &rgba);
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_BACKGROUND_RGBA:
|
||||
/* This notifies the GObject itself. */
|
||||
set_bg_color (celltext, g_value_get_boxed (value));
|
||||
break;
|
||||
|
||||
case PROP_FOREGROUND_GDK:
|
||||
case PROP_FOREGROUND_RGBA:
|
||||
/* This notifies the GObject itself. */
|
||||
set_fg_color (celltext, g_value_get_boxed (value));
|
||||
break;
|
||||
@ -1465,8 +1528,10 @@ get_layout (GtkCellRendererText *celltext,
|
||||
{
|
||||
PangoColor color;
|
||||
|
||||
color = priv->foreground;
|
||||
|
||||
color.red = (guint16) (priv->foreground.red * 65535);
|
||||
color.green = (guint16) (priv->foreground.green * 65535);
|
||||
color.blue = (guint16) (priv->foreground.blue * 65535);
|
||||
|
||||
add_attr (attr_list,
|
||||
pango_attr_foreground_new (color.red, color.green, color.blue));
|
||||
}
|
||||
@ -1738,10 +1803,7 @@ gtk_cell_renderer_text_render (GtkCellRenderer *cell,
|
||||
(flags & GTK_CELL_RENDERER_SELECTED) == 0)
|
||||
{
|
||||
gdk_cairo_rectangle (cr, background_area);
|
||||
cairo_set_source_rgb (cr,
|
||||
priv->background.red / 65535.,
|
||||
priv->background.green / 65535.,
|
||||
priv->background.blue / 65535.);
|
||||
gdk_cairo_set_source_rgba (cr, &priv->background);
|
||||
cairo_fill (cr);
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ struct _GtkCellViewPrivate
|
||||
GList *cell_list;
|
||||
gint spacing;
|
||||
|
||||
GdkColor background;
|
||||
GdkRGBA background;
|
||||
gboolean background_set;
|
||||
};
|
||||
|
||||
@ -143,6 +143,7 @@ enum
|
||||
PROP_0,
|
||||
PROP_BACKGROUND,
|
||||
PROP_BACKGROUND_GDK,
|
||||
PROP_BACKGROUND_RGBA,
|
||||
PROP_BACKGROUND_SET,
|
||||
PROP_MODEL
|
||||
};
|
||||
@ -186,6 +187,20 @@ gtk_cell_view_class_init (GtkCellViewClass *klass)
|
||||
P_("Background color as a GdkColor"),
|
||||
GDK_TYPE_COLOR,
|
||||
GTK_PARAM_READWRITE));
|
||||
/**
|
||||
* GtkCellView:background-rgba
|
||||
*
|
||||
* The background color as a #GdkRGBA
|
||||
*
|
||||
* Since: 3.0
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_BACKGROUND_RGBA,
|
||||
g_param_spec_boxed ("background-rgba",
|
||||
P_("Background RGBA color"),
|
||||
P_("Background color as a GdkRGBA"),
|
||||
GDK_TYPE_RGBA,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
/**
|
||||
* GtkCellView:model
|
||||
@ -247,11 +262,17 @@ gtk_cell_view_get_property (GObject *object,
|
||||
{
|
||||
GdkColor color;
|
||||
|
||||
color = view->priv->background;
|
||||
color.red = (guint) (view->priv->background.red * 65535);
|
||||
color.green = (guint) (view->priv->background.green * 65535);
|
||||
color.blue = (guint) (view->priv->background.blue * 65535);
|
||||
color.pixel = 0;
|
||||
|
||||
g_value_set_boxed (value, &color);
|
||||
}
|
||||
break;
|
||||
case PROP_BACKGROUND_RGBA:
|
||||
g_value_set_boxed (value, &view->priv->background);
|
||||
break;
|
||||
case PROP_BACKGROUND_SET:
|
||||
g_value_set_boolean (value, view->priv->background_set);
|
||||
break;
|
||||
@ -291,6 +312,9 @@ gtk_cell_view_set_property (GObject *object,
|
||||
case PROP_BACKGROUND_GDK:
|
||||
gtk_cell_view_set_background_color (view, g_value_get_boxed (value));
|
||||
break;
|
||||
case PROP_BACKGROUND_RGBA:
|
||||
gtk_cell_view_set_background_rgba (view, g_value_get_boxed (value));
|
||||
break;
|
||||
case PROP_BACKGROUND_SET:
|
||||
view->priv->background_set = g_value_get_boolean (value);
|
||||
break;
|
||||
@ -449,7 +473,7 @@ gtk_cell_view_draw (GtkWidget *widget,
|
||||
if (cellview->priv->background_set)
|
||||
{
|
||||
gdk_cairo_rectangle (cr, &area);
|
||||
gdk_cairo_set_source_color (cr, &cellview->priv->background);
|
||||
gdk_cairo_set_source_rgba (cr, &cellview->priv->background);
|
||||
cairo_fill (cr);
|
||||
}
|
||||
|
||||
@ -1122,7 +1146,47 @@ gtk_cell_view_set_background_color (GtkCellView *cell_view,
|
||||
g_object_notify (G_OBJECT (cell_view), "background-set");
|
||||
}
|
||||
|
||||
cell_view->priv->background = *color;
|
||||
cell_view->priv->background.red = color->red / 65535.;
|
||||
cell_view->priv->background.green = color->green / 65535.;
|
||||
cell_view->priv->background.blue = color->blue / 65535.;
|
||||
cell_view->priv->background.alpha = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cell_view->priv->background_set)
|
||||
{
|
||||
cell_view->priv->background_set = FALSE;
|
||||
g_object_notify (G_OBJECT (cell_view), "background-set");
|
||||
}
|
||||
}
|
||||
|
||||
gtk_widget_queue_draw (GTK_WIDGET (cell_view));
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_cell_view_set_background_rgba:
|
||||
* @cell_view: a #GtkCellView
|
||||
* @rgba: the new background color
|
||||
*
|
||||
* Sets the background color of @cell_view.
|
||||
*
|
||||
* Since: 3.0
|
||||
*/
|
||||
void
|
||||
gtk_cell_view_set_background_rgba (GtkCellView *cell_view,
|
||||
const GdkRGBA *rgba)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_CELL_VIEW (cell_view));
|
||||
|
||||
if (rgba)
|
||||
{
|
||||
if (!cell_view->priv->background_set)
|
||||
{
|
||||
cell_view->priv->background_set = TRUE;
|
||||
g_object_notify (G_OBJECT (cell_view), "background-set");
|
||||
}
|
||||
|
||||
cell_view->priv->background = *rgba;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -89,6 +89,8 @@ void gtk_cell_view_get_desired_height_for_width_of_row(GtkCellView
|
||||
|
||||
void gtk_cell_view_set_background_color (GtkCellView *cell_view,
|
||||
const GdkColor *color);
|
||||
void gtk_cell_view_set_background_rgba (GtkCellView *cell_view,
|
||||
const GdkRGBA *rgba);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -71,7 +71,7 @@ struct _GtkClipboard
|
||||
GdkAtom *cached_targets;
|
||||
gint n_cached_targets;
|
||||
|
||||
guint notify_signal_id;
|
||||
gulong notify_signal_id;
|
||||
gboolean storing_selection;
|
||||
GMainLoop *store_loop;
|
||||
guint store_timeout;
|
||||
|
@ -57,10 +57,8 @@ struct _GtkColorButtonPrivate
|
||||
GtkWidget *cs_dialog; /* Color selection dialog */
|
||||
|
||||
gchar *title; /* Title for the color selection window */
|
||||
|
||||
GdkColor color;
|
||||
guint16 alpha;
|
||||
|
||||
GdkRGBA rgba;
|
||||
|
||||
guint use_alpha : 1; /* Use alpha or not */
|
||||
};
|
||||
|
||||
@ -71,7 +69,8 @@ enum
|
||||
PROP_USE_ALPHA,
|
||||
PROP_TITLE,
|
||||
PROP_COLOR,
|
||||
PROP_ALPHA
|
||||
PROP_ALPHA,
|
||||
PROP_RGBA
|
||||
};
|
||||
|
||||
/* Signals */
|
||||
@ -205,7 +204,23 @@ gtk_color_button_class_init (GtkColorButtonClass *klass)
|
||||
P_("The selected opacity value (0 fully transparent, 65535 fully opaque)"),
|
||||
0, 65535, 65535,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
|
||||
/**
|
||||
* GtkColorButton::rgba
|
||||
*
|
||||
* The RGBA color.
|
||||
*
|
||||
* Since: 3.0
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_RGBA,
|
||||
g_param_spec_boxed ("rgba",
|
||||
P_("Current RGBA Color"),
|
||||
P_("The selected RGBA color"),
|
||||
GDK_TYPE_RGBA,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
|
||||
/**
|
||||
* GtkColorButton::color-set:
|
||||
* @widget: the object which received the signal.
|
||||
@ -235,7 +250,7 @@ static gboolean
|
||||
gtk_color_button_has_alpha (GtkColorButton *color_button)
|
||||
{
|
||||
return color_button->priv->use_alpha &&
|
||||
color_button->priv->alpha < 65535;
|
||||
color_button->priv->rgba.alpha < 1;
|
||||
}
|
||||
|
||||
static cairo_pattern_t *
|
||||
@ -282,15 +297,14 @@ gtk_color_button_draw_cb (GtkWidget *widget,
|
||||
cairo_mask (cr, checkered);
|
||||
cairo_pattern_destroy (checkered);
|
||||
|
||||
cairo_set_source_rgba (cr,
|
||||
color_button->priv->color.red / 65535.,
|
||||
color_button->priv->color.green / 65535.,
|
||||
color_button->priv->color.blue / 65535.,
|
||||
color_button->priv->alpha / 65535.);
|
||||
gdk_cairo_set_source_rgba (cr, &color_button->priv->rgba);
|
||||
}
|
||||
else
|
||||
{
|
||||
gdk_cairo_set_source_color (cr, &color_button->priv->color);
|
||||
cairo_set_source_rgb (cr,
|
||||
color_button->priv->rgba.red,
|
||||
color_button->priv->rgba.green,
|
||||
color_button->priv->rgba.blue);
|
||||
}
|
||||
|
||||
cairo_paint (cr);
|
||||
@ -340,10 +354,10 @@ gtk_color_button_drag_data_received (GtkWidget *widget,
|
||||
|
||||
dropped = (guint16 *)selection_data->data;
|
||||
|
||||
color_button->priv->color.red = dropped[0];
|
||||
color_button->priv->color.green = dropped[1];
|
||||
color_button->priv->color.blue = dropped[2];
|
||||
color_button->priv->alpha = dropped[3];
|
||||
color_button->priv->rgba.red = dropped[0] / 65535.;
|
||||
color_button->priv->rgba.green = dropped[1] / 65535.;
|
||||
color_button->priv->rgba.blue = dropped[2] / 65535.;
|
||||
color_button->priv->rgba.alpha = dropped[3] / 65535.;
|
||||
|
||||
gtk_widget_queue_draw (color_button->priv->draw_area);
|
||||
|
||||
@ -352,27 +366,28 @@ gtk_color_button_drag_data_received (GtkWidget *widget,
|
||||
g_object_freeze_notify (G_OBJECT (color_button));
|
||||
g_object_notify (G_OBJECT (color_button), "color");
|
||||
g_object_notify (G_OBJECT (color_button), "alpha");
|
||||
g_object_notify (G_OBJECT (color_button), "rgba");
|
||||
g_object_thaw_notify (G_OBJECT (color_button));
|
||||
}
|
||||
|
||||
static void
|
||||
set_color_icon (GdkDragContext *context,
|
||||
GdkColor *color)
|
||||
GdkRGBA *rgba)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
guint32 pixel;
|
||||
cairo_surface_t *surface;
|
||||
cairo_t *cr;
|
||||
|
||||
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE,
|
||||
8, 48, 32);
|
||||
surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24,
|
||||
48, 32);
|
||||
cr = cairo_create (surface);
|
||||
|
||||
pixel = ((color->red & 0xff00) << 16) |
|
||||
((color->green & 0xff00) << 8) |
|
||||
(color->blue & 0xff00);
|
||||
gdk_cairo_set_source_rgba (cr, rgba);
|
||||
cairo_paint (cr);
|
||||
|
||||
gdk_pixbuf_fill (pixbuf, pixel);
|
||||
|
||||
gtk_drag_set_icon_pixbuf (context, pixbuf, -2, -2);
|
||||
g_object_unref (pixbuf);
|
||||
gtk_drag_set_icon_surface (context, surface);
|
||||
|
||||
cairo_destroy (cr);
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -381,8 +396,8 @@ gtk_color_button_drag_begin (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GtkColorButton *color_button = data;
|
||||
|
||||
set_color_icon (context, &color_button->priv->color);
|
||||
|
||||
set_color_icon (context, &color_button->priv->rgba);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -395,10 +410,10 @@ gtk_color_button_drag_data_get (GtkWidget *widget,
|
||||
{
|
||||
guint16 dropped[4];
|
||||
|
||||
dropped[0] = color_button->priv->color.red;
|
||||
dropped[1] = color_button->priv->color.green;
|
||||
dropped[2] = color_button->priv->color.blue;
|
||||
dropped[3] = color_button->priv->alpha;
|
||||
dropped[0] = (guint16) (color_button->priv->rgba.red * 65535);
|
||||
dropped[1] = (guint16) (color_button->priv->rgba.green * 65535);
|
||||
dropped[2] = (guint16) (color_button->priv->rgba.blue * 65535);
|
||||
dropped[3] = (guint16) (color_button->priv->rgba.alpha * 65535);
|
||||
|
||||
gtk_selection_data_set (selection_data, selection_data->target,
|
||||
16, (guchar *)dropped, 8);
|
||||
@ -446,10 +461,10 @@ gtk_color_button_init (GtkColorButton *color_button)
|
||||
|
||||
/* Start with opaque black, alpha disabled */
|
||||
|
||||
color_button->priv->color.red = 0;
|
||||
color_button->priv->color.green = 0;
|
||||
color_button->priv->color.blue = 0;
|
||||
color_button->priv->alpha = 65535;
|
||||
color_button->priv->rgba.red = 0;
|
||||
color_button->priv->rgba.green = 0;
|
||||
color_button->priv->rgba.blue = 0;
|
||||
color_button->priv->rgba.alpha = 1;
|
||||
color_button->priv->use_alpha = FALSE;
|
||||
|
||||
gtk_drag_dest_set (GTK_WIDGET (color_button),
|
||||
@ -522,6 +537,12 @@ gtk_color_button_new_with_color (const GdkColor *color)
|
||||
return g_object_new (GTK_TYPE_COLOR_BUTTON, "color", color, NULL);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gtk_color_button_new_with_rgba (const GdkRGBA *rgba)
|
||||
{
|
||||
return g_object_new (GTK_TYPE_COLOR_BUTTON, "rgba", rgba, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
dialog_ok_clicked (GtkWidget *widget,
|
||||
gpointer data)
|
||||
@ -533,8 +554,7 @@ dialog_ok_clicked (GtkWidget *widget,
|
||||
selection_dialog = GTK_COLOR_SELECTION_DIALOG (color_button->priv->cs_dialog);
|
||||
color_selection = GTK_COLOR_SELECTION (gtk_color_selection_dialog_get_color_selection (selection_dialog));
|
||||
|
||||
gtk_color_selection_get_current_color (color_selection, &color_button->priv->color);
|
||||
color_button->priv->alpha = gtk_color_selection_get_current_alpha (color_selection);
|
||||
gtk_color_selection_get_current_rgba (color_selection, &color_button->priv->rgba);
|
||||
|
||||
gtk_widget_hide (color_button->priv->cs_dialog);
|
||||
|
||||
@ -545,6 +565,7 @@ dialog_ok_clicked (GtkWidget *widget,
|
||||
g_object_freeze_notify (G_OBJECT (color_button));
|
||||
g_object_notify (G_OBJECT (color_button), "color");
|
||||
g_object_notify (G_OBJECT (color_button), "alpha");
|
||||
g_object_notify (G_OBJECT (color_button), "rgba");
|
||||
g_object_thaw_notify (G_OBJECT (color_button));
|
||||
}
|
||||
|
||||
@ -615,16 +636,11 @@ gtk_color_button_clicked (GtkButton *button)
|
||||
|
||||
gtk_color_selection_set_has_opacity_control (color_selection,
|
||||
color_button->priv->use_alpha);
|
||||
|
||||
gtk_color_selection_set_previous_color (color_selection,
|
||||
&color_button->priv->color);
|
||||
gtk_color_selection_set_previous_alpha (color_selection,
|
||||
color_button->priv->alpha);
|
||||
|
||||
gtk_color_selection_set_current_color (color_selection,
|
||||
&color_button->priv->color);
|
||||
gtk_color_selection_set_current_alpha (color_selection,
|
||||
color_button->priv->alpha);
|
||||
gtk_color_selection_set_previous_rgba (color_selection,
|
||||
&color_button->priv->rgba);
|
||||
gtk_color_selection_set_current_rgba (color_selection,
|
||||
&color_button->priv->rgba);
|
||||
|
||||
gtk_window_present (GTK_WINDOW (color_button->priv->cs_dialog));
|
||||
}
|
||||
@ -645,13 +661,14 @@ gtk_color_button_set_color (GtkColorButton *color_button,
|
||||
g_return_if_fail (GTK_IS_COLOR_BUTTON (color_button));
|
||||
g_return_if_fail (color != NULL);
|
||||
|
||||
color_button->priv->color.red = color->red;
|
||||
color_button->priv->color.green = color->green;
|
||||
color_button->priv->color.blue = color->blue;
|
||||
color_button->priv->rgba.red = color->red / 65535.;
|
||||
color_button->priv->rgba.green = color->green / 65535.;
|
||||
color_button->priv->rgba.blue = color->blue / 65535.;
|
||||
|
||||
gtk_widget_queue_draw (color_button->priv->draw_area);
|
||||
|
||||
g_object_notify (G_OBJECT (color_button), "color");
|
||||
g_object_notify (G_OBJECT (color_button), "rgba");
|
||||
}
|
||||
|
||||
|
||||
@ -670,11 +687,12 @@ gtk_color_button_set_alpha (GtkColorButton *color_button,
|
||||
{
|
||||
g_return_if_fail (GTK_IS_COLOR_BUTTON (color_button));
|
||||
|
||||
color_button->priv->alpha = alpha;
|
||||
color_button->priv->rgba.alpha = alpha / 65535.;
|
||||
|
||||
gtk_widget_queue_draw (color_button->priv->draw_area);
|
||||
|
||||
g_object_notify (G_OBJECT (color_button), "alpha");
|
||||
g_object_notify (G_OBJECT (color_button), "rgba");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -691,10 +709,10 @@ gtk_color_button_get_color (GtkColorButton *color_button,
|
||||
GdkColor *color)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_COLOR_BUTTON (color_button));
|
||||
|
||||
color->red = color_button->priv->color.red;
|
||||
color->green = color_button->priv->color.green;
|
||||
color->blue = color_button->priv->color.blue;
|
||||
|
||||
color->red = (guint16) (color_button->priv->rgba.red * 65535);
|
||||
color->green = (guint16) (color_button->priv->rgba.green * 65535);
|
||||
color->blue = (guint16) (color_button->priv->rgba.blue * 65535);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -711,8 +729,48 @@ guint16
|
||||
gtk_color_button_get_alpha (GtkColorButton *color_button)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_COLOR_BUTTON (color_button), 0);
|
||||
|
||||
return color_button->priv->alpha;
|
||||
|
||||
return (guint16) (color_button->priv->rgba.alpha * 65535);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_color_button_set_rgba:
|
||||
* @color_button: a #GtkColorButton.
|
||||
* @rgba: a #GdkRGBA to set the current color with
|
||||
*
|
||||
* Sets the current color to be @rgba.
|
||||
*
|
||||
* Since: 3.0
|
||||
**/
|
||||
void
|
||||
gtk_color_button_set_rgba (GtkColorButton *color_button,
|
||||
const GdkRGBA *rgba)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_COLOR_BUTTON (color_button));
|
||||
g_return_if_fail (rgba != NULL);
|
||||
|
||||
color_button->priv->rgba = *rgba;
|
||||
|
||||
g_object_notify (G_OBJECT (color_button), "rgba");
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_color_button_get_rgba:
|
||||
* @color_button: a #GtkColorButton.
|
||||
* @rgba: a #GdkRGBA to fill in with the current color
|
||||
*
|
||||
* Sets @rgba to be the current color in the #GtkColorButton widget.
|
||||
*
|
||||
* Since: 3.0
|
||||
**/
|
||||
void
|
||||
gtk_color_button_get_rgba (GtkColorButton *color_button,
|
||||
GdkRGBA *rgba)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_COLOR_BUTTON (color_button));
|
||||
g_return_if_fail (rgba != NULL);
|
||||
|
||||
*rgba = color_button->priv->rgba;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -829,6 +887,9 @@ gtk_color_button_set_property (GObject *object,
|
||||
case PROP_ALPHA:
|
||||
gtk_color_button_set_alpha (color_button, g_value_get_uint (value));
|
||||
break;
|
||||
case PROP_RGBA:
|
||||
gtk_color_button_set_rgba (color_button, g_value_get_boxed (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
||||
break;
|
||||
@ -859,6 +920,14 @@ gtk_color_button_get_property (GObject *object,
|
||||
case PROP_ALPHA:
|
||||
g_value_set_uint (value, gtk_color_button_get_alpha (color_button));
|
||||
break;
|
||||
case PROP_RGBA:
|
||||
{
|
||||
GdkRGBA rgba;
|
||||
|
||||
gtk_color_button_get_rgba (color_button, &rgba);
|
||||
g_value_set_boxed (value, &rgba);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
||||
break;
|
||||
|
@ -82,6 +82,7 @@ struct _GtkColorButtonClass {
|
||||
GType gtk_color_button_get_type (void) G_GNUC_CONST;
|
||||
GtkWidget *gtk_color_button_new (void);
|
||||
GtkWidget *gtk_color_button_new_with_color (const GdkColor *color);
|
||||
GtkWidget *gtk_color_button_new_with_rgba (const GdkRGBA *rgba);
|
||||
void gtk_color_button_set_color (GtkColorButton *color_button,
|
||||
const GdkColor *color);
|
||||
void gtk_color_button_set_alpha (GtkColorButton *color_button,
|
||||
@ -92,6 +93,11 @@ guint16 gtk_color_button_get_alpha (GtkColorButton *color_button);
|
||||
void gtk_color_button_set_use_alpha (GtkColorButton *color_button,
|
||||
gboolean use_alpha);
|
||||
gboolean gtk_color_button_get_use_alpha (GtkColorButton *color_button);
|
||||
|
||||
void gtk_color_button_set_rgba (GtkColorButton *color_button,
|
||||
const GdkRGBA *rgba);
|
||||
void gtk_color_button_get_rgba (GtkColorButton *color_button,
|
||||
GdkRGBA *rgba);
|
||||
void gtk_color_button_set_title (GtkColorButton *color_button,
|
||||
const gchar *title);
|
||||
G_CONST_RETURN gchar *gtk_color_button_get_title (GtkColorButton *color_button);
|
||||
|
@ -102,7 +102,8 @@ enum {
|
||||
PROP_HAS_PALETTE,
|
||||
PROP_HAS_OPACITY_CONTROL,
|
||||
PROP_CURRENT_COLOR,
|
||||
PROP_CURRENT_ALPHA
|
||||
PROP_CURRENT_ALPHA,
|
||||
PROP_CURRENT_RGBA
|
||||
};
|
||||
|
||||
enum {
|
||||
@ -332,7 +333,22 @@ gtk_color_selection_class_init (GtkColorSelectionClass *klass)
|
||||
P_("The current opacity value (0 fully transparent, 65535 fully opaque)"),
|
||||
0, 65535, 65535,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
|
||||
/**
|
||||
* GtkColorSelection:current-rgba
|
||||
*
|
||||
* The current RGBA color.
|
||||
*
|
||||
* Since: 3.0
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_CURRENT_RGBA,
|
||||
g_param_spec_boxed ("current-rgba",
|
||||
P_("Current RGBA"),
|
||||
P_("The current RGBA color"),
|
||||
GDK_TYPE_RGBA,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
color_selection_signals[COLOR_CHANGED] =
|
||||
g_signal_new (I_("color-changed"),
|
||||
G_OBJECT_CLASS_TYPE (gobject_class),
|
||||
@ -560,6 +576,9 @@ gtk_color_selection_set_property (GObject *object,
|
||||
case PROP_CURRENT_ALPHA:
|
||||
gtk_color_selection_set_current_alpha (colorsel, g_value_get_uint (value));
|
||||
break;
|
||||
case PROP_CURRENT_RGBA:
|
||||
gtk_color_selection_set_current_rgba (colorsel, g_value_get_boxed (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@ -591,6 +610,14 @@ gtk_color_selection_get_property (GObject *object,
|
||||
case PROP_CURRENT_ALPHA:
|
||||
g_value_set_uint (value, gtk_color_selection_get_current_alpha (colorsel));
|
||||
break;
|
||||
case PROP_CURRENT_RGBA:
|
||||
{
|
||||
GdkRGBA rgba;
|
||||
|
||||
gtk_color_selection_get_current_rgba (colorsel, &rgba);
|
||||
g_value_set_boxed (value, &rgba);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@ -2633,6 +2660,142 @@ gtk_color_selection_get_previous_alpha (GtkColorSelection *colorsel)
|
||||
return priv->has_opacity ? UNSCALE (priv->old_color[COLORSEL_OPACITY]) : 65535;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_color_selection_set_current_rgba:
|
||||
* @colorsel: a #GtkColorSelection.
|
||||
* @rgba: A #GdkRGBA to set the current color with
|
||||
*
|
||||
* Sets the current color to be @rgba. The first time this is called, it will
|
||||
* also set the original color to be @rgba too.
|
||||
*
|
||||
* Since: 3.0
|
||||
**/
|
||||
void
|
||||
gtk_color_selection_set_current_rgba (GtkColorSelection *colorsel,
|
||||
const GdkRGBA *rgba)
|
||||
{
|
||||
GtkColorSelectionPrivate *priv;
|
||||
gint i;
|
||||
|
||||
g_return_if_fail (GTK_IS_COLOR_SELECTION (colorsel));
|
||||
g_return_if_fail (rgba != NULL);
|
||||
|
||||
priv = colorsel->private_data;
|
||||
priv->changing = TRUE;
|
||||
|
||||
priv->color[COLORSEL_RED] = CLAMP (rgba->red, 0, 1);
|
||||
priv->color[COLORSEL_GREEN] = CLAMP (rgba->green, 0, 1);
|
||||
priv->color[COLORSEL_BLUE] = CLAMP (rgba->blue, 0, 1);
|
||||
priv->color[COLORSEL_OPACITY] = CLAMP (rgba->alpha, 0, 1);
|
||||
|
||||
gtk_rgb_to_hsv (priv->color[COLORSEL_RED],
|
||||
priv->color[COLORSEL_GREEN],
|
||||
priv->color[COLORSEL_BLUE],
|
||||
&priv->color[COLORSEL_HUE],
|
||||
&priv->color[COLORSEL_SATURATION],
|
||||
&priv->color[COLORSEL_VALUE]);
|
||||
|
||||
if (priv->default_set == FALSE)
|
||||
{
|
||||
for (i = 0; i < COLORSEL_NUM_CHANNELS; i++)
|
||||
priv->old_color[i] = priv->color[i];
|
||||
}
|
||||
|
||||
priv->default_set = TRUE;
|
||||
update_color (colorsel);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_color_selection_get_current_rgba:
|
||||
* @colorsel: a #GtkColorSelection.
|
||||
* @rgba: (out): a #GdkRGBA to fill in with the current color.
|
||||
*
|
||||
* Sets @rgba to be the current color in the GtkColorSelection widget.
|
||||
*
|
||||
* Since: 3.0
|
||||
**/
|
||||
void
|
||||
gtk_color_selection_get_current_rgba (GtkColorSelection *colorsel,
|
||||
GdkRGBA *rgba)
|
||||
{
|
||||
GtkColorSelectionPrivate *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_COLOR_SELECTION (colorsel));
|
||||
g_return_if_fail (rgba != NULL);
|
||||
|
||||
priv = colorsel->private_data;
|
||||
rgba->red = priv->color[COLORSEL_RED];
|
||||
rgba->green = priv->color[COLORSEL_GREEN];
|
||||
rgba->blue = priv->color[COLORSEL_BLUE];
|
||||
rgba->alpha = (priv->has_opacity) ? priv->color[COLORSEL_OPACITY] : 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_color_selection_set_previous_rgba:
|
||||
* @colorsel: a #GtkColorSelection.
|
||||
* @rgba: a #GdkRGBA to set the previous color with
|
||||
*
|
||||
* Sets the 'previous' color to be @rgba. This function should be called with
|
||||
* some hesitations, as it might seem confusing to have that color change.
|
||||
* Calling gtk_color_selection_set_current_rgba() will also set this color the first
|
||||
* time it is called.
|
||||
*
|
||||
* Since: 3.0
|
||||
**/
|
||||
void
|
||||
gtk_color_selection_set_previous_rgba (GtkColorSelection *colorsel,
|
||||
const GdkRGBA *rgba)
|
||||
{
|
||||
GtkColorSelectionPrivate *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_COLOR_SELECTION (colorsel));
|
||||
g_return_if_fail (rgba != NULL);
|
||||
|
||||
priv = colorsel->private_data;
|
||||
priv->changing = TRUE;
|
||||
|
||||
priv->old_color[COLORSEL_RED] = CLAMP (rgba->red, 0, 1);
|
||||
priv->old_color[COLORSEL_GREEN] = CLAMP (rgba->green, 0, 1);
|
||||
priv->old_color[COLORSEL_BLUE] = CLAMP (rgba->blue, 0, 1);
|
||||
priv->old_color[COLORSEL_OPACITY] = CLAMP (rgba->alpha, 0, 1);
|
||||
|
||||
gtk_rgb_to_hsv (priv->old_color[COLORSEL_RED],
|
||||
priv->old_color[COLORSEL_GREEN],
|
||||
priv->old_color[COLORSEL_BLUE],
|
||||
&priv->old_color[COLORSEL_HUE],
|
||||
&priv->old_color[COLORSEL_SATURATION],
|
||||
&priv->old_color[COLORSEL_VALUE]);
|
||||
|
||||
color_sample_update_samples (colorsel);
|
||||
priv->default_set = TRUE;
|
||||
priv->changing = FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_color_selection_get_previous_rgba:
|
||||
* @colorsel: a #GtkColorSelection.
|
||||
* @rgba: a #GdkRGBA to fill in with the original color value.
|
||||
*
|
||||
* Fills @rgba in with the original color value.
|
||||
*
|
||||
* Since: 3.0
|
||||
**/
|
||||
void
|
||||
gtk_color_selection_get_previous_rgba (GtkColorSelection *colorsel,
|
||||
GdkRGBA *rgba)
|
||||
{
|
||||
GtkColorSelectionPrivate *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_COLOR_SELECTION (colorsel));
|
||||
g_return_if_fail (rgba != NULL);
|
||||
|
||||
priv = colorsel->private_data;
|
||||
rgba->red = priv->old_color[COLORSEL_RED];
|
||||
rgba->green = priv->old_color[COLORSEL_GREEN];
|
||||
rgba->blue = priv->old_color[COLORSEL_BLUE];
|
||||
rgba->alpha = (priv->has_opacity) ? priv->old_color[COLORSEL_OPACITY] : 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_color_selection_set_palette_color:
|
||||
* @colorsel: a #GtkColorSelection.
|
||||
|
@ -104,6 +104,15 @@ void gtk_color_selection_get_previous_color (GtkColorSelection *colorsel,
|
||||
GdkColor *color);
|
||||
guint16 gtk_color_selection_get_previous_alpha (GtkColorSelection *colorsel);
|
||||
|
||||
void gtk_color_selection_set_current_rgba (GtkColorSelection *colorsel,
|
||||
const GdkRGBA *rgba);
|
||||
void gtk_color_selection_get_current_rgba (GtkColorSelection *colorsel,
|
||||
GdkRGBA *rgba);
|
||||
void gtk_color_selection_set_previous_rgba (GtkColorSelection *colorsel,
|
||||
const GdkRGBA *rgba);
|
||||
void gtk_color_selection_get_previous_rgba (GtkColorSelection *colorsel,
|
||||
GdkRGBA *rgba);
|
||||
|
||||
gboolean gtk_color_selection_is_adjusting (GtkColorSelection *colorsel);
|
||||
|
||||
gboolean gtk_color_selection_palette_from_string (const gchar *str,
|
||||
|
@ -125,10 +125,10 @@ struct _GtkComboBoxPrivate
|
||||
GtkWidget *popup_window;
|
||||
GtkWidget *scrolled_window;
|
||||
|
||||
guint inserted_id;
|
||||
guint deleted_id;
|
||||
guint reordered_id;
|
||||
guint changed_id;
|
||||
gulong inserted_id;
|
||||
gulong deleted_id;
|
||||
gulong reordered_id;
|
||||
gulong changed_id;
|
||||
guint popup_idle_id;
|
||||
guint activate_button;
|
||||
guint32 activate_time;
|
||||
@ -143,6 +143,8 @@ struct _GtkComboBoxPrivate
|
||||
gint text_column;
|
||||
GtkCellRenderer *text_renderer;
|
||||
|
||||
gint id_column;
|
||||
|
||||
GSList *cells;
|
||||
|
||||
guint popup_in_progress : 1;
|
||||
@ -245,7 +247,8 @@ enum {
|
||||
PROP_EDITING_CANCELED,
|
||||
PROP_HAS_ENTRY,
|
||||
PROP_ENTRY_TEXT_COLUMN,
|
||||
PROP_POPUP_FIXED_WIDTH
|
||||
PROP_POPUP_FIXED_WIDTH,
|
||||
PROP_ID_COLUMN
|
||||
};
|
||||
|
||||
static guint combo_box_signals[LAST_SIGNAL] = {0,};
|
||||
@ -948,6 +951,23 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass)
|
||||
-1, G_MAXINT, -1,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
/**
|
||||
* GtkComboBox:id-column:
|
||||
*
|
||||
* The column in the combo box's model that provides numeric
|
||||
* IDs for the values in the model, if != -1.
|
||||
*
|
||||
* Since: 3.0
|
||||
*/
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_ID_COLUMN,
|
||||
g_param_spec_int ("id-column",
|
||||
P_("ID Column"),
|
||||
P_("The column in the combo box's model that provides "
|
||||
"numeric IDs for the values in the model"),
|
||||
-1, G_MAXINT, -1,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
/**
|
||||
* GtkComboBox:popup-fixed-width:
|
||||
*
|
||||
@ -1077,6 +1097,7 @@ gtk_combo_box_init (GtkComboBox *combo_box)
|
||||
|
||||
priv->text_column = -1;
|
||||
priv->text_renderer = NULL;
|
||||
priv->id_column = -1;
|
||||
|
||||
gtk_combo_box_check_appearance (combo_box);
|
||||
}
|
||||
@ -1168,6 +1189,10 @@ gtk_combo_box_set_property (GObject *object,
|
||||
gtk_combo_box_set_entry_text_column (combo_box, g_value_get_int (value));
|
||||
break;
|
||||
|
||||
case PROP_ID_COLUMN:
|
||||
gtk_combo_box_set_id_column (combo_box, g_value_get_int (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@ -1245,6 +1270,10 @@ gtk_combo_box_get_property (GObject *object,
|
||||
g_value_set_int (value, priv->text_column);
|
||||
break;
|
||||
|
||||
case PROP_ID_COLUMN:
|
||||
g_value_set_int (value, priv->id_column);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@ -6544,14 +6573,14 @@ gtk_combo_box_get_preferred_height_for_width (GtkWidget *widget,
|
||||
|
||||
xpad = 2 * (border_width + cell_style->xthickness);
|
||||
ypad = 2 * (border_width + cell_style->ythickness);
|
||||
}
|
||||
}
|
||||
|
||||
size -= but_width;
|
||||
size -= 2 * focus_width;
|
||||
size -= xpad;
|
||||
|
||||
gtk_combo_box_measure_height_for_width (combo_box, size, &min_height, &nat_height);
|
||||
|
||||
|
||||
min_height = MAX (min_height, but_height);
|
||||
nat_height = MAX (nat_height, but_height);
|
||||
|
||||
@ -6573,3 +6602,50 @@ gtk_combo_box_get_preferred_height_for_width (GtkWidget *widget,
|
||||
if (natural_size)
|
||||
*natural_size = nat_height;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_combo_box_set_id_column:
|
||||
* @combo_box: A #GtkComboBox
|
||||
* @id_column: A column in @model to get numeric IDs for values from
|
||||
*
|
||||
* Sets the model column which @combo_box should use to get numeric IDs
|
||||
* for values from. The column @id_column in the model of @combo_box
|
||||
* must be of type %G_TYPE_INT.
|
||||
*
|
||||
* Since: 3.0
|
||||
*/
|
||||
void
|
||||
gtk_combo_box_set_id_column (GtkComboBox *combo_box,
|
||||
gint id_column)
|
||||
{
|
||||
GtkComboBoxPrivate *priv = combo_box->priv;
|
||||
GtkTreeModel *model;
|
||||
|
||||
g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
|
||||
|
||||
model = gtk_combo_box_get_model (combo_box);
|
||||
|
||||
g_return_if_fail (id_column >= 0);
|
||||
g_return_if_fail (model == NULL || id_column < gtk_tree_model_get_n_columns (model));
|
||||
|
||||
priv->id_column = id_column;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_combo_box_get_id_column:
|
||||
* @combo_box: A #GtkComboBox
|
||||
*
|
||||
* Returns the column which @combo_box is using to get numeric IDs
|
||||
* for values from.
|
||||
*
|
||||
* Return value: A column in the data source model of @combo_box.
|
||||
*
|
||||
* Since: 3.0
|
||||
*/
|
||||
gint
|
||||
gtk_combo_box_get_id_column (GtkComboBox *combo_box)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_COMBO_BOX (combo_box), 0);
|
||||
|
||||
return combo_box->priv->id_column;
|
||||
}
|
||||
|
@ -133,6 +133,9 @@ void gtk_combo_box_popup_for_device (GtkComboBox *combo_box,
|
||||
void gtk_combo_box_popdown (GtkComboBox *combo_box);
|
||||
AtkObject* gtk_combo_box_get_popup_accessible (GtkComboBox *combo_box);
|
||||
|
||||
gint gtk_combo_box_get_id_column (GtkComboBox *combo_box);
|
||||
void gtk_combo_box_set_id_column (GtkComboBox *combo_box,
|
||||
gint id_column);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
* SECTION:gtkcomboboxtext
|
||||
* @Short_description: A simple, text-only combo box
|
||||
* @Title: GtkComboBoxText
|
||||
* @See_also: @GtkComboBox
|
||||
* @See_also: #GtkComboBox
|
||||
*
|
||||
* A GtkComboBoxText is a simple variant of #GtkComboBox that hides
|
||||
* the model-view complexity for simple text-only use cases.
|
||||
@ -72,7 +72,7 @@ gtk_combo_box_text_init (GtkComboBoxText *combo_box)
|
||||
{
|
||||
GtkListStore *store;
|
||||
|
||||
store = gtk_list_store_new (1, G_TYPE_STRING);
|
||||
store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT);
|
||||
gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box), GTK_TREE_MODEL (store));
|
||||
g_object_unref (store);
|
||||
}
|
||||
@ -102,6 +102,7 @@ gtk_combo_box_text_new (void)
|
||||
{
|
||||
return g_object_new (GTK_TYPE_COMBO_BOX_TEXT,
|
||||
"entry-text-column", 0,
|
||||
"id-column", 1,
|
||||
NULL);
|
||||
}
|
||||
|
||||
@ -121,6 +122,7 @@ gtk_combo_box_text_new_with_entry (void)
|
||||
return g_object_new (GTK_TYPE_COMBO_BOX_TEXT,
|
||||
"has-entry", TRUE,
|
||||
"entry-text-column", 0,
|
||||
"id-column", 1,
|
||||
NULL);
|
||||
}
|
||||
|
||||
@ -129,7 +131,7 @@ gtk_combo_box_text_new_with_entry (void)
|
||||
* @combo_box: A #GtkComboBoxText
|
||||
* @text: A string
|
||||
*
|
||||
* Appends @string to the list of strings stored in @combo_box.
|
||||
* Appends @text to the list of strings stored in @combo_box.
|
||||
*
|
||||
* Since: 2.24
|
||||
*/
|
||||
@ -137,22 +139,23 @@ void
|
||||
gtk_combo_box_text_append_text (GtkComboBoxText *combo_box,
|
||||
const gchar *text)
|
||||
{
|
||||
GtkListStore *store;
|
||||
GtkTreeIter iter;
|
||||
gint text_column;
|
||||
gint column_type;
|
||||
gtk_combo_box_text_insert_text (combo_box, G_MAXINT, text);
|
||||
}
|
||||
|
||||
g_return_if_fail (GTK_IS_COMBO_BOX_TEXT (combo_box));
|
||||
g_return_if_fail (text != NULL);
|
||||
|
||||
store = GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (combo_box)));
|
||||
g_return_if_fail (GTK_IS_LIST_STORE (store));
|
||||
text_column = gtk_combo_box_get_entry_text_column (GTK_COMBO_BOX (combo_box));
|
||||
column_type = gtk_tree_model_get_column_type (GTK_TREE_MODEL (store), text_column);
|
||||
g_return_if_fail (column_type == G_TYPE_STRING);
|
||||
|
||||
gtk_list_store_append (store, &iter);
|
||||
gtk_list_store_set (store, &iter, text_column, text, -1);
|
||||
/**
|
||||
* gtk_combo_box_text_prepend_text:
|
||||
* @combo_box: A #GtkComboBox
|
||||
* @text: A string
|
||||
*
|
||||
* Prepends @text to the list of strings stored in @combo_box.
|
||||
*
|
||||
* Since: 2.24
|
||||
*/
|
||||
void
|
||||
gtk_combo_box_text_prepend_text (GtkComboBoxText *combo_box,
|
||||
const gchar *text)
|
||||
{
|
||||
gtk_combo_box_text_insert_text (combo_box, 0, text);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -161,7 +164,7 @@ gtk_combo_box_text_append_text (GtkComboBoxText *combo_box,
|
||||
* @position: An index to insert @text
|
||||
* @text: A string
|
||||
*
|
||||
* Inserts @string at @position in the list of strings stored in @combo_box.
|
||||
* Inserts @text at @position in the list of strings stored in @combo_box.
|
||||
*
|
||||
* Since: 2.24
|
||||
*/
|
||||
@ -169,10 +172,32 @@ void
|
||||
gtk_combo_box_text_insert_text (GtkComboBoxText *combo_box,
|
||||
gint position,
|
||||
const gchar *text)
|
||||
{
|
||||
gtk_combo_box_text_insert_text_with_id (combo_box, position, text, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_combo_box_text_insert_text_with_id:
|
||||
* @combo_box: A #GtkComboBoxText
|
||||
* @position: An index to insert @text
|
||||
* @text: A string
|
||||
* @id: a numeric ID for this value
|
||||
*
|
||||
* Inserts @text at @position in the list of strings stored in @combo_box,
|
||||
* and sets its numeric ID to @id. See #GtkComboBox::id-column.
|
||||
*
|
||||
* Since: 3.0
|
||||
*/
|
||||
void
|
||||
gtk_combo_box_text_insert_text_with_id (GtkComboBoxText *combo_box,
|
||||
gint position,
|
||||
const gchar *text,
|
||||
gint id)
|
||||
{
|
||||
GtkListStore *store;
|
||||
GtkTreeIter iter;
|
||||
gint text_column;
|
||||
gint id_column;
|
||||
gint column_type;
|
||||
|
||||
g_return_if_fail (GTK_IS_COMBO_BOX_TEXT (combo_box));
|
||||
@ -184,41 +209,17 @@ gtk_combo_box_text_insert_text (GtkComboBoxText *combo_box,
|
||||
text_column = gtk_combo_box_get_entry_text_column (GTK_COMBO_BOX (combo_box));
|
||||
column_type = gtk_tree_model_get_column_type (GTK_TREE_MODEL (store), text_column);
|
||||
g_return_if_fail (column_type == G_TYPE_STRING);
|
||||
id_column = gtk_combo_box_get_id_column (GTK_COMBO_BOX (combo_box));
|
||||
if (id_column != -1)
|
||||
{
|
||||
column_type = gtk_tree_model_get_column_type (GTK_TREE_MODEL (store), id_column);
|
||||
g_return_if_fail (column_type == G_TYPE_INT);
|
||||
}
|
||||
|
||||
gtk_list_store_insert (store, &iter, position);
|
||||
gtk_list_store_set (store, &iter, text_column, text, -1);
|
||||
gtk_list_store_set (store, &iter, text_column, text, id_column, id, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_combo_box_text_prepend_text:
|
||||
* @combo_box: A #GtkComboBox
|
||||
* @text: A string
|
||||
*
|
||||
* Prepends @string to the list of strings stored in @combo_box.
|
||||
*
|
||||
* Since: 2.24
|
||||
*/
|
||||
void
|
||||
gtk_combo_box_text_prepend_text (GtkComboBoxText *combo_box,
|
||||
const gchar *text)
|
||||
{
|
||||
GtkListStore *store;
|
||||
GtkTreeIter iter;
|
||||
gint text_column;
|
||||
gint column_type;
|
||||
|
||||
g_return_if_fail (GTK_IS_COMBO_BOX_TEXT (combo_box));
|
||||
g_return_if_fail (text != NULL);
|
||||
|
||||
store = GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (combo_box)));
|
||||
g_return_if_fail (GTK_IS_LIST_STORE (store));
|
||||
text_column = gtk_combo_box_get_entry_text_column (GTK_COMBO_BOX (combo_box));
|
||||
column_type = gtk_tree_model_get_column_type (GTK_TREE_MODEL (store), text_column);
|
||||
g_return_if_fail (column_type == G_TYPE_STRING);
|
||||
|
||||
gtk_list_store_prepend (store, &iter);
|
||||
gtk_list_store_set (store, &iter, text_column, text, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_combo_box_text_remove:
|
||||
@ -248,6 +249,25 @@ gtk_combo_box_text_remove (GtkComboBoxText *combo_box,
|
||||
gtk_list_store_remove (store, &iter);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_combo_box_text_remove_all:
|
||||
* @combo_box: A #GtkComboBoxText
|
||||
*
|
||||
* Removes all the text entries from the combo box.
|
||||
*
|
||||
* Since: 3.0
|
||||
*/
|
||||
void
|
||||
gtk_combo_box_text_remove_all (GtkComboBoxText *combo_box)
|
||||
{
|
||||
GtkListStore *store;
|
||||
|
||||
g_return_if_fail (GTK_IS_COMBO_BOX_TEXT (combo_box));
|
||||
|
||||
store = GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (combo_box)));
|
||||
gtk_list_store_clear (store);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_combo_box_text_get_active_text:
|
||||
* @combo_box: A #GtkComboBoxText
|
||||
|
@ -69,8 +69,13 @@ void gtk_combo_box_text_prepend_text (GtkComboBoxText *combo_box
|
||||
const gchar *text);
|
||||
void gtk_combo_box_text_remove (GtkComboBoxText *combo_box,
|
||||
gint position);
|
||||
void gtk_combo_box_text_remove_all (GtkComboBoxText *combo_box);
|
||||
gchar *gtk_combo_box_text_get_active_text (GtkComboBoxText *combo_box);
|
||||
|
||||
void gtk_combo_box_text_insert_text_with_id (GtkComboBoxText *combo_box,
|
||||
gint position,
|
||||
const gchar *text,
|
||||
gint id);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -323,11 +323,13 @@ static void gtk_container_map (GtkWidget *widget);
|
||||
static void gtk_container_unmap (GtkWidget *widget);
|
||||
static void gtk_container_adjust_size_request (GtkWidget *widget,
|
||||
GtkOrientation orientation,
|
||||
gint for_size,
|
||||
gint *minimum_size,
|
||||
gint *natural_size);
|
||||
static void gtk_container_adjust_size_allocation (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
GtkOrientation orientation,
|
||||
gint *natural_size,
|
||||
gint *allocated_pos,
|
||||
gint *allocated_size);
|
||||
|
||||
static gchar* gtk_container_child_default_composite_name (GtkContainer *container,
|
||||
GtkWidget *child);
|
||||
@ -1776,7 +1778,6 @@ gtk_container_resize_children (GtkContainer *container)
|
||||
static void
|
||||
gtk_container_adjust_size_request (GtkWidget *widget,
|
||||
GtkOrientation orientation,
|
||||
gint for_size,
|
||||
gint *minimum_size,
|
||||
gint *natural_size)
|
||||
{
|
||||
@ -1797,28 +1798,33 @@ gtk_container_adjust_size_request (GtkWidget *widget,
|
||||
/* chain up last so gtk_widget_set_size_request() values
|
||||
* will have a chance to overwrite our border width.
|
||||
*/
|
||||
parent_class->adjust_size_request (widget, orientation, for_size,
|
||||
parent_class->adjust_size_request (widget, orientation,
|
||||
minimum_size, natural_size);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_container_adjust_size_allocation (GtkWidget *widget,
|
||||
GtkAllocation *allocation)
|
||||
GtkOrientation orientation,
|
||||
gint *natural_size,
|
||||
gint *allocated_pos,
|
||||
gint *allocated_size)
|
||||
{
|
||||
GtkContainer *container;
|
||||
int border_width;
|
||||
|
||||
container = GTK_CONTAINER (widget);
|
||||
|
||||
parent_class->adjust_size_allocation (widget, allocation);
|
||||
|
||||
if (!GTK_CONTAINER_GET_CLASS (widget)->handle_border_width)
|
||||
return;
|
||||
{
|
||||
parent_class->adjust_size_allocation (widget, orientation,
|
||||
natural_size, allocated_pos,
|
||||
allocated_size);
|
||||
return;
|
||||
}
|
||||
|
||||
border_width = container->priv->border_width;
|
||||
|
||||
allocation->width -= border_width * 2;
|
||||
allocation->height -= border_width * 2;
|
||||
*allocated_size -= border_width * 2;
|
||||
|
||||
/* If we get a pathological too-small allocation to hold
|
||||
* even the border width, leave all allocation to the actual
|
||||
@ -1828,23 +1834,26 @@ gtk_container_adjust_size_allocation (GtkWidget *widget,
|
||||
* As long as we have space, set x,y properly.
|
||||
*/
|
||||
|
||||
if (allocation->width < 1)
|
||||
if (*allocated_size < 1)
|
||||
{
|
||||
allocation->width += border_width * 2;
|
||||
*allocated_size += border_width * 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
allocation->x += border_width;
|
||||
*allocated_pos += border_width;
|
||||
*natural_size -= border_width * 2;
|
||||
}
|
||||
|
||||
if (allocation->height < 1)
|
||||
{
|
||||
allocation->height += border_width * 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
allocation->y += border_width;
|
||||
}
|
||||
/* Chain up to GtkWidgetClass *after* removing our border width from
|
||||
* the proposed allocation size. This is because it's possible that the
|
||||
* widget was allocated more space than it needs in a said orientation,
|
||||
* if GtkWidgetClass does any alignments and thus limits the size to the
|
||||
* natural size... then we need that to be done *after* removing any margins
|
||||
* and padding values.
|
||||
*/
|
||||
parent_class->adjust_size_allocation (widget, orientation,
|
||||
natural_size, allocated_pos,
|
||||
allocated_size);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2310,7 +2319,7 @@ get_allocation_coords (GtkContainer *container,
|
||||
GtkWidget *widget,
|
||||
GdkRectangle *allocation)
|
||||
{
|
||||
gtk_widget_set_allocation (widget, allocation);
|
||||
gtk_widget_get_allocation (widget, allocation);
|
||||
|
||||
return gtk_widget_translate_coordinates (widget, GTK_WIDGET (container),
|
||||
0, 0, &allocation->x, &allocation->y);
|
||||
|
309
gtk/gtkentry.c
309
gtk/gtkentry.c
@ -265,8 +265,7 @@ static void gtk_entry_size_allocate (GtkWidget *widget,
|
||||
static void gtk_entry_draw_frame (GtkWidget *widget,
|
||||
cairo_t *cr);
|
||||
static void gtk_entry_draw_progress (GtkWidget *widget,
|
||||
cairo_t *cr,
|
||||
GdkWindow *window);
|
||||
cairo_t *cr);
|
||||
static gint gtk_entry_draw (GtkWidget *widget,
|
||||
cairo_t *cr);
|
||||
static gint gtk_entry_button_press (GtkWidget *widget,
|
||||
@ -468,7 +467,7 @@ static void get_text_area_size (GtkEntry *entry,
|
||||
gint *y,
|
||||
gint *width,
|
||||
gint *height);
|
||||
static void get_widget_window_size (GtkEntry *entry,
|
||||
static void get_frame_size (GtkEntry *entry,
|
||||
gint *x,
|
||||
gint *y,
|
||||
gint *width,
|
||||
@ -2260,6 +2259,7 @@ gtk_entry_init (GtkEntry *entry)
|
||||
GtkEntryPrivate *priv = GTK_ENTRY_GET_PRIVATE (entry);
|
||||
|
||||
gtk_widget_set_can_focus (GTK_WIDGET (entry), TRUE);
|
||||
gtk_widget_set_has_window (GTK_WIDGET (entry), FALSE);
|
||||
|
||||
entry->editable = TRUE;
|
||||
entry->visible = TRUE;
|
||||
@ -2622,11 +2622,9 @@ realize_icon_info (GtkWidget *widget,
|
||||
attributes.width = 1;
|
||||
attributes.height = 1;
|
||||
attributes.window_type = GDK_WINDOW_CHILD;
|
||||
attributes.wclass = GDK_INPUT_OUTPUT;
|
||||
attributes.visual = gtk_widget_get_visual (widget);
|
||||
attributes.wclass = GDK_INPUT_ONLY;
|
||||
attributes.event_mask = gtk_widget_get_events (widget);
|
||||
attributes.event_mask |= (GDK_EXPOSURE_MASK |
|
||||
GDK_BUTTON_PRESS_MASK |
|
||||
attributes.event_mask |= (GDK_BUTTON_PRESS_MASK |
|
||||
GDK_BUTTON_RELEASE_MASK |
|
||||
GDK_BUTTON1_MOTION_MASK |
|
||||
GDK_BUTTON3_MOTION_MASK |
|
||||
@ -2634,14 +2632,12 @@ realize_icon_info (GtkWidget *widget,
|
||||
GDK_POINTER_MOTION_MASK |
|
||||
GDK_ENTER_NOTIFY_MASK |
|
||||
GDK_LEAVE_NOTIFY_MASK);
|
||||
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
|
||||
attributes_mask = GDK_WA_X | GDK_WA_Y;
|
||||
|
||||
icon_info->window = gdk_window_new (gtk_widget_get_window (widget),
|
||||
&attributes,
|
||||
attributes_mask);
|
||||
gdk_window_set_user_data (icon_info->window, widget);
|
||||
gdk_window_set_background (icon_info->window,
|
||||
>k_widget_get_style (widget)->base[gtk_widget_get_state (widget)]);
|
||||
|
||||
gtk_widget_queue_resize (widget);
|
||||
}
|
||||
@ -2709,27 +2705,25 @@ gtk_entry_realize (GtkWidget *widget)
|
||||
{
|
||||
GtkEntry *entry;
|
||||
GtkEntryPrivate *priv;
|
||||
GtkStateType state;
|
||||
GtkStyle *style;
|
||||
EntryIconInfo *icon_info;
|
||||
GdkWindow *window;
|
||||
GdkWindowAttr attributes;
|
||||
gint attributes_mask;
|
||||
gint frame_x, frame_y;
|
||||
int i;
|
||||
|
||||
gtk_widget_set_realized (widget, TRUE);
|
||||
window = gtk_widget_get_parent_window (widget);
|
||||
gtk_widget_set_window (widget, window);
|
||||
g_object_ref (window);
|
||||
|
||||
entry = GTK_ENTRY (widget);
|
||||
priv = GTK_ENTRY_GET_PRIVATE (entry);
|
||||
|
||||
attributes.window_type = GDK_WINDOW_CHILD;
|
||||
|
||||
get_widget_window_size (entry, &attributes.x, &attributes.y, &attributes.width, &attributes.height);
|
||||
|
||||
attributes.wclass = GDK_INPUT_OUTPUT;
|
||||
attributes.visual = gtk_widget_get_visual (widget);
|
||||
attributes.wclass = GDK_INPUT_ONLY;
|
||||
attributes.event_mask = gtk_widget_get_events (widget);
|
||||
attributes.event_mask |= (GDK_EXPOSURE_MASK |
|
||||
GDK_BUTTON_PRESS_MASK |
|
||||
attributes.event_mask |= (GDK_BUTTON_PRESS_MASK |
|
||||
GDK_BUTTON_RELEASE_MASK |
|
||||
GDK_BUTTON1_MOTION_MASK |
|
||||
GDK_BUTTON3_MOTION_MASK |
|
||||
@ -2737,21 +2731,23 @@ gtk_entry_realize (GtkWidget *widget)
|
||||
GDK_POINTER_MOTION_MASK |
|
||||
GDK_ENTER_NOTIFY_MASK |
|
||||
GDK_LEAVE_NOTIFY_MASK);
|
||||
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
|
||||
|
||||
window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
|
||||
gtk_widget_set_window (widget, window);
|
||||
gdk_window_set_user_data (window, entry);
|
||||
attributes_mask = GDK_WA_X | GDK_WA_Y;
|
||||
|
||||
get_text_area_size (entry, &attributes.x, &attributes.y, &attributes.width, &attributes.height);
|
||||
|
||||
|
||||
get_frame_size (entry, &frame_x, &frame_y, NULL, NULL);
|
||||
attributes.x += frame_x;
|
||||
attributes.y += frame_y;
|
||||
|
||||
if (gtk_widget_is_sensitive (widget))
|
||||
{
|
||||
attributes.cursor = gdk_cursor_new_for_display (gtk_widget_get_display (widget), GDK_XTERM);
|
||||
attributes_mask |= GDK_WA_CURSOR;
|
||||
}
|
||||
|
||||
entry->text_area = gdk_window_new (window, &attributes, attributes_mask);
|
||||
entry->text_area = gdk_window_new (gtk_widget_get_window (widget),
|
||||
&attributes,
|
||||
attributes_mask);
|
||||
|
||||
gdk_window_set_user_data (entry->text_area, entry);
|
||||
|
||||
@ -2760,11 +2756,6 @@ gtk_entry_realize (GtkWidget *widget)
|
||||
|
||||
gtk_widget_style_attach (widget);
|
||||
|
||||
style = gtk_widget_get_style (widget);
|
||||
state = gtk_widget_get_state (widget);
|
||||
gdk_window_set_background (window, &style->base[state]);
|
||||
gdk_window_set_background (entry->text_area, &style->base[state]);
|
||||
|
||||
gdk_window_show (entry->text_area);
|
||||
|
||||
gtk_im_context_set_client_window (entry->im_context, entry->text_area);
|
||||
@ -2918,10 +2909,12 @@ place_windows (GtkEntry *entry)
|
||||
GtkWidget *widget = GTK_WIDGET (entry);
|
||||
GtkEntryPrivate *priv = GTK_ENTRY_GET_PRIVATE (entry);
|
||||
gint x, y, width, height;
|
||||
gint frame_x, frame_y;
|
||||
GtkAllocation primary;
|
||||
GtkAllocation secondary;
|
||||
EntryIconInfo *icon_info = NULL;
|
||||
|
||||
get_frame_size (entry, &frame_x, &frame_y, NULL, NULL);
|
||||
get_text_area_size (entry, &x, &y, &width, &height);
|
||||
get_icon_allocations (entry, &primary, &secondary);
|
||||
|
||||
@ -2934,6 +2927,13 @@ place_windows (GtkEntry *entry)
|
||||
x += primary.width;
|
||||
width -= primary.width + secondary.width;
|
||||
|
||||
x += frame_x;
|
||||
y += frame_y;
|
||||
primary.x += frame_x;
|
||||
primary.y += frame_y;
|
||||
secondary.x += frame_x;
|
||||
secondary.y += frame_y;
|
||||
|
||||
if ((icon_info = priv->icons[GTK_ENTRY_ICON_PRIMARY]) != NULL)
|
||||
gdk_window_move_resize (icon_info->window,
|
||||
primary.x, primary.y,
|
||||
@ -2966,7 +2966,7 @@ gtk_entry_get_text_area_size (GtkEntry *entry,
|
||||
_gtk_entry_get_borders (entry, &xborder, &yborder);
|
||||
|
||||
if (gtk_widget_get_realized (widget))
|
||||
frame_height = gdk_window_get_height (gtk_widget_get_window (widget));
|
||||
get_frame_size (entry, NULL, NULL, NULL, &frame_height);
|
||||
else
|
||||
frame_height = requisition.height;
|
||||
|
||||
@ -3005,11 +3005,11 @@ get_text_area_size (GtkEntry *entry,
|
||||
|
||||
|
||||
static void
|
||||
get_widget_window_size (GtkEntry *entry,
|
||||
gint *x,
|
||||
gint *y,
|
||||
gint *width,
|
||||
gint *height)
|
||||
get_frame_size (GtkEntry *entry,
|
||||
gint *x,
|
||||
gint *y,
|
||||
gint *width,
|
||||
gint *height)
|
||||
{
|
||||
GtkAllocation allocation;
|
||||
GtkRequisition requisition;
|
||||
@ -3077,13 +3077,8 @@ gtk_entry_size_allocate (GtkWidget *widget,
|
||||
|
||||
if (gtk_widget_get_realized (widget))
|
||||
{
|
||||
gint x, y, width, height;
|
||||
GtkEntryCompletion* completion;
|
||||
|
||||
get_widget_window_size (entry, &x, &y, &width, &height);
|
||||
gdk_window_move_resize (gtk_widget_get_window (widget),
|
||||
x, y, width, height);
|
||||
|
||||
place_windows (entry);
|
||||
gtk_entry_recompute (entry);
|
||||
|
||||
@ -3250,11 +3245,17 @@ gtk_entry_draw_frame (GtkWidget *widget,
|
||||
GdkWindow *window;
|
||||
gint x = 0, y = 0, width, height;
|
||||
GtkStateType state;
|
||||
GtkAllocation allocation;
|
||||
gint frame_x, frame_y;
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
window = gtk_widget_get_window (widget);
|
||||
|
||||
width = gdk_window_get_width (window);
|
||||
height = gdk_window_get_height (window);
|
||||
get_frame_size (GTK_ENTRY (widget), &frame_x, &frame_y, &width, &height);
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
|
||||
cairo_translate (cr, frame_x - allocation.x, frame_y - allocation.y);
|
||||
|
||||
/* Fix a problem with some themes which assume that entry->text_area's
|
||||
* width equals widget->window's width
|
||||
@ -3282,12 +3283,17 @@ gtk_entry_draw_frame (GtkWidget *widget,
|
||||
state = gtk_widget_has_focus (widget) ?
|
||||
GTK_STATE_ACTIVE : gtk_widget_get_state (widget);
|
||||
|
||||
gtk_paint_flat_box (style, cr,
|
||||
state, GTK_SHADOW_NONE,
|
||||
widget, "entry_bg",
|
||||
x, y, width, height);
|
||||
|
||||
gtk_paint_shadow (style, cr,
|
||||
state, priv->shadow_type,
|
||||
widget, "entry", x, y, width, height);
|
||||
|
||||
|
||||
gtk_entry_draw_progress (widget, cr, window);
|
||||
gtk_entry_draw_progress (widget, cr);
|
||||
|
||||
if (gtk_widget_has_focus (widget) && !priv->interior_focus)
|
||||
{
|
||||
@ -3301,6 +3307,8 @@ gtk_entry_draw_frame (GtkWidget *widget,
|
||||
widget, "entry",
|
||||
0, 0, width, height);
|
||||
}
|
||||
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -3337,15 +3345,17 @@ get_progress_area (GtkWidget *widget,
|
||||
GtkEntryPrivate *private = GTK_ENTRY_GET_PRIVATE (widget);
|
||||
GtkEntry *entry = GTK_ENTRY (widget);
|
||||
GtkBorder progress_border;
|
||||
gint frame_width, frame_height;
|
||||
|
||||
get_frame_size (entry, NULL, NULL, &frame_width, &frame_height);
|
||||
gtk_entry_get_progress_border (widget, &progress_border);
|
||||
|
||||
*x = progress_border.left;
|
||||
*y = progress_border.top;
|
||||
|
||||
*width = gdk_window_get_width (gtk_widget_get_window (widget))
|
||||
*width = frame_width
|
||||
- progress_border.left - progress_border.right;
|
||||
*height = gdk_window_get_height (gtk_widget_get_window (widget))
|
||||
*height = frame_height
|
||||
- progress_border.top - progress_border.bottom;
|
||||
|
||||
if (gtk_widget_has_focus (widget) && !private->interior_focus)
|
||||
@ -3389,8 +3399,7 @@ get_progress_area (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
gtk_entry_draw_progress (GtkWidget *widget,
|
||||
cairo_t *cr,
|
||||
GdkWindow *window)
|
||||
cairo_t *cr)
|
||||
{
|
||||
gint x, y, width, height;
|
||||
GtkStateType state;
|
||||
@ -3400,16 +3409,6 @@ gtk_entry_draw_progress (GtkWidget *widget,
|
||||
if ((width <= 0) || (height <= 0))
|
||||
return;
|
||||
|
||||
if (window != gtk_widget_get_window (widget))
|
||||
{
|
||||
gint pos_x, pos_y;
|
||||
|
||||
gdk_window_get_position (window, &pos_x, &pos_y);
|
||||
|
||||
x -= pos_x;
|
||||
y -= pos_y;
|
||||
}
|
||||
|
||||
state = GTK_STATE_SELECTED;
|
||||
if (!gtk_widget_get_sensitive (widget))
|
||||
state = GTK_STATE_INSENSITIVE;
|
||||
@ -3437,23 +3436,15 @@ gtk_entry_draw (GtkWidget *widget,
|
||||
GTK_STATE_ACTIVE : gtk_widget_get_state (widget);
|
||||
|
||||
if (gtk_cairo_should_draw_window (cr, gtk_widget_get_window (widget)))
|
||||
gtk_entry_draw_frame (widget, cr);
|
||||
|
||||
if (gtk_cairo_should_draw_window (cr, entry->text_area))
|
||||
{
|
||||
/* Draw entry_bg, shadow, progress and focus */
|
||||
gtk_entry_draw_frame (widget, cr);
|
||||
|
||||
/* Draw text and cursor */
|
||||
cairo_save (cr);
|
||||
|
||||
gtk_cairo_transform_to_window (cr, widget, entry->text_area);
|
||||
|
||||
gtk_paint_flat_box (style, cr,
|
||||
state, GTK_SHADOW_NONE,
|
||||
widget, "entry_bg",
|
||||
0, 0,
|
||||
gdk_window_get_width (entry->text_area),
|
||||
gdk_window_get_height (entry->text_area));
|
||||
|
||||
gtk_entry_draw_progress (widget, cr, entry->text_area);
|
||||
|
||||
if (entry->dnd_position != -1)
|
||||
gtk_entry_draw_cursor (GTK_ENTRY (widget), cr, CURSOR_DND);
|
||||
|
||||
@ -3462,35 +3453,26 @@ gtk_entry_draw (GtkWidget *widget,
|
||||
/* When no text is being displayed at all, don't show the cursor */
|
||||
if (gtk_entry_get_display_mode (entry) != DISPLAY_BLANK &&
|
||||
gtk_widget_has_focus (widget) &&
|
||||
entry->selection_bound == entry->current_pos && entry->cursor_visible)
|
||||
entry->selection_bound == entry->current_pos && entry->cursor_visible)
|
||||
gtk_entry_draw_cursor (GTK_ENTRY (widget), cr, CURSOR_STANDARD);
|
||||
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
for (i = 0; i < MAX_ICONS; i++)
|
||||
{
|
||||
EntryIconInfo *icon_info = priv->icons[i];
|
||||
|
||||
if (icon_info != NULL && gtk_cairo_should_draw_window (cr, icon_info->window))
|
||||
/* Draw icons */
|
||||
for (i = 0; i < MAX_ICONS; i++)
|
||||
{
|
||||
cairo_save (cr);
|
||||
EntryIconInfo *icon_info = priv->icons[i];
|
||||
|
||||
gtk_cairo_transform_to_window (cr, widget, icon_info->window);
|
||||
if (icon_info != NULL)
|
||||
{
|
||||
cairo_save (cr);
|
||||
|
||||
gtk_paint_flat_box (style, cr,
|
||||
state, GTK_SHADOW_NONE,
|
||||
widget, "entry_bg",
|
||||
0, 0,
|
||||
gdk_window_get_width (icon_info->window),
|
||||
gdk_window_get_height (icon_info->window));
|
||||
gtk_cairo_transform_to_window (cr, widget, icon_info->window);
|
||||
|
||||
gtk_entry_draw_progress (widget, cr, icon_info->window);
|
||||
draw_icon (widget, cr, i);
|
||||
draw_icon (widget, cr, i);
|
||||
|
||||
cairo_restore (cr);
|
||||
|
||||
break;
|
||||
cairo_restore (cr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4208,30 +4190,10 @@ gtk_entry_state_changed (GtkWidget *widget,
|
||||
GtkStateType previous_state)
|
||||
{
|
||||
GtkEntry *entry = GTK_ENTRY (widget);
|
||||
GtkEntryPrivate *priv = GTK_ENTRY_GET_PRIVATE (widget);
|
||||
GdkCursor *cursor;
|
||||
gint i;
|
||||
|
||||
if (gtk_widget_get_realized (widget))
|
||||
{
|
||||
GtkStateType state;
|
||||
GtkStyle *style;
|
||||
|
||||
style = gtk_widget_get_style (widget);
|
||||
state = gtk_widget_get_state (widget);
|
||||
|
||||
gdk_window_set_background (gtk_widget_get_window (widget),
|
||||
&style->base[state]);
|
||||
gdk_window_set_background (entry->text_area,
|
||||
&style->base[state]);
|
||||
for (i = 0; i < MAX_ICONS; i++)
|
||||
{
|
||||
EntryIconInfo *icon_info = priv->icons[i];
|
||||
if (icon_info && icon_info->window)
|
||||
gdk_window_set_background (icon_info->window,
|
||||
&style->base[state]);
|
||||
}
|
||||
|
||||
if (gtk_widget_is_sensitive (widget))
|
||||
cursor = gdk_cursor_new_for_display (gtk_widget_get_display (widget), GDK_XTERM);
|
||||
else
|
||||
@ -4424,7 +4386,6 @@ gtk_entry_style_set (GtkWidget *widget,
|
||||
GtkEntryPrivate *priv = GTK_ENTRY_GET_PRIVATE (entry);
|
||||
gint focus_width;
|
||||
gboolean interior_focus;
|
||||
gint i;
|
||||
|
||||
gtk_widget_style_get (widget,
|
||||
"focus-line-width", &focus_width,
|
||||
@ -4439,25 +4400,6 @@ gtk_entry_style_set (GtkWidget *widget,
|
||||
|
||||
gtk_entry_recompute (entry);
|
||||
|
||||
if (previous_style && gtk_widget_get_realized (widget))
|
||||
{
|
||||
GtkStyle *style;
|
||||
|
||||
style = gtk_widget_get_style (widget);
|
||||
|
||||
gdk_window_set_background (gtk_widget_get_window (widget),
|
||||
&style->base[gtk_widget_get_state (widget)]);
|
||||
gdk_window_set_background (entry->text_area,
|
||||
&style->base[gtk_widget_get_state (widget)]);
|
||||
for (i = 0; i < MAX_ICONS; i++)
|
||||
{
|
||||
EntryIconInfo *icon_info = priv->icons[i];
|
||||
if (icon_info && icon_info->window)
|
||||
gdk_window_set_background (icon_info->window,
|
||||
&style->base[gtk_widget_get_state (widget)]);
|
||||
}
|
||||
}
|
||||
|
||||
icon_theme_changed (entry);
|
||||
icon_margin_changed (entry);
|
||||
}
|
||||
@ -5567,7 +5509,7 @@ gtk_entry_draw_text (GtkEntry *entry,
|
||||
gint pos_x, pos_y;
|
||||
gint width, height;
|
||||
gint progress_x, progress_y, progress_width, progress_height;
|
||||
|
||||
gint clip_width, clip_height;
|
||||
|
||||
/* Nothing to display at all */
|
||||
if (gtk_entry_get_display_mode (entry) == DISPLAY_BLANK)
|
||||
@ -5584,6 +5526,11 @@ gtk_entry_draw_text (GtkEntry *entry,
|
||||
&progress_x, &progress_y,
|
||||
&progress_width, &progress_height);
|
||||
|
||||
clip_width = gdk_window_get_width (entry->text_area);
|
||||
clip_height = gdk_window_get_height (entry->text_area);
|
||||
cairo_rectangle (cr, 0, 0, clip_width, clip_height);
|
||||
cairo_clip (cr);
|
||||
|
||||
/* If the color is the same, or the progress area has a zero
|
||||
* size, then we only need to draw once. */
|
||||
if ((text_color.pixel == bar_text_color.pixel) ||
|
||||
@ -5771,7 +5718,8 @@ static void
|
||||
gtk_entry_queue_draw (GtkEntry *entry)
|
||||
{
|
||||
if (gtk_widget_is_drawable (GTK_WIDGET (entry)))
|
||||
gdk_window_invalidate_rect (entry->text_area, NULL, FALSE);
|
||||
gdk_window_invalidate_rect (gtk_widget_get_window (GTK_WIDGET (entry)),
|
||||
NULL, FALSE);
|
||||
}
|
||||
|
||||
void
|
||||
@ -6708,29 +6656,46 @@ gtk_entry_set_buffer (GtkEntry *entry,
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_entry_get_text_window:
|
||||
* gtk_entry_get_text_area:
|
||||
* @entry: a #GtkEntry
|
||||
* @text_area: Return location for the text area.
|
||||
*
|
||||
* Returns the #GdkWindow which contains the text. This function is
|
||||
* useful when drawing something to the entry in a draw
|
||||
* callback because it enables the callback to distinguish between
|
||||
* the text window and entry's icon windows.
|
||||
* Returns the area where the entry's text is drawn. This function is
|
||||
* useful when drawing something to the entry in a draw callback.
|
||||
*
|
||||
* See also gtk_entry_get_icon_window().
|
||||
* See also gtk_entry_get_icon_area().
|
||||
*
|
||||
* Return value: (transfer none): the entry's text window.
|
||||
*
|
||||
* Since: 2.20
|
||||
* Since: 3.0
|
||||
**/
|
||||
GdkWindow *
|
||||
gtk_entry_get_text_window (GtkEntry *entry)
|
||||
void
|
||||
gtk_entry_get_text_area (GtkEntry *entry,
|
||||
GdkRectangle *text_area)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
|
||||
g_return_if_fail (GTK_IS_ENTRY (entry));
|
||||
g_return_if_fail (text_area != NULL);
|
||||
|
||||
return entry->text_area;
|
||||
if (entry->text_area)
|
||||
{
|
||||
GtkAllocation allocation;
|
||||
gint x, y;
|
||||
|
||||
gtk_widget_get_allocation (GTK_WIDGET (entry), &allocation);
|
||||
gdk_window_get_position (entry->text_area, &x, &y);
|
||||
|
||||
text_area->x = x - allocation.x;
|
||||
text_area->y = y - allocation.y;
|
||||
text_area->width = gdk_window_get_width (entry->text_area);
|
||||
text_area->height = gdk_window_get_height (entry->text_area);
|
||||
}
|
||||
else
|
||||
{
|
||||
text_area->x = 0;
|
||||
text_area->y = 0;
|
||||
text_area->width = 0;
|
||||
text_area->height = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gtk_entry_set_text:
|
||||
* @entry: a #GtkEntry
|
||||
@ -8032,9 +7997,14 @@ gtk_entry_get_icon_at_pos (GtkEntry *entry,
|
||||
{
|
||||
GtkAllocation primary;
|
||||
GtkAllocation secondary;
|
||||
gint frame_x, frame_y;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_ENTRY (entry), -1);
|
||||
|
||||
get_frame_size (entry, &frame_x, &frame_y, NULL, NULL);
|
||||
x -= frame_x;
|
||||
y -= frame_y;
|
||||
|
||||
get_icon_allocations (entry, &primary, &secondary);
|
||||
|
||||
if (primary.x <= x && x < primary.x + primary.width &&
|
||||
@ -8136,38 +8106,53 @@ gtk_entry_get_current_icon_drag_source (GtkEntry *entry)
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_entry_get_icon_window:
|
||||
* gtk_entry_get_icon_area:
|
||||
* @entry: A #GtkEntry
|
||||
* @icon_pos: Icon position
|
||||
* @icon_area: Return location for the icon's area
|
||||
*
|
||||
* Returns the #GdkWindow which contains the entry's icon at
|
||||
* @icon_pos. This function is useful when drawing something to the
|
||||
* entry in a draw callback because it enables the callback
|
||||
* to distinguish between the text window and entry's icon windows.
|
||||
* Returns the area where entry's icon at @icon_pos is drawn.
|
||||
* This function is useful when drawing something to the
|
||||
* entry in a draw callback.
|
||||
*
|
||||
* See also gtk_entry_get_text_window().
|
||||
* See also gtk_entry_get_text_area()
|
||||
*
|
||||
* Return value: (transfer none): the entry's icon window at @icon_pos.
|
||||
*
|
||||
* Since: 2.20
|
||||
* Since: 3.0
|
||||
*/
|
||||
GdkWindow *
|
||||
gtk_entry_get_icon_window (GtkEntry *entry,
|
||||
GtkEntryIconPosition icon_pos)
|
||||
void
|
||||
gtk_entry_get_icon_area (GtkEntry *entry,
|
||||
GtkEntryIconPosition icon_pos,
|
||||
GdkRectangle *icon_area)
|
||||
{
|
||||
GtkEntryPrivate *priv;
|
||||
EntryIconInfo *icon_info;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
|
||||
g_return_if_fail (GTK_IS_ENTRY (entry));
|
||||
g_return_if_fail (icon_area != NULL);
|
||||
|
||||
priv = GTK_ENTRY_GET_PRIVATE (entry);
|
||||
|
||||
icon_info = priv->icons[icon_pos];
|
||||
|
||||
if (icon_info)
|
||||
return icon_info->window;
|
||||
{
|
||||
GtkAllocation primary;
|
||||
GtkAllocation secondary;
|
||||
|
||||
return NULL;
|
||||
get_icon_allocations (entry, &primary, &secondary);
|
||||
|
||||
if (icon_pos == GTK_ENTRY_ICON_PRIMARY)
|
||||
*icon_area = primary;
|
||||
else
|
||||
*icon_area = secondary;
|
||||
}
|
||||
else
|
||||
{
|
||||
icon_area->x = 0;
|
||||
icon_area->y = 0;
|
||||
icon_area->width = 0;
|
||||
icon_area->height = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -172,7 +172,8 @@ GtkEntryBuffer* gtk_entry_get_buffer (GtkEntry *entry);
|
||||
void gtk_entry_set_buffer (GtkEntry *entry,
|
||||
GtkEntryBuffer *buffer);
|
||||
|
||||
GdkWindow *gtk_entry_get_text_window (GtkEntry *entry);
|
||||
void gtk_entry_get_text_area (GtkEntry *entry,
|
||||
GdkRectangle *text_area);
|
||||
|
||||
void gtk_entry_set_visibility (GtkEntry *entry,
|
||||
gboolean visible);
|
||||
@ -303,8 +304,9 @@ void gtk_entry_set_icon_drag_source (GtkEntry *
|
||||
GtkTargetList *target_list,
|
||||
GdkDragAction actions);
|
||||
gint gtk_entry_get_current_icon_drag_source (GtkEntry *entry);
|
||||
GdkWindow* gtk_entry_get_icon_window (GtkEntry *entry,
|
||||
GtkEntryIconPosition icon_pos);
|
||||
void gtk_entry_get_icon_area (GtkEntry *entry,
|
||||
GtkEntryIconPosition icon_pos,
|
||||
GdkRectangle *icon_area);
|
||||
|
||||
gboolean gtk_entry_im_context_filter_keypress (GtkEntry *entry,
|
||||
GdkEventKey *event);
|
||||
|
@ -1400,7 +1400,14 @@ _gtk_entry_completion_resize_popup (GtkEntryCompletion *completion)
|
||||
if (!window)
|
||||
return FALSE;
|
||||
|
||||
gtk_widget_get_allocation (completion->priv->entry, &allocation);
|
||||
gtk_widget_get_preferred_size (completion->priv->entry,
|
||||
&entry_req, NULL);
|
||||
|
||||
gdk_window_get_origin (window, &x, &y);
|
||||
x += allocation.x;
|
||||
y += allocation.y + (allocation.height - entry_req.height) / 2;
|
||||
|
||||
_gtk_entry_get_borders (GTK_ENTRY (completion->priv->entry), &x_border, &y_border);
|
||||
|
||||
matches = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (completion->priv->filter_model), NULL);
|
||||
@ -1436,7 +1443,6 @@ _gtk_entry_completion_resize_popup (GtkEntryCompletion *completion)
|
||||
else
|
||||
gtk_widget_show (completion->priv->scrolled_window);
|
||||
|
||||
gtk_widget_get_allocation (completion->priv->entry, &allocation);
|
||||
if (completion->priv->popup_set_width)
|
||||
width = MIN (allocation.width, monitor.width) - 2 * x_border;
|
||||
else
|
||||
@ -1455,8 +1461,6 @@ _gtk_entry_completion_resize_popup (GtkEntryCompletion *completion)
|
||||
|
||||
gtk_widget_get_preferred_size (completion->priv->popup_window,
|
||||
&popup_req, NULL);
|
||||
gtk_widget_get_preferred_size (completion->priv->entry,
|
||||
&entry_req, NULL);
|
||||
|
||||
if (x < monitor.x)
|
||||
x = monitor.x;
|
||||
|
@ -543,4 +543,5 @@ typedef enum
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
#endif /* __GTK_ENUMS_H__ */
|
||||
|
@ -970,11 +970,8 @@ gtk_expander_enter_notify (GtkWidget *widget,
|
||||
GdkEventCrossing *event)
|
||||
{
|
||||
GtkExpander *expander = GTK_EXPANDER (widget);
|
||||
GtkWidget *event_widget;
|
||||
|
||||
event_widget = gtk_get_event_widget ((GdkEvent *) event);
|
||||
|
||||
if (event_widget == widget &&
|
||||
if (event->window == expander->priv->event_window &&
|
||||
event->detail != GDK_NOTIFY_INFERIOR)
|
||||
{
|
||||
expander->priv->prelight = TRUE;
|
||||
@ -993,11 +990,8 @@ gtk_expander_leave_notify (GtkWidget *widget,
|
||||
GdkEventCrossing *event)
|
||||
{
|
||||
GtkExpander *expander = GTK_EXPANDER (widget);
|
||||
GtkWidget *event_widget;
|
||||
|
||||
event_widget = gtk_get_event_widget ((GdkEvent *) event);
|
||||
|
||||
if (event_widget == widget &&
|
||||
if (event->window == expander->priv->event_window &&
|
||||
event->detail != GDK_NOTIFY_INFERIOR)
|
||||
{
|
||||
expander->priv->prelight = FALSE;
|
||||
|
1635
gtk/gtkgrid.c
Normal file
1635
gtk/gtkgrid.c
Normal file
File diff suppressed because it is too large
Load Diff
98
gtk/gtkgrid.h
Normal file
98
gtk/gtkgrid.h
Normal file
@ -0,0 +1,98 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
* Author: Matthias Clasen
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __GTK_GRID_H__
|
||||
#define __GTK_GRID_H__
|
||||
|
||||
|
||||
#include <gtk/gtkcontainer.h>
|
||||
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_GRID (gtk_grid_get_type ())
|
||||
#define GTK_GRID(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_GRID, GtkGrid))
|
||||
#define GTK_GRID_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_GRID, GtkGridClass))
|
||||
#define GTK_IS_GRID(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_GRID))
|
||||
#define GTK_IS_GRID_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_GRID))
|
||||
#define GTK_GRID_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_GRID, GtkGridClass))
|
||||
|
||||
|
||||
typedef struct _GtkGrid GtkGrid;
|
||||
typedef struct _GtkGridPrivate GtkGridPrivate;
|
||||
typedef struct _GtkGridClass GtkGridClass;
|
||||
|
||||
struct _GtkGrid
|
||||
{
|
||||
/* <private> */
|
||||
GtkContainer container;
|
||||
|
||||
GtkGridPrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkGridClass
|
||||
{
|
||||
GtkContainerClass parent_class;
|
||||
|
||||
void (*_gtk_reserved1) (void);
|
||||
void (*_gtk_reserved2) (void);
|
||||
void (*_gtk_reserved3) (void);
|
||||
void (*_gtk_reserved4) (void);
|
||||
void (*_gtk_reserved5) (void);
|
||||
void (*_gtk_reserved6) (void);
|
||||
void (*_gtk_reserved7) (void);
|
||||
void (*_gtk_reserved8) (void);
|
||||
};
|
||||
|
||||
GType gtk_grid_get_type (void) G_GNUC_CONST;
|
||||
GtkWidget* gtk_grid_new (void);
|
||||
void gtk_grid_attach (GtkGrid *grid,
|
||||
GtkWidget *child,
|
||||
gint left,
|
||||
gint top,
|
||||
gint width,
|
||||
gint height);
|
||||
void gtk_grid_attach_next_to (GtkGrid *grid,
|
||||
GtkWidget *widget,
|
||||
GtkWidget *sibling,
|
||||
GtkPositionType side,
|
||||
gint width,
|
||||
gint height);
|
||||
void gtk_grid_set_row_homogeneous (GtkGrid *grid,
|
||||
gboolean homogeneous);
|
||||
gboolean gtk_grid_get_row_homogeneous (GtkGrid *grid);
|
||||
void gtk_grid_set_row_spacing (GtkGrid *grid,
|
||||
guint spacing);
|
||||
guint gtk_grid_get_row_spacing (GtkGrid *grid);
|
||||
void gtk_grid_set_column_homogeneous (GtkGrid *grid,
|
||||
gboolean homogeneous);
|
||||
gboolean gtk_grid_get_column_homogeneous (GtkGrid *grid);
|
||||
void gtk_grid_set_column_spacing (GtkGrid *grid,
|
||||
guint spacing);
|
||||
guint gtk_grid_get_column_spacing (GtkGrid *grid);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_GRID_H__ */
|
@ -3062,15 +3062,63 @@ gdk_color_to_css (GdkColor *color)
|
||||
color->blue >> 8);
|
||||
}
|
||||
|
||||
static GdkPixbuf *
|
||||
_gtk_icon_info_load_symbolic_internal (GtkIconInfo *icon_info,
|
||||
const gchar *css_fg,
|
||||
const gchar *css_success,
|
||||
const gchar *css_warning,
|
||||
const gchar *css_error,
|
||||
GError **error)
|
||||
{
|
||||
GInputStream *stream;
|
||||
GdkPixbuf *pixbuf;
|
||||
gchar *data;
|
||||
|
||||
data = g_strconcat ("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"
|
||||
"<svg version=\"1.1\"\n"
|
||||
" xmlns=\"http://www.w3.org/2000/svg\"\n"
|
||||
" xmlns:xi=\"http://www.w3.org/2001/XInclude\"\n"
|
||||
" width=\"16\"\n"
|
||||
" height=\"16\">\n"
|
||||
" <style type=\"text/css\">\n"
|
||||
" rect,path {\n"
|
||||
" fill: ", css_fg," !important;\n"
|
||||
" }\n"
|
||||
" .warning {\n"
|
||||
" fill: ", css_warning," !important;\n"
|
||||
" }\n"
|
||||
" .error {\n"
|
||||
" fill: ", css_error," !important;\n"
|
||||
" }\n"
|
||||
" .success {\n"
|
||||
" fill: ", css_success," !important;\n"
|
||||
" }\n"
|
||||
" </style>\n"
|
||||
" <xi:include href=\"", icon_info->filename, "\"/>\n"
|
||||
"</svg>",
|
||||
NULL);
|
||||
|
||||
stream = g_memory_input_stream_new_from_data (data, -1, g_free);
|
||||
pixbuf = gdk_pixbuf_new_from_stream_at_scale (stream,
|
||||
icon_info->desired_size,
|
||||
icon_info->desired_size,
|
||||
TRUE,
|
||||
NULL,
|
||||
error);
|
||||
g_object_unref (stream);
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_icon_info_load_symbolic:
|
||||
* @icon_info: a #GtkIconInfo
|
||||
* @fg: a #GdkColor representing the foreground color of the icon
|
||||
* @success_color: (allow-none): a #GdkColor representing the warning color
|
||||
* @fg: a #GdkRGBA representing the foreground color of the icon
|
||||
* @success_color: (allow-none): a #GdkRGBA representing the warning color
|
||||
* of the icon or %NULL to use the default color
|
||||
* @warning_color: (allow-none): a #GdkColor representing the warning color
|
||||
* @warning_color: (allow-none): a #GdkRGBA representing the warning color
|
||||
* of the icon or %NULL to use the default color
|
||||
* @error_color: (allow-none): a #GdkColor representing the error color
|
||||
* @error_color: (allow-none): a #GdkRGBA representing the error color
|
||||
* of the icon or %NULL to use the default color (allow-none)
|
||||
* @was_symbolic: (allow-none): a #gboolean, returns whether the loaded icon
|
||||
* was a symbolic one and whether the @fg color was applied to it.
|
||||
@ -3100,16 +3148,14 @@ gdk_color_to_css (GdkColor *color)
|
||||
**/
|
||||
GdkPixbuf *
|
||||
gtk_icon_info_load_symbolic (GtkIconInfo *icon_info,
|
||||
GdkColor *fg,
|
||||
GdkColor *success_color,
|
||||
GdkColor *warning_color,
|
||||
GdkColor *error_color,
|
||||
GdkRGBA *fg,
|
||||
GdkRGBA *success_color,
|
||||
GdkRGBA *warning_color,
|
||||
GdkRGBA *error_color,
|
||||
gboolean *was_symbolic,
|
||||
GError **error)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
GInputStream *stream;
|
||||
gchar *data;
|
||||
gchar *css_fg;
|
||||
gchar *css_success;
|
||||
gchar *css_warning;
|
||||
@ -3128,68 +3174,40 @@ gtk_icon_info_load_symbolic (GtkIconInfo *icon_info,
|
||||
if (was_symbolic)
|
||||
*was_symbolic = TRUE;
|
||||
|
||||
css_fg = gdk_color_to_css (fg);
|
||||
css_fg = gdk_rgba_to_string (fg);
|
||||
if (!warning_color)
|
||||
{
|
||||
GdkColor warning_default_color = { 0, 0xf500, 0x7900, 0x3e00 };
|
||||
css_warning = gdk_color_to_css (&warning_default_color);
|
||||
}
|
||||
else
|
||||
css_warning = gdk_color_to_css (warning_color);
|
||||
css_warning = gdk_rgba_to_string (warning_color);
|
||||
|
||||
if (!error_color)
|
||||
{
|
||||
GdkColor error_default_color = { 0, 0xcc00, 0x0000, 0x0000 };
|
||||
css_error = gdk_color_to_css (&error_default_color);
|
||||
}
|
||||
else
|
||||
css_error = gdk_color_to_css (error_color);
|
||||
css_error = gdk_rgba_to_string (error_color);
|
||||
|
||||
if (!success_color)
|
||||
{
|
||||
GdkColor success_default_color = { 0, 0x4e00, 0x9a00, 0x0600 };
|
||||
css_success = gdk_color_to_css (&success_default_color);
|
||||
}
|
||||
else
|
||||
css_success = gdk_color_to_css (success_color);
|
||||
css_success = gdk_rgba_to_string (success_color);
|
||||
|
||||
data = g_strconcat (
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"
|
||||
"<svg version=\"1.1\"\n"
|
||||
" xmlns=\"http://www.w3.org/2000/svg\"\n"
|
||||
" xmlns:xi=\"http://www.w3.org/2001/XInclude\"\n"
|
||||
" width=\"16\"\n"
|
||||
" height=\"16\">\n"
|
||||
" <style type=\"text/css\">\n"
|
||||
" rect,path {\n"
|
||||
" fill: ", css_fg," !important;\n"
|
||||
" }\n"
|
||||
" .warning {\n"
|
||||
" fill: ", css_warning," !important;\n"
|
||||
" }\n"
|
||||
" .error {\n"
|
||||
" fill: ", css_error," !important;\n"
|
||||
" }\n"
|
||||
" .success {\n"
|
||||
" fill: ", css_success," !important;\n"
|
||||
" }\n"
|
||||
" </style>\n"
|
||||
" <xi:include href=\"", icon_info->filename, "\"/>\n"
|
||||
"</svg>",
|
||||
NULL);
|
||||
pixbuf = _gtk_icon_info_load_symbolic_internal (icon_info,
|
||||
css_fg, css_success,
|
||||
css_warning, css_error,
|
||||
error);
|
||||
g_free (css_fg);
|
||||
g_free (css_warning);
|
||||
g_free (css_success);
|
||||
g_free (css_error);
|
||||
|
||||
stream = g_memory_input_stream_new_from_data (data, -1, g_free);
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_stream_at_scale (stream,
|
||||
icon_info->desired_size,
|
||||
icon_info->desired_size,
|
||||
TRUE,
|
||||
NULL,
|
||||
error);
|
||||
g_object_unref (stream);
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
@ -3222,6 +3240,7 @@ gtk_icon_info_load_symbolic_for_style (GtkIconInfo *icon_info,
|
||||
gboolean *was_symbolic,
|
||||
GError **error)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkColor success_color;
|
||||
GdkColor warning_color;
|
||||
GdkColor error_color;
|
||||
@ -3229,6 +3248,19 @@ gtk_icon_info_load_symbolic_for_style (GtkIconInfo *icon_info,
|
||||
GdkColor *success = NULL;
|
||||
GdkColor *warning = NULL;
|
||||
GdkColor *err = NULL;
|
||||
gchar *css_fg, *css_success;
|
||||
gchar *css_warning, *css_error;
|
||||
|
||||
if (!icon_info->filename ||
|
||||
!g_str_has_suffix (icon_info->filename, "-symbolic.svg"))
|
||||
{
|
||||
if (was_symbolic)
|
||||
*was_symbolic = FALSE;
|
||||
return gtk_icon_info_load_icon (icon_info, error);
|
||||
}
|
||||
|
||||
if (was_symbolic)
|
||||
*was_symbolic = TRUE;
|
||||
|
||||
fg = &style->fg[state];
|
||||
if (gtk_style_lookup_color (style, "success_color", &success_color))
|
||||
@ -3238,8 +3270,22 @@ gtk_icon_info_load_symbolic_for_style (GtkIconInfo *icon_info,
|
||||
if (gtk_style_lookup_color (style, "error_color", &error_color))
|
||||
err = &error_color;
|
||||
|
||||
return gtk_icon_info_load_symbolic (icon_info, fg, success, warning, err,
|
||||
was_symbolic, error);
|
||||
css_fg = gdk_color_to_css (fg);
|
||||
css_success = gdk_color_to_css (success);
|
||||
css_warning = gdk_color_to_css (warning);
|
||||
css_error = gdk_color_to_css (err);
|
||||
|
||||
pixbuf = _gtk_icon_info_load_symbolic_internal (icon_info,
|
||||
css_fg, css_success,
|
||||
css_warning, css_error,
|
||||
error);
|
||||
|
||||
g_free (css_fg);
|
||||
g_free (css_success);
|
||||
g_free (css_warning);
|
||||
g_free (css_error);
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -172,11 +172,11 @@ GdkPixbuf * gtk_icon_info_get_builtin_pixbuf (GtkIconInfo *icon_info
|
||||
GdkPixbuf * gtk_icon_info_load_icon (GtkIconInfo *icon_info,
|
||||
GError **error);
|
||||
GdkPixbuf * gtk_icon_info_load_symbolic (GtkIconInfo *icon_info,
|
||||
GdkColor *fg,
|
||||
GdkColor *success_color,
|
||||
GdkColor *warning_color,
|
||||
GdkColor *error_color,
|
||||
gboolean *was_symbolic,
|
||||
GdkRGBA *fg,
|
||||
GdkRGBA *success_color,
|
||||
GdkRGBA *warning_color,
|
||||
GdkRGBA *error_color,
|
||||
gboolean *was_symbolic,
|
||||
GError **error);
|
||||
GdkPixbuf * gtk_icon_info_load_symbolic_for_style (GtkIconInfo *icon_info,
|
||||
GtkStyle *style,
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "gtkentry.h"
|
||||
#include "gtkcombobox.h"
|
||||
#include "gtktextbuffer.h"
|
||||
#include "gtkscrollable.h"
|
||||
#include "gtksizerequest.h"
|
||||
#include "gtktreednd.h"
|
||||
#include "gtkprivate.h"
|
||||
@ -48,12 +49,17 @@
|
||||
* @title: GtkIconView
|
||||
* @short_description: A widget which displays a list of icons in a grid
|
||||
*
|
||||
* #GtkIconView provides an alternative view on a list model.
|
||||
* #GtkIconView provides an alternative view on a #GtkTreeModel.
|
||||
* It displays the model as a grid of icons with labels. Like
|
||||
* #GtkTreeView, it allows to select one or multiple items
|
||||
* (depending on the selection mode, see gtk_icon_view_set_selection_mode()).
|
||||
* In addition to selection with the arrow keys, #GtkIconView supports
|
||||
* rubberband selection, which is controlled by dragging the pointer.
|
||||
*
|
||||
* Note that if the tree model is backed by an actual tree store (as
|
||||
* opposed to a flat list where the mapping to icons is obvious),
|
||||
* #GtkIconView will only display the first level of the tree and
|
||||
* ignore the tree's branches.
|
||||
*/
|
||||
|
||||
#define SCROLL_EDGE_SIZE 15
|
||||
@ -233,7 +239,11 @@ enum
|
||||
PROP_MARGIN,
|
||||
PROP_REORDERABLE,
|
||||
PROP_TOOLTIP_COLUMN,
|
||||
PROP_ITEM_PADDING
|
||||
PROP_ITEM_PADDING,
|
||||
|
||||
/* For scrollable interface */
|
||||
PROP_HADJUSTMENT,
|
||||
PROP_VADJUSTMENT
|
||||
};
|
||||
|
||||
/* GObject vfuncs */
|
||||
@ -283,9 +293,6 @@ static void gtk_icon_view_forall (GtkContainer
|
||||
gpointer callback_data);
|
||||
|
||||
/* GtkIconView vfuncs */
|
||||
static void gtk_icon_view_set_adjustments (GtkIconView *icon_view,
|
||||
GtkAdjustment *hadj,
|
||||
GtkAdjustment *vadj);
|
||||
static void gtk_icon_view_real_select_all (GtkIconView *icon_view);
|
||||
static void gtk_icon_view_real_unselect_all (GtkIconView *icon_view);
|
||||
static void gtk_icon_view_real_select_cursor_item (GtkIconView *icon_view);
|
||||
@ -293,6 +300,15 @@ static void gtk_icon_view_real_toggle_cursor_item (GtkIconView
|
||||
static gboolean gtk_icon_view_real_activate_cursor_item (GtkIconView *icon_view);
|
||||
|
||||
/* Internal functions */
|
||||
static void gtk_icon_view_set_hadjustment_values (GtkIconView *icon_view);
|
||||
static void gtk_icon_view_set_vadjustment_values (GtkIconView *icon_view);
|
||||
static void gtk_icon_view_set_hadjustment (GtkIconView *icon_view,
|
||||
GtkAdjustment *adjustment);
|
||||
static void gtk_icon_view_set_vadjustment (GtkIconView *icon_view,
|
||||
GtkAdjustment *adjustment);
|
||||
static void gtk_icon_view_accessible_set_adjustment (GtkIconView *icon_view,
|
||||
GtkOrientation orientation,
|
||||
GtkAdjustment *adjustment);
|
||||
static void gtk_icon_view_adjustment_changed (GtkAdjustment *adjustment,
|
||||
GtkIconView *icon_view);
|
||||
static void gtk_icon_view_layout (GtkIconView *icon_view);
|
||||
@ -480,7 +496,8 @@ G_DEFINE_TYPE_WITH_CODE (GtkIconView, gtk_icon_view, GTK_TYPE_CONTAINER,
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_CELL_LAYOUT,
|
||||
gtk_icon_view_cell_layout_init)
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
|
||||
gtk_icon_view_buildable_init))
|
||||
gtk_icon_view_buildable_init)
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_SCROLLABLE, NULL))
|
||||
|
||||
static void
|
||||
gtk_icon_view_class_init (GtkIconViewClass *klass)
|
||||
@ -528,7 +545,6 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
|
||||
container_class->remove = gtk_icon_view_remove;
|
||||
container_class->forall = gtk_icon_view_forall;
|
||||
|
||||
klass->set_scroll_adjustments = gtk_icon_view_set_adjustments;
|
||||
klass->select_all = gtk_icon_view_real_select_all;
|
||||
klass->unselect_all = gtk_icon_view_real_unselect_all;
|
||||
klass->select_cursor_item = gtk_icon_view_real_select_cursor_item;
|
||||
@ -777,7 +793,9 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
|
||||
0, G_MAXINT, 6,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
|
||||
/* Scrollable interface properties */
|
||||
g_object_class_override_property (gobject_class, PROP_HADJUSTMENT, "hadjustment");
|
||||
g_object_class_override_property (gobject_class, PROP_VADJUSTMENT, "vadjustment");
|
||||
|
||||
/* Style properties */
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
@ -796,25 +814,6 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
/* Signals */
|
||||
/**
|
||||
* GtkIconView::set-scroll-adjustments
|
||||
* @horizontal: the horizontal #GtkAdjustment
|
||||
* @vertical: the vertical #GtkAdjustment
|
||||
*
|
||||
* Set the scroll adjustments for the icon view. Usually scrolled containers
|
||||
* like #GtkScrolledWindow will emit this signal to connect two instances
|
||||
* of #GtkScrollbar to the scroll directions of the #GtkIconView.
|
||||
*/
|
||||
widget_class->set_scroll_adjustments_signal =
|
||||
g_signal_new (I_("set-scroll-adjustments"),
|
||||
G_TYPE_FROM_CLASS (gobject_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GtkIconViewClass, set_scroll_adjustments),
|
||||
NULL, NULL,
|
||||
_gtk_marshal_VOID__OBJECT_OBJECT,
|
||||
G_TYPE_NONE, 2,
|
||||
GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT);
|
||||
|
||||
/**
|
||||
* GtkIconView::item-activated:
|
||||
* @iconview: the object on which the signal is emitted
|
||||
@ -1113,8 +1112,6 @@ gtk_icon_view_init (GtkIconView *icon_view)
|
||||
|
||||
gtk_widget_set_can_focus (GTK_WIDGET (icon_view), TRUE);
|
||||
|
||||
gtk_icon_view_set_adjustments (icon_view, NULL, NULL);
|
||||
|
||||
icon_view->priv->cell_list = NULL;
|
||||
icon_view->priv->n_cells = 0;
|
||||
icon_view->priv->cursor_cell = -1;
|
||||
@ -1202,6 +1199,13 @@ gtk_icon_view_set_property (GObject *object,
|
||||
gtk_icon_view_set_item_padding (icon_view, g_value_get_int (value));
|
||||
break;
|
||||
|
||||
case PROP_HADJUSTMENT:
|
||||
gtk_icon_view_set_hadjustment (icon_view, g_value_get_object (value));
|
||||
break;
|
||||
case PROP_VADJUSTMENT:
|
||||
gtk_icon_view_set_vadjustment (icon_view, g_value_get_object (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@ -1267,6 +1271,13 @@ gtk_icon_view_get_property (GObject *object,
|
||||
g_value_set_int (value, icon_view->priv->item_padding);
|
||||
break;
|
||||
|
||||
case PROP_HADJUSTMENT:
|
||||
g_value_set_object (value, icon_view->priv->hadjustment);
|
||||
break;
|
||||
case PROP_VADJUSTMENT:
|
||||
g_value_set_object (value, icon_view->priv->vadjustment);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@ -1486,8 +1497,6 @@ gtk_icon_view_size_allocate (GtkWidget *widget,
|
||||
{
|
||||
GtkIconView *icon_view = GTK_ICON_VIEW (widget);
|
||||
|
||||
GtkAdjustment *hadjustment, *vadjustment;
|
||||
|
||||
gtk_widget_set_allocation (widget, allocation);
|
||||
|
||||
if (gtk_widget_get_realized (widget))
|
||||
@ -1504,26 +1513,12 @@ gtk_icon_view_size_allocate (GtkWidget *widget,
|
||||
|
||||
gtk_icon_view_allocate_children (icon_view);
|
||||
|
||||
hadjustment = icon_view->priv->hadjustment;
|
||||
vadjustment = icon_view->priv->vadjustment;
|
||||
/* Delay signal emission */
|
||||
g_object_freeze_notify (G_OBJECT (icon_view->priv->hadjustment));
|
||||
g_object_freeze_notify (G_OBJECT (icon_view->priv->vadjustment));
|
||||
|
||||
hadjustment->page_size = allocation->width;
|
||||
hadjustment->page_increment = allocation->width * 0.9;
|
||||
hadjustment->step_increment = allocation->width * 0.1;
|
||||
hadjustment->lower = 0;
|
||||
hadjustment->upper = MAX (allocation->width, icon_view->priv->width);
|
||||
|
||||
if (hadjustment->value > hadjustment->upper - hadjustment->page_size)
|
||||
gtk_adjustment_set_value (hadjustment, hadjustment->upper - hadjustment->page_size);
|
||||
|
||||
vadjustment->page_size = allocation->height;
|
||||
vadjustment->page_increment = allocation->height * 0.9;
|
||||
vadjustment->step_increment = allocation->height * 0.1;
|
||||
vadjustment->lower = 0;
|
||||
vadjustment->upper = MAX (allocation->height, icon_view->priv->height);
|
||||
|
||||
if (vadjustment->value > vadjustment->upper - vadjustment->page_size)
|
||||
gtk_adjustment_set_value (vadjustment, vadjustment->upper - vadjustment->page_size);
|
||||
gtk_icon_view_set_hadjustment_values (icon_view);
|
||||
gtk_icon_view_set_vadjustment_values (icon_view);
|
||||
|
||||
if (gtk_widget_get_realized (widget) &&
|
||||
icon_view->priv->scroll_to_path)
|
||||
@ -1539,11 +1534,10 @@ gtk_icon_view_size_allocate (GtkWidget *widget,
|
||||
icon_view->priv->scroll_to_col_align);
|
||||
gtk_tree_path_free (path);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_adjustment_changed (hadjustment);
|
||||
gtk_adjustment_changed (vadjustment);
|
||||
}
|
||||
|
||||
/* Emit any pending signals now */
|
||||
g_object_thaw_notify (G_OBJECT (icon_view->priv->hadjustment));
|
||||
g_object_thaw_notify (G_OBJECT (icon_view->priv->vadjustment));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -2509,62 +2503,6 @@ gtk_icon_view_unselect_all_internal (GtkIconView *icon_view)
|
||||
|
||||
|
||||
/* GtkIconView signals */
|
||||
static void
|
||||
gtk_icon_view_set_adjustments (GtkIconView *icon_view,
|
||||
GtkAdjustment *hadj,
|
||||
GtkAdjustment *vadj)
|
||||
{
|
||||
gboolean need_adjust = FALSE;
|
||||
|
||||
if (hadj)
|
||||
g_return_if_fail (GTK_IS_ADJUSTMENT (hadj));
|
||||
else
|
||||
hadj = gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
|
||||
if (vadj)
|
||||
g_return_if_fail (GTK_IS_ADJUSTMENT (vadj));
|
||||
else
|
||||
vadj = gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
|
||||
|
||||
if (icon_view->priv->hadjustment && (icon_view->priv->hadjustment != hadj))
|
||||
{
|
||||
g_signal_handlers_disconnect_matched (icon_view->priv->hadjustment, G_SIGNAL_MATCH_DATA,
|
||||
0, 0, NULL, NULL, icon_view);
|
||||
g_object_unref (icon_view->priv->hadjustment);
|
||||
}
|
||||
|
||||
if (icon_view->priv->vadjustment && (icon_view->priv->vadjustment != vadj))
|
||||
{
|
||||
g_signal_handlers_disconnect_matched (icon_view->priv->vadjustment, G_SIGNAL_MATCH_DATA,
|
||||
0, 0, NULL, NULL, icon_view);
|
||||
g_object_unref (icon_view->priv->vadjustment);
|
||||
}
|
||||
|
||||
if (icon_view->priv->hadjustment != hadj)
|
||||
{
|
||||
icon_view->priv->hadjustment = hadj;
|
||||
g_object_ref_sink (icon_view->priv->hadjustment);
|
||||
|
||||
g_signal_connect (icon_view->priv->hadjustment, "value-changed",
|
||||
G_CALLBACK (gtk_icon_view_adjustment_changed),
|
||||
icon_view);
|
||||
need_adjust = TRUE;
|
||||
}
|
||||
|
||||
if (icon_view->priv->vadjustment != vadj)
|
||||
{
|
||||
icon_view->priv->vadjustment = vadj;
|
||||
g_object_ref_sink (icon_view->priv->vadjustment);
|
||||
|
||||
g_signal_connect (icon_view->priv->vadjustment, "value-changed",
|
||||
G_CALLBACK (gtk_icon_view_adjustment_changed),
|
||||
icon_view);
|
||||
need_adjust = TRUE;
|
||||
}
|
||||
|
||||
if (need_adjust)
|
||||
gtk_icon_view_adjustment_changed (NULL, icon_view);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_icon_view_real_select_all (GtkIconView *icon_view)
|
||||
{
|
||||
@ -2670,17 +2608,161 @@ gtk_icon_view_process_updates (GtkIconView *icon_view)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_icon_view_adjustment_changed (GtkAdjustment *adjustment,
|
||||
GtkIconView *icon_view)
|
||||
gtk_icon_view_set_hadjustment_values (GtkIconView *icon_view)
|
||||
{
|
||||
GtkAllocation allocation;
|
||||
GtkAdjustment *adj = icon_view->priv->hadjustment;
|
||||
gdouble old_page_size;
|
||||
gdouble old_upper;
|
||||
gdouble old_value;
|
||||
gdouble new_value;
|
||||
gdouble new_upper;
|
||||
|
||||
gtk_widget_get_allocation (GTK_WIDGET (icon_view), &allocation);
|
||||
|
||||
old_value = gtk_adjustment_get_value (adj);
|
||||
old_upper = gtk_adjustment_get_upper (adj);
|
||||
old_page_size = gtk_adjustment_get_page_size (adj);
|
||||
new_upper = MAX (allocation.width, icon_view->priv->width);
|
||||
|
||||
g_object_set (adj,
|
||||
"lower", 0.0,
|
||||
"upper", new_upper,
|
||||
"page-size", (gdouble)allocation.width,
|
||||
"step-increment", allocation.width * 0.1,
|
||||
"page-increment", allocation.width * 0.9,
|
||||
NULL);
|
||||
|
||||
if (gtk_widget_get_direction (GTK_WIDGET (icon_view)) == GTK_TEXT_DIR_RTL)
|
||||
{
|
||||
/* Make sure no scrolling occurs for RTL locales also (if possible) */
|
||||
/* Quick explanation:
|
||||
* In LTR locales, leftmost portion of visible rectangle should stay
|
||||
* fixed, which means left edge of scrollbar thumb should remain fixed
|
||||
* and thus adjustment's value should stay the same.
|
||||
*
|
||||
* In RTL locales, we want to keep rightmost portion of visible
|
||||
* rectangle fixed. This means right edge of thumb should remain fixed.
|
||||
* In this case, upper - value - page_size should remain constant.
|
||||
*/
|
||||
new_value = (new_upper - allocation.width) -
|
||||
(old_upper - old_value - old_page_size);
|
||||
new_value = CLAMP (new_value, 0, new_upper - allocation.width);
|
||||
}
|
||||
else
|
||||
new_value = CLAMP (old_value, 0, new_upper - allocation.width);
|
||||
|
||||
if (new_value != old_value)
|
||||
gtk_adjustment_set_value (adj, new_value);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_icon_view_set_vadjustment_values (GtkIconView *icon_view)
|
||||
{
|
||||
GtkAllocation allocation;
|
||||
GtkAdjustment *adj = icon_view->priv->vadjustment;
|
||||
gdouble old_value;
|
||||
gdouble new_value;
|
||||
gdouble new_upper;
|
||||
|
||||
gtk_widget_get_allocation (GTK_WIDGET (icon_view), &allocation);
|
||||
|
||||
old_value = gtk_adjustment_get_value (adj);
|
||||
new_upper = MAX (allocation.height, icon_view->priv->height);
|
||||
|
||||
g_object_set (adj,
|
||||
"lower", 0.0,
|
||||
"upper", new_upper,
|
||||
"page-size", (gdouble)allocation.height,
|
||||
"step-increment", allocation.height * 0.1,
|
||||
"page-increment", allocation.height * 0.9,
|
||||
NULL);
|
||||
|
||||
new_value = CLAMP (old_value, 0, new_upper - allocation.height);
|
||||
if (new_value != old_value)
|
||||
gtk_adjustment_set_value (adj, new_value);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_icon_view_set_hadjustment (GtkIconView *icon_view,
|
||||
GtkAdjustment *adjustment)
|
||||
{
|
||||
GtkIconViewPrivate *priv = icon_view->priv;
|
||||
|
||||
if (adjustment && priv->hadjustment == adjustment)
|
||||
return;
|
||||
|
||||
if (priv->hadjustment != NULL)
|
||||
{
|
||||
g_signal_handlers_disconnect_matched (priv->hadjustment,
|
||||
G_SIGNAL_MATCH_DATA,
|
||||
0, 0, NULL, NULL, icon_view);
|
||||
g_object_unref (priv->hadjustment);
|
||||
}
|
||||
|
||||
if (!adjustment)
|
||||
adjustment = gtk_adjustment_new (0.0, 0.0, 0.0,
|
||||
0.0, 0.0, 0.0);
|
||||
|
||||
g_signal_connect (adjustment, "value-changed",
|
||||
G_CALLBACK (gtk_icon_view_adjustment_changed), icon_view);
|
||||
priv->hadjustment = g_object_ref_sink (adjustment);
|
||||
gtk_icon_view_set_hadjustment_values (icon_view);
|
||||
|
||||
gtk_icon_view_accessible_set_adjustment (icon_view,
|
||||
GTK_ORIENTATION_HORIZONTAL,
|
||||
priv->hadjustment);
|
||||
|
||||
g_object_notify (G_OBJECT (icon_view), "hadjustment");
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_icon_view_set_vadjustment (GtkIconView *icon_view,
|
||||
GtkAdjustment *adjustment)
|
||||
{
|
||||
GtkIconViewPrivate *priv = icon_view->priv;
|
||||
|
||||
if (adjustment && priv->vadjustment == adjustment)
|
||||
return;
|
||||
|
||||
if (priv->vadjustment != NULL)
|
||||
{
|
||||
g_signal_handlers_disconnect_matched (priv->vadjustment,
|
||||
G_SIGNAL_MATCH_DATA,
|
||||
0, 0, NULL, NULL, icon_view);
|
||||
g_object_unref (priv->vadjustment);
|
||||
}
|
||||
|
||||
if (!adjustment)
|
||||
adjustment = gtk_adjustment_new (0.0, 0.0, 0.0,
|
||||
0.0, 0.0, 0.0);
|
||||
|
||||
g_signal_connect (adjustment, "value-changed",
|
||||
G_CALLBACK (gtk_icon_view_adjustment_changed), icon_view);
|
||||
priv->vadjustment = g_object_ref_sink (adjustment);
|
||||
gtk_icon_view_set_vadjustment_values (icon_view);
|
||||
|
||||
gtk_icon_view_accessible_set_adjustment (icon_view,
|
||||
GTK_ORIENTATION_VERTICAL,
|
||||
priv->vadjustment);
|
||||
|
||||
g_object_notify (G_OBJECT (icon_view), "vadjustment");
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_icon_view_adjustment_changed (GtkAdjustment *adjustment,
|
||||
GtkIconView *icon_view)
|
||||
{
|
||||
GtkIconViewPrivate *priv = icon_view->priv;
|
||||
|
||||
if (gtk_widget_get_realized (GTK_WIDGET (icon_view)))
|
||||
{
|
||||
gdk_window_move (icon_view->priv->bin_window,
|
||||
- icon_view->priv->hadjustment->value,
|
||||
- icon_view->priv->vadjustment->value);
|
||||
gdk_window_move (priv->bin_window,
|
||||
- priv->hadjustment->value,
|
||||
- priv->vadjustment->value);
|
||||
|
||||
if (icon_view->priv->doing_rubberband)
|
||||
gtk_icon_view_update_rubberband (GTK_WIDGET (icon_view));
|
||||
gtk_icon_view_update_rubberband (GTK_WIDGET (icon_view));
|
||||
|
||||
gtk_icon_view_process_updates (icon_view);
|
||||
}
|
||||
@ -3597,11 +3679,13 @@ gtk_icon_view_row_changed (GtkTreeModel *model,
|
||||
GtkTreeIter *iter,
|
||||
gpointer data)
|
||||
{
|
||||
GtkIconView *icon_view = GTK_ICON_VIEW (data);
|
||||
GtkIconViewItem *item;
|
||||
gint index;
|
||||
GtkIconView *icon_view;
|
||||
|
||||
icon_view = GTK_ICON_VIEW (data);
|
||||
/* ignore changes in branches */
|
||||
if (gtk_tree_path_get_depth (path) > 1)
|
||||
return;
|
||||
|
||||
gtk_icon_view_stop_editing (icon_view, TRUE);
|
||||
|
||||
@ -3620,13 +3704,15 @@ gtk_icon_view_row_inserted (GtkTreeModel *model,
|
||||
GtkTreeIter *iter,
|
||||
gpointer data)
|
||||
{
|
||||
GtkIconView *icon_view = GTK_ICON_VIEW (data);
|
||||
gint index;
|
||||
GtkIconViewItem *item;
|
||||
gboolean iters_persist;
|
||||
GtkIconView *icon_view;
|
||||
GList *list;
|
||||
|
||||
icon_view = GTK_ICON_VIEW (data);
|
||||
|
||||
/* ignore changes in branches */
|
||||
if (gtk_tree_path_get_depth (path) > 1)
|
||||
return;
|
||||
|
||||
iters_persist = gtk_tree_model_get_flags (icon_view->priv->model) & GTK_TREE_MODEL_ITERS_PERSIST;
|
||||
|
||||
@ -3664,13 +3750,15 @@ gtk_icon_view_row_deleted (GtkTreeModel *model,
|
||||
GtkTreePath *path,
|
||||
gpointer data)
|
||||
{
|
||||
GtkIconView *icon_view = GTK_ICON_VIEW (data);
|
||||
gint index;
|
||||
GtkIconView *icon_view;
|
||||
GtkIconViewItem *item;
|
||||
GList *list, *next;
|
||||
gboolean emit = FALSE;
|
||||
|
||||
icon_view = GTK_ICON_VIEW (data);
|
||||
|
||||
/* ignore changes in branches */
|
||||
if (gtk_tree_path_get_depth (path) > 1)
|
||||
return;
|
||||
|
||||
index = gtk_tree_path_get_indices(path)[0];
|
||||
|
||||
@ -3714,14 +3802,16 @@ gtk_icon_view_rows_reordered (GtkTreeModel *model,
|
||||
gint *new_order,
|
||||
gpointer data)
|
||||
{
|
||||
GtkIconView *icon_view = GTK_ICON_VIEW (data);
|
||||
int i;
|
||||
int length;
|
||||
GtkIconView *icon_view;
|
||||
GList *items = NULL, *list;
|
||||
GtkIconViewItem **item_array;
|
||||
gint *order;
|
||||
|
||||
icon_view = GTK_ICON_VIEW (data);
|
||||
|
||||
/* ignore changes in branches */
|
||||
if (iter != NULL)
|
||||
return;
|
||||
|
||||
gtk_icon_view_stop_editing (icon_view, TRUE);
|
||||
|
||||
@ -5334,8 +5424,6 @@ gtk_icon_view_set_model (GtkIconView *icon_view,
|
||||
if (model)
|
||||
{
|
||||
GType column_type;
|
||||
|
||||
g_return_if_fail (gtk_tree_model_get_flags (model) & GTK_TREE_MODEL_LIST_ONLY);
|
||||
|
||||
if (icon_view->priv->pixbuf_column != -1)
|
||||
{
|
||||
@ -9113,60 +9201,53 @@ gtk_icon_view_accessible_adjustment_changed (GtkAdjustment *adjustment,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_icon_view_accessible_set_scroll_adjustments (GtkWidget *widget,
|
||||
GtkAdjustment *hadj,
|
||||
GtkAdjustment *vadj)
|
||||
gtk_icon_view_accessible_set_adjustment (GtkIconView *icon_view,
|
||||
GtkOrientation orientation,
|
||||
GtkAdjustment *adjustment)
|
||||
{
|
||||
AtkObject *atk_obj;
|
||||
GtkIconViewAccessiblePrivate *priv;
|
||||
GtkAdjustment **old_adj_ptr;
|
||||
|
||||
atk_obj = gtk_widget_get_accessible (widget);
|
||||
atk_obj = gtk_widget_get_accessible (GTK_WIDGET (icon_view));
|
||||
priv = gtk_icon_view_accessible_get_priv (atk_obj);
|
||||
|
||||
if (priv->old_hadj != hadj)
|
||||
/* Adjustments are set for the first time in constructor and priv is not
|
||||
* initialized at that time, so skip this first setting. */
|
||||
if (!priv)
|
||||
return;
|
||||
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
if (priv->old_hadj)
|
||||
{
|
||||
g_object_remove_weak_pointer (G_OBJECT (priv->old_hadj),
|
||||
(gpointer *)&priv->old_hadj);
|
||||
|
||||
g_signal_handlers_disconnect_by_func (priv->old_hadj,
|
||||
(gpointer) gtk_icon_view_accessible_adjustment_changed,
|
||||
widget);
|
||||
}
|
||||
priv->old_hadj = hadj;
|
||||
if (priv->old_hadj)
|
||||
{
|
||||
g_object_add_weak_pointer (G_OBJECT (priv->old_hadj),
|
||||
(gpointer *)&priv->old_hadj);
|
||||
g_signal_connect (hadj,
|
||||
"value-changed",
|
||||
G_CALLBACK (gtk_icon_view_accessible_adjustment_changed),
|
||||
widget);
|
||||
}
|
||||
if (priv->old_hadj == adjustment)
|
||||
return;
|
||||
|
||||
old_adj_ptr = &priv->old_hadj;
|
||||
}
|
||||
if (priv->old_vadj != vadj)
|
||||
else
|
||||
{
|
||||
if (priv->old_vadj)
|
||||
{
|
||||
g_object_remove_weak_pointer (G_OBJECT (priv->old_vadj),
|
||||
(gpointer *)&priv->old_vadj);
|
||||
|
||||
g_signal_handlers_disconnect_by_func (priv->old_vadj,
|
||||
(gpointer) gtk_icon_view_accessible_adjustment_changed,
|
||||
widget);
|
||||
}
|
||||
priv->old_vadj = vadj;
|
||||
if (priv->old_vadj)
|
||||
{
|
||||
g_object_add_weak_pointer (G_OBJECT (priv->old_vadj),
|
||||
(gpointer *)&priv->old_vadj);
|
||||
g_signal_connect (vadj,
|
||||
"value-changed",
|
||||
G_CALLBACK (gtk_icon_view_accessible_adjustment_changed),
|
||||
widget);
|
||||
}
|
||||
if (priv->old_vadj == adjustment)
|
||||
return;
|
||||
|
||||
old_adj_ptr = &priv->old_vadj;
|
||||
}
|
||||
|
||||
/* Disconnect signal handlers */
|
||||
if (*old_adj_ptr)
|
||||
{
|
||||
g_object_remove_weak_pointer (G_OBJECT (*old_adj_ptr),
|
||||
(gpointer *)&priv->old_hadj);
|
||||
g_signal_handlers_disconnect_by_func (*old_adj_ptr,
|
||||
gtk_icon_view_accessible_adjustment_changed,
|
||||
icon_view);
|
||||
}
|
||||
|
||||
/* Connect signal */
|
||||
*old_adj_ptr = adjustment;
|
||||
g_object_add_weak_pointer (G_OBJECT (adjustment), (gpointer *)old_adj_ptr);
|
||||
g_signal_connect (adjustment, "value-changed",
|
||||
G_CALLBACK (gtk_icon_view_accessible_adjustment_changed),
|
||||
icon_view);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -9469,27 +9550,13 @@ gtk_icon_view_accessible_initialize (AtkObject *accessible,
|
||||
|
||||
icon_view = GTK_ICON_VIEW (data);
|
||||
if (icon_view->priv->hadjustment)
|
||||
{
|
||||
priv->old_hadj = icon_view->priv->hadjustment;
|
||||
g_object_add_weak_pointer (G_OBJECT (priv->old_hadj), (gpointer *)&priv->old_hadj);
|
||||
g_signal_connect (icon_view->priv->hadjustment,
|
||||
"value-changed",
|
||||
G_CALLBACK (gtk_icon_view_accessible_adjustment_changed),
|
||||
icon_view);
|
||||
}
|
||||
gtk_icon_view_accessible_set_adjustment (icon_view,
|
||||
GTK_ORIENTATION_HORIZONTAL,
|
||||
icon_view->priv->hadjustment);
|
||||
if (icon_view->priv->vadjustment)
|
||||
{
|
||||
priv->old_vadj = icon_view->priv->vadjustment;
|
||||
g_object_add_weak_pointer (G_OBJECT (priv->old_vadj), (gpointer *)&priv->old_vadj);
|
||||
g_signal_connect (icon_view->priv->vadjustment,
|
||||
"value-changed",
|
||||
G_CALLBACK (gtk_icon_view_accessible_adjustment_changed),
|
||||
icon_view);
|
||||
}
|
||||
g_signal_connect_after (data,
|
||||
"set-scroll-adjustments",
|
||||
G_CALLBACK (gtk_icon_view_accessible_set_scroll_adjustments),
|
||||
NULL);
|
||||
gtk_icon_view_accessible_set_adjustment (icon_view,
|
||||
GTK_ORIENTATION_VERTICAL,
|
||||
icon_view->priv->vadjustment);
|
||||
g_signal_connect (data,
|
||||
"notify",
|
||||
G_CALLBACK (gtk_icon_view_accessible_notify_gtk),
|
||||
|
@ -89,10 +89,6 @@ struct _GtkIconViewClass
|
||||
{
|
||||
GtkContainerClass parent_class;
|
||||
|
||||
void (* set_scroll_adjustments) (GtkIconView *icon_view,
|
||||
GtkAdjustment *hadjustment,
|
||||
GtkAdjustment *vadjustment);
|
||||
|
||||
void (* item_activated) (GtkIconView *icon_view,
|
||||
GtkTreePath *path);
|
||||
void (* selection_changed) (GtkIconView *icon_view);
|
||||
@ -156,7 +152,6 @@ void gtk_icon_view_set_item_padding (GtkIconView *icon_view,
|
||||
gint item_padding);
|
||||
gint gtk_icon_view_get_item_padding (GtkIconView *icon_view);
|
||||
|
||||
|
||||
GtkTreePath * gtk_icon_view_get_path_at_pos (GtkIconView *icon_view,
|
||||
gint x,
|
||||
gint y);
|
||||
|
@ -1045,7 +1045,7 @@ gtk_image_menu_item_screen_changed (GtkWidget *widget,
|
||||
GdkScreen *previous_screen)
|
||||
{
|
||||
GtkSettings *settings;
|
||||
guint show_image_connection;
|
||||
gulong show_image_connection;
|
||||
|
||||
if (!gtk_widget_has_screen (widget))
|
||||
return;
|
||||
@ -1053,18 +1053,14 @@ gtk_image_menu_item_screen_changed (GtkWidget *widget,
|
||||
settings = gtk_widget_get_settings (widget);
|
||||
|
||||
show_image_connection =
|
||||
GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (settings),
|
||||
"gtk-image-menu-item-connection"));
|
||||
g_signal_handler_find (settings, G_SIGNAL_MATCH_FUNC, 0, 0,
|
||||
NULL, gtk_image_menu_item_setting_changed, NULL);
|
||||
|
||||
if (show_image_connection)
|
||||
return;
|
||||
|
||||
show_image_connection =
|
||||
g_signal_connect (settings, "notify::gtk-menu-images",
|
||||
G_CALLBACK (gtk_image_menu_item_setting_changed), NULL);
|
||||
g_object_set_data (G_OBJECT (settings),
|
||||
I_("gtk-image-menu-item-connection"),
|
||||
GUINT_TO_POINTER (show_image_connection));
|
||||
g_signal_connect (settings, "notify::gtk-menu-images",
|
||||
G_CALLBACK (gtk_image_menu_item_setting_changed), NULL);
|
||||
|
||||
show_image_change_notify (GTK_IMAGE_MENU_ITEM (widget));
|
||||
}
|
||||
|
297
gtk/gtklayout.c
297
gtk/gtklayout.c
@ -30,6 +30,8 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#undef GTK_DISABLE_DEPRECATED
|
||||
|
||||
#include "gtklayout.h"
|
||||
|
||||
#include "gdkconfig.h"
|
||||
@ -37,6 +39,7 @@
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkintl.h"
|
||||
#include "gtkmarshalers.h"
|
||||
#include "gtkscrollable.h"
|
||||
|
||||
|
||||
typedef struct _GtkLayoutChild GtkLayoutChild;
|
||||
@ -49,6 +52,7 @@ struct _GtkLayoutPrivate
|
||||
|
||||
GtkAdjustment *hadjustment;
|
||||
GtkAdjustment *vadjustment;
|
||||
|
||||
/* Properties */
|
||||
|
||||
GdkVisibilityState visibility;
|
||||
@ -90,9 +94,6 @@ static void gtk_layout_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static GObject *gtk_layout_constructor (GType type,
|
||||
guint n_properties,
|
||||
GObjectConstructParam *properties);
|
||||
static void gtk_layout_finalize (GObject *object);
|
||||
static void gtk_layout_realize (GtkWidget *widget);
|
||||
static void gtk_layout_unrealize (GtkWidget *widget);
|
||||
@ -111,9 +112,6 @@ static void gtk_layout_forall (GtkContainer *container,
|
||||
gboolean include_internals,
|
||||
GtkCallback callback,
|
||||
gpointer callback_data);
|
||||
static void gtk_layout_set_adjustments (GtkLayout *layout,
|
||||
GtkAdjustment *hadj,
|
||||
GtkAdjustment *vadj);
|
||||
static void gtk_layout_set_child_property (GtkContainer *container,
|
||||
GtkWidget *child,
|
||||
guint property_id,
|
||||
@ -131,11 +129,11 @@ static void gtk_layout_adjustment_changed (GtkAdjustment *adjustment,
|
||||
static void gtk_layout_style_set (GtkWidget *widget,
|
||||
GtkStyle *old_style);
|
||||
|
||||
static void gtk_layout_set_adjustment_upper (GtkAdjustment *adj,
|
||||
gdouble upper,
|
||||
gboolean always_emit_changed);
|
||||
static void gtk_layout_set_hadjustment_values (GtkLayout *layout);
|
||||
static void gtk_layout_set_vadjustment_values (GtkLayout *layout);
|
||||
|
||||
G_DEFINE_TYPE (GtkLayout, gtk_layout, GTK_TYPE_CONTAINER)
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkLayout, gtk_layout, GTK_TYPE_CONTAINER,
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_SCROLLABLE, NULL))
|
||||
|
||||
/* Public interface
|
||||
*/
|
||||
@ -195,6 +193,8 @@ gtk_layout_get_bin_window (GtkLayout *layout)
|
||||
* See #GtkScrolledWindow, #GtkScrollbar, #GtkAdjustment for details.
|
||||
*
|
||||
* Return value: (transfer none): horizontal scroll adjustment
|
||||
*
|
||||
* Deprecated: 3.0: Use gtk_scrollable_get_hadjustment()
|
||||
**/
|
||||
GtkAdjustment*
|
||||
gtk_layout_get_hadjustment (GtkLayout *layout)
|
||||
@ -215,6 +215,8 @@ gtk_layout_get_hadjustment (GtkLayout *layout)
|
||||
* See #GtkScrolledWindow, #GtkScrollbar, #GtkAdjustment for details.
|
||||
*
|
||||
* Return value: (transfer none): vertical scroll adjustment
|
||||
*
|
||||
* Deprecated: 3.0: Use gtk_scrollable_get_vadjustment()
|
||||
**/
|
||||
GtkAdjustment*
|
||||
gtk_layout_get_vadjustment (GtkLayout *layout)
|
||||
@ -224,73 +226,59 @@ gtk_layout_get_vadjustment (GtkLayout *layout)
|
||||
return layout->priv->vadjustment;
|
||||
}
|
||||
|
||||
static GtkAdjustment *
|
||||
new_default_adjustment (void)
|
||||
{
|
||||
return gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_layout_set_adjustments (GtkLayout *layout,
|
||||
GtkAdjustment *hadj,
|
||||
GtkAdjustment *vadj)
|
||||
static void
|
||||
gtk_layout_set_hadjustment_values (GtkLayout *layout)
|
||||
{
|
||||
GtkLayoutPrivate *priv = layout->priv;
|
||||
gboolean need_adjust = FALSE;
|
||||
GtkAllocation allocation;
|
||||
GtkAdjustment *adj = priv->hadjustment;
|
||||
gdouble old_value;
|
||||
gdouble new_value;
|
||||
gdouble new_upper;
|
||||
|
||||
if (hadj)
|
||||
g_return_if_fail (GTK_IS_ADJUSTMENT (hadj));
|
||||
else if (priv->hadjustment)
|
||||
hadj = new_default_adjustment ();
|
||||
if (vadj)
|
||||
g_return_if_fail (GTK_IS_ADJUSTMENT (vadj));
|
||||
else if (priv->vadjustment)
|
||||
vadj = new_default_adjustment ();
|
||||
gtk_widget_get_allocation (GTK_WIDGET (layout), &allocation);
|
||||
|
||||
if (priv->hadjustment && (priv->hadjustment != hadj))
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (priv->hadjustment,
|
||||
gtk_layout_adjustment_changed,
|
||||
layout);
|
||||
g_object_unref (priv->hadjustment);
|
||||
}
|
||||
old_value = gtk_adjustment_get_value (adj);
|
||||
new_upper = MAX (allocation.width, priv->width);
|
||||
|
||||
if (priv->vadjustment && (priv->vadjustment != vadj))
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (priv->vadjustment,
|
||||
gtk_layout_adjustment_changed,
|
||||
layout);
|
||||
g_object_unref (priv->vadjustment);
|
||||
}
|
||||
g_object_set (adj,
|
||||
"lower", 0.0,
|
||||
"upper", new_upper,
|
||||
"page-size", (gdouble)allocation.width,
|
||||
"step-increment", allocation.width * 0.1,
|
||||
"page-increment", allocation.width * 0.9,
|
||||
NULL);
|
||||
|
||||
if (priv->hadjustment != hadj)
|
||||
{
|
||||
priv->hadjustment = hadj;
|
||||
g_object_ref_sink (priv->hadjustment);
|
||||
gtk_layout_set_adjustment_upper (priv->hadjustment, priv->width, FALSE);
|
||||
new_value = CLAMP (old_value, 0, new_upper - allocation.width);
|
||||
if (new_value != old_value)
|
||||
gtk_adjustment_set_value (adj, new_value);
|
||||
}
|
||||
|
||||
g_signal_connect (priv->hadjustment, "value-changed",
|
||||
G_CALLBACK (gtk_layout_adjustment_changed),
|
||||
layout);
|
||||
need_adjust = TRUE;
|
||||
}
|
||||
static void
|
||||
gtk_layout_set_vadjustment_values (GtkLayout *layout)
|
||||
{
|
||||
GtkAllocation allocation;
|
||||
GtkAdjustment *adj = layout->priv->vadjustment;
|
||||
gdouble old_value;
|
||||
gdouble new_value;
|
||||
gdouble new_upper;
|
||||
|
||||
if (priv->vadjustment != vadj)
|
||||
{
|
||||
priv->vadjustment = vadj;
|
||||
g_object_ref_sink (priv->vadjustment);
|
||||
gtk_layout_set_adjustment_upper (priv->vadjustment, priv->height, FALSE);
|
||||
gtk_widget_get_allocation (GTK_WIDGET (layout), &allocation);
|
||||
|
||||
g_signal_connect (priv->vadjustment, "value-changed",
|
||||
G_CALLBACK (gtk_layout_adjustment_changed),
|
||||
layout);
|
||||
need_adjust = TRUE;
|
||||
}
|
||||
old_value = gtk_adjustment_get_value (adj);
|
||||
new_upper = MAX (allocation.height, layout->priv->height);
|
||||
|
||||
/* vadj or hadj can be NULL while constructing; don't emit a signal
|
||||
then */
|
||||
if (need_adjust && vadj && hadj)
|
||||
gtk_layout_adjustment_changed (NULL, layout);
|
||||
g_object_set (adj,
|
||||
"lower", 0.0,
|
||||
"upper", new_upper,
|
||||
"page-size", (gdouble)allocation.height,
|
||||
"step-increment", allocation.height * 0.1,
|
||||
"page-increment", allocation.height * 0.9,
|
||||
NULL);
|
||||
|
||||
new_value = CLAMP (old_value, 0, new_upper - allocation.height);
|
||||
if (new_value != old_value)
|
||||
gtk_adjustment_set_value (adj, new_value);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -313,22 +301,43 @@ gtk_layout_finalize (GObject *object)
|
||||
* Sets the horizontal scroll adjustment for the layout.
|
||||
*
|
||||
* See #GtkScrolledWindow, #GtkScrollbar, #GtkAdjustment for details.
|
||||
*
|
||||
*
|
||||
* Deprecated: 3.0: Use gtk_scrollable_set_hadjustment()
|
||||
**/
|
||||
void
|
||||
void
|
||||
gtk_layout_set_hadjustment (GtkLayout *layout,
|
||||
GtkAdjustment *adjustment)
|
||||
GtkAdjustment *adjustment)
|
||||
{
|
||||
GtkLayoutPrivate *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_LAYOUT (layout));
|
||||
g_return_if_fail (adjustment == NULL || GTK_IS_ADJUSTMENT (adjustment));
|
||||
|
||||
priv = layout->priv;
|
||||
|
||||
gtk_layout_set_adjustments (layout, adjustment, priv->vadjustment);
|
||||
if (adjustment && priv->hadjustment == adjustment)
|
||||
return;
|
||||
|
||||
if (priv->hadjustment != NULL)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (priv->hadjustment,
|
||||
gtk_layout_adjustment_changed,
|
||||
layout);
|
||||
g_object_unref (priv->hadjustment);
|
||||
}
|
||||
|
||||
if (adjustment == NULL)
|
||||
adjustment = gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
|
||||
|
||||
g_signal_connect (adjustment, "value-changed",
|
||||
G_CALLBACK (gtk_layout_adjustment_changed), layout);
|
||||
priv->hadjustment = g_object_ref_sink (adjustment);
|
||||
gtk_layout_set_hadjustment_values (layout);
|
||||
|
||||
g_object_notify (G_OBJECT (layout), "hadjustment");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* gtk_layout_set_vadjustment:
|
||||
* @layout: a #GtkLayout
|
||||
@ -337,19 +346,39 @@ gtk_layout_set_hadjustment (GtkLayout *layout,
|
||||
* Sets the vertical scroll adjustment for the layout.
|
||||
*
|
||||
* See #GtkScrolledWindow, #GtkScrollbar, #GtkAdjustment for details.
|
||||
*
|
||||
*
|
||||
* Deprecated: 3.0: Use gtk_scrollable_set_vadjustment()
|
||||
**/
|
||||
void
|
||||
void
|
||||
gtk_layout_set_vadjustment (GtkLayout *layout,
|
||||
GtkAdjustment *adjustment)
|
||||
GtkAdjustment *adjustment)
|
||||
{
|
||||
GtkLayoutPrivate *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_LAYOUT (layout));
|
||||
g_return_if_fail (adjustment == NULL || GTK_IS_ADJUSTMENT (adjustment));
|
||||
|
||||
priv = layout->priv;
|
||||
|
||||
gtk_layout_set_adjustments (layout, priv->hadjustment, adjustment);
|
||||
if (adjustment && priv->vadjustment == adjustment)
|
||||
return;
|
||||
|
||||
if (priv->vadjustment != NULL)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (priv->vadjustment,
|
||||
gtk_layout_adjustment_changed,
|
||||
layout);
|
||||
g_object_unref (priv->vadjustment);
|
||||
}
|
||||
|
||||
if (adjustment == NULL)
|
||||
adjustment = gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
|
||||
|
||||
g_signal_connect (adjustment, "value-changed",
|
||||
G_CALLBACK (gtk_layout_adjustment_changed), layout);
|
||||
priv->vadjustment = g_object_ref_sink (adjustment);
|
||||
gtk_layout_set_vadjustment_values (layout);
|
||||
|
||||
g_object_notify (G_OBJECT (layout), "vadjustment");
|
||||
}
|
||||
|
||||
@ -472,34 +501,6 @@ gtk_layout_move (GtkLayout *layout,
|
||||
gtk_layout_move_internal (layout, child_widget, TRUE, x, TRUE, y);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_layout_set_adjustment_upper (GtkAdjustment *adj,
|
||||
gdouble upper,
|
||||
gboolean always_emit_changed)
|
||||
{
|
||||
gboolean changed = FALSE;
|
||||
gboolean value_changed = FALSE;
|
||||
|
||||
gdouble min = MAX (0., upper - adj->page_size);
|
||||
|
||||
if (upper != adj->upper)
|
||||
{
|
||||
adj->upper = upper;
|
||||
changed = TRUE;
|
||||
}
|
||||
|
||||
if (adj->value > min)
|
||||
{
|
||||
adj->value = min;
|
||||
value_changed = TRUE;
|
||||
}
|
||||
|
||||
if (changed || always_emit_changed)
|
||||
gtk_adjustment_changed (adj);
|
||||
if (value_changed)
|
||||
gtk_adjustment_value_changed (adj);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_layout_set_size:
|
||||
* @layout: a #GtkLayout
|
||||
@ -535,11 +536,6 @@ gtk_layout_set_size (GtkLayout *layout,
|
||||
}
|
||||
g_object_thaw_notify (G_OBJECT (layout));
|
||||
|
||||
if (priv->hadjustment)
|
||||
gtk_layout_set_adjustment_upper (priv->hadjustment, priv->width, FALSE);
|
||||
if (priv->vadjustment)
|
||||
gtk_layout_set_adjustment_upper (priv->vadjustment, priv->height, FALSE);
|
||||
|
||||
if (gtk_widget_get_realized (widget))
|
||||
{
|
||||
GtkAllocation allocation;
|
||||
@ -549,6 +545,9 @@ gtk_layout_set_size (GtkLayout *layout,
|
||||
height = MAX (height, allocation.height);
|
||||
gdk_window_resize (priv->bin_window, width, height);
|
||||
}
|
||||
|
||||
gtk_layout_set_hadjustment_values (layout);
|
||||
gtk_layout_set_vadjustment_values (layout);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -594,7 +593,6 @@ gtk_layout_class_init (GtkLayoutClass *class)
|
||||
gobject_class->set_property = gtk_layout_set_property;
|
||||
gobject_class->get_property = gtk_layout_get_property;
|
||||
gobject_class->finalize = gtk_layout_finalize;
|
||||
gobject_class->constructor = gtk_layout_constructor;
|
||||
|
||||
container_class->set_child_property = gtk_layout_set_child_property;
|
||||
container_class->get_child_property = gtk_layout_get_child_property;
|
||||
@ -619,21 +617,9 @@ gtk_layout_class_init (GtkLayoutClass *class)
|
||||
0,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_HADJUSTMENT,
|
||||
g_param_spec_object ("hadjustment",
|
||||
P_("Horizontal adjustment"),
|
||||
P_("The GtkAdjustment for the horizontal position"),
|
||||
GTK_TYPE_ADJUSTMENT,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_VADJUSTMENT,
|
||||
g_param_spec_object ("vadjustment",
|
||||
P_("Vertical adjustment"),
|
||||
P_("The GtkAdjustment for the vertical position"),
|
||||
GTK_TYPE_ADJUSTMENT,
|
||||
GTK_PARAM_READWRITE));
|
||||
/* Scrollable interface */
|
||||
g_object_class_override_property (gobject_class, PROP_HADJUSTMENT, "hadjustment");
|
||||
g_object_class_override_property (gobject_class, PROP_VADJUSTMENT, "vadjustment");
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_WIDTH,
|
||||
@ -665,28 +651,6 @@ gtk_layout_class_init (GtkLayoutClass *class)
|
||||
container_class->remove = gtk_layout_remove;
|
||||
container_class->forall = gtk_layout_forall;
|
||||
|
||||
class->set_scroll_adjustments = gtk_layout_set_adjustments;
|
||||
|
||||
/**
|
||||
* GtkLayout::set-scroll-adjustments
|
||||
* @horizontal: the horizontal #GtkAdjustment
|
||||
* @vertical: the vertical #GtkAdjustment
|
||||
*
|
||||
* Set the scroll adjustments for the layout. Usually scrolled containers
|
||||
* like #GtkScrolledWindow will emit this signal to connect two instances
|
||||
* of #GtkScrollbar to the scroll directions of the #GtkLayout.
|
||||
*/
|
||||
widget_class->set_scroll_adjustments_signal =
|
||||
g_signal_new (I_("set-scroll-adjustments"),
|
||||
G_OBJECT_CLASS_TYPE (gobject_class),
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
|
||||
G_STRUCT_OFFSET (GtkLayoutClass, set_scroll_adjustments),
|
||||
NULL, NULL,
|
||||
_gtk_marshal_VOID__OBJECT_OBJECT,
|
||||
G_TYPE_NONE, 2,
|
||||
GTK_TYPE_ADJUSTMENT,
|
||||
GTK_TYPE_ADJUSTMENT);
|
||||
|
||||
g_type_class_add_private (class, sizeof (GtkLayoutPrivate));
|
||||
}
|
||||
|
||||
@ -831,32 +795,6 @@ gtk_layout_init (GtkLayout *layout)
|
||||
priv->freeze_count = 0;
|
||||
}
|
||||
|
||||
static GObject *
|
||||
gtk_layout_constructor (GType type,
|
||||
guint n_properties,
|
||||
GObjectConstructParam *properties)
|
||||
{
|
||||
GtkLayoutPrivate *priv;
|
||||
GtkLayout *layout;
|
||||
GObject *object;
|
||||
GtkAdjustment *hadj, *vadj;
|
||||
|
||||
object = G_OBJECT_CLASS (gtk_layout_parent_class)->constructor (type,
|
||||
n_properties,
|
||||
properties);
|
||||
|
||||
layout = GTK_LAYOUT (object);
|
||||
priv = layout->priv;
|
||||
|
||||
hadj = priv->hadjustment ? priv->hadjustment : new_default_adjustment ();
|
||||
vadj = priv->vadjustment ? priv->vadjustment : new_default_adjustment ();
|
||||
|
||||
if (!priv->hadjustment || !priv->vadjustment)
|
||||
gtk_layout_set_adjustments (layout, hadj, vadj);
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
/* Widget methods
|
||||
*/
|
||||
|
||||
@ -1010,17 +948,8 @@ gtk_layout_size_allocate (GtkWidget *widget,
|
||||
MAX (priv->height, allocation->height));
|
||||
}
|
||||
|
||||
priv->hadjustment->page_size = allocation->width;
|
||||
priv->hadjustment->page_increment = allocation->width * 0.9;
|
||||
priv->hadjustment->lower = 0;
|
||||
/* set_adjustment_upper() emits ::changed */
|
||||
gtk_layout_set_adjustment_upper (priv->hadjustment, MAX (allocation->width, priv->width), TRUE);
|
||||
|
||||
priv->vadjustment->page_size = allocation->height;
|
||||
priv->vadjustment->page_increment = allocation->height * 0.9;
|
||||
priv->vadjustment->lower = 0;
|
||||
priv->vadjustment->upper = MAX (allocation->height, priv->height);
|
||||
gtk_layout_set_adjustment_upper (priv->vadjustment, MAX (allocation->height, priv->height), TRUE);
|
||||
gtk_layout_set_hadjustment_values (layout);
|
||||
gtk_layout_set_vadjustment_values (layout);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -66,10 +66,6 @@ struct _GtkLayoutClass
|
||||
{
|
||||
GtkContainerClass parent_class;
|
||||
|
||||
void (*set_scroll_adjustments) (GtkLayout *layout,
|
||||
GtkAdjustment *hadjustment,
|
||||
GtkAdjustment *vadjustment);
|
||||
|
||||
/* Padding for future expansion */
|
||||
void (*_gtk_reserved1) (void);
|
||||
void (*_gtk_reserved2) (void);
|
||||
@ -98,6 +94,8 @@ void gtk_layout_get_size (GtkLayout *layout,
|
||||
guint *width,
|
||||
guint *height);
|
||||
|
||||
#ifndef GTK_DISABLE_DEPRECATED
|
||||
|
||||
GtkAdjustment* gtk_layout_get_hadjustment (GtkLayout *layout);
|
||||
GtkAdjustment* gtk_layout_get_vadjustment (GtkLayout *layout);
|
||||
void gtk_layout_set_hadjustment (GtkLayout *layout,
|
||||
@ -105,6 +103,8 @@ void gtk_layout_set_hadjustment (GtkLayout *layout,
|
||||
void gtk_layout_set_vadjustment (GtkLayout *layout,
|
||||
GtkAdjustment *adjustment);
|
||||
|
||||
#endif
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_LAYOUT_H__ */
|
||||
|
@ -87,7 +87,7 @@ struct _GtkPageSetupUnixDialogPrivate
|
||||
GtkWidget *landscape_radio;
|
||||
GtkWidget *reverse_landscape_radio;
|
||||
|
||||
guint request_details_tag;
|
||||
gulong request_details_tag;
|
||||
GtkPrinter *request_details_printer;
|
||||
|
||||
GtkPrintSettings *print_settings;
|
||||
|
@ -248,7 +248,7 @@ struct GtkPrintUnixDialogPrivate
|
||||
|
||||
GtkPrinter *current_printer;
|
||||
GtkPrinter *request_details_printer;
|
||||
guint request_details_tag;
|
||||
gulong request_details_tag;
|
||||
GtkPrinterOptionSet *options;
|
||||
gulong options_changed_handler;
|
||||
gulong mark_conflicts_id;
|
||||
|
@ -84,13 +84,10 @@ static void gtk_progress_bar_get_property (GObject *object,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_progress_bar_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition);
|
||||
static void gtk_progress_bar_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
static void gtk_progress_bar_real_update (GtkProgressBar *progress);
|
||||
static gboolean gtk_progress_bar_draw (GtkWidget *widget,
|
||||
cairo_t *cr);
|
||||
static void gtk_progress_bar_act_mode_enter (GtkProgressBar *progress);
|
||||
static void gtk_progress_bar_realize (GtkWidget *widget);
|
||||
static void gtk_progress_bar_finalize (GObject *object);
|
||||
static void gtk_progress_bar_set_orientation (GtkProgressBar *progress,
|
||||
GtkOrientation orientation);
|
||||
@ -111,10 +108,8 @@ gtk_progress_bar_class_init (GtkProgressBarClass *class)
|
||||
gobject_class->get_property = gtk_progress_bar_get_property;
|
||||
gobject_class->finalize = gtk_progress_bar_finalize;
|
||||
|
||||
widget_class->realize = gtk_progress_bar_realize;
|
||||
widget_class->draw = gtk_progress_bar_draw;
|
||||
widget_class->size_request = gtk_progress_bar_size_request;
|
||||
widget_class->size_allocate = gtk_progress_bar_size_allocate;
|
||||
|
||||
g_object_class_override_property (gobject_class,
|
||||
PROP_ORIENTATION,
|
||||
@ -276,39 +271,8 @@ gtk_progress_bar_init (GtkProgressBar *pbar)
|
||||
|
||||
priv->text = NULL;
|
||||
priv->fraction = 0.0;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_progress_bar_realize (GtkWidget *widget)
|
||||
{
|
||||
GtkAllocation allocation;
|
||||
GdkWindow *window;
|
||||
GdkWindowAttr attributes;
|
||||
gint attributes_mask;
|
||||
|
||||
gtk_widget_set_realized (widget, TRUE);
|
||||
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
|
||||
attributes.window_type = GDK_WINDOW_CHILD;
|
||||
attributes.x = allocation.x;
|
||||
attributes.y = allocation.y;
|
||||
attributes.width = allocation.width;
|
||||
attributes.height = allocation.height;
|
||||
attributes.wclass = GDK_INPUT_OUTPUT;
|
||||
attributes.visual = gtk_widget_get_visual (widget);
|
||||
attributes.event_mask = gtk_widget_get_events (widget);
|
||||
attributes.event_mask |= GDK_EXPOSURE_MASK;
|
||||
|
||||
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
|
||||
window = gdk_window_new (gtk_widget_get_parent_window (widget),
|
||||
&attributes, attributes_mask);
|
||||
gtk_widget_set_window (widget, window);
|
||||
gdk_window_set_user_data (window, widget);
|
||||
|
||||
gtk_widget_style_attach (widget);
|
||||
gtk_style_set_background (gtk_widget_get_style (widget),
|
||||
window, GTK_STATE_ACTIVE);
|
||||
gtk_widget_set_has_window (GTK_WIDGET (pbar), FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -572,18 +536,6 @@ gtk_progress_bar_size_request (GtkWidget *widget,
|
||||
requisition->height = MAX (min_height, height);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_progress_bar_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation)
|
||||
{
|
||||
gtk_widget_set_allocation (widget, allocation);
|
||||
|
||||
if (gtk_widget_get_realized (widget))
|
||||
gdk_window_move_resize (gtk_widget_get_window (widget),
|
||||
allocation->x, allocation->y,
|
||||
allocation->width, allocation->height);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_progress_bar_act_mode_enter (GtkProgressBar *pbar)
|
||||
{
|
||||
|
@ -435,6 +435,7 @@ gtk_recent_chooser_default_constructor (GType type,
|
||||
gtk_tree_view_column_set_resizable (impl->icon_column, FALSE);
|
||||
|
||||
renderer = gtk_cell_renderer_pixbuf_new ();
|
||||
g_object_set (renderer, "stock-size", GTK_ICON_SIZE_BUTTON, NULL);
|
||||
gtk_tree_view_column_pack_start (impl->icon_column, renderer, FALSE);
|
||||
gtk_tree_view_column_set_cell_data_func (impl->icon_column,
|
||||
renderer,
|
||||
@ -984,23 +985,17 @@ recent_icon_data_func (GtkTreeViewColumn *tree_column,
|
||||
GtkTreeIter *iter,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkRecentChooserDefault *impl = GTK_RECENT_CHOOSER_DEFAULT (user_data);
|
||||
GtkRecentInfo *info = NULL;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
gtk_tree_model_get (model, iter,
|
||||
RECENT_INFO_COLUMN, &info,
|
||||
-1);
|
||||
GIcon *icon;
|
||||
|
||||
gtk_tree_model_get (model, iter, RECENT_INFO_COLUMN, &info, -1);
|
||||
g_assert (info != NULL);
|
||||
|
||||
pixbuf = gtk_recent_info_get_icon (info, impl->icon_size);
|
||||
|
||||
g_object_set (cell,
|
||||
"pixbuf", pixbuf,
|
||||
NULL);
|
||||
|
||||
if (pixbuf)
|
||||
g_object_unref (pixbuf);
|
||||
|
||||
icon = gtk_recent_info_get_gicon (info);
|
||||
g_object_set (cell, "gicon", icon, NULL);
|
||||
|
||||
if (icon != NULL)
|
||||
g_object_unref (icon);
|
||||
|
||||
gtk_recent_info_unref (info);
|
||||
}
|
||||
|
@ -78,9 +78,6 @@ struct _GtkRecentChooserMenuPrivate
|
||||
/* the recent manager object */
|
||||
GtkRecentManager *manager;
|
||||
|
||||
/* size of the icons of the menu items */
|
||||
gint icon_size;
|
||||
|
||||
/* max size of the menu item label */
|
||||
gint label_width;
|
||||
|
||||
@ -121,7 +118,6 @@ enum {
|
||||
};
|
||||
|
||||
|
||||
#define FALLBACK_ICON_SIZE 32
|
||||
#define FALLBACK_ITEM_LIMIT 10
|
||||
#define DEFAULT_LABEL_WIDTH 30
|
||||
|
||||
@ -178,8 +174,6 @@ static void set_recent_manager (GtkRecentChooserMenu *menu,
|
||||
static void chooser_set_sort_type (GtkRecentChooserMenu *menu,
|
||||
GtkRecentSortType sort_type);
|
||||
|
||||
static gint get_icon_size_for_widget (GtkWidget *widget);
|
||||
|
||||
static void item_activate_cb (GtkWidget *widget,
|
||||
gpointer user_data);
|
||||
static void manager_changed_cb (GtkRecentManager *manager,
|
||||
@ -281,7 +275,6 @@ gtk_recent_chooser_menu_init (GtkRecentChooserMenu *menu)
|
||||
|
||||
priv->limit = FALLBACK_ITEM_LIMIT;
|
||||
priv->sort_type = GTK_RECENT_SORT_NONE;
|
||||
priv->icon_size = FALLBACK_ICON_SIZE;
|
||||
priv->label_width = DEFAULT_LABEL_WIDTH;
|
||||
|
||||
priv->first_recent_item_pos = -1;
|
||||
@ -817,7 +810,7 @@ gtk_recent_chooser_menu_create_item (GtkRecentChooserMenu *menu,
|
||||
GtkRecentChooserMenuPrivate *priv;
|
||||
gchar *text;
|
||||
GtkWidget *item, *image, *label;
|
||||
GdkPixbuf *icon;
|
||||
GIcon *icon;
|
||||
|
||||
g_assert (info != NULL);
|
||||
|
||||
@ -875,11 +868,13 @@ gtk_recent_chooser_menu_create_item (GtkRecentChooserMenu *menu,
|
||||
|
||||
if (priv->show_icons)
|
||||
{
|
||||
icon = gtk_recent_info_get_icon (info, priv->icon_size);
|
||||
|
||||
image = gtk_image_new_from_pixbuf (icon);
|
||||
icon = gtk_recent_info_get_gicon (info);
|
||||
|
||||
image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_MENU);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
|
||||
g_object_unref (icon);
|
||||
gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (item), TRUE);
|
||||
if (icon)
|
||||
g_object_unref (icon);
|
||||
}
|
||||
|
||||
g_signal_connect (item, "activate",
|
||||
@ -1085,8 +1080,6 @@ gtk_recent_chooser_menu_populate (GtkRecentChooserMenu *menu)
|
||||
pdata->menu = menu;
|
||||
pdata->placeholder = g_object_ref (priv->placeholder);
|
||||
|
||||
priv->icon_size = get_icon_size_for_widget (GTK_WIDGET (menu));
|
||||
|
||||
/* remove our menu items first */
|
||||
gtk_recent_chooser_menu_dispose_items (menu);
|
||||
|
||||
@ -1152,24 +1145,6 @@ set_recent_manager (GtkRecentChooserMenu *menu,
|
||||
menu);
|
||||
}
|
||||
|
||||
static gint
|
||||
get_icon_size_for_widget (GtkWidget *widget)
|
||||
{
|
||||
GtkSettings *settings;
|
||||
gint width, height;
|
||||
|
||||
if (gtk_widget_has_screen (widget))
|
||||
settings = gtk_settings_get_for_screen (gtk_widget_get_screen (widget));
|
||||
else
|
||||
settings = gtk_settings_get_default ();
|
||||
|
||||
if (gtk_icon_size_lookup_for_settings (settings, GTK_ICON_SIZE_MENU,
|
||||
&width, &height))
|
||||
return MAX (width, height);
|
||||
|
||||
return FALLBACK_ICON_SIZE;
|
||||
}
|
||||
|
||||
static void
|
||||
foreach_set_shot_tips (GtkWidget *widget,
|
||||
gpointer user_data)
|
||||
|
@ -111,7 +111,7 @@
|
||||
#include "gtkmarshalers.h"
|
||||
|
||||
/* the file where we store the recently used items */
|
||||
#define GTK_RECENTLY_USED_FILE ".recently-used.xbel"
|
||||
#define GTK_RECENTLY_USED_FILE "recently-used.xbel"
|
||||
|
||||
/* return all items by default */
|
||||
#define DEFAULT_LIMIT -1
|
||||
@ -176,6 +176,9 @@ struct _GtkRecentManagerPrivate
|
||||
GBookmarkFile *recent_items;
|
||||
|
||||
GFileMonitor *monitor;
|
||||
|
||||
guint changed_timeout;
|
||||
guint changed_age;
|
||||
};
|
||||
|
||||
enum
|
||||
@ -390,12 +393,26 @@ gtk_recent_manager_get_property (GObject *object,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_recent_manager_dispose (GObject *object)
|
||||
gtk_recent_manager_finalize (GObject *object)
|
||||
{
|
||||
GtkRecentManager *manager = GTK_RECENT_MANAGER (object);
|
||||
GtkRecentManagerPrivate *priv = manager->priv;
|
||||
|
||||
if (priv->monitor)
|
||||
g_free (priv->filename);
|
||||
|
||||
if (priv->recent_items != NULL)
|
||||
g_bookmark_file_free (priv->recent_items);
|
||||
|
||||
G_OBJECT_CLASS (gtk_recent_manager_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_recent_manager_dispose (GObject *gobject)
|
||||
{
|
||||
GtkRecentManager *manager = GTK_RECENT_MANAGER (gobject);
|
||||
GtkRecentManagerPrivate *priv = manager->priv;
|
||||
|
||||
if (priv->monitor != NULL)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (priv->monitor,
|
||||
G_CALLBACK (gtk_recent_manager_monitor_changed),
|
||||
@ -404,21 +421,21 @@ gtk_recent_manager_dispose (GObject *object)
|
||||
priv->monitor = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (gtk_recent_manager_parent_class)->dispose (object);
|
||||
}
|
||||
if (priv->changed_timeout != 0)
|
||||
{
|
||||
g_source_remove (priv->changed_timeout);
|
||||
priv->changed_timeout = 0;
|
||||
priv->changed_age = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_recent_manager_finalize (GObject *object)
|
||||
{
|
||||
GtkRecentManager *manager = GTK_RECENT_MANAGER (object);
|
||||
GtkRecentManagerPrivate *priv = manager->priv;
|
||||
if (priv->is_dirty)
|
||||
{
|
||||
g_object_ref (manager);
|
||||
g_signal_emit (manager, signal_changed, 0);
|
||||
g_object_unref (manager);
|
||||
}
|
||||
|
||||
g_free (priv->filename);
|
||||
|
||||
if (priv->recent_items)
|
||||
g_bookmark_file_free (priv->recent_items);
|
||||
|
||||
G_OBJECT_CLASS (gtk_recent_manager_parent_class)->finalize (object);
|
||||
G_OBJECT_CLASS (gtk_recent_manager_parent_class)->dispose (gobject);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -456,8 +473,6 @@ gtk_recent_manager_real_changed (GtkRecentManager *manager)
|
||||
else if (age == 0)
|
||||
{
|
||||
g_bookmark_file_free (priv->recent_items);
|
||||
priv->recent_items = NULL;
|
||||
|
||||
priv->recent_items = g_bookmark_file_new ();
|
||||
}
|
||||
}
|
||||
@ -520,6 +535,14 @@ gtk_recent_manager_monitor_changed (GFileMonitor *monitor,
|
||||
}
|
||||
}
|
||||
|
||||
static gchar *
|
||||
get_default_filename (void)
|
||||
{
|
||||
return g_build_filename (g_get_user_data_dir (),
|
||||
GTK_RECENTLY_USED_FILE,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_recent_manager_set_filename (GtkRecentManager *manager,
|
||||
const gchar *filename)
|
||||
@ -560,9 +583,7 @@ gtk_recent_manager_set_filename (GtkRecentManager *manager,
|
||||
else
|
||||
{
|
||||
if (!filename || *filename == '\0')
|
||||
priv->filename = g_build_filename (g_get_home_dir (),
|
||||
GTK_RECENTLY_USED_FILE,
|
||||
NULL);
|
||||
priv->filename = get_default_filename ();
|
||||
else
|
||||
priv->filename = g_strdup (filename);
|
||||
}
|
||||
@ -681,8 +702,7 @@ gtk_recent_manager_new (void)
|
||||
* gtk_recent_manager_get_default:
|
||||
*
|
||||
* Gets a unique instance of #GtkRecentManager, that you can share
|
||||
* in your application without caring about memory management. The
|
||||
* returned instance will be freed when you application terminates.
|
||||
* in your application without caring about memory management.
|
||||
*
|
||||
* Return value: (transfer none): A unique #GtkRecentManager. Do not ref or unref it.
|
||||
*
|
||||
@ -937,7 +957,6 @@ gtk_recent_manager_add_full (GtkRecentManager *manager,
|
||||
* will dump our changes
|
||||
*/
|
||||
priv->is_dirty = TRUE;
|
||||
|
||||
gtk_recent_manager_changed (manager);
|
||||
|
||||
return TRUE;
|
||||
@ -998,7 +1017,6 @@ gtk_recent_manager_remove_item (GtkRecentManager *manager,
|
||||
}
|
||||
|
||||
priv->is_dirty = TRUE;
|
||||
|
||||
gtk_recent_manager_changed (manager);
|
||||
|
||||
return TRUE;
|
||||
@ -1222,7 +1240,6 @@ gtk_recent_manager_move_item (GtkRecentManager *recent_manager,
|
||||
}
|
||||
|
||||
priv->is_dirty = TRUE;
|
||||
|
||||
gtk_recent_manager_changed (recent_manager);
|
||||
|
||||
return TRUE;
|
||||
@ -1277,17 +1294,15 @@ purge_recent_items_list (GtkRecentManager *manager,
|
||||
{
|
||||
GtkRecentManagerPrivate *priv = manager->priv;
|
||||
|
||||
if (!priv->recent_items)
|
||||
if (priv->recent_items == NULL)
|
||||
return;
|
||||
|
||||
|
||||
g_bookmark_file_free (priv->recent_items);
|
||||
priv->recent_items = NULL;
|
||||
|
||||
priv->recent_items = g_bookmark_file_new ();
|
||||
priv->size = 0;
|
||||
priv->is_dirty = TRUE;
|
||||
|
||||
|
||||
/* emit the changed signal, to ensure that the purge is written */
|
||||
priv->is_dirty = TRUE;
|
||||
gtk_recent_manager_changed (manager);
|
||||
}
|
||||
|
||||
@ -1327,10 +1342,43 @@ gtk_recent_manager_purge_items (GtkRecentManager *manager,
|
||||
return purged;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_recent_manager_changed (GtkRecentManager *recent_manager)
|
||||
static gboolean
|
||||
emit_manager_changed (gpointer data)
|
||||
{
|
||||
g_signal_emit (recent_manager, signal_changed, 0);
|
||||
GtkRecentManager *manager = data;
|
||||
|
||||
manager->priv->changed_age = 0;
|
||||
manager->priv->changed_timeout = 0;
|
||||
|
||||
g_signal_emit (manager, signal_changed, 0);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_recent_manager_changed (GtkRecentManager *manager)
|
||||
{
|
||||
/* coalesce consecutive changes
|
||||
*
|
||||
* we schedule a write in 250 msecs immediately; if we get more than one
|
||||
* request per millisecond before the timeout has a chance to run, we
|
||||
* schedule an emission immediately.
|
||||
*/
|
||||
if (manager->priv->changed_timeout == 0)
|
||||
manager->priv->changed_timeout = gdk_threads_add_timeout (250, emit_manager_changed, manager);
|
||||
else
|
||||
{
|
||||
manager->priv->changed_age += 1;
|
||||
|
||||
if (manager->priv->changed_age > 250)
|
||||
{
|
||||
g_source_remove (manager->priv->changed_timeout);
|
||||
g_signal_emit (manager, signal_changed, 0);
|
||||
|
||||
manager->priv->changed_age = 0;
|
||||
manager->priv->changed_timeout = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1921,6 +1969,35 @@ gtk_recent_info_get_icon (GtkRecentInfo *info,
|
||||
return retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_recent_info_get_gicon:
|
||||
* @info: a #GtkRecentInfo
|
||||
*
|
||||
* Retrieves the icon associated to the resource MIME type.
|
||||
*
|
||||
* Return value: a #GIcon containing the icon, or %NULL. Use
|
||||
* g_object_unref() when finished using the icon
|
||||
*
|
||||
* Since: 2.22
|
||||
*/
|
||||
GIcon *
|
||||
gtk_recent_info_get_gicon (GtkRecentInfo *info)
|
||||
{
|
||||
GIcon *icon = NULL;
|
||||
gchar *content_type;
|
||||
|
||||
g_return_val_if_fail (info != NULL, NULL);
|
||||
|
||||
if (info->mime_type != NULL &&
|
||||
(content_type = g_content_type_from_mime_type (info->mime_type)) != NULL)
|
||||
{
|
||||
icon = g_content_type_get_icon (content_type);
|
||||
g_free (content_type);
|
||||
}
|
||||
|
||||
return icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_recent_info_is_local:
|
||||
* @info: a #GtkRecentInfo
|
||||
@ -2310,6 +2387,72 @@ gtk_recent_info_has_group (GtkRecentInfo *info,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_recent_info_create_app_info:
|
||||
* @info: a #GtkRecentInfo
|
||||
* @app_name: (allow-none): the name of the application that should
|
||||
* be mapped to a #GAppInfo; if %NULL is used then the default
|
||||
* application for the MIME type is used
|
||||
* @error: (allow-none): return location for a #GError, or %NULL
|
||||
*
|
||||
* Creates a #GAppInfo for the specified #GtkRecentInfo
|
||||
*
|
||||
* Return value: (transfer full): the newly created #GAppInfo, or %NULL.
|
||||
* In case of error, @error will be set either with a
|
||||
* %GTK_RECENT_MANAGER_ERROR or a %G_IO_ERROR
|
||||
*/
|
||||
GAppInfo *
|
||||
gtk_recent_info_create_app_info (GtkRecentInfo *info,
|
||||
const gchar *app_name,
|
||||
GError **error)
|
||||
{
|
||||
RecentAppInfo *ai;
|
||||
GAppInfo *app_info;
|
||||
GError *internal_error = NULL;
|
||||
|
||||
g_return_val_if_fail (info != NULL, NULL);
|
||||
|
||||
if (app_name == NULL || *app_name == '\0')
|
||||
{
|
||||
char *content_type;
|
||||
|
||||
if (info->mime_type == NULL)
|
||||
return NULL;
|
||||
|
||||
content_type = g_content_type_from_mime_type (info->mime_type);
|
||||
if (content_type == NULL)
|
||||
return NULL;
|
||||
|
||||
app_info = g_app_info_get_default_for_type (content_type, TRUE);
|
||||
g_free (content_type);
|
||||
|
||||
return app_info;
|
||||
}
|
||||
|
||||
ai = g_hash_table_lookup (info->apps_lookup, app_name);
|
||||
if (ai == NULL)
|
||||
{
|
||||
g_set_error (error, GTK_RECENT_MANAGER_ERROR,
|
||||
GTK_RECENT_MANAGER_ERROR_NOT_REGISTERED,
|
||||
_("No registered application with name '%s' for item with URI '%s' found"),
|
||||
app_name,
|
||||
info->uri);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
internal_error = NULL;
|
||||
app_info = g_app_info_create_from_commandline (ai->exec, ai->name,
|
||||
G_APP_INFO_CREATE_NONE,
|
||||
&internal_error);
|
||||
if (internal_error != NULL)
|
||||
{
|
||||
g_propagate_error (error, internal_error);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return app_info;
|
||||
}
|
||||
|
||||
/*
|
||||
* _gtk_recent_manager_sync:
|
||||
*
|
||||
|
@ -204,6 +204,9 @@ gboolean gtk_recent_info_get_application_info (GtkRecentInfo *info
|
||||
const gchar **app_exec,
|
||||
guint *count,
|
||||
time_t *time_);
|
||||
GAppInfo * gtk_recent_info_create_app_info (GtkRecentInfo *info,
|
||||
const gchar *app_name,
|
||||
GError **error);
|
||||
gchar ** gtk_recent_info_get_applications (GtkRecentInfo *info,
|
||||
gsize *length) G_GNUC_MALLOC;
|
||||
gchar * gtk_recent_info_last_application (GtkRecentInfo *info) G_GNUC_MALLOC;
|
||||
@ -215,6 +218,7 @@ gboolean gtk_recent_info_has_group (GtkRecentInfo *info
|
||||
const gchar *group_name);
|
||||
GdkPixbuf * gtk_recent_info_get_icon (GtkRecentInfo *info,
|
||||
gint size);
|
||||
GIcon * gtk_recent_info_get_gicon (GtkRecentInfo *info);
|
||||
gchar * gtk_recent_info_get_short_name (GtkRecentInfo *info) G_GNUC_MALLOC;
|
||||
gchar * gtk_recent_info_get_uri_display (GtkRecentInfo *info) G_GNUC_MALLOC;
|
||||
gint gtk_recent_info_get_age (GtkRecentInfo *info);
|
||||
|
205
gtk/gtkscrollable.c
Normal file
205
gtk/gtkscrollable.c
Normal file
@ -0,0 +1,205 @@
|
||||
/* gtkscrollable.c
|
||||
* Copyright (C) 2008 Tadej Borovšak <tadeboro@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:gtkscrollable
|
||||
* @Short_Description: An interface for scrollable widgets
|
||||
* @Title: GtkScrollable
|
||||
*
|
||||
* #GtkScrollable is interface that is implemented by widgets with native
|
||||
* scrolling ability.
|
||||
*
|
||||
* To implement this interface, all one needs to do is to override
|
||||
* #GtkScrollable:hadjustment and #GtkScrollable:vadjustment properties.
|
||||
*
|
||||
* <refsect2>
|
||||
* <title>Creating a scrollable widget</title>
|
||||
* <para>
|
||||
* There are some common things all scrollable widgets will need to do.
|
||||
*
|
||||
* <orderedlist>
|
||||
* <listitem>
|
||||
* <para>
|
||||
* When parent sets adjustments, widget needs to populate adjustment's
|
||||
* #GtkAdjustment:lower, #GtkAdjustment:upper,
|
||||
* #GtkAdjustment:step-increment, #GtkAdjustment:page-increment and
|
||||
* #GtkAdjustment:page-size properties and connect to
|
||||
* #GtkAdjustment::value-changed signal.
|
||||
* </para>
|
||||
* </listitem>
|
||||
* <listitem>
|
||||
* <para>
|
||||
* When parent allocates space to child, scrollable widget needs to update
|
||||
* properties listed under 1 with new values.
|
||||
* </para>
|
||||
* </listitem>
|
||||
* <listitem>
|
||||
* <para>
|
||||
* When any of the adjustments emits #GtkAdjustment::value-changed signal,
|
||||
* scrollable widget needs to scroll it's contents.
|
||||
* </para>
|
||||
* </listitem>
|
||||
* </orderedlist>
|
||||
* </para>
|
||||
* </refsect2>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkscrollable.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkintl.h"
|
||||
|
||||
G_DEFINE_INTERFACE (GtkScrollable, gtk_scrollable, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
gtk_scrollable_default_init (GtkScrollableInterface *iface)
|
||||
{
|
||||
GParamSpec *pspec;
|
||||
|
||||
/**
|
||||
* GtkScrollable:hadjustment:
|
||||
*
|
||||
* Horizontal #GtkAdjustment of scrollable widget. This adjustment is
|
||||
* shared between scrollable widget and it's parent.
|
||||
*
|
||||
* Since: 3.0
|
||||
*/
|
||||
pspec = g_param_spec_object ("hadjustment",
|
||||
P_("Horizontal adjustment"),
|
||||
P_("Horizontal adjustment that is shared "
|
||||
"between scrollable widget and it's "
|
||||
"controller"),
|
||||
GTK_TYPE_ADJUSTMENT,
|
||||
GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT);
|
||||
g_object_interface_install_property (iface, pspec);
|
||||
|
||||
/**
|
||||
* GtkScrollable:vadjustment:
|
||||
*
|
||||
* Verical #GtkAdjustment of scrollable widget. This adjustment is shared
|
||||
* between scrollable widget and it's parent.
|
||||
*
|
||||
* Since: 3.0
|
||||
*/
|
||||
pspec = g_param_spec_object ("vadjustment",
|
||||
P_("Vertical adjustment"),
|
||||
P_("Vertical adjustment that is shared "
|
||||
"between scrollable widget and it's "
|
||||
"controller"),
|
||||
GTK_TYPE_ADJUSTMENT,
|
||||
GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT);
|
||||
g_object_interface_install_property (iface, pspec);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_scrollable_get_hadjustment:
|
||||
* @scrollable: a #GtkScrollable
|
||||
*
|
||||
* Retrieves the #GtkAdjustment, used for horizontal scrolling.
|
||||
*
|
||||
* Return value: (transfer none): horizontal #GtkAdjustment.
|
||||
*
|
||||
* Since: 3.0
|
||||
**/
|
||||
GtkAdjustment *
|
||||
gtk_scrollable_get_hadjustment (GtkScrollable *scrollable)
|
||||
{
|
||||
GtkAdjustment *adj = NULL;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_SCROLLABLE (scrollable), NULL);
|
||||
|
||||
g_object_get (scrollable, "hadjustment", &adj, NULL);
|
||||
|
||||
/* Horrid hack; g_object_get() returns a new reference but
|
||||
* that contradicts the memory management conventions
|
||||
* for accessors.
|
||||
*/
|
||||
if (adj)
|
||||
g_object_unref (adj);
|
||||
|
||||
return adj;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_scrollable_set_hadjustment:
|
||||
* @scrollable: a #GtkScrollable
|
||||
* @hadjustment: (allow-none): a #GtkAdjustment
|
||||
*
|
||||
* Sets the horizontal adjustment of the #GtkScrollable.
|
||||
*
|
||||
* Since: 3.0
|
||||
**/
|
||||
void
|
||||
gtk_scrollable_set_hadjustment (GtkScrollable *scrollable,
|
||||
GtkAdjustment *hadjustment)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_SCROLLABLE (scrollable));
|
||||
g_return_if_fail (hadjustment == NULL || GTK_IS_ADJUSTMENT (hadjustment));
|
||||
|
||||
g_object_set (scrollable, "hadjustment", hadjustment, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_scrollable_get_vadjustment:
|
||||
* @scrollable: a #GtkScrollable
|
||||
*
|
||||
* Retrieves the #GtkAdjustment, used for vertical scrolling.
|
||||
*
|
||||
* Return value: (transfer none): vertical #GtkAdjustment.
|
||||
*
|
||||
* Since: 3.0
|
||||
**/
|
||||
GtkAdjustment *
|
||||
gtk_scrollable_get_vadjustment (GtkScrollable *scrollable)
|
||||
{
|
||||
GtkAdjustment *adj = NULL;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_SCROLLABLE (scrollable), NULL);
|
||||
|
||||
g_object_get (scrollable, "vadjustment", &adj, NULL);
|
||||
|
||||
/* Horrid hack; g_object_get() returns a new reference but
|
||||
* that contradicts the memory management conventions
|
||||
* for accessors.
|
||||
*/
|
||||
if (adj)
|
||||
g_object_unref (adj);
|
||||
|
||||
return adj;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_scrollable_set_vadjustment:
|
||||
* @scrollable: a #GtkScrollable
|
||||
* @vadjustment: (allow-none): a #GtkAdjustment
|
||||
*
|
||||
* Sets the vertical adjustment of the #GtkScrollable.
|
||||
*
|
||||
* Since: 3.0
|
||||
**/
|
||||
void
|
||||
gtk_scrollable_set_vadjustment (GtkScrollable *scrollable,
|
||||
GtkAdjustment *vadjustment)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_SCROLLABLE (scrollable));
|
||||
g_return_if_fail (vadjustment == NULL || GTK_IS_ADJUSTMENT (vadjustment));
|
||||
|
||||
g_object_set (scrollable, "vadjustment", vadjustment, NULL);
|
||||
}
|
55
gtk/gtkscrollable.h
Normal file
55
gtk/gtkscrollable.h
Normal file
@ -0,0 +1,55 @@
|
||||
/* gtkscrollable.h
|
||||
* Copyright (C) 2008 Tadej Borovšak <tadeboro@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __GTK_SCROLLABLE_H__
|
||||
#define __GTK_SCROLLABLE_H__
|
||||
|
||||
#include <gtk/gtkadjustment.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_SCROLLABLE (gtk_scrollable_get_type ())
|
||||
#define GTK_SCROLLABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SCROLLABLE, GtkScrollable))
|
||||
#define GTK_IS_SCROLLABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SCROLLABLE))
|
||||
#define GTK_SCROLLABLE_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GTK_TYPE_SCROLLABLE, GtkScrollableInterface))
|
||||
|
||||
typedef struct _GtkScrollable GtkScrollable; /* Dummy */
|
||||
typedef struct _GtkScrollableInterface GtkScrollableInterface;
|
||||
|
||||
struct _GtkScrollableInterface
|
||||
{
|
||||
GTypeInterface base_iface;
|
||||
};
|
||||
|
||||
/* Public API */
|
||||
GType gtk_scrollable_get_type (void) G_GNUC_CONST;
|
||||
GtkAdjustment *gtk_scrollable_get_hadjustment (GtkScrollable *scrollable);
|
||||
void gtk_scrollable_set_hadjustment (GtkScrollable *scrollable,
|
||||
GtkAdjustment *hadjustment);
|
||||
GtkAdjustment *gtk_scrollable_get_vadjustment (GtkScrollable *scrollable);
|
||||
void gtk_scrollable_set_vadjustment (GtkScrollable *scrollable,
|
||||
GtkAdjustment *vadjustment);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_SCROLLABLE_H__ */
|
@ -31,6 +31,31 @@
|
||||
#include "gtkintl.h"
|
||||
#include "gtkprivate.h"
|
||||
|
||||
|
||||
/**
|
||||
* SECTION:gtkscrollbar
|
||||
* @Short_description: Base class for GtkHScrollbar and GtkVScrollbar
|
||||
* @Title: GtkScrollbar
|
||||
* @See_also: #GtkHScrollbar, #GtkVScrollbar, #GtkAdjustment,
|
||||
* #GtkScrolledWindow
|
||||
*
|
||||
* The #GtkScrollbar widget is the base class for #GtkHScrollbar and
|
||||
* #GtkVScrollbar. It can be used in the same way as these, by setting
|
||||
* the "orientation" property appropriately.
|
||||
*
|
||||
* The position of the thumb in a scrollbar is controlled by the scroll
|
||||
* adjustments. See #GtkAdjustment for the fields in an adjustment - for
|
||||
* #GtkScrollbar, the #GtkAdjustment.value field represents the position
|
||||
* of the scrollbar, which must be between the #GtkAdjustment.lower field
|
||||
* and #GtkAdjustment.upper - #GtkAdjustment.page_size. The
|
||||
* #GtkAdjustment.page_size field represents the size of the visible
|
||||
* scrollable area. The #GtkAdjustment.step_increment and
|
||||
* #GtkAdjustment.page_increment fields are used when the user asks to
|
||||
* step down (using the small stepper arrows) or page down (using for
|
||||
* example the <keycap>PageDown</keycap> key).
|
||||
*/
|
||||
|
||||
|
||||
static void gtk_scrollbar_style_set (GtkWidget *widget,
|
||||
GtkStyle *previous);
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include "gtkbindings.h"
|
||||
#include "gtkmarshalers.h"
|
||||
#include "gtkscrollable.h"
|
||||
#include "gtkscrolledwindow.h"
|
||||
#include "gtkwindow.h"
|
||||
#include "gtktypeutils.h"
|
||||
@ -40,7 +41,7 @@
|
||||
* SECTION:gtkscrolledwindow
|
||||
* @Short_description: Adds scrollbars to its child widget
|
||||
* @Title: GtkScrolledWindow
|
||||
* @See_also: #GtkViewport, #GtkAdjustment, #GtkWidgetClass
|
||||
* @See_also: #GtkScrollable, #GtkViewport, #GtkAdjustment
|
||||
*
|
||||
* #GtkScrolledWindow is a #GtkBin subclass: it's a container
|
||||
* the accepts a single child widget. #GtkScrolledWindow adds scrollbars
|
||||
@ -48,16 +49,7 @@
|
||||
* child widget.
|
||||
*
|
||||
* The scrolled window can work in two ways. Some widgets have native
|
||||
* scrolling support; these widgets have "slots" for #GtkAdjustment
|
||||
* objects.
|
||||
* <footnote><para>The scrolled window installs #GtkAdjustment objects in
|
||||
* the child window's slots using the set_scroll_adjustments_signal,
|
||||
* found in #GtkWidgetClass. (Conceptually, these widgets implement a
|
||||
* "Scrollable" interface; because GTK+ 1.2 lacked interface support in
|
||||
* the object system, this interface is hackily implemented as a signal
|
||||
* in #GtkWidgetClass. The GTK+ 2.0 object system would allow a clean
|
||||
* implementation, but it wasn't worth breaking the
|
||||
* API.)</para></footnote>
|
||||
* scrolling support; these widgets implement the #GtkScrollable interface.
|
||||
* Widgets with native scroll support include #GtkTreeView, #GtkTextView,
|
||||
* and #GtkLayout.
|
||||
*
|
||||
@ -142,6 +134,9 @@ struct _GtkScrolledWindowPrivate
|
||||
guint vscrollbar_visible : 1;
|
||||
guint window_placement : 2;
|
||||
guint focus_out : 1; /* Flag used by ::move-focus-out implementation */
|
||||
|
||||
gint min_content_width;
|
||||
gint min_content_height;
|
||||
};
|
||||
|
||||
|
||||
@ -153,7 +148,9 @@ enum {
|
||||
PROP_VSCROLLBAR_POLICY,
|
||||
PROP_WINDOW_PLACEMENT,
|
||||
PROP_WINDOW_PLACEMENT_SET,
|
||||
PROP_SHADOW_TYPE
|
||||
PROP_SHADOW_TYPE,
|
||||
PROP_MIN_CONTENT_WIDTH,
|
||||
PROP_MIN_CONTENT_HEIGHT
|
||||
};
|
||||
|
||||
/* Signals */
|
||||
@ -380,6 +377,20 @@ gtk_scrolled_window_class_init (GtkScrolledWindowClass *class)
|
||||
DEFAULT_SCROLLBAR_SPACING,
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_MIN_CONTENT_WIDTH,
|
||||
g_param_spec_int ("min-content-width",
|
||||
P_("Minimum Content Width"),
|
||||
P_("The minimum width that the scrolled window will allocate to its content"),
|
||||
-1, G_MAXINT, -1,
|
||||
GTK_PARAM_READWRITE));
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_MIN_CONTENT_HEIGHT,
|
||||
g_param_spec_int ("min-content-height",
|
||||
P_("Minimum Content Height"),
|
||||
P_("The minimum height that the scrolled window will allocate to its content"),
|
||||
-1, G_MAXINT, -1,
|
||||
GTK_PARAM_READWRITE));
|
||||
/**
|
||||
* GtkScrolledWindow::scroll-child:
|
||||
* @scrolled_window: a #GtkScrolledWindow
|
||||
@ -475,6 +486,8 @@ gtk_scrolled_window_init (GtkScrolledWindow *scrolled_window)
|
||||
priv->focus_out = FALSE;
|
||||
priv->window_placement = GTK_CORNER_TOP_LEFT;
|
||||
gtk_scrolled_window_update_real_placement (scrolled_window);
|
||||
priv->min_content_width = -1;
|
||||
priv->min_content_height = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -549,7 +562,7 @@ gtk_scrolled_window_set_hadjustment (GtkScrolledWindow *scrolled_window,
|
||||
else
|
||||
{
|
||||
GtkAdjustment *old_adjustment;
|
||||
|
||||
|
||||
old_adjustment = gtk_range_get_adjustment (GTK_RANGE (priv->hscrollbar));
|
||||
if (old_adjustment == hadjustment)
|
||||
return;
|
||||
@ -568,10 +581,8 @@ gtk_scrolled_window_set_hadjustment (GtkScrolledWindow *scrolled_window,
|
||||
gtk_scrolled_window_adjustment_changed (hadjustment, scrolled_window);
|
||||
|
||||
child = gtk_bin_get_child (bin);
|
||||
if (child)
|
||||
gtk_widget_set_scroll_adjustments (child,
|
||||
gtk_range_get_adjustment (GTK_RANGE (priv->hscrollbar)),
|
||||
gtk_range_get_adjustment (GTK_RANGE (priv->vscrollbar)));
|
||||
if (GTK_IS_SCROLLABLE (child))
|
||||
gtk_scrollable_set_vadjustment (GTK_SCROLLABLE (child), hadjustment);
|
||||
|
||||
g_object_notify (G_OBJECT (scrolled_window), "hadjustment");
|
||||
}
|
||||
@ -585,7 +596,7 @@ gtk_scrolled_window_set_hadjustment (GtkScrolledWindow *scrolled_window,
|
||||
*/
|
||||
void
|
||||
gtk_scrolled_window_set_vadjustment (GtkScrolledWindow *scrolled_window,
|
||||
GtkAdjustment *vadjustment)
|
||||
GtkAdjustment *vadjustment)
|
||||
{
|
||||
GtkScrolledWindowPrivate *priv;
|
||||
GtkBin *bin;
|
||||
@ -633,10 +644,8 @@ gtk_scrolled_window_set_vadjustment (GtkScrolledWindow *scrolled_window,
|
||||
gtk_scrolled_window_adjustment_changed (vadjustment, scrolled_window);
|
||||
|
||||
child = gtk_bin_get_child (bin);
|
||||
if (child)
|
||||
gtk_widget_set_scroll_adjustments (child,
|
||||
gtk_range_get_adjustment (GTK_RANGE (priv->hscrollbar)),
|
||||
gtk_range_get_adjustment (GTK_RANGE (priv->vscrollbar)));
|
||||
if (GTK_IS_SCROLLABLE (child))
|
||||
gtk_scrollable_set_vadjustment (GTK_SCROLLABLE (child), vadjustment);
|
||||
|
||||
g_object_notify (G_OBJECT (scrolled_window), "vadjustment");
|
||||
}
|
||||
@ -1049,6 +1058,14 @@ gtk_scrolled_window_set_property (GObject *object,
|
||||
gtk_scrolled_window_set_shadow_type (scrolled_window,
|
||||
g_value_get_enum (value));
|
||||
break;
|
||||
case PROP_MIN_CONTENT_WIDTH:
|
||||
gtk_scrolled_window_set_min_content_width (scrolled_window,
|
||||
g_value_get_int (value));
|
||||
break;
|
||||
case PROP_MIN_CONTENT_HEIGHT:
|
||||
gtk_scrolled_window_set_min_content_height (scrolled_window,
|
||||
g_value_get_int (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@ -1074,12 +1091,6 @@ gtk_scrolled_window_get_property (GObject *object,
|
||||
g_value_set_object (value,
|
||||
G_OBJECT (gtk_scrolled_window_get_vadjustment (scrolled_window)));
|
||||
break;
|
||||
case PROP_HSCROLLBAR_POLICY:
|
||||
g_value_set_enum (value, priv->hscrollbar_policy);
|
||||
break;
|
||||
case PROP_VSCROLLBAR_POLICY:
|
||||
g_value_set_enum (value, priv->vscrollbar_policy);
|
||||
break;
|
||||
case PROP_WINDOW_PLACEMENT:
|
||||
g_value_set_enum (value, priv->window_placement);
|
||||
break;
|
||||
@ -1089,6 +1100,18 @@ gtk_scrolled_window_get_property (GObject *object,
|
||||
case PROP_SHADOW_TYPE:
|
||||
g_value_set_enum (value, priv->shadow_type);
|
||||
break;
|
||||
case PROP_HSCROLLBAR_POLICY:
|
||||
g_value_set_enum (value, priv->hscrollbar_policy);
|
||||
break;
|
||||
case PROP_VSCROLLBAR_POLICY:
|
||||
g_value_set_enum (value, priv->vscrollbar_policy);
|
||||
break;
|
||||
case PROP_MIN_CONTENT_WIDTH:
|
||||
g_value_set_int (value, priv->min_content_width);
|
||||
break;
|
||||
case PROP_MIN_CONTENT_HEIGHT:
|
||||
g_value_set_int (value, priv->min_content_height);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@ -1853,6 +1876,7 @@ gtk_scrolled_window_add (GtkContainer *container,
|
||||
GtkScrolledWindow *scrolled_window;
|
||||
GtkBin *bin;
|
||||
GtkWidget *child_widget;
|
||||
GtkAdjustment *hadj, *vadj;
|
||||
|
||||
bin = GTK_BIN (container);
|
||||
child_widget = gtk_bin_get_child (bin);
|
||||
@ -1864,12 +1888,14 @@ gtk_scrolled_window_add (GtkContainer *container,
|
||||
_gtk_bin_set_child (bin, child);
|
||||
gtk_widget_set_parent (child, GTK_WIDGET (bin));
|
||||
|
||||
/* this is a temporary message */
|
||||
if (!gtk_widget_set_scroll_adjustments (child,
|
||||
gtk_range_get_adjustment (GTK_RANGE (priv->hscrollbar)),
|
||||
gtk_range_get_adjustment (GTK_RANGE (priv->vscrollbar))))
|
||||
hadj = gtk_range_get_adjustment (GTK_RANGE (scrolled_window->priv->hscrollbar));
|
||||
vadj = gtk_range_get_adjustment (GTK_RANGE (scrolled_window->priv->vscrollbar));
|
||||
|
||||
if (GTK_IS_SCROLLABLE (child))
|
||||
g_object_set (child, "hadjustment", hadj, "vadjustment", vadj, NULL);
|
||||
else
|
||||
g_warning ("gtk_scrolled_window_add(): cannot add non scrollable widget "
|
||||
"use gtk_scrolled_window_add_with_viewport() instead");
|
||||
"use gtk_scrolled_window_add_with_viewport() instead");
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1879,8 +1905,8 @@ gtk_scrolled_window_remove (GtkContainer *container,
|
||||
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (container));
|
||||
g_return_if_fail (child != NULL);
|
||||
g_return_if_fail (gtk_bin_get_child (GTK_BIN (container)) == child);
|
||||
|
||||
gtk_widget_set_scroll_adjustments (child, NULL, NULL);
|
||||
|
||||
g_object_set (child, "hadjustment", NULL, "vadjustment", NULL, NULL);
|
||||
|
||||
/* chain parent class handler to remove child */
|
||||
GTK_CONTAINER_CLASS (gtk_scrolled_window_parent_class)->remove (container, child);
|
||||
@ -1905,9 +1931,8 @@ gtk_scrolled_window_remove (GtkContainer *container,
|
||||
* widgets with native scrolling support should not be used with the
|
||||
* #GtkViewport proxy.
|
||||
*
|
||||
* A widget supports scrolling natively if the
|
||||
* set_scroll_adjustments_signal field in #GtkWidgetClass is non-zero,
|
||||
* i.e. has been filled in with a valid signal identifier.
|
||||
* A widget supports scrolling natively if it implements the
|
||||
* #GtkScrollable interface.
|
||||
*/
|
||||
void
|
||||
gtk_scrolled_window_add_with_viewport (GtkScrolledWindow *scrolled_window,
|
||||
@ -1935,7 +1960,7 @@ gtk_scrolled_window_add_with_viewport (GtkScrolledWindow *scrolled_window,
|
||||
{
|
||||
viewport =
|
||||
gtk_viewport_new (gtk_scrolled_window_get_hadjustment (scrolled_window),
|
||||
gtk_scrolled_window_get_vadjustment (scrolled_window));
|
||||
gtk_scrolled_window_get_vadjustment (scrolled_window));
|
||||
gtk_container_add (GTK_CONTAINER (scrolled_window), viewport);
|
||||
}
|
||||
|
||||
@ -2025,9 +2050,19 @@ gtk_scrolled_window_get_preferred_size (GtkWidget *widget,
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Always ask for at least enough to fit the scrollbars */
|
||||
minimum_req.width += vscrollbar_requisition.width;
|
||||
natural_req.width += vscrollbar_requisition.width;
|
||||
gint min_content_width = priv->min_content_width;
|
||||
|
||||
if (min_content_width >= 0)
|
||||
{
|
||||
minimum_req.width = MAX (minimum_req.width, min_content_width);
|
||||
natural_req.width = MAX (natural_req.width, min_content_width);
|
||||
extra_width = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
minimum_req.width += vscrollbar_requisition.width;
|
||||
natural_req.width += vscrollbar_requisition.width;
|
||||
}
|
||||
}
|
||||
}
|
||||
else /* GTK_ORIENTATION_VERTICAL */
|
||||
@ -2043,9 +2078,19 @@ gtk_scrolled_window_get_preferred_size (GtkWidget *widget,
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Always ask for at least enough to fit the scrollbars */
|
||||
minimum_req.height += hscrollbar_requisition.height;
|
||||
natural_req.height += hscrollbar_requisition.height;
|
||||
gint min_content_height = priv->min_content_height;
|
||||
|
||||
if (min_content_height >= 0)
|
||||
{
|
||||
minimum_req.height = MAX (minimum_req.height, min_content_height);
|
||||
natural_req.height = MAX (natural_req.height, min_content_height);
|
||||
extra_height = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
minimum_req.height += vscrollbar_requisition.height;
|
||||
natural_req.height += vscrollbar_requisition.height;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2064,14 +2109,14 @@ gtk_scrolled_window_get_preferred_size (GtkWidget *widget,
|
||||
{
|
||||
minimum_req.height = MAX (minimum_req.height, vscrollbar_requisition.height);
|
||||
natural_req.height = MAX (natural_req.height, vscrollbar_requisition.height);
|
||||
if (!extra_height || priv->vscrollbar_policy == GTK_POLICY_ALWAYS)
|
||||
if (!extra_width || priv->vscrollbar_policy == GTK_POLICY_ALWAYS)
|
||||
extra_width = scrollbar_spacing + vscrollbar_requisition.width;
|
||||
}
|
||||
|
||||
minimum_req.width += extra_width;
|
||||
minimum_req.height += extra_height;
|
||||
natural_req.width += extra_width;
|
||||
natural_req.height += extra_height;
|
||||
minimum_req.width += MAX (0, extra_width);
|
||||
minimum_req.height += MAX (0, extra_height);
|
||||
natural_req.width += MAX (0, extra_width);
|
||||
natural_req.height += MAX (0, extra_height);
|
||||
|
||||
if (priv->shadow_type != GTK_SHADOW_NONE)
|
||||
{
|
||||
@ -2135,3 +2180,59 @@ gtk_scrolled_window_get_preferred_width_for_height (GtkWidget *widget,
|
||||
|
||||
GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, minimum_width, natural_width);
|
||||
}
|
||||
|
||||
gint
|
||||
gtk_scrolled_window_get_min_content_width (GtkScrolledWindow *scrolled_window)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window), 0);
|
||||
|
||||
return scrolled_window->priv->min_content_width;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_scrolled_window_set_min_content_width (GtkScrolledWindow *scrolled_window,
|
||||
gint min_content_width)
|
||||
{
|
||||
GtkScrolledWindowPrivate *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
|
||||
|
||||
priv = scrolled_window->priv;
|
||||
|
||||
if (priv->min_content_width != min_content_width)
|
||||
{
|
||||
priv->min_content_width = min_content_width;
|
||||
|
||||
gtk_widget_queue_resize (GTK_WIDGET (scrolled_window));
|
||||
|
||||
g_object_notify (G_OBJECT (scrolled_window), "min-content-width");
|
||||
}
|
||||
}
|
||||
|
||||
gint
|
||||
gtk_scrolled_window_get_min_content_height (GtkScrolledWindow *scrolled_window)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window), 0);
|
||||
|
||||
return scrolled_window->priv->min_content_height;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_scrolled_window_set_min_content_height (GtkScrolledWindow *scrolled_window,
|
||||
gint min_content_height)
|
||||
{
|
||||
GtkScrolledWindowPrivate *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
|
||||
|
||||
priv = scrolled_window->priv;
|
||||
|
||||
if (priv->min_content_height != min_content_height)
|
||||
{
|
||||
priv->min_content_height = min_content_height;
|
||||
|
||||
gtk_widget_queue_resize (GTK_WIDGET (scrolled_window));
|
||||
|
||||
g_object_notify (G_OBJECT (scrolled_window), "min-content-height");
|
||||
}
|
||||
}
|
||||
|
@ -115,6 +115,13 @@ GtkShadowType gtk_scrolled_window_get_shadow_type (GtkScrolledWindow *scrolle
|
||||
void gtk_scrolled_window_add_with_viewport (GtkScrolledWindow *scrolled_window,
|
||||
GtkWidget *child);
|
||||
|
||||
gint gtk_scrolled_window_get_min_content_width (GtkScrolledWindow *scrolled_window);
|
||||
void gtk_scrolled_window_set_min_content_width (GtkScrolledWindow *scrolled_window,
|
||||
gint width);
|
||||
gint gtk_scrolled_window_get_min_content_height (GtkScrolledWindow *scrolled_window);
|
||||
void gtk_scrolled_window_set_min_content_height (GtkScrolledWindow *scrolled_window,
|
||||
gint height);
|
||||
|
||||
gint _gtk_scrolled_window_get_scrollbar_spacing (GtkScrolledWindow *scrolled_window);
|
||||
|
||||
|
||||
|
@ -226,20 +226,56 @@ compute_size_for_orientation (GtkWidget *request,
|
||||
requisition_size = requisition.width;
|
||||
|
||||
if (for_size < 0)
|
||||
GTK_WIDGET_GET_CLASS (request)->get_preferred_width (request, &min_size, &nat_size);
|
||||
{
|
||||
GTK_WIDGET_GET_CLASS (request)->get_preferred_width (request, &min_size, &nat_size);
|
||||
}
|
||||
else
|
||||
GTK_WIDGET_GET_CLASS (request)->get_preferred_width_for_height (request, for_size,
|
||||
&min_size, &nat_size);
|
||||
{
|
||||
int ignored_position = 0;
|
||||
int natural_height;
|
||||
|
||||
/* Pull the base natural height from the cache as it's needed to adjust
|
||||
* the proposed 'for_size' */
|
||||
gtk_widget_get_preferred_height (widget, NULL, &natural_height);
|
||||
|
||||
/* convert for_size to unadjusted height (for_size is a proposed allocation) */
|
||||
GTK_WIDGET_GET_CLASS (request)->adjust_size_allocation (widget,
|
||||
GTK_ORIENTATION_VERTICAL,
|
||||
&natural_height,
|
||||
&ignored_position,
|
||||
&for_size);
|
||||
|
||||
GTK_WIDGET_GET_CLASS (request)->get_preferred_width_for_height (request, for_size,
|
||||
&min_size, &nat_size);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
requisition_size = requisition.height;
|
||||
|
||||
if (for_size < 0)
|
||||
GTK_WIDGET_GET_CLASS (request)->get_preferred_height (request, &min_size, &nat_size);
|
||||
{
|
||||
GTK_WIDGET_GET_CLASS (request)->get_preferred_height (request, &min_size, &nat_size);
|
||||
}
|
||||
else
|
||||
GTK_WIDGET_GET_CLASS (request)->get_preferred_height_for_width (request, for_size,
|
||||
&min_size, &nat_size);
|
||||
{
|
||||
int ignored_position = 0;
|
||||
int natural_width;
|
||||
|
||||
/* Pull the base natural width from the cache as it's needed to adjust
|
||||
* the proposed 'for_size' */
|
||||
gtk_widget_get_preferred_width (widget, NULL, &natural_width);
|
||||
|
||||
/* convert for_size to unadjusted width (for_size is a proposed allocation) */
|
||||
GTK_WIDGET_GET_CLASS (request)->adjust_size_allocation (widget,
|
||||
GTK_ORIENTATION_HORIZONTAL,
|
||||
&natural_width,
|
||||
&ignored_position,
|
||||
&for_size);
|
||||
|
||||
GTK_WIDGET_GET_CLASS (request)->get_preferred_height_for_width (request, for_size,
|
||||
&min_size, &nat_size);
|
||||
}
|
||||
}
|
||||
pop_recursion_check (request, orientation);
|
||||
|
||||
@ -270,7 +306,6 @@ compute_size_for_orientation (GtkWidget *request,
|
||||
orientation == GTK_SIZE_GROUP_HORIZONTAL ?
|
||||
GTK_ORIENTATION_HORIZONTAL :
|
||||
GTK_ORIENTATION_VERTICAL,
|
||||
cached_size->for_size,
|
||||
&adjusted_min,
|
||||
&adjusted_natural);
|
||||
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "gtkdnd.h"
|
||||
#include "gtkdebug.h"
|
||||
#include "gtkintl.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
|
||||
|
||||
/**
|
||||
|
@ -135,7 +135,7 @@ static void gtk_spin_button_state_changed (GtkWidget *widget,
|
||||
GtkStateType previous_state);
|
||||
static void gtk_spin_button_style_set (GtkWidget *widget,
|
||||
GtkStyle *previous_style);
|
||||
static void gtk_spin_button_draw_arrow (GtkSpinButton *spin_button,
|
||||
static void gtk_spin_button_draw_arrow (GtkSpinButton *spin_button,
|
||||
cairo_t *cr,
|
||||
GtkArrowType arrow_type);
|
||||
static gboolean gtk_spin_button_timer (GtkSpinButton *spin_button);
|
||||
@ -598,7 +598,7 @@ gtk_spin_button_realize (GtkWidget *widget)
|
||||
GTK_WIDGET_CLASS (gtk_spin_button_parent_class)->realize (widget);
|
||||
|
||||
attributes.window_type = GDK_WINDOW_CHILD;
|
||||
attributes.wclass = GDK_INPUT_OUTPUT;
|
||||
attributes.wclass = GDK_INPUT_ONLY;
|
||||
attributes.visual = gtk_widget_get_visual (widget);
|
||||
attributes.event_mask = gtk_widget_get_events (widget);
|
||||
attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK
|
||||
@ -607,8 +607,8 @@ gtk_spin_button_realize (GtkWidget *widget)
|
||||
|
||||
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
|
||||
|
||||
attributes.x = allocation.width - arrow_size - 2 * style->xthickness;
|
||||
attributes.y = (allocation.height - requisition.height) / 2;
|
||||
attributes.x = allocation.x + allocation.width - arrow_size - 2 * style->xthickness;
|
||||
attributes.y = allocation.y + (allocation.height - requisition.height) / 2;
|
||||
attributes.width = arrow_size + 2 * style->xthickness;
|
||||
attributes.height = requisition.height;
|
||||
|
||||
@ -616,9 +616,6 @@ gtk_spin_button_realize (GtkWidget *widget)
|
||||
&attributes, attributes_mask);
|
||||
gdk_window_set_user_data (priv->panel, widget);
|
||||
|
||||
gtk_style_set_background (style,
|
||||
priv->panel, GTK_STATE_NORMAL);
|
||||
|
||||
return_val = FALSE;
|
||||
g_signal_emit (spin_button, spinbutton_signals[OUTPUT], 0, &return_val);
|
||||
if (return_val == FALSE)
|
||||
@ -755,14 +752,15 @@ gtk_spin_button_size_allocate (GtkWidget *widget,
|
||||
gtk_widget_set_allocation (widget, allocation);
|
||||
|
||||
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
|
||||
panel_allocation.x = 0;
|
||||
panel_allocation.x = allocation->x;
|
||||
else
|
||||
panel_allocation.x = allocation->width - panel_width;
|
||||
panel_allocation.x = allocation->x + allocation->width - panel_width;
|
||||
|
||||
panel_allocation.width = panel_width;
|
||||
panel_allocation.height = MIN (requisition.height, allocation->height);
|
||||
|
||||
panel_allocation.y = 0;
|
||||
panel_allocation.y = allocation->y +
|
||||
(allocation->height - requisition.height) / 2;
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_spin_button_parent_class)->size_allocate (widget, allocation);
|
||||
|
||||
@ -784,36 +782,32 @@ gtk_spin_button_draw (GtkWidget *widget,
|
||||
{
|
||||
GtkSpinButton *spin = GTK_SPIN_BUTTON (widget);
|
||||
GtkSpinButtonPrivate *priv = spin->priv;
|
||||
GtkShadowType shadow_type;
|
||||
GtkStateType state;
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_spin_button_parent_class)->draw (widget, cr);
|
||||
|
||||
if (gtk_cairo_should_draw_window (cr, priv->panel))
|
||||
{
|
||||
GtkShadowType shadow_type;
|
||||
cairo_save (cr);
|
||||
|
||||
shadow_type = spin_button_get_shadow_type (spin);
|
||||
shadow_type = spin_button_get_shadow_type (spin);
|
||||
|
||||
gtk_cairo_transform_to_window (cr, widget, priv->panel);
|
||||
state = gtk_widget_has_focus (widget) ?
|
||||
GTK_STATE_ACTIVE : gtk_widget_get_state (widget);
|
||||
|
||||
if (shadow_type != GTK_SHADOW_NONE)
|
||||
{
|
||||
GtkStateType state;
|
||||
gtk_cairo_transform_to_window (cr, widget, priv->panel);
|
||||
|
||||
state = gtk_widget_has_focus (widget) ?
|
||||
GTK_STATE_ACTIVE : gtk_widget_get_state (widget);
|
||||
gtk_paint_box (gtk_widget_get_style (widget), cr,
|
||||
state, shadow_type,
|
||||
widget, "spinbutton",
|
||||
0, 0,
|
||||
gdk_window_get_width (priv->panel),
|
||||
gdk_window_get_height (priv->panel));
|
||||
|
||||
gtk_paint_box (gtk_widget_get_style (widget), cr,
|
||||
state, shadow_type,
|
||||
widget, "spinbutton",
|
||||
0, 0,
|
||||
gdk_window_get_width (priv->panel),
|
||||
gdk_window_get_height (priv->panel));
|
||||
}
|
||||
gtk_spin_button_draw_arrow (spin, cr, GTK_ARROW_UP);
|
||||
gtk_spin_button_draw_arrow (spin, cr, GTK_ARROW_DOWN);
|
||||
|
||||
cairo_restore (cr);
|
||||
|
||||
gtk_spin_button_draw_arrow (spin, cr, GTK_ARROW_UP);
|
||||
gtk_spin_button_draw_arrow (spin, cr, GTK_ARROW_DOWN);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -844,18 +838,18 @@ spin_button_at_limit (GtkSpinButton *spin_button,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_spin_button_draw_arrow (GtkSpinButton *spin_button,
|
||||
gtk_spin_button_draw_arrow (GtkSpinButton *spin_button,
|
||||
cairo_t *cr,
|
||||
GtkArrowType arrow_type)
|
||||
{
|
||||
GtkSpinButtonPrivate *priv;
|
||||
GtkRequisition requisition;
|
||||
GtkStateType state_type;
|
||||
GtkShadowType shadow_type;
|
||||
GtkStyle *style;
|
||||
GtkWidget *widget;
|
||||
gint x;
|
||||
gint y;
|
||||
gint panel_height;
|
||||
gint height;
|
||||
gint width;
|
||||
gint h, w;
|
||||
@ -866,23 +860,23 @@ gtk_spin_button_draw_arrow (GtkSpinButton *spin_button,
|
||||
widget = GTK_WIDGET (spin_button);
|
||||
|
||||
style = gtk_widget_get_style (widget);
|
||||
gtk_widget_get_preferred_size (widget, &requisition, NULL);
|
||||
|
||||
width = spin_button_get_arrow_size (spin_button) + 2 * style->xthickness;
|
||||
panel_height = gdk_window_get_height (priv->panel);
|
||||
|
||||
if (arrow_type == GTK_ARROW_UP)
|
||||
{
|
||||
x = 0;
|
||||
y = 0;
|
||||
|
||||
height = requisition.height / 2;
|
||||
height = panel_height / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = 0;
|
||||
y = requisition.height / 2;
|
||||
y = panel_height / 2;
|
||||
|
||||
height = (requisition.height + 1) / 2;
|
||||
height = (panel_height + 1) / 2;
|
||||
}
|
||||
|
||||
if (spin_button_at_limit (spin_button, arrow_type))
|
||||
@ -919,7 +913,7 @@ gtk_spin_button_draw_arrow (GtkSpinButton *spin_button,
|
||||
(arrow_type == GTK_ARROW_UP)? "spinbutton_up" : "spinbutton_down",
|
||||
x, y, width, height);
|
||||
|
||||
height = requisition.height;
|
||||
height = panel_height;
|
||||
|
||||
if (arrow_type == GTK_ARROW_DOWN)
|
||||
{
|
||||
|
@ -49,6 +49,7 @@
|
||||
#include "gtktextutil.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
#include "gtkwindow.h"
|
||||
#include "gtkscrollable.h"
|
||||
|
||||
|
||||
/* How scrolling, validation, exposes, etc. work.
|
||||
@ -117,7 +118,7 @@ struct _GtkTextViewPrivate
|
||||
GdkDevice *grab_device;
|
||||
GdkDevice *dnd_device;
|
||||
|
||||
guint selection_drag_handler;
|
||||
gulong selection_drag_handler;
|
||||
guint scroll_timeout;
|
||||
|
||||
GtkTextWindow *text_window;
|
||||
@ -222,7 +223,6 @@ struct _GtkTextPendingScroll
|
||||
|
||||
enum
|
||||
{
|
||||
SET_SCROLL_ADJUSTMENTS,
|
||||
POPULATE_POPUP,
|
||||
MOVE_CURSOR,
|
||||
PAGE_HORIZONTALLY,
|
||||
@ -258,7 +258,9 @@ enum
|
||||
PROP_BUFFER,
|
||||
PROP_OVERWRITE,
|
||||
PROP_ACCEPTS_TAB,
|
||||
PROP_IM_MODULE
|
||||
PROP_IM_MODULE,
|
||||
PROP_HADJUSTMENT,
|
||||
PROP_VADJUSTMENT
|
||||
};
|
||||
|
||||
static void gtk_text_view_finalize (GObject *object);
|
||||
@ -347,9 +349,6 @@ static void gtk_text_view_drag_data_received (GtkWidget *widget,
|
||||
guint info,
|
||||
guint time);
|
||||
|
||||
static void gtk_text_view_set_scroll_adjustments (GtkTextView *text_view,
|
||||
GtkAdjustment *hadj,
|
||||
GtkAdjustment *vadj);
|
||||
static gboolean gtk_text_view_popup_menu (GtkWidget *widget);
|
||||
|
||||
static void gtk_text_view_move_cursor (GtkTextView *text_view,
|
||||
@ -438,9 +437,6 @@ static void gtk_text_view_set_virtual_cursor_pos (GtkTextView *text_view,
|
||||
gint x,
|
||||
gint y);
|
||||
|
||||
static GtkAdjustment* get_hadjustment (GtkTextView *text_view);
|
||||
static GtkAdjustment* get_vadjustment (GtkTextView *text_view);
|
||||
|
||||
static void gtk_text_view_do_popup (GtkTextView *text_view,
|
||||
GdkEventButton *event);
|
||||
|
||||
@ -457,6 +453,13 @@ static void gtk_text_view_update_adjustments (GtkTextView *text_view);
|
||||
static void gtk_text_view_invalidate (GtkTextView *text_view);
|
||||
static void gtk_text_view_flush_first_validate (GtkTextView *text_view);
|
||||
|
||||
static void gtk_text_view_set_hadjustment (GtkTextView *text_view,
|
||||
GtkAdjustment *adjustment);
|
||||
static void gtk_text_view_set_vadjustment (GtkTextView *text_view,
|
||||
GtkAdjustment *adjustment);
|
||||
static void gtk_text_view_set_hadjustment_values (GtkTextView *text_view);
|
||||
static void gtk_text_view_set_vadjustment_values (GtkTextView *text_view);
|
||||
|
||||
static void gtk_text_view_update_im_spot_location (GtkTextView *text_view);
|
||||
|
||||
/* Container methods */
|
||||
@ -532,7 +535,8 @@ static gint text_window_get_height (GtkTextWindow *win);
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
G_DEFINE_TYPE (GtkTextView, gtk_text_view, GTK_TYPE_CONTAINER)
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkTextView, gtk_text_view, GTK_TYPE_CONTAINER,
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_SCROLLABLE, NULL))
|
||||
|
||||
static void
|
||||
add_move_binding (GtkBindingSet *binding_set,
|
||||
@ -615,7 +619,6 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
|
||||
klass->copy_clipboard = gtk_text_view_copy_clipboard;
|
||||
klass->paste_clipboard = gtk_text_view_paste_clipboard;
|
||||
klass->toggle_overwrite = gtk_text_view_toggle_overwrite;
|
||||
klass->set_scroll_adjustments = gtk_text_view_set_scroll_adjustments;
|
||||
|
||||
/*
|
||||
* Properties
|
||||
@ -767,6 +770,10 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
|
||||
NULL,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
/* GtkScrollable interface */
|
||||
g_object_class_override_property (gobject_class, PROP_HADJUSTMENT, "hadjustment");
|
||||
g_object_class_override_property (gobject_class, PROP_VADJUSTMENT, "vadjustment");
|
||||
|
||||
/*
|
||||
* Style properties
|
||||
*/
|
||||
@ -1020,27 +1027,6 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
|
||||
_gtk_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
/**
|
||||
* GtkTextView::set-scroll-adjustments
|
||||
* @horizontal: the horizontal #GtkAdjustment
|
||||
* @vertical: the vertical #GtkAdjustment
|
||||
*
|
||||
* Set the scroll adjustments for the text view. Usually scrolled containers
|
||||
* like #GtkScrolledWindow will emit this signal to connect two instances
|
||||
* of #GtkScrollbar to the scroll directions of the #GtkTextView.
|
||||
*/
|
||||
signals[SET_SCROLL_ADJUSTMENTS] =
|
||||
g_signal_new (I_("set-scroll-adjustments"),
|
||||
G_OBJECT_CLASS_TYPE (gobject_class),
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
|
||||
G_STRUCT_OFFSET (GtkTextViewClass, set_scroll_adjustments),
|
||||
NULL, NULL,
|
||||
_gtk_marshal_VOID__OBJECT_OBJECT,
|
||||
G_TYPE_NONE, 2,
|
||||
GTK_TYPE_ADJUSTMENT,
|
||||
GTK_TYPE_ADJUSTMENT);
|
||||
widget_class->set_scroll_adjustments_signal = signals[SET_SCROLL_ADJUSTMENTS];
|
||||
|
||||
/**
|
||||
* GtkTextView::populate-popup:
|
||||
* @entry: The text view on which the signal is emitted
|
||||
@ -1913,7 +1899,7 @@ gtk_text_view_scroll_to_iter (GtkTextView *text_view,
|
||||
|
||||
if (scroll_inc != 0)
|
||||
{
|
||||
retval = set_adjustment_clamped (get_vadjustment (text_view),
|
||||
retval = set_adjustment_clamped (text_view->priv->vadjustment,
|
||||
current_y_scroll + scroll_inc);
|
||||
|
||||
DV (g_print (" vert increment %d\n", scroll_inc));
|
||||
@ -1950,7 +1936,7 @@ gtk_text_view_scroll_to_iter (GtkTextView *text_view,
|
||||
|
||||
if (scroll_inc != 0)
|
||||
{
|
||||
retval = set_adjustment_clamped (get_hadjustment (text_view),
|
||||
retval = set_adjustment_clamped (text_view->priv->hadjustment,
|
||||
current_x_scroll + scroll_inc);
|
||||
|
||||
DV (g_print (" horiz increment %d\n", scroll_inc));
|
||||
@ -2078,33 +2064,6 @@ gtk_text_view_flush_scroll (GtkTextView *text_view)
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_text_view_set_adjustment_upper (GtkAdjustment *adj, gdouble upper)
|
||||
{
|
||||
if (upper != adj->upper)
|
||||
{
|
||||
gdouble min = MAX (0.0, upper - adj->page_size);
|
||||
gboolean value_changed = FALSE;
|
||||
|
||||
adj->upper = upper;
|
||||
|
||||
if (adj->value > min)
|
||||
{
|
||||
adj->value = min;
|
||||
value_changed = TRUE;
|
||||
}
|
||||
|
||||
gtk_adjustment_changed (adj);
|
||||
DV(g_print(">Changed adj upper to %g ("G_STRLOC")\n", upper));
|
||||
|
||||
if (value_changed)
|
||||
{
|
||||
DV(g_print(">Changed adj value because upper decreased ("G_STRLOC")\n"));
|
||||
gtk_adjustment_value_changed (adj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_text_view_update_adjustments (GtkTextView *text_view)
|
||||
{
|
||||
@ -2129,28 +2088,8 @@ gtk_text_view_update_adjustments (GtkTextView *text_view)
|
||||
priv->width = width;
|
||||
priv->height = height;
|
||||
|
||||
gtk_text_view_set_adjustment_upper (get_hadjustment (text_view),
|
||||
MAX (SCREEN_WIDTH (text_view), width));
|
||||
gtk_text_view_set_adjustment_upper (get_vadjustment (text_view),
|
||||
MAX (SCREEN_HEIGHT (text_view), height));
|
||||
|
||||
/* hadj/vadj exist since we called get_hadjustment/get_vadjustment above */
|
||||
|
||||
/* Set up the step sizes; we'll say that a page is
|
||||
our allocation minus one step, and a step is
|
||||
1/10 of our allocation. */
|
||||
priv->hadjustment->step_increment =
|
||||
SCREEN_WIDTH (text_view) / 10.0;
|
||||
priv->hadjustment->page_increment =
|
||||
SCREEN_WIDTH (text_view) * 0.9;
|
||||
|
||||
priv->vadjustment->step_increment =
|
||||
SCREEN_HEIGHT (text_view) / 10.0;
|
||||
priv->vadjustment->page_increment =
|
||||
SCREEN_HEIGHT (text_view) * 0.9;
|
||||
|
||||
gtk_adjustment_changed (get_hadjustment (text_view));
|
||||
gtk_adjustment_changed (get_vadjustment (text_view));
|
||||
gtk_text_view_set_hadjustment_values (text_view);
|
||||
gtk_text_view_set_vadjustment_values (text_view);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3145,6 +3084,14 @@ gtk_text_view_set_property (GObject *object,
|
||||
gtk_im_multicontext_set_context_id (GTK_IM_MULTICONTEXT (priv->im_context), priv->im_module);
|
||||
break;
|
||||
|
||||
case PROP_HADJUSTMENT:
|
||||
gtk_text_view_set_hadjustment (text_view, g_value_get_object (value));
|
||||
break;
|
||||
|
||||
case PROP_VADJUSTMENT:
|
||||
gtk_text_view_set_vadjustment (text_view, g_value_get_object (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@ -3225,6 +3172,14 @@ gtk_text_view_get_property (GObject *object,
|
||||
g_value_set_string (value, priv->im_module);
|
||||
break;
|
||||
|
||||
case PROP_HADJUSTMENT:
|
||||
g_value_set_object (value, priv->hadjustment);
|
||||
break;
|
||||
|
||||
case PROP_VADJUSTMENT:
|
||||
g_value_set_object (value, priv->vadjustment);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@ -3464,8 +3419,6 @@ gtk_text_view_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation widget_allocation;
|
||||
GtkTextView *text_view;
|
||||
GtkTextViewPrivate *priv;
|
||||
GtkTextIter first_para;
|
||||
gint y;
|
||||
gint width, height;
|
||||
GdkRectangle text_rect;
|
||||
GdkRectangle left_rect;
|
||||
@ -3596,44 +3549,9 @@ gtk_text_view_size_allocate (GtkWidget *widget,
|
||||
/* Note that this will do some layout validation */
|
||||
gtk_text_view_allocate_children (text_view);
|
||||
|
||||
/* Ensure h/v adj exist */
|
||||
get_hadjustment (text_view);
|
||||
get_vadjustment (text_view);
|
||||
|
||||
priv->hadjustment->page_size = SCREEN_WIDTH (text_view);
|
||||
priv->hadjustment->page_increment = SCREEN_WIDTH (text_view) * 0.9;
|
||||
priv->hadjustment->step_increment = SCREEN_WIDTH (text_view) * 0.1;
|
||||
priv->hadjustment->lower = 0;
|
||||
priv->hadjustment->upper = MAX (SCREEN_WIDTH (text_view),
|
||||
priv->width);
|
||||
|
||||
if (priv->hadjustment->value > priv->hadjustment->upper - priv->hadjustment->page_size)
|
||||
gtk_adjustment_set_value (priv->hadjustment, MAX (0, priv->hadjustment->upper - priv->hadjustment->page_size));
|
||||
|
||||
gtk_adjustment_changed (priv->hadjustment);
|
||||
|
||||
priv->vadjustment->page_size = SCREEN_HEIGHT (text_view);
|
||||
priv->vadjustment->page_increment = SCREEN_HEIGHT (text_view) * 0.9;
|
||||
priv->vadjustment->step_increment = SCREEN_HEIGHT (text_view) * 0.1;
|
||||
priv->vadjustment->lower = 0;
|
||||
priv->vadjustment->upper = MAX (SCREEN_HEIGHT (text_view),
|
||||
priv->height);
|
||||
|
||||
/* Now adjust the value of the adjustment to keep the cursor at the
|
||||
* same place in the buffer
|
||||
*/
|
||||
gtk_text_view_get_first_para_iter (text_view, &first_para);
|
||||
gtk_text_layout_get_line_yrange (priv->layout, &first_para, &y, NULL);
|
||||
|
||||
y += priv->first_para_pixels;
|
||||
|
||||
if (y > priv->vadjustment->upper - priv->vadjustment->page_size)
|
||||
y = MAX (0, priv->vadjustment->upper - priv->vadjustment->page_size);
|
||||
|
||||
if (y != priv->yoffset)
|
||||
gtk_adjustment_set_value (priv->vadjustment, y);
|
||||
|
||||
gtk_adjustment_changed (priv->vadjustment);
|
||||
/* Update adjustments */
|
||||
gtk_text_view_set_hadjustment_values (text_view);
|
||||
gtk_text_view_set_vadjustment_values (text_view);
|
||||
|
||||
/* The GTK resize loop processes all the pending exposes right
|
||||
* after doing the resize stuff, so the idle sizer won't have a
|
||||
@ -3912,14 +3830,14 @@ changed_handler (GtkTextLayout *layout,
|
||||
{
|
||||
priv->yoffset += new_first_para_top - old_first_para_top;
|
||||
|
||||
get_vadjustment (text_view)->value = priv->yoffset;
|
||||
text_view->priv->vadjustment->value = priv->yoffset;
|
||||
yoffset_changed = TRUE;
|
||||
}
|
||||
|
||||
if (yoffset_changed)
|
||||
{
|
||||
DV(g_print ("Changing scroll position (%s)\n", G_STRLOC));
|
||||
gtk_adjustment_value_changed (get_vadjustment (text_view));
|
||||
gtk_adjustment_value_changed (text_view->priv->vadjustment);
|
||||
}
|
||||
|
||||
/* FIXME be smarter about which anchored widgets we update */
|
||||
@ -5508,15 +5426,15 @@ gtk_text_view_move_viewport (GtkTextView *text_view,
|
||||
case GTK_SCROLL_STEPS:
|
||||
case GTK_SCROLL_PAGES:
|
||||
case GTK_SCROLL_ENDS:
|
||||
adjustment = get_vadjustment (text_view);
|
||||
adjustment = text_view->priv->vadjustment;
|
||||
break;
|
||||
case GTK_SCROLL_HORIZONTAL_STEPS:
|
||||
case GTK_SCROLL_HORIZONTAL_PAGES:
|
||||
case GTK_SCROLL_HORIZONTAL_ENDS:
|
||||
adjustment = get_hadjustment (text_view);
|
||||
adjustment = text_view->priv->hadjustment;
|
||||
break;
|
||||
default:
|
||||
adjustment = get_vadjustment (text_view);
|
||||
adjustment = text_view->priv->vadjustment;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -7296,13 +7214,43 @@ gtk_text_view_drag_data_received (GtkWidget *widget,
|
||||
* Returns: (transfer none): pointer to the horizontal #GtkAdjustment
|
||||
*
|
||||
* Since: 2.22
|
||||
*
|
||||
* Deprecated: 3.0: Use gtk_scrollable_get_hadjustment()
|
||||
**/
|
||||
GtkAdjustment*
|
||||
gtk_text_view_get_hadjustment (GtkTextView *text_view)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_TEXT_VIEW (text_view), NULL);
|
||||
|
||||
return get_hadjustment (text_view);
|
||||
return text_view->priv->hadjustment;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_text_view_set_hadjustment (GtkTextView *text_view,
|
||||
GtkAdjustment *adjustment)
|
||||
{
|
||||
GtkTextViewPrivate *priv = text_view->priv;
|
||||
|
||||
if (adjustment && priv->hadjustment == adjustment)
|
||||
return;
|
||||
|
||||
if (priv->hadjustment != NULL)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (priv->hadjustment,
|
||||
gtk_text_view_value_changed,
|
||||
text_view);
|
||||
g_object_unref (priv->hadjustment);
|
||||
}
|
||||
|
||||
if (adjustment == NULL)
|
||||
adjustment = gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
|
||||
|
||||
g_signal_connect (adjustment, "value-changed",
|
||||
G_CALLBACK (gtk_text_view_value_changed), text_view);
|
||||
priv->hadjustment = g_object_ref_sink (adjustment);
|
||||
gtk_text_view_set_hadjustment_values (text_view);
|
||||
|
||||
g_object_notify (G_OBJECT (text_view), "hadjustment");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -7320,90 +7268,104 @@ gtk_text_view_get_vadjustment (GtkTextView *text_view)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_TEXT_VIEW (text_view), NULL);
|
||||
|
||||
return get_vadjustment (text_view);
|
||||
}
|
||||
|
||||
static GtkAdjustment*
|
||||
get_hadjustment (GtkTextView *text_view)
|
||||
{
|
||||
if (text_view->priv->hadjustment == NULL)
|
||||
gtk_text_view_set_scroll_adjustments (text_view,
|
||||
NULL, /* forces creation */
|
||||
text_view->priv->vadjustment);
|
||||
|
||||
return text_view->priv->hadjustment;
|
||||
}
|
||||
|
||||
static GtkAdjustment*
|
||||
get_vadjustment (GtkTextView *text_view)
|
||||
{
|
||||
if (text_view->priv->vadjustment == NULL)
|
||||
gtk_text_view_set_scroll_adjustments (text_view,
|
||||
text_view->priv->hadjustment,
|
||||
NULL); /* forces creation */
|
||||
return text_view->priv->vadjustment;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gtk_text_view_set_scroll_adjustments (GtkTextView *text_view,
|
||||
GtkAdjustment *hadj,
|
||||
GtkAdjustment *vadj)
|
||||
gtk_text_view_set_vadjustment (GtkTextView *text_view,
|
||||
GtkAdjustment *adjustment)
|
||||
{
|
||||
GtkTextViewPrivate *priv = text_view->priv;
|
||||
gboolean need_adjust = FALSE;
|
||||
|
||||
if (hadj)
|
||||
g_return_if_fail (GTK_IS_ADJUSTMENT (hadj));
|
||||
else
|
||||
hadj = gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
|
||||
if (vadj)
|
||||
g_return_if_fail (GTK_IS_ADJUSTMENT (vadj));
|
||||
else
|
||||
vadj = gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
|
||||
if (adjustment && priv->vadjustment == adjustment)
|
||||
return;
|
||||
|
||||
if (priv->hadjustment && (priv->hadjustment != hadj))
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (priv->hadjustment,
|
||||
gtk_text_view_value_changed,
|
||||
text_view);
|
||||
g_object_unref (priv->hadjustment);
|
||||
}
|
||||
|
||||
if (priv->vadjustment && (priv->vadjustment != vadj))
|
||||
if (priv->vadjustment != NULL)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (priv->vadjustment,
|
||||
gtk_text_view_value_changed,
|
||||
text_view);
|
||||
gtk_text_view_value_changed,
|
||||
text_view);
|
||||
g_object_unref (priv->vadjustment);
|
||||
}
|
||||
|
||||
if (priv->hadjustment != hadj)
|
||||
{
|
||||
priv->hadjustment = hadj;
|
||||
g_object_ref_sink (priv->hadjustment);
|
||||
|
||||
g_signal_connect (priv->hadjustment, "value-changed",
|
||||
G_CALLBACK (gtk_text_view_value_changed),
|
||||
text_view);
|
||||
need_adjust = TRUE;
|
||||
}
|
||||
if (adjustment == NULL)
|
||||
adjustment = gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
|
||||
|
||||
if (priv->vadjustment != vadj)
|
||||
{
|
||||
priv->vadjustment = vadj;
|
||||
g_object_ref_sink (priv->vadjustment);
|
||||
|
||||
g_signal_connect (priv->vadjustment, "value-changed",
|
||||
G_CALLBACK (gtk_text_view_value_changed),
|
||||
text_view);
|
||||
need_adjust = TRUE;
|
||||
}
|
||||
g_signal_connect (adjustment, "value-changed",
|
||||
G_CALLBACK (gtk_text_view_value_changed), text_view);
|
||||
priv->vadjustment = g_object_ref_sink (adjustment);
|
||||
gtk_text_view_set_vadjustment_values (text_view);
|
||||
|
||||
if (need_adjust)
|
||||
gtk_text_view_value_changed (NULL, text_view);
|
||||
g_object_notify (G_OBJECT (text_view), "vadjustment");
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_text_view_set_hadjustment_values (GtkTextView *text_view)
|
||||
{
|
||||
GtkTextViewPrivate *priv;
|
||||
gint screen_width;
|
||||
gdouble old_value;
|
||||
gdouble new_value;
|
||||
gdouble new_upper;
|
||||
|
||||
priv = text_view->priv;
|
||||
|
||||
screen_width = SCREEN_WIDTH (text_view);
|
||||
old_value = gtk_adjustment_get_value (priv->hadjustment);
|
||||
new_upper = MAX (screen_width, priv->width);
|
||||
|
||||
g_object_set (priv->hadjustment,
|
||||
"lower", 0.0,
|
||||
"upper", new_upper,
|
||||
"page-size", (gdouble)screen_width,
|
||||
"step-increment", screen_width * 0.1,
|
||||
"page-increment", screen_width * 0.9,
|
||||
NULL);
|
||||
|
||||
new_value = CLAMP (old_value, 0, new_upper - screen_width);
|
||||
if (new_value != old_value)
|
||||
gtk_adjustment_set_value (priv->hadjustment, new_value);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_text_view_set_vadjustment_values (GtkTextView *text_view)
|
||||
{
|
||||
GtkTextViewPrivate *priv;
|
||||
GtkTextIter first_para;
|
||||
gint screen_height;
|
||||
gint y;
|
||||
gdouble old_value;
|
||||
gdouble new_value;
|
||||
gdouble new_upper;
|
||||
|
||||
priv = text_view->priv;
|
||||
|
||||
screen_height = SCREEN_HEIGHT (text_view);
|
||||
old_value = gtk_adjustment_get_value (priv->vadjustment);
|
||||
new_upper = MAX (screen_height, priv->height);
|
||||
|
||||
g_object_set (priv->vadjustment,
|
||||
"lower", 0.0,
|
||||
"upper", new_upper,
|
||||
"page-size", (gdouble)screen_height,
|
||||
"step-increment", screen_height * 0.1,
|
||||
"page-increment", screen_height * 0.9,
|
||||
NULL);
|
||||
|
||||
/* Now adjust the value of the adjustment to keep the cursor at the
|
||||
* same place in the buffer */
|
||||
gtk_text_view_ensure_layout (text_view);
|
||||
gtk_text_view_get_first_para_iter (text_view, &first_para);
|
||||
gtk_text_layout_get_line_yrange (priv->layout, &first_para, &y, NULL);
|
||||
|
||||
y += priv->first_para_pixels;
|
||||
|
||||
new_value = CLAMP (y, 0, new_upper - screen_height);
|
||||
if (new_value != old_value)
|
||||
gtk_adjustment_set_value (priv->vadjustment, new_value);
|
||||
}
|
||||
|
||||
|
||||
/* FIXME this adjust_allocation is a big cut-and-paste from
|
||||
* GtkCList, needs to be some "official" way to do this
|
||||
* factored out.
|
||||
|
@ -73,10 +73,6 @@ struct _GtkTextViewClass
|
||||
{
|
||||
GtkContainerClass parent_class;
|
||||
|
||||
void (* set_scroll_adjustments) (GtkTextView *text_view,
|
||||
GtkAdjustment *hadjustment,
|
||||
GtkAdjustment *vadjustment);
|
||||
|
||||
void (* populate_popup) (GtkTextView *text_view,
|
||||
GtkMenu *menu);
|
||||
|
||||
@ -182,8 +178,10 @@ void gtk_text_view_window_to_buffer_coords (GtkTextView *text_view,
|
||||
gint *buffer_x,
|
||||
gint *buffer_y);
|
||||
|
||||
GtkAdjustment* gtk_text_view_get_hadjustment (GtkTextView *text_view);
|
||||
GtkAdjustment* gtk_text_view_get_vadjustment (GtkTextView *text_view);
|
||||
#ifndef GTK_DISABLE_DEPRECATED
|
||||
GtkAdjustment* gtk_text_view_get_hadjustment (GtkTextView *text_view);
|
||||
GtkAdjustment* gtk_text_view_get_vadjustment (GtkTextView *text_view);
|
||||
#endif
|
||||
|
||||
GdkWindow* gtk_text_view_get_window (GtkTextView *text_view,
|
||||
GtkTextWindowType win);
|
||||
|
@ -1083,7 +1083,7 @@ gtk_tool_item_group_set_focus_cb (GtkWidget *window,
|
||||
/* Check that the focused widgets is fully visible within
|
||||
* the group's parent widget and make it visible otherwise. */
|
||||
|
||||
adjustment = gtk_tool_palette_get_vadjustment (GTK_TOOL_PALETTE (p));
|
||||
adjustment = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (p));
|
||||
|
||||
if (adjustment)
|
||||
{
|
||||
@ -1107,7 +1107,7 @@ gtk_tool_item_group_set_focus_cb (GtkWidget *window,
|
||||
}
|
||||
}
|
||||
|
||||
adjustment = gtk_tool_palette_get_hadjustment (GTK_TOOL_PALETTE (p));
|
||||
adjustment = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (p));
|
||||
|
||||
if (adjustment)
|
||||
{
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "gtkmarshalers.h"
|
||||
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkscrollable.h"
|
||||
#include "gtkintl.h"
|
||||
|
||||
#define DEFAULT_ICON_SIZE GTK_ICON_SIZE_SMALL_TOOLBAR
|
||||
@ -120,6 +121,8 @@ enum
|
||||
PROP_ICON_SIZE_SET,
|
||||
PROP_ORIENTATION,
|
||||
PROP_TOOLBAR_STYLE,
|
||||
PROP_HADJUSTMENT,
|
||||
PROP_VADJUSTMENT
|
||||
};
|
||||
|
||||
enum
|
||||
@ -133,7 +136,7 @@ struct _GtkToolItemGroupInfo
|
||||
{
|
||||
GtkToolItemGroup *widget;
|
||||
|
||||
guint notify_collapsed;
|
||||
gulong notify_collapsed;
|
||||
guint pos;
|
||||
guint exclusive : 1;
|
||||
guint expand : 1;
|
||||
@ -177,10 +180,17 @@ static const GtkTargetEntry dnd_targets[] =
|
||||
{ "application/x-gtk-tool-palette-group", GTK_TARGET_SAME_APP, 0 },
|
||||
};
|
||||
|
||||
static void gtk_tool_palette_set_hadjustment (GtkToolPalette *palette,
|
||||
GtkAdjustment *adjustment);
|
||||
static void gtk_tool_palette_set_vadjustment (GtkToolPalette *palette,
|
||||
GtkAdjustment *adjustment);
|
||||
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkToolPalette,
|
||||
gtk_tool_palette,
|
||||
GTK_TYPE_CONTAINER,
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE, NULL));
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE, NULL)
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_SCROLLABLE, NULL))
|
||||
|
||||
static void
|
||||
gtk_tool_palette_init (GtkToolPalette *palette)
|
||||
@ -258,6 +268,14 @@ gtk_tool_palette_set_property (GObject *object,
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_HADJUSTMENT:
|
||||
gtk_tool_palette_set_hadjustment (palette, g_value_get_object (value));
|
||||
break;
|
||||
|
||||
case PROP_VADJUSTMENT:
|
||||
gtk_tool_palette_set_vadjustment (palette, g_value_get_object (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@ -290,6 +308,14 @@ gtk_tool_palette_get_property (GObject *object,
|
||||
g_value_set_enum (value, gtk_tool_palette_get_style (palette));
|
||||
break;
|
||||
|
||||
case PROP_HADJUSTMENT:
|
||||
g_value_set_object (value, palette->priv->hadjustment);
|
||||
break;
|
||||
|
||||
case PROP_VADJUSTMENT:
|
||||
g_value_set_object (value, palette->priv->vadjustment);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@ -702,36 +728,6 @@ gtk_tool_palette_adjustment_value_changed (GtkAdjustment *adjustment,
|
||||
gtk_tool_palette_size_allocate (widget, &allocation);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tool_palette_set_scroll_adjustments (GtkWidget *widget,
|
||||
GtkAdjustment *hadjustment,
|
||||
GtkAdjustment *vadjustment)
|
||||
{
|
||||
GtkToolPalette *palette = GTK_TOOL_PALETTE (widget);
|
||||
|
||||
if (hadjustment)
|
||||
g_object_ref_sink (hadjustment);
|
||||
if (vadjustment)
|
||||
g_object_ref_sink (vadjustment);
|
||||
|
||||
if (palette->priv->hadjustment)
|
||||
g_object_unref (palette->priv->hadjustment);
|
||||
if (palette->priv->vadjustment)
|
||||
g_object_unref (palette->priv->vadjustment);
|
||||
|
||||
palette->priv->hadjustment = hadjustment;
|
||||
palette->priv->vadjustment = vadjustment;
|
||||
|
||||
if (palette->priv->hadjustment)
|
||||
g_signal_connect (palette->priv->hadjustment, "value-changed",
|
||||
G_CALLBACK (gtk_tool_palette_adjustment_value_changed),
|
||||
palette);
|
||||
if (palette->priv->vadjustment)
|
||||
g_signal_connect (palette->priv->vadjustment, "value-changed",
|
||||
G_CALLBACK (gtk_tool_palette_adjustment_value_changed),
|
||||
palette);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tool_palette_add (GtkContainer *container,
|
||||
GtkWidget *child)
|
||||
@ -952,38 +948,15 @@ gtk_tool_palette_class_init (GtkToolPaletteClass *cls)
|
||||
cclass->set_child_property = gtk_tool_palette_set_child_property;
|
||||
cclass->get_child_property = gtk_tool_palette_get_child_property;
|
||||
|
||||
cls->set_scroll_adjustments = gtk_tool_palette_set_scroll_adjustments;
|
||||
|
||||
/* Handle screen-changed so we can update our GtkSettings.
|
||||
*/
|
||||
wclass->screen_changed = gtk_tool_palette_screen_changed;
|
||||
|
||||
/**
|
||||
* GtkToolPalette::set-scroll-adjustments:
|
||||
* @widget: the GtkToolPalette that received the signal
|
||||
* @hadjustment: The horizontal adjustment
|
||||
* @vadjustment: The vertical adjustment
|
||||
*
|
||||
* Set the scroll adjustments for the viewport.
|
||||
* Usually scrolled containers like GtkScrolledWindow will emit this
|
||||
* signal to connect two instances of GtkScrollbar to the scroll
|
||||
* directions of the GtkToolpalette.
|
||||
*
|
||||
* Since: 2.20
|
||||
*/
|
||||
wclass->set_scroll_adjustments_signal =
|
||||
g_signal_new ("set-scroll-adjustments",
|
||||
G_TYPE_FROM_CLASS (oclass),
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
|
||||
G_STRUCT_OFFSET (GtkToolPaletteClass, set_scroll_adjustments),
|
||||
NULL, NULL,
|
||||
_gtk_marshal_VOID__OBJECT_OBJECT,
|
||||
G_TYPE_NONE, 2,
|
||||
GTK_TYPE_ADJUSTMENT,
|
||||
GTK_TYPE_ADJUSTMENT);
|
||||
|
||||
g_object_class_override_property (oclass, PROP_ORIENTATION, "orientation");
|
||||
|
||||
g_object_class_override_property (oclass, PROP_HADJUSTMENT, "hadjustment");
|
||||
g_object_class_override_property (oclass, PROP_VADJUSTMENT, "vadjustment");
|
||||
|
||||
/**
|
||||
* GtkToolPalette:icon-size:
|
||||
*
|
||||
@ -1908,6 +1881,8 @@ _gtk_tool_palette_set_expanding_child (GtkToolPalette *palette,
|
||||
* Returns: (transfer none): the horizontal adjustment of @palette
|
||||
*
|
||||
* Since: 2.20
|
||||
*
|
||||
* Deprecated: 3.0: Use gtk_scrollable_get_hadjustment()
|
||||
*/
|
||||
GtkAdjustment*
|
||||
gtk_tool_palette_get_hadjustment (GtkToolPalette *palette)
|
||||
@ -1917,6 +1892,35 @@ gtk_tool_palette_get_hadjustment (GtkToolPalette *palette)
|
||||
return palette->priv->hadjustment;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tool_palette_set_hadjustment (GtkToolPalette *palette,
|
||||
GtkAdjustment *adjustment)
|
||||
{
|
||||
GtkToolPalettePrivate *priv = palette->priv;
|
||||
|
||||
if (adjustment && priv->hadjustment == adjustment)
|
||||
return;
|
||||
|
||||
if (priv->hadjustment != NULL)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (priv->hadjustment,
|
||||
gtk_tool_palette_adjustment_value_changed,
|
||||
palette);
|
||||
g_object_unref (priv->hadjustment);
|
||||
}
|
||||
|
||||
if (adjustment == NULL)
|
||||
adjustment = gtk_adjustment_new (0.0, 0.0, 0.0,
|
||||
0.0, 0.0, 0.0);
|
||||
|
||||
g_signal_connect (adjustment, "value-changed",
|
||||
G_CALLBACK (gtk_tool_palette_adjustment_value_changed),
|
||||
palette);
|
||||
priv->hadjustment = g_object_ref_sink (adjustment);
|
||||
/* FIXME: Adjustment should probably have it's values updated now */
|
||||
g_object_notify (G_OBJECT (palette), "hadjustment");
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tool_palette_get_vadjustment:
|
||||
* @palette: a #GtkToolPalette
|
||||
@ -1926,6 +1930,8 @@ gtk_tool_palette_get_hadjustment (GtkToolPalette *palette)
|
||||
* Returns: (transfer none): the vertical adjustment of @palette
|
||||
*
|
||||
* Since: 2.20
|
||||
*
|
||||
* Deprecated: 3.0: Use gtk_scrollable_get_vadjustment()
|
||||
*/
|
||||
GtkAdjustment*
|
||||
gtk_tool_palette_get_vadjustment (GtkToolPalette *palette)
|
||||
@ -1935,6 +1941,35 @@ gtk_tool_palette_get_vadjustment (GtkToolPalette *palette)
|
||||
return palette->priv->vadjustment;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tool_palette_set_vadjustment (GtkToolPalette *palette,
|
||||
GtkAdjustment *adjustment)
|
||||
{
|
||||
GtkToolPalettePrivate *priv = palette->priv;
|
||||
|
||||
if (adjustment && priv->vadjustment == adjustment)
|
||||
return;
|
||||
|
||||
if (priv->vadjustment != NULL)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (priv->vadjustment,
|
||||
gtk_tool_palette_adjustment_value_changed,
|
||||
palette);
|
||||
g_object_unref (priv->vadjustment);
|
||||
}
|
||||
|
||||
if (adjustment == NULL)
|
||||
adjustment = gtk_adjustment_new (0.0, 0.0, 0.0,
|
||||
0.0, 0.0, 0.0);
|
||||
|
||||
g_signal_connect (adjustment, "value-changed",
|
||||
G_CALLBACK (gtk_tool_palette_adjustment_value_changed),
|
||||
palette);
|
||||
priv->vadjustment = g_object_ref_sink (adjustment);
|
||||
/* FIXME: Adjustment should probably have it's values updated now */
|
||||
g_object_notify (G_OBJECT (palette), "vadjustment");
|
||||
}
|
||||
|
||||
GtkSizeGroup *
|
||||
_gtk_tool_palette_get_size_group (GtkToolPalette *palette)
|
||||
{
|
||||
|
@ -72,10 +72,6 @@ struct _GtkToolPaletteClass
|
||||
{
|
||||
GtkContainerClass parent_class;
|
||||
|
||||
void (*set_scroll_adjustments) (GtkWidget *widget,
|
||||
GtkAdjustment *hadjustment,
|
||||
GtkAdjustment *vadjustment);
|
||||
|
||||
/* Padding for future expansion */
|
||||
void (*_gtk_reserved1) (void);
|
||||
void (*_gtk_reserved2) (void);
|
||||
@ -130,9 +126,13 @@ void gtk_tool_palette_add_drag_dest (GtkToolPa
|
||||
GtkToolPaletteDragTargets targets,
|
||||
GdkDragAction actions);
|
||||
|
||||
#ifndef GTK_DISABLE_DEPRECATED
|
||||
|
||||
GtkAdjustment* gtk_tool_palette_get_hadjustment (GtkToolPalette *palette);
|
||||
GtkAdjustment* gtk_tool_palette_get_vadjustment (GtkToolPalette *palette);
|
||||
|
||||
#endif
|
||||
|
||||
G_CONST_RETURN GtkTargetEntry* gtk_tool_palette_get_drag_target_item (void) G_GNUC_CONST;
|
||||
G_CONST_RETURN GtkTargetEntry* gtk_tool_palette_get_drag_target_group (void) G_GNUC_CONST;
|
||||
|
||||
|
@ -25,6 +25,37 @@
|
||||
#include "gtkprivate.h"
|
||||
#include <string.h>
|
||||
|
||||
|
||||
/**
|
||||
* SECTION:gtktreemodelfilter
|
||||
* @Short_description: A GtkTreeModel which hides parts of an underlying tree model
|
||||
* @Title: GtkTreeModelFilter
|
||||
* @See_also:#GtkTreeModelSort
|
||||
*
|
||||
* A #GtkTreeModelFilter is a tree model which wraps another tree model,
|
||||
* and can do the following things:
|
||||
* <itemizedlist>
|
||||
* <listitem><para>
|
||||
* Filter specific rows, based on data from a "visible column", a column
|
||||
* storing booleans indicating whether the row should be filtered or not,
|
||||
* or based on the return value of a "visible function", which gets a
|
||||
* model, iter and user_data and returns a boolean indicating whether the
|
||||
* row should be filtered or not.
|
||||
* </para></listitem>
|
||||
* <listitem><para>
|
||||
* Modify the "appearance" of the model, using a modify function.
|
||||
* This is extremely powerful and allows for just changing
|
||||
* some values and also for creating a completely different model based on
|
||||
* the given child model.
|
||||
* </para></listitem>
|
||||
* <listitem><para>
|
||||
* Set a different root node, also known as a "virtual root". You can pass in
|
||||
* a #GtkTreePath indicating the root node for the filter at construction time.
|
||||
* </para></listitem>
|
||||
* </itemizedlist>
|
||||
*/
|
||||
|
||||
|
||||
/* ITER FORMAT:
|
||||
*
|
||||
* iter->stamp = filter->priv->stamp
|
||||
@ -106,11 +137,11 @@ struct _GtkTreeModelFilterPrivate
|
||||
gboolean virtual_root_deleted;
|
||||
|
||||
/* signal ids */
|
||||
guint changed_id;
|
||||
guint inserted_id;
|
||||
guint has_child_toggled_id;
|
||||
guint deleted_id;
|
||||
guint reordered_id;
|
||||
gulong changed_id;
|
||||
gulong inserted_id;
|
||||
gulong has_child_toggled_id;
|
||||
gulong deleted_id;
|
||||
gulong reordered_id;
|
||||
};
|
||||
|
||||
/* properties */
|
||||
|
@ -37,9 +37,38 @@ G_BEGIN_DECLS
|
||||
#define GTK_IS_TREE_MODEL_FILTER_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), GTK_TYPE_TREE_MODEL_FILTER))
|
||||
#define GTK_TREE_MODEL_FILTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TREE_MODEL_FILTER, GtkTreeModelFilterClass))
|
||||
|
||||
/**
|
||||
* GtkTreeModelFilterVisibleFunc:
|
||||
* @model: the child model of the #GtkTreeModelFilter
|
||||
* @iter: a #GtkTreeIter pointing to the row in @model whose visibility
|
||||
* is determined
|
||||
* @data: user data given to gtk_tree_model_filter_set_visible_func()
|
||||
*
|
||||
* A function which decides whether the row indicated by @iter is visible.
|
||||
*
|
||||
* Returns: Whether the row indicated by @iter is visible.
|
||||
*/
|
||||
typedef gboolean (* GtkTreeModelFilterVisibleFunc) (GtkTreeModel *model,
|
||||
GtkTreeIter *iter,
|
||||
gpointer data);
|
||||
|
||||
/**
|
||||
* GtkTreeModelFilterModifyFunc:
|
||||
* @model: the #GtkTreeModelFilter
|
||||
* @iter: a #GtkTreeIter pointing to the row whose display values are determined
|
||||
* @value: A #GValue which is already initialized for with the correct type for
|
||||
* the column @column.
|
||||
* @column: the column whose display value is determined
|
||||
* @data: user data given to gtk_tree_model_filter_set_modify_func()
|
||||
*
|
||||
* A function which calculates display values from raw values in the model.
|
||||
* It must fill @value with the display value for the column @column in the
|
||||
* row indicated by @iter.
|
||||
*
|
||||
* Since this function is called for each data access, it's not a
|
||||
* particularly efficient operation.
|
||||
*/
|
||||
|
||||
typedef void (* GtkTreeModelFilterModifyFunc) (GtkTreeModel *model,
|
||||
GtkTreeIter *iter,
|
||||
GValue *value,
|
||||
|
@ -62,11 +62,11 @@ struct _GtkTreeModelSort
|
||||
GDestroyNotify GSEAL (default_sort_destroy);
|
||||
|
||||
/* signal ids */
|
||||
guint GSEAL (changed_id);
|
||||
guint GSEAL (inserted_id);
|
||||
guint GSEAL (has_child_toggled_id);
|
||||
guint GSEAL (deleted_id);
|
||||
guint GSEAL (reordered_id);
|
||||
gulong GSEAL (changed_id);
|
||||
gulong GSEAL (inserted_id);
|
||||
gulong GSEAL (has_child_toggled_id);
|
||||
gulong GSEAL (deleted_id);
|
||||
gulong GSEAL (reordered_id);
|
||||
};
|
||||
|
||||
struct _GtkTreeModelSortClass
|
||||
|
@ -102,6 +102,8 @@ struct _GtkTreeViewPrivate
|
||||
/* Adjustments */
|
||||
GtkAdjustment *hadjustment;
|
||||
GtkAdjustment *vadjustment;
|
||||
gint min_display_width;
|
||||
gint min_display_height;
|
||||
|
||||
/* Sub windows */
|
||||
GdkWindow *bin_window;
|
||||
@ -240,7 +242,7 @@ struct _GtkTreeViewPrivate
|
||||
GDestroyNotify search_position_destroy;
|
||||
GtkWidget *search_window;
|
||||
GtkWidget *search_entry;
|
||||
guint search_entry_changed_id;
|
||||
gulong search_entry_changed_id;
|
||||
guint typeselect_flush_timeout;
|
||||
|
||||
/* Grid and tree lines */
|
||||
|
@ -26,6 +26,41 @@
|
||||
#include "gtkintl.h"
|
||||
|
||||
|
||||
/**
|
||||
* SECTION:gtktreeselection
|
||||
* @Short_description: The selection object for GtkTreeView
|
||||
* @Title: GtkTreeSelection
|
||||
* @See_also: #GtkTreeView, #GtkTreeViewColumn, #GtkTreeDnd, #GtkTreeMode,
|
||||
* #GtkTreeSortable, #GtkTreeModelSort, #GtkListStore, #GtkTreeStore,
|
||||
* #GtkCellRenderer, #GtkCellEditable, #GtkCellRendererPixbuf,
|
||||
* #GtkCellRendererText, #GtkCellRendererToggle
|
||||
*
|
||||
* The #GtkTreeSelection object is a helper object to manage the selection
|
||||
* for a #GtkTreeView widget. The #GtkTreeSelection object is
|
||||
* automatically created when a new #GtkTreeView widget is created, and
|
||||
* cannot exist independentally of this widget. The primary reason the
|
||||
* #GtkTreeSelection objects exists is for cleanliness of code and API.
|
||||
* That is, there is no conceptual reason all these functions could not be
|
||||
* methods on the #GtkTreeView widget instead of a separate function.
|
||||
*
|
||||
* The #GtkTreeSelection object is gotten from a #GtkTreeView by calling
|
||||
* gtk_tree_view_get_selection(). It can be manipulated to check the
|
||||
* selection status of the tree, as well as select and deselect individual
|
||||
* rows. Selection is done completely view side. As a result, multiple
|
||||
* views of the same model can have completely different selections.
|
||||
* Additionally, you cannot change the selection of a row on the model that
|
||||
* is not currently displayed by the view without expanding its parents
|
||||
* first.
|
||||
*
|
||||
* One of the important things to remember when monitoring the selection of
|
||||
* a view is that the #GtkTreeSelection::changed signal is mostly a hint.
|
||||
* That is,it may only emit one signal when a range of rows is selected.
|
||||
* Additionally, it may on occasion emit a #GtkTreeSelection::changed signal
|
||||
* when nothing has happened (mostly as a result of programmers calling
|
||||
* select_row on an already selected row).
|
||||
*/
|
||||
|
||||
|
||||
static void gtk_tree_selection_finalize (GObject *object);
|
||||
static gint gtk_tree_selection_real_select_all (GtkTreeSelection *selection);
|
||||
static gint gtk_tree_selection_real_unselect_all (GtkTreeSelection *selection);
|
||||
@ -54,6 +89,15 @@ gtk_tree_selection_class_init (GtkTreeSelectionClass *class)
|
||||
object_class->finalize = gtk_tree_selection_finalize;
|
||||
class->changed = NULL;
|
||||
|
||||
/**
|
||||
* GtkTreeSelection::changed:
|
||||
* @treeselection: the object which received the signal.
|
||||
*
|
||||
* Emitted whenever the selection has (possibly) changed. Please note that
|
||||
* this signal is mostly a hint. It may only be emitted once when a range
|
||||
* of rows are selected, and it may occasionally be emitted when nothing
|
||||
* has happened.
|
||||
*/
|
||||
tree_selection_signals[CHANGED] =
|
||||
g_signal_new (I_("changed"),
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
|
@ -36,11 +36,37 @@ G_BEGIN_DECLS
|
||||
#define GTK_IS_TREE_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TREE_SELECTION))
|
||||
#define GTK_TREE_SELECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TREE_SELECTION, GtkTreeSelectionClass))
|
||||
|
||||
/**
|
||||
* GtkTreeSelectionFunc:
|
||||
* @selection: A #GtkTreeSelection
|
||||
* @model: A #GtkTreeModel being viewed
|
||||
* @path: The #GtkTreePath of the row in question
|
||||
* @path_currently_selected: %TRUE, if the path is currently selected
|
||||
* @data: user data
|
||||
*
|
||||
* A function used by gtk_tree_selection_set_select_function() to filter
|
||||
* whether or not a row may be selected. It is called whenever a row's
|
||||
* state might change. A return value of %TRUE indicates to @selection
|
||||
* that it is okay to change the selection.
|
||||
*
|
||||
* Returns: %TRUE, if the selection state of the row can be toggled
|
||||
*/
|
||||
typedef gboolean (* GtkTreeSelectionFunc) (GtkTreeSelection *selection,
|
||||
GtkTreeModel *model,
|
||||
GtkTreePath *path,
|
||||
gboolean path_currently_selected,
|
||||
gpointer data);
|
||||
|
||||
/**
|
||||
* GtkTreeSelectionForeachFunc:
|
||||
* @model: The #GtkTreeModel being viewed
|
||||
* @path: The #GtkTreePath of a selected row
|
||||
* @iter: A #GtkTreeIter pointing to a selected row
|
||||
* @data: user data
|
||||
*
|
||||
* A function used by gtk_tree_selection_selected_foreach() to map all
|
||||
* selected rows. It will be called on every selected row in the view.
|
||||
*/
|
||||
typedef void (* GtkTreeSelectionForeachFunc) (GtkTreeModel *model,
|
||||
GtkTreePath *path,
|
||||
GtkTreeIter *iter,
|
||||
|
@ -24,6 +24,18 @@
|
||||
#include "gtkintl.h"
|
||||
|
||||
|
||||
/**
|
||||
* SECTION:gtktreesortable
|
||||
* @Short_description: The interface for sortable models used by GtkTreeView
|
||||
* @Title: GtkTreeSortable
|
||||
* @See_also:#GtkTreeModel, #GtkTreeView
|
||||
*
|
||||
* #GtkTreeSortable is an interface to be implemented by tree models which
|
||||
* support sorting. The #GtkTreeView uses the methods provided by this interface
|
||||
* to sort the model.
|
||||
*/
|
||||
|
||||
|
||||
static void gtk_tree_sortable_base_init (gpointer g_class);
|
||||
|
||||
GType
|
||||
|
@ -46,6 +46,28 @@ enum {
|
||||
typedef struct _GtkTreeSortable GtkTreeSortable; /* Dummy typedef */
|
||||
typedef struct _GtkTreeSortableIface GtkTreeSortableIface;
|
||||
|
||||
/**
|
||||
* GtkTreeIterCompareFunc:
|
||||
* @model: The #GtkTreeModel the comparison is within
|
||||
* @a: A #GtkTreeIter in @model
|
||||
* @b: Another #GtkTreeIter in @model
|
||||
* @user_data: Data passed when the compare func is assigned e.g. by
|
||||
* gtk_tree_sortable_set_sort_func()
|
||||
*
|
||||
* A GtkTreeIterCompareFunc should return a negative integer, zero, or a positive
|
||||
* integer if @a sorts before @b, @a sorts with @b, or @a sorts after @b
|
||||
* respectively. If two iters compare as equal, their order in the sorted model
|
||||
* is undefined. In order to ensure that the #GtkTreeSortable behaves as
|
||||
* expected, the GtkTreeIterCompareFunc must define a partial order on
|
||||
* the model, i.e. it must be reflexive, antisymmetric and transitive.
|
||||
*
|
||||
* For example, if @model is a product catalogue, then a compare function
|
||||
* for the "price" column could be one which returns
|
||||
* <literal>price_of(@a) - price_of(@b)</literal>.
|
||||
*
|
||||
* Returns: a negative integer, zero or a positive integer depending on whether
|
||||
* @a sorts before, with or after @b
|
||||
*/
|
||||
typedef gint (* GtkTreeIterCompareFunc) (GtkTreeModel *model,
|
||||
GtkTreeIter *a,
|
||||
GtkTreeIter *b,
|
||||
|
@ -28,6 +28,41 @@
|
||||
#include "gtkintl.h"
|
||||
|
||||
|
||||
/**
|
||||
* SECTION:gtktreestore
|
||||
* @Short_description: A tree-like data structure that can be used with the GtkTreeView
|
||||
* @Title: GtkTreeStore
|
||||
* @See_also: #GtkTreeModel
|
||||
*
|
||||
* The #GtkTreeStore object is a list model for use with a #GtkTreeView
|
||||
* widget. It implements the #GtkTreeModel interface, and consequentialy,
|
||||
* can use all of the methods available there. It also implements the
|
||||
* #GtkTreeSortable interface so it can be sorted by the view. Finally,
|
||||
* it also implements the tree <link linkend="gtktreednd">drag and
|
||||
* drop</link> interfaces.
|
||||
*
|
||||
* <refsect2 id="GtkTreeStore-BUILDER-UI">
|
||||
* <title>GtkTreeStore as GtkBuildable</title>
|
||||
* The GtkTreeStore implementation of the #GtkBuildable interface allows
|
||||
* to specify the model columns with a <columns> element that may
|
||||
* contain multiple <column> elements, each specifying one model
|
||||
* column. The "type" attribute specifies the data type for the column.
|
||||
* <example>
|
||||
* <title>A UI Definition fragment for a tree store</title>
|
||||
* <programlisting><![CDATA[
|
||||
* <object class="GtkTreeStore">
|
||||
* <columns>
|
||||
* <column type="gchararray"/>
|
||||
* <column type="gchararray"/>
|
||||
* <column type="gint"/>
|
||||
* </columns>
|
||||
* </object>
|
||||
* ]]></programlisting>
|
||||
* </example>
|
||||
* </refsect2>
|
||||
*/
|
||||
|
||||
|
||||
#define G_NODE(node) ((GNode *)node)
|
||||
#define GTK_TREE_STORE_IS_SORTED(tree) (((GtkTreeStore*)(tree))->sort_column_id != GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID)
|
||||
#define VALID_ITER(iter, tree_store) ((iter)!= NULL && (iter)->user_data != NULL && ((GtkTreeStore*)(tree_store))->stamp == (iter)->stamp)
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include "gtkframe.h"
|
||||
#include "gtktreemodelsort.h"
|
||||
#include "gtktooltip.h"
|
||||
#include "gtkscrollable.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
|
||||
@ -249,9 +250,10 @@ static void gtk_tree_view_drag_data_received (GtkWidget *widget,
|
||||
guint time);
|
||||
|
||||
/* tree_model signals */
|
||||
static void gtk_tree_view_set_adjustments (GtkTreeView *tree_view,
|
||||
GtkAdjustment *hadj,
|
||||
GtkAdjustment *vadj);
|
||||
static void gtk_tree_view_set_hadjustment (GtkTreeView *tree_view,
|
||||
GtkAdjustment *adjustment);
|
||||
static void gtk_tree_view_set_vadjustment (GtkTreeView *tree_view,
|
||||
GtkAdjustment *adjustment);
|
||||
static gboolean gtk_tree_view_real_move_cursor (GtkTreeView *tree_view,
|
||||
GtkMovementStep step,
|
||||
gint count);
|
||||
@ -488,7 +490,8 @@ static guint tree_view_signals [LAST_SIGNAL] = { 0 };
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkTreeView, gtk_tree_view, GTK_TYPE_CONTAINER,
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
|
||||
gtk_tree_view_buildable_init))
|
||||
gtk_tree_view_buildable_init)
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_SCROLLABLE, NULL))
|
||||
|
||||
static void
|
||||
gtk_tree_view_class_init (GtkTreeViewClass *class)
|
||||
@ -546,7 +549,6 @@ gtk_tree_view_class_init (GtkTreeViewClass *class)
|
||||
container_class->forall = gtk_tree_view_forall;
|
||||
container_class->set_focus_child = gtk_tree_view_set_focus_child;
|
||||
|
||||
class->set_scroll_adjustments = gtk_tree_view_set_adjustments;
|
||||
class->move_cursor = gtk_tree_view_real_move_cursor;
|
||||
class->select_all = gtk_tree_view_real_select_all;
|
||||
class->unselect_all = gtk_tree_view_real_unselect_all;
|
||||
@ -566,21 +568,8 @@ gtk_tree_view_class_init (GtkTreeViewClass *class)
|
||||
GTK_TYPE_TREE_MODEL,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (o_class,
|
||||
PROP_HADJUSTMENT,
|
||||
g_param_spec_object ("hadjustment",
|
||||
P_("Horizontal Adjustment"),
|
||||
P_("Horizontal Adjustment for the widget"),
|
||||
GTK_TYPE_ADJUSTMENT,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (o_class,
|
||||
PROP_VADJUSTMENT,
|
||||
g_param_spec_object ("vadjustment",
|
||||
P_("Vertical Adjustment"),
|
||||
P_("Vertical Adjustment for the widget"),
|
||||
GTK_TYPE_ADJUSTMENT,
|
||||
GTK_PARAM_READWRITE));
|
||||
g_object_class_override_property (o_class, PROP_HADJUSTMENT, "hadjustment");
|
||||
g_object_class_override_property (o_class, PROP_VADJUSTMENT, "vadjustment");
|
||||
|
||||
g_object_class_install_property (o_class,
|
||||
PROP_HEADERS_VISIBLE,
|
||||
@ -856,26 +845,6 @@ gtk_tree_view_class_init (GtkTreeViewClass *class)
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
/* Signals */
|
||||
/**
|
||||
* GtkTreeView::set-scroll-adjustments
|
||||
* @horizontal: the horizontal #GtkAdjustment
|
||||
* @vertical: the vertical #GtkAdjustment
|
||||
*
|
||||
* Set the scroll adjustments for the tree view. Usually scrolled containers
|
||||
* like #GtkScrolledWindow will emit this signal to connect two instances
|
||||
* of #GtkScrollbar to the scroll directions of the #GtkTreeView.
|
||||
*/
|
||||
widget_class->set_scroll_adjustments_signal =
|
||||
g_signal_new (I_("set-scroll-adjustments"),
|
||||
G_TYPE_FROM_CLASS (o_class),
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
|
||||
G_STRUCT_OFFSET (GtkTreeViewClass, set_scroll_adjustments),
|
||||
NULL, NULL,
|
||||
_gtk_marshal_VOID__OBJECT_OBJECT,
|
||||
G_TYPE_NONE, 2,
|
||||
GTK_TYPE_ADJUSTMENT,
|
||||
GTK_TYPE_ADJUSTMENT);
|
||||
|
||||
/**
|
||||
* GtkTreeView::row-activated:
|
||||
* @tree_view: the object on which the signal is emitted
|
||||
@ -1337,7 +1306,6 @@ gtk_tree_view_init (GtkTreeView *tree_view)
|
||||
tree_view->priv->fixed_height = -1;
|
||||
tree_view->priv->fixed_height_mode = FALSE;
|
||||
tree_view->priv->fixed_height_check = 0;
|
||||
gtk_tree_view_set_adjustments (tree_view, NULL, NULL);
|
||||
tree_view->priv->selection = _gtk_tree_selection_new_with_tree_view (tree_view);
|
||||
tree_view->priv->enable_search = TRUE;
|
||||
tree_view->priv->search_column = -1;
|
||||
@ -8112,67 +8080,6 @@ gtk_tree_view_set_focus_child (GtkContainer *container,
|
||||
GTK_CONTAINER_CLASS (gtk_tree_view_parent_class)->set_focus_child (container, child);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_view_set_adjustments (GtkTreeView *tree_view,
|
||||
GtkAdjustment *hadj,
|
||||
GtkAdjustment *vadj)
|
||||
{
|
||||
gboolean need_adjust = FALSE;
|
||||
|
||||
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
|
||||
|
||||
if (hadj)
|
||||
g_return_if_fail (GTK_IS_ADJUSTMENT (hadj));
|
||||
else
|
||||
hadj = gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
|
||||
if (vadj)
|
||||
g_return_if_fail (GTK_IS_ADJUSTMENT (vadj));
|
||||
else
|
||||
vadj = gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
|
||||
|
||||
if (tree_view->priv->hadjustment && (tree_view->priv->hadjustment != hadj))
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (tree_view->priv->hadjustment,
|
||||
gtk_tree_view_adjustment_changed,
|
||||
tree_view);
|
||||
g_object_unref (tree_view->priv->hadjustment);
|
||||
}
|
||||
|
||||
if (tree_view->priv->vadjustment && (tree_view->priv->vadjustment != vadj))
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (tree_view->priv->vadjustment,
|
||||
gtk_tree_view_adjustment_changed,
|
||||
tree_view);
|
||||
g_object_unref (tree_view->priv->vadjustment);
|
||||
}
|
||||
|
||||
if (tree_view->priv->hadjustment != hadj)
|
||||
{
|
||||
tree_view->priv->hadjustment = hadj;
|
||||
g_object_ref_sink (tree_view->priv->hadjustment);
|
||||
|
||||
g_signal_connect (tree_view->priv->hadjustment, "value-changed",
|
||||
G_CALLBACK (gtk_tree_view_adjustment_changed),
|
||||
tree_view);
|
||||
need_adjust = TRUE;
|
||||
}
|
||||
|
||||
if (tree_view->priv->vadjustment != vadj)
|
||||
{
|
||||
tree_view->priv->vadjustment = vadj;
|
||||
g_object_ref_sink (tree_view->priv->vadjustment);
|
||||
|
||||
g_signal_connect (tree_view->priv->vadjustment, "value-changed",
|
||||
G_CALLBACK (gtk_tree_view_adjustment_changed),
|
||||
tree_view);
|
||||
need_adjust = TRUE;
|
||||
}
|
||||
|
||||
if (need_adjust)
|
||||
gtk_tree_view_adjustment_changed (NULL, tree_view);
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
gtk_tree_view_real_move_cursor (GtkTreeView *tree_view,
|
||||
GtkMovementStep step,
|
||||
@ -10929,15 +10836,14 @@ gtk_tree_view_get_selection (GtkTreeView *tree_view)
|
||||
*
|
||||
* Return value: (transfer none): A #GtkAdjustment object, or %NULL
|
||||
* if none is currently being used.
|
||||
*
|
||||
* Deprecated: 3.0: Use gtk_scrollable_get_hadjustment()
|
||||
**/
|
||||
GtkAdjustment *
|
||||
gtk_tree_view_get_hadjustment (GtkTreeView *tree_view)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), NULL);
|
||||
|
||||
if (tree_view->priv->hadjustment == NULL)
|
||||
gtk_tree_view_set_hadjustment (tree_view, NULL);
|
||||
|
||||
return tree_view->priv->hadjustment;
|
||||
}
|
||||
|
||||
@ -10947,16 +10853,40 @@ gtk_tree_view_get_hadjustment (GtkTreeView *tree_view)
|
||||
* @adjustment: (allow-none): The #GtkAdjustment to set, or %NULL
|
||||
*
|
||||
* Sets the #GtkAdjustment for the current horizontal aspect.
|
||||
*
|
||||
* Deprecated: 3.0: Use gtk_scrollable_set_hadjustment()
|
||||
**/
|
||||
void
|
||||
gtk_tree_view_set_hadjustment (GtkTreeView *tree_view,
|
||||
GtkAdjustment *adjustment)
|
||||
GtkAdjustment *adjustment)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
|
||||
GtkTreeViewPrivate *priv = tree_view->priv;
|
||||
|
||||
gtk_tree_view_set_adjustments (tree_view,
|
||||
adjustment,
|
||||
tree_view->priv->vadjustment);
|
||||
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
|
||||
g_return_if_fail (adjustment == NULL || GTK_IS_ADJUSTMENT (adjustment));
|
||||
|
||||
if (adjustment && priv->hadjustment == adjustment)
|
||||
return;
|
||||
|
||||
if (priv->hadjustment != NULL)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (priv->hadjustment,
|
||||
gtk_tree_view_adjustment_changed,
|
||||
tree_view);
|
||||
g_object_unref (priv->hadjustment);
|
||||
}
|
||||
|
||||
if (adjustment == NULL)
|
||||
adjustment = gtk_adjustment_new (0.0, 0.0, 0.0,
|
||||
0.0, 0.0, 0.0);
|
||||
|
||||
g_signal_connect (adjustment, "value-changed",
|
||||
G_CALLBACK (gtk_tree_view_adjustment_changed), tree_view);
|
||||
priv->hadjustment = g_object_ref_sink (adjustment);
|
||||
/* FIXME: Adjustment should probably be populated here with fresh values, but
|
||||
* internal details are too complicated for me to decipher right now.
|
||||
*/
|
||||
gtk_tree_view_adjustment_changed (NULL, tree_view);
|
||||
|
||||
g_object_notify (G_OBJECT (tree_view), "hadjustment");
|
||||
}
|
||||
@ -10969,15 +10899,14 @@ gtk_tree_view_set_hadjustment (GtkTreeView *tree_view,
|
||||
*
|
||||
* Return value: (transfer none): A #GtkAdjustment object, or %NULL
|
||||
* if none is currently being used.
|
||||
*
|
||||
* Deprecated: 3.0: Use gtk_scrollable_get_vadjustment()
|
||||
**/
|
||||
GtkAdjustment *
|
||||
gtk_tree_view_get_vadjustment (GtkTreeView *tree_view)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), NULL);
|
||||
|
||||
if (tree_view->priv->vadjustment == NULL)
|
||||
gtk_tree_view_set_vadjustment (tree_view, NULL);
|
||||
|
||||
return tree_view->priv->vadjustment;
|
||||
}
|
||||
|
||||
@ -10987,17 +10916,40 @@ gtk_tree_view_get_vadjustment (GtkTreeView *tree_view)
|
||||
* @adjustment: (allow-none): The #GtkAdjustment to set, or %NULL
|
||||
*
|
||||
* Sets the #GtkAdjustment for the current vertical aspect.
|
||||
*
|
||||
* Deprecated: 3.0: Use gtk_scrollable_set_vadjustment()
|
||||
**/
|
||||
void
|
||||
gtk_tree_view_set_vadjustment (GtkTreeView *tree_view,
|
||||
GtkAdjustment *adjustment)
|
||||
GtkAdjustment *adjustment)
|
||||
{
|
||||
GtkTreeViewPrivate *priv = tree_view->priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
|
||||
g_return_if_fail (adjustment == NULL || GTK_IS_ADJUSTMENT (adjustment));
|
||||
|
||||
gtk_tree_view_set_adjustments (tree_view,
|
||||
tree_view->priv->hadjustment,
|
||||
adjustment);
|
||||
if (adjustment && priv->vadjustment == adjustment)
|
||||
return;
|
||||
|
||||
if (priv->vadjustment != NULL)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (priv->vadjustment,
|
||||
gtk_tree_view_adjustment_changed,
|
||||
tree_view);
|
||||
g_object_unref (priv->vadjustment);
|
||||
}
|
||||
|
||||
if (adjustment == NULL)
|
||||
adjustment = gtk_adjustment_new (0.0, 0.0, 0.0,
|
||||
0.0, 0.0, 0.0);
|
||||
|
||||
g_signal_connect (adjustment, "value-changed",
|
||||
G_CALLBACK (gtk_tree_view_adjustment_changed), tree_view);
|
||||
priv->vadjustment = g_object_ref_sink (adjustment);
|
||||
/* FIXME: Adjustment should probably be populated here with fresh values, but
|
||||
* internal details are too complicated for me to decipher right now.
|
||||
*/
|
||||
gtk_tree_view_adjustment_changed (NULL, tree_view);
|
||||
g_object_notify (G_OBJECT (tree_view), "vadjustment");
|
||||
}
|
||||
|
||||
|
@ -70,9 +70,6 @@ struct _GtkTreeViewClass
|
||||
{
|
||||
GtkContainerClass parent_class;
|
||||
|
||||
void (* set_scroll_adjustments) (GtkTreeView *tree_view,
|
||||
GtkAdjustment *hadjustment,
|
||||
GtkAdjustment *vadjustment);
|
||||
void (* row_activated) (GtkTreeView *tree_view,
|
||||
GtkTreePath *path,
|
||||
GtkTreeViewColumn *column);
|
||||
@ -150,12 +147,18 @@ GtkTreeModel *gtk_tree_view_get_model (GtkTreeView
|
||||
void gtk_tree_view_set_model (GtkTreeView *tree_view,
|
||||
GtkTreeModel *model);
|
||||
GtkTreeSelection *gtk_tree_view_get_selection (GtkTreeView *tree_view);
|
||||
|
||||
#ifndef GTK_DISABLE_DEPRECATED
|
||||
|
||||
GtkAdjustment *gtk_tree_view_get_hadjustment (GtkTreeView *tree_view);
|
||||
void gtk_tree_view_set_hadjustment (GtkTreeView *tree_view,
|
||||
GtkAdjustment *adjustment);
|
||||
GtkAdjustment *gtk_tree_view_get_vadjustment (GtkTreeView *tree_view);
|
||||
void gtk_tree_view_set_vadjustment (GtkTreeView *tree_view,
|
||||
GtkAdjustment *adjustment);
|
||||
|
||||
#endif
|
||||
|
||||
gboolean gtk_tree_view_get_headers_visible (GtkTreeView *tree_view);
|
||||
void gtk_tree_view_set_headers_visible (GtkTreeView *tree_view,
|
||||
gboolean headers_visible);
|
||||
|
@ -36,6 +36,24 @@
|
||||
#include "gtkintl.h"
|
||||
|
||||
|
||||
/**
|
||||
* SECTION:gtktreeviewcolumn
|
||||
* @Short_description: A visible column in a GtkTreeView widget
|
||||
* @Title: GtkTreeViewColumn
|
||||
* @See_also: #GtkTreeView, #GtkTreeSelection, #GtkTreeDnd, #GtkTreeMode, #GtkTreeSortable,
|
||||
* #GtkTreeModelSort, #GtkListStore, #GtkTreeStore, #GtkCellRenderer, #GtkCellEditable,
|
||||
* #GtkCellRendererPixbuf, #GtkCellRendererText, #GtkCellRendererToggle
|
||||
*
|
||||
* The GtkTreeViewColumn object represents a visible column in a #GtkTreeView widget.
|
||||
* It allows to set properties of the column header, and functions as a holding pen for
|
||||
* the cell renderers which determine how the data in the column is displayed.
|
||||
*
|
||||
* Please refer to the <link linkend="TreeWidget">tree widget conceptual overview</link>
|
||||
* for an overview of all the objects and data types related to the tree widget and how
|
||||
* they work together.
|
||||
*/
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
|
@ -39,6 +39,19 @@ G_BEGIN_DECLS
|
||||
#define GTK_IS_TREE_VIEW_COLUMN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TREE_VIEW_COLUMN))
|
||||
#define GTK_TREE_VIEW_COLUMN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TREE_VIEW_COLUMN, GtkTreeViewColumnClass))
|
||||
|
||||
typedef struct _GtkTreeViewColumn GtkTreeViewColumn;
|
||||
typedef struct _GtkTreeViewColumnClass GtkTreeViewColumnClass;
|
||||
|
||||
/**
|
||||
* GtkTreeViewColumnSizing:
|
||||
* @GTK_TREE_VIEW_COLUMN_GROW_ONLY: Columns only get bigger in reaction to changes in the model
|
||||
* @GTK_TREE_VIEW_COLUMN_AUTOSIZE: Columns resize to be the optimal size everytime the model changes.
|
||||
* @GTK_TREE_VIEW_COLUMN_FIXED: Columns are a fixed numbers of pixels wide.
|
||||
*
|
||||
* The sizing method the column uses to determine its width. Please note
|
||||
* that @GTK_TREE_VIEW_COLUMN_AUTOSIZE are inefficient for large views, and
|
||||
* can make columns appear choppy.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GTK_TREE_VIEW_COLUMN_GROW_ONLY,
|
||||
@ -46,9 +59,21 @@ typedef enum
|
||||
GTK_TREE_VIEW_COLUMN_FIXED
|
||||
} GtkTreeViewColumnSizing;
|
||||
|
||||
typedef struct _GtkTreeViewColumn GtkTreeViewColumn;
|
||||
typedef struct _GtkTreeViewColumnClass GtkTreeViewColumnClass;
|
||||
|
||||
/**
|
||||
* GtkTreeCellDataFunc:
|
||||
* @tree_column: A #GtkTreeColumn
|
||||
* @cell: The #GtkCellRenderer that is being rendered by @tree_column
|
||||
* @tree_model: The #GtkTreeModel being rendered
|
||||
* @iter: A #GtkTreeIter of the current row rendered
|
||||
* @data: user data
|
||||
*
|
||||
* A function to set the properties of a cell instead of just using the
|
||||
* straight mapping between the cell and the model. This is useful for
|
||||
* customizing the cell renderer. For example, a function might get an
|
||||
* integer from the @tree_model, and render it to the "text" attribute of
|
||||
* "cell" by converting it to its written equivilent. This is set by
|
||||
* calling gtk_tree_view_column_set_cell_data_func()
|
||||
*/
|
||||
typedef void (* GtkTreeCellDataFunc) (GtkTreeViewColumn *tree_column,
|
||||
GtkCellRenderer *cell,
|
||||
GtkTreeModel *tree_model,
|
||||
@ -68,7 +93,7 @@ struct _GtkTreeViewColumn
|
||||
GdkWindow *GSEAL (window);
|
||||
GtkCellEditable *GSEAL (editable_widget);
|
||||
gfloat GSEAL (xalign);
|
||||
guint GSEAL (property_changed_signal);
|
||||
gulong GSEAL (property_changed_signal);
|
||||
gint GSEAL (spacing);
|
||||
|
||||
/* Sizing fields */
|
||||
@ -90,8 +115,8 @@ struct _GtkTreeViewColumn
|
||||
GList *GSEAL (cell_list);
|
||||
|
||||
/* Sorting */
|
||||
guint GSEAL (sort_clicked_signal);
|
||||
guint GSEAL (sort_column_changed_signal);
|
||||
gulong GSEAL (sort_clicked_signal);
|
||||
gulong GSEAL (sort_column_changed_signal);
|
||||
gint GSEAL (sort_column_id);
|
||||
GtkSortType GSEAL (sort_order);
|
||||
|
||||
|
@ -25,10 +25,14 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#undef GTK_DISABLE_DEPRECATED
|
||||
#include "gtkviewport.h"
|
||||
#define GTK_DISABLE_DEPRECATED
|
||||
#include "gtkintl.h"
|
||||
#include "gtkmarshalers.h"
|
||||
#include "gtktypeutils.h"
|
||||
#include "gtkscrollable.h"
|
||||
#include "gtkprivate.h"
|
||||
|
||||
|
||||
@ -68,6 +72,8 @@ enum {
|
||||
PROP_0,
|
||||
PROP_HADJUSTMENT,
|
||||
PROP_VADJUSTMENT,
|
||||
PROP_MIN_DISPLAY_WIDTH,
|
||||
PROP_MIN_DISPLAY_HEIGHT,
|
||||
PROP_SHADOW_TYPE
|
||||
};
|
||||
|
||||
@ -81,9 +87,6 @@ static void gtk_viewport_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_viewport_set_scroll_adjustments (GtkViewport *viewport,
|
||||
GtkAdjustment *hadjustment,
|
||||
GtkAdjustment *vadjustment);
|
||||
static void gtk_viewport_destroy (GtkWidget *widget);
|
||||
static void gtk_viewport_realize (GtkWidget *widget);
|
||||
static void gtk_viewport_unrealize (GtkWidget *widget);
|
||||
@ -106,7 +109,8 @@ static void gtk_viewport_get_preferred_height (GtkWidget *widget,
|
||||
gint *natural_size);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GtkViewport, gtk_viewport, GTK_TYPE_BIN)
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkViewport, gtk_viewport, GTK_TYPE_BIN,
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_SCROLLABLE, NULL))
|
||||
|
||||
static void
|
||||
gtk_viewport_class_init (GtkViewportClass *class)
|
||||
@ -134,23 +138,9 @@ gtk_viewport_class_init (GtkViewportClass *class)
|
||||
|
||||
container_class->add = gtk_viewport_add;
|
||||
|
||||
class->set_scroll_adjustments = gtk_viewport_set_scroll_adjustments;
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_HADJUSTMENT,
|
||||
g_param_spec_object ("hadjustment",
|
||||
P_("Horizontal adjustment"),
|
||||
P_("The GtkAdjustment that determines the values of the horizontal position for this viewport"),
|
||||
GTK_TYPE_ADJUSTMENT,
|
||||
GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_VADJUSTMENT,
|
||||
g_param_spec_object ("vadjustment",
|
||||
P_("Vertical adjustment"),
|
||||
P_("The GtkAdjustment that determines the values of the vertical position for this viewport"),
|
||||
GTK_TYPE_ADJUSTMENT,
|
||||
GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
||||
/* GtkScrollable implementation */
|
||||
g_object_class_override_property (gobject_class, PROP_HADJUSTMENT, "hadjustment");
|
||||
g_object_class_override_property (gobject_class, PROP_VADJUSTMENT, "vadjustment");
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_SHADOW_TYPE,
|
||||
@ -161,26 +151,6 @@ gtk_viewport_class_init (GtkViewportClass *class)
|
||||
GTK_SHADOW_IN,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
/**
|
||||
* GtkViewport::set-scroll-adjustments
|
||||
* @horizontal: the horizontal #GtkAdjustment
|
||||
* @vertical: the vertical #GtkAdjustment
|
||||
*
|
||||
* Set the scroll adjustments for the viewport. Usually scrolled containers
|
||||
* like #GtkScrolledWindow will emit this signal to connect two instances
|
||||
* of #GtkScrollbar to the scroll directions of the #GtkViewport.
|
||||
*/
|
||||
widget_class->set_scroll_adjustments_signal =
|
||||
g_signal_new (I_("set-scroll-adjustments"),
|
||||
G_OBJECT_CLASS_TYPE (gobject_class),
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
|
||||
G_STRUCT_OFFSET (GtkViewportClass, set_scroll_adjustments),
|
||||
NULL, NULL,
|
||||
_gtk_marshal_VOID__OBJECT_OBJECT,
|
||||
G_TYPE_NONE, 2,
|
||||
GTK_TYPE_ADJUSTMENT,
|
||||
GTK_TYPE_ADJUSTMENT);
|
||||
|
||||
g_type_class_add_private (class, sizeof (GtkViewportPrivate));
|
||||
}
|
||||
|
||||
@ -324,52 +294,6 @@ gtk_viewport_destroy (GtkWidget *widget)
|
||||
GTK_WIDGET_CLASS (gtk_viewport_parent_class)->destroy (widget);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_viewport_get_hadjustment:
|
||||
* @viewport: a #GtkViewport.
|
||||
*
|
||||
* Returns the horizontal adjustment of the viewport.
|
||||
*
|
||||
* Return value: (transfer none): the horizontal adjustment of @viewport.
|
||||
**/
|
||||
GtkAdjustment*
|
||||
gtk_viewport_get_hadjustment (GtkViewport *viewport)
|
||||
{
|
||||
GtkViewportPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_VIEWPORT (viewport), NULL);
|
||||
|
||||
priv = viewport->priv;
|
||||
|
||||
if (!priv->hadjustment)
|
||||
gtk_viewport_set_hadjustment (viewport, NULL);
|
||||
|
||||
return priv->hadjustment;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_viewport_get_vadjustment:
|
||||
* @viewport: a #GtkViewport.
|
||||
*
|
||||
* Returns the vertical adjustment of the viewport.
|
||||
*
|
||||
* Return value: (transfer none): the vertical adjustment of @viewport.
|
||||
**/
|
||||
GtkAdjustment*
|
||||
gtk_viewport_get_vadjustment (GtkViewport *viewport)
|
||||
{
|
||||
GtkViewportPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_VIEWPORT (viewport), NULL);
|
||||
|
||||
priv = viewport->priv;
|
||||
|
||||
if (!priv->vadjustment)
|
||||
gtk_viewport_set_vadjustment (viewport, NULL);
|
||||
|
||||
return priv->vadjustment;
|
||||
}
|
||||
|
||||
static void
|
||||
viewport_get_view_allocation (GtkViewport *viewport,
|
||||
GtkAllocation *view_allocation)
|
||||
@ -402,7 +326,7 @@ viewport_reclamp_adjustment (GtkAdjustment *adjustment,
|
||||
gboolean *value_changed)
|
||||
{
|
||||
gdouble value = adjustment->value;
|
||||
|
||||
|
||||
value = CLAMP (value, 0, adjustment->upper - adjustment->page_size);
|
||||
if (value != adjustment->value)
|
||||
{
|
||||
@ -414,6 +338,56 @@ viewport_reclamp_adjustment (GtkAdjustment *adjustment,
|
||||
*value_changed = FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_viewport_get_hadjustment:
|
||||
* @viewport: a #GtkViewport.
|
||||
*
|
||||
* Returns the horizontal adjustment of the viewport.
|
||||
*
|
||||
* Return value: (transfer none): the horizontal adjustment of @viewport.
|
||||
*
|
||||
* Deprecated: 3.0: Use gtk_scrollable_get_hadjustment()
|
||||
**/
|
||||
GtkAdjustment*
|
||||
gtk_viewport_get_hadjustment (GtkViewport *viewport)
|
||||
{
|
||||
GtkViewportPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_VIEWPORT (viewport), NULL);
|
||||
|
||||
priv = viewport->priv;
|
||||
|
||||
if (!priv->hadjustment)
|
||||
gtk_viewport_set_hadjustment (viewport, NULL);
|
||||
|
||||
return priv->hadjustment;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_viewport_get_vadjustment:
|
||||
* @viewport: a #GtkViewport.
|
||||
*
|
||||
* Returns the vertical adjustment of the viewport.
|
||||
*
|
||||
* Return value: (transfer none): the vertical adjustment of @viewport.
|
||||
*
|
||||
* Deprecated: 3.0: Use gtk_scrollable_get_vadjustment()
|
||||
**/
|
||||
GtkAdjustment*
|
||||
gtk_viewport_get_vadjustment (GtkViewport *viewport)
|
||||
{
|
||||
GtkViewportPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_VIEWPORT (viewport), NULL);
|
||||
|
||||
priv = viewport->priv;
|
||||
|
||||
if (!priv->vadjustment)
|
||||
gtk_viewport_set_vadjustment (viewport, NULL);
|
||||
|
||||
return priv->vadjustment;
|
||||
}
|
||||
|
||||
static void
|
||||
viewport_set_hadjustment_values (GtkViewport *viewport,
|
||||
gboolean *value_changed)
|
||||
@ -537,6 +511,8 @@ viewport_set_adjustment (GtkViewport *viewport,
|
||||
* @adjustment: (allow-none): a #GtkAdjustment.
|
||||
*
|
||||
* Sets the horizontal adjustment of the viewport.
|
||||
*
|
||||
* Deprecated: 3.0: Use gtk_scrollable_set_hadjustment()
|
||||
**/
|
||||
void
|
||||
gtk_viewport_set_hadjustment (GtkViewport *viewport,
|
||||
@ -557,6 +533,8 @@ gtk_viewport_set_hadjustment (GtkViewport *viewport,
|
||||
* @adjustment: (allow-none): a #GtkAdjustment.
|
||||
*
|
||||
* Sets the vertical adjustment of the viewport.
|
||||
*
|
||||
* Deprecated: 3.0: Use gtk_scrollable_set_vadjustment()
|
||||
**/
|
||||
void
|
||||
gtk_viewport_set_vadjustment (GtkViewport *viewport,
|
||||
@ -571,15 +549,6 @@ gtk_viewport_set_vadjustment (GtkViewport *viewport,
|
||||
g_object_notify (G_OBJECT (viewport), "vadjustment");
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_viewport_set_scroll_adjustments (GtkViewport *viewport,
|
||||
GtkAdjustment *hadjustment,
|
||||
GtkAdjustment *vadjustment)
|
||||
{
|
||||
gtk_viewport_set_hadjustment (viewport, hadjustment);
|
||||
gtk_viewport_set_vadjustment (viewport, vadjustment);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_viewport_set_shadow_type:
|
||||
* @viewport: a #GtkViewport.
|
||||
|
@ -63,10 +63,6 @@ struct _GtkViewportClass
|
||||
{
|
||||
GtkBinClass parent_class;
|
||||
|
||||
void (*set_scroll_adjustments) (GtkViewport *viewport,
|
||||
GtkAdjustment *hadjustment,
|
||||
GtkAdjustment *vadjustment);
|
||||
|
||||
/* Padding for future expansion */
|
||||
void (*_gtk_reserved1) (void);
|
||||
void (*_gtk_reserved2) (void);
|
||||
@ -78,12 +74,18 @@ struct _GtkViewportClass
|
||||
GType gtk_viewport_get_type (void) G_GNUC_CONST;
|
||||
GtkWidget* gtk_viewport_new (GtkAdjustment *hadjustment,
|
||||
GtkAdjustment *vadjustment);
|
||||
|
||||
#ifndef GTK_DISABLE_DEPRECATED
|
||||
|
||||
GtkAdjustment* gtk_viewport_get_hadjustment (GtkViewport *viewport);
|
||||
GtkAdjustment* gtk_viewport_get_vadjustment (GtkViewport *viewport);
|
||||
void gtk_viewport_set_hadjustment (GtkViewport *viewport,
|
||||
GtkAdjustment *adjustment);
|
||||
void gtk_viewport_set_vadjustment (GtkViewport *viewport,
|
||||
GtkAdjustment *adjustment);
|
||||
|
||||
#endif
|
||||
|
||||
void gtk_viewport_set_shadow_type (GtkViewport *viewport,
|
||||
GtkShadowType type);
|
||||
GtkShadowType gtk_viewport_get_shadow_type (GtkViewport *viewport);
|
||||
|
454
gtk/gtkwidget.c
454
gtk/gtkwidget.c
@ -72,73 +72,186 @@
|
||||
* <refsect2 id="geometry-management">
|
||||
* <title>Height-for-width Geometry Management</title>
|
||||
* <para>
|
||||
* GTK+ uses a height-for-width (and width-for-height) geometry management system.
|
||||
* Height-for-width means that a widget can change how much vertical space it needs,
|
||||
* depending on the amount of horizontal space that it is given (and similar for
|
||||
* width-for-height). The most common example is a label that reflows to fill up the
|
||||
* available width, wraps to fewer lines, and therefore needs less height.
|
||||
* GTK+ uses a height-for-width (and width-for-height) geometry management
|
||||
* system Height-for-width means that a widget can change how much
|
||||
* vertical space it needs, depending on the amount of horizontal space
|
||||
* that it is given (and similar for width-for-height). The most common
|
||||
* example is a label that reflows to fill up the available width, wraps
|
||||
* to fewer lines, and therefore needs less height.
|
||||
*
|
||||
* GTK+'s traditional two-pass <link linkend="size-allocation">size-allocation</link>
|
||||
* algorithm does not allow this flexibility. #GtkWidget provides a default
|
||||
* implementation of the height-for-width methods for existing widgets,
|
||||
* which always requests the same height, regardless of the available width.
|
||||
* Height-for-width geometry management is implemented in GTK+ by way
|
||||
* of five virtual methods:
|
||||
* <variablelist>
|
||||
* <varlistentry>
|
||||
* <term>#GtkWidgetClass.get_request_mode()</term>
|
||||
* <listitem>
|
||||
* This allows a widget to tell it's parent container whether
|
||||
* it preferrs to be allocated in %GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH
|
||||
* or %GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT mode.
|
||||
* %GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH means the widget preferrs to
|
||||
* have #GtkWidgetClass.get_preferred_width() called and then
|
||||
* #GtkWidgetClass.get_preferred_height_for_width() and is the
|
||||
* default return for unimplemented cases.
|
||||
* However it's important to note (as described below) that any
|
||||
* widget which trades height-for-width must respond properly to
|
||||
* both #GtkSizeRequestModes since it might be queried in either
|
||||
* orientation by it's parent container.
|
||||
* </listitem>
|
||||
* </varlistentry>
|
||||
* <varlistentry>
|
||||
* <term>#GtkWidgetClass.get_preferred_width()</term>
|
||||
* <listitem>
|
||||
* This is called by containers to obtain the minimum and
|
||||
* natural width of a widget. A widget will never be allocated
|
||||
* a width less than it's minimum and will only ever be allocated
|
||||
* a width greater than the natural width once all of the said
|
||||
* widget's siblings have received their natural widths.
|
||||
* Furthermore a widget will only ever be allocated a width greater
|
||||
* than it's natural width if it was configured to receive extra
|
||||
* expand space from it's parent container.
|
||||
* </listitem>
|
||||
* </varlistentry>
|
||||
* <varlistentry>
|
||||
* <term>#GtkWidgetClass.get_preferred_height()</term>
|
||||
* <listitem>
|
||||
* This is called by containers to obtain the minimum and
|
||||
* natural height of a widget.
|
||||
* A widget that does not actually trade any height for width
|
||||
* or width for height only has to implement these two virtual
|
||||
* methods (#GtkWidgetClass.get_preferred_width() and
|
||||
* #GtkWidgetClass.get_preferred_height()).
|
||||
* </listitem>
|
||||
* </varlistentry>
|
||||
* <varlistentry>
|
||||
* <term>#GtkWidgetClass.get_preferred_height_for_width()</term>
|
||||
* <listitem>
|
||||
* This is similar to #GtkWidgetClass.get_preferred_height() except
|
||||
* that it is passed a contextual width to request height for. By
|
||||
* implementing this virtual method it is possible for a #GtkLabel
|
||||
* to tell it's parent how much height would be required if the
|
||||
* label were to be allocated a said width.
|
||||
* </listitem>
|
||||
* </varlistentry>
|
||||
* <varlistentry>
|
||||
* <term>#GtkWidgetClass.get_preferred_width_for_height()</term>
|
||||
* <listitem>
|
||||
* This is analogous to #GtkWidgetClass.get_preferred_height_for_width()
|
||||
* except that it operates in the oposite orientation. It's rare that
|
||||
* a widget actually does %GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT requests
|
||||
* but can happen when for example; a widget or container gets additional
|
||||
* columns to compensate for a smaller allocated height.
|
||||
* </listitem>
|
||||
* </varlistentry>
|
||||
* </variablelist>
|
||||
*
|
||||
* Some important things to keep in mind when implementing
|
||||
* height-for-width and when using it in container
|
||||
* implementations.
|
||||
* There are some important things to keep in mind when implementing
|
||||
* height-for-width and when using it in container implementations.
|
||||
*
|
||||
* The geometry management system will query a logical hierarchy in
|
||||
* The geometry management system will query a widget hierarchy in
|
||||
* only one orientation at a time. When widgets are initially queried
|
||||
* for their minimum sizes it is generally done in a dual pass
|
||||
* in the direction chosen by the toplevel.
|
||||
* for their minimum sizes it is generally done in two initial passes
|
||||
* in the #GtkSizeRequestMode chosen by the toplevel.
|
||||
*
|
||||
* For instance when queried in the normal height-for-width mode:
|
||||
* First the default minimum and natural width for each widget
|
||||
* in the interface will computed and collectively returned to
|
||||
* the toplevel by way of gtk_widget_get_preferred_width().
|
||||
* Next, the toplevel will use the minimum width to query for the
|
||||
* minimum height contextual to that width using
|
||||
* gtk_widget_get_preferred_height_for_width(), which will also
|
||||
* be a highly recursive operation. This minimum-for-minimum size can
|
||||
* be used to set the minimum size constraint on the toplevel.
|
||||
* For example, when queried in the normal
|
||||
* %GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH mode:
|
||||
* First, the default minimum and natural width for each widget
|
||||
* in the interface will be computed using gtk_width_get_preferred_width().
|
||||
* Because the preferred widths for each container depends on the preferred
|
||||
* widths of thier children, this information propagates up the hierarchy,
|
||||
* and finally a minimum and natural width is determined for the entire
|
||||
* toplevel. Next, the toplevel will use the minimum width to query for the
|
||||
* minimum height contextual to that width using
|
||||
* gtk_widget_get_preferred_height_for_width(), which will also be a highly
|
||||
* recursive operation. The minimum height for the minimum width is normally
|
||||
* used to set the minimum size constraint on the toplevel
|
||||
* (unless gtk_window_set_geometry_hints() is explicitly used instead).
|
||||
*
|
||||
* When allocating, each container can use the minimum and natural
|
||||
* sizes reported by their children to allocate natural sizes and
|
||||
* expose as much content as possible with the given allocation.
|
||||
* After the toplevel window has initially requested it's size in both
|
||||
* dimensions it can go on to allocate itself a reasonable size (or a size
|
||||
* previously specified with gtk_window_set_default_size()). During the
|
||||
* recursive allocation process it's important to note that request cycles
|
||||
* will be recursively executed while container widgets allocate their children.
|
||||
* Each container widget, once allocated a size will go on to first share the
|
||||
* space in one orientation among its children and then request each child's
|
||||
* height for their target allocated width or width for allocated height
|
||||
* depending. In this way a #GtkWidget will typically be requested its size
|
||||
* a number of times before actually being allocated a size, the size a
|
||||
* widget is finally allocated can of course differ from the size it
|
||||
* requested. For this reason; #GtkWidget caches a small number of results
|
||||
* to avoid re-querying for the same sizes in one allocation cycle.
|
||||
*
|
||||
* That means that the request operation at allocation time will
|
||||
* usually fire again in contexts of different allocated sizes than
|
||||
* the ones originally queried for. #GtkWidget caches a
|
||||
* small number of results to avoid re-querying for the same
|
||||
* allocated size in one allocation cycle.
|
||||
*
|
||||
* A widget that does not actually do height-for-width
|
||||
* or width-for-height size negotiations only has to implement
|
||||
* #GtkWidgetClass.get_preferred_width() and
|
||||
* #GtkWidgetClass.get_preferred_height().
|
||||
* See <link linkend="container-geometry-management">GtkContainer's
|
||||
* geometry management section</link>
|
||||
* to learn more about how height-for-width allocations are performed
|
||||
* by container widgets.
|
||||
*
|
||||
* If a widget does move content around to smartly use up the
|
||||
* allocated size, then it must support the request properly in
|
||||
* both orientations; even if the request only makes sense in
|
||||
* one orientation.
|
||||
* allocated size, then it must support the request in both
|
||||
* #GtkSizeRequestModes even if the widget in question only
|
||||
* trades sizes in a single orientation.
|
||||
*
|
||||
* For instance, a #GtkLabel that does height-for-width word wrapping
|
||||
* will not expect to have #GtkWidgetClass.get_preferred_height() called because that
|
||||
* call is specific to a width-for-height request. In this case the
|
||||
* label must return the heights contextual to its minimum possible
|
||||
* width. By following this rule any widget that handles height-for-width
|
||||
* or width-for-height requests will always be allocated at least
|
||||
* enough space to fit its own content.
|
||||
* will not expect to have #GtkWidgetClass.get_preferred_height() called
|
||||
* because that call is specific to a width-for-height request. In this
|
||||
* case the label must return the heights required for it's own minimum
|
||||
* possible width. By following this rule any widget that handles
|
||||
* height-for-width or width-for-height requests will always be allocated
|
||||
* at least enough space to fit its own content.
|
||||
*
|
||||
* Here are some examples of how a %GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH widget
|
||||
* generally deals with width-for-height requests, for #GtkWidgetClass.get_preferred_height()
|
||||
* it will do:
|
||||
* <programlisting><![CDATA[
|
||||
* static void
|
||||
* foo_widget_get_preferred_height (GtkWidget *widget, gint *min_height, gint *nat_height)
|
||||
* {
|
||||
* if (i_am_in_height_for_width_mode)
|
||||
* {
|
||||
* gint min_width;
|
||||
*
|
||||
* GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, &min_width, NULL);
|
||||
* GTK_WIDGET_GET_CLASS (widget)->get_preferred_height_for_width (widget, min_width,
|
||||
* min_height, nat_height);
|
||||
* }
|
||||
* else
|
||||
* {
|
||||
* ... some widgets do both, for instance if a GtkLabel is rotated to 90 degrees
|
||||
* it will return the minimum and natural height for the rotated label here.
|
||||
* }
|
||||
* }
|
||||
* ]]></programlisting>
|
||||
*
|
||||
* And in #GtkWidgetClass.get_preferred_width_for_height() it will simply return
|
||||
* the minimum and natural width:
|
||||
*
|
||||
* <programlisting><![CDATA[
|
||||
* static void
|
||||
* foo_widget_get_preferred_width_for_height (GtkWidget *widget, gint for_height,
|
||||
* gint *min_width, gint *nat_width)
|
||||
* {
|
||||
* if (i_am_in_height_for_width_mode)
|
||||
* {
|
||||
* GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, min_width, nat_width);
|
||||
* }
|
||||
* else
|
||||
* {
|
||||
* ... again if a widget is sometimes operating in width-for-height mode
|
||||
* (like a rotated GtkLabel) it can go ahead and do it's real width for
|
||||
* height calculation here.
|
||||
* }
|
||||
* }
|
||||
* ]]></programlisting>
|
||||
*
|
||||
* Often a widget needs to get its own request during size request or
|
||||
* allocation, for example when computing height it may need to also
|
||||
* compute width, or when deciding how to use an allocation the widget may
|
||||
* need to know its natural size. In these cases, the widget should be
|
||||
* careful to call its virtual methods directly, like this:
|
||||
* compute width, or when deciding how to use an allocation the widget
|
||||
* may need to know its natural size. In these cases, the widget should
|
||||
* be careful to call its virtual methods directly, like this:
|
||||
* <example>
|
||||
* <title>Widget calling its own size request method.</title>
|
||||
* <programlisting>
|
||||
* GTK_WIDGET_GET_CLASS(widget)->get_preferred_width (widget), &min, &natural);
|
||||
* GTK_WIDGET_GET_CLASS(widget)->get_preferred_width (widget),
|
||||
* &min, &natural);
|
||||
* </programlisting>
|
||||
* </example>
|
||||
*
|
||||
@ -572,11 +685,13 @@ static void gtk_widget_queue_tooltip_query (GtkWidget *widg
|
||||
|
||||
static void gtk_widget_real_adjust_size_request (GtkWidget *widget,
|
||||
GtkOrientation orientation,
|
||||
gint for_size,
|
||||
gint *minimum_size,
|
||||
gint *natural_size);
|
||||
static void gtk_widget_real_adjust_size_allocation (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
GtkOrientation orientation,
|
||||
gint *natural_size,
|
||||
gint *allocated_pos,
|
||||
gint *allocated_size);
|
||||
|
||||
static void gtk_widget_set_usize_internal (GtkWidget *widget,
|
||||
gint width,
|
||||
@ -742,7 +857,6 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
||||
klass->destroy = gtk_widget_real_destroy;
|
||||
|
||||
klass->activate_signal = 0;
|
||||
klass->set_scroll_adjustments_signal = 0;
|
||||
klass->dispatch_child_properties_changed = gtk_widget_dispatch_child_properties_changed;
|
||||
klass->show = gtk_widget_real_show;
|
||||
klass->show_all = gtk_widget_show;
|
||||
@ -3810,7 +3924,8 @@ gtk_widget_show (GtkWidget *widget)
|
||||
widget->priv->computed_hexpand ||
|
||||
widget->priv->computed_vexpand)
|
||||
{
|
||||
gtk_widget_queue_compute_expand (widget);
|
||||
if (widget->priv->parent != NULL)
|
||||
gtk_widget_queue_compute_expand (widget->priv->parent);
|
||||
}
|
||||
|
||||
g_signal_emit (widget, widget_signals[SHOW], 0);
|
||||
@ -4496,6 +4611,8 @@ gtk_widget_size_allocate (GtkWidget *widget,
|
||||
gboolean alloc_needed;
|
||||
gboolean size_changed;
|
||||
gboolean position_changed;
|
||||
gint natural_width, natural_height;
|
||||
gint min_width, min_height;
|
||||
|
||||
priv = widget->priv;
|
||||
|
||||
@ -4532,7 +4649,37 @@ gtk_widget_size_allocate (GtkWidget *widget,
|
||||
real_allocation = *allocation;
|
||||
|
||||
adjusted_allocation = real_allocation;
|
||||
GTK_WIDGET_GET_CLASS (widget)->adjust_size_allocation (widget, &adjusted_allocation);
|
||||
if (gtk_widget_get_request_mode (widget) == GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH)
|
||||
{
|
||||
/* Go ahead and request the height for allocated width, note that the internals
|
||||
* of get_height_for_width will internally limit the for_size to natural size
|
||||
* when aligning implicitly.
|
||||
*/
|
||||
gtk_widget_get_preferred_width (widget, &min_width, &natural_width);
|
||||
gtk_widget_get_preferred_height_for_width (widget, real_allocation.width, NULL, &natural_height);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Go ahead and request the width for allocated height, note that the internals
|
||||
* of get_width_for_height will internally limit the for_size to natural size
|
||||
* when aligning implicitly.
|
||||
*/
|
||||
gtk_widget_get_preferred_height (widget, &min_height, &natural_height);
|
||||
gtk_widget_get_preferred_width_for_height (widget, real_allocation.height, NULL, &natural_width);
|
||||
}
|
||||
|
||||
/* Now that we have the right natural height and width, go ahead and remove any margins from the
|
||||
* allocated sizes and possibly limit them to the natural sizes */
|
||||
GTK_WIDGET_GET_CLASS (widget)->adjust_size_allocation (widget,
|
||||
GTK_ORIENTATION_HORIZONTAL,
|
||||
&natural_width,
|
||||
&adjusted_allocation.x,
|
||||
&adjusted_allocation.width);
|
||||
GTK_WIDGET_GET_CLASS (widget)->adjust_size_allocation (widget,
|
||||
GTK_ORIENTATION_VERTICAL,
|
||||
&natural_height,
|
||||
&adjusted_allocation.y,
|
||||
&adjusted_allocation.height);
|
||||
|
||||
if (adjusted_allocation.x < real_allocation.x ||
|
||||
adjusted_allocation.y < real_allocation.y ||
|
||||
@ -4807,140 +4954,76 @@ gtk_widget_real_size_allocate (GtkWidget *widget,
|
||||
}
|
||||
|
||||
static void
|
||||
get_span_inside_border (GtkWidget *widget,
|
||||
GtkAlign align,
|
||||
int start_pad,
|
||||
int end_pad,
|
||||
int allocated_outside_size,
|
||||
int natural_inside_size,
|
||||
int *coord_inside_p,
|
||||
int *size_inside_p)
|
||||
adjust_for_align(GtkAlign align,
|
||||
gint *natural_size,
|
||||
gint *allocated_pos,
|
||||
gint *allocated_size)
|
||||
{
|
||||
int inside_allocated;
|
||||
int content_size;
|
||||
int coord, size;
|
||||
|
||||
inside_allocated = allocated_outside_size - start_pad - end_pad;
|
||||
|
||||
content_size = natural_inside_size;
|
||||
if (content_size > inside_allocated)
|
||||
{
|
||||
/* didn't get full natural size */
|
||||
content_size = inside_allocated;
|
||||
}
|
||||
|
||||
coord = size = 0; /* silence compiler */
|
||||
switch (align)
|
||||
{
|
||||
case GTK_ALIGN_FILL:
|
||||
coord = start_pad;
|
||||
size = inside_allocated;
|
||||
/* change nothing */
|
||||
break;
|
||||
case GTK_ALIGN_START:
|
||||
coord = start_pad;
|
||||
size = content_size;
|
||||
/* keep *allocated_pos where it is */
|
||||
*allocated_size = MIN (*allocated_size, *natural_size);
|
||||
break;
|
||||
case GTK_ALIGN_END:
|
||||
coord = allocated_outside_size - end_pad - content_size;
|
||||
size = content_size;
|
||||
if (*allocated_size > *natural_size)
|
||||
{
|
||||
*allocated_pos += (*allocated_size - *natural_size);
|
||||
*allocated_size = *natural_size;
|
||||
}
|
||||
break;
|
||||
case GTK_ALIGN_CENTER:
|
||||
coord = start_pad + (inside_allocated - content_size) / 2;
|
||||
size = content_size;
|
||||
if (*allocated_size > *natural_size)
|
||||
{
|
||||
*allocated_pos += (*allocated_size - *natural_size) / 2;
|
||||
*allocated_size = MIN (*allocated_size, *natural_size);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (coord_inside_p)
|
||||
*coord_inside_p = coord;
|
||||
|
||||
if (size_inside_p)
|
||||
*size_inside_p = size;
|
||||
}
|
||||
|
||||
static void
|
||||
get_span_inside_border_horizontal (GtkWidget *widget,
|
||||
const GtkWidgetAuxInfo *aux_info,
|
||||
int allocated_outside_width,
|
||||
int natural_inside_width,
|
||||
int *x_inside_p,
|
||||
int *width_inside_p)
|
||||
adjust_for_margin(gint start_margin,
|
||||
gint end_margin,
|
||||
gint *natural_size,
|
||||
gint *allocated_pos,
|
||||
gint *allocated_size)
|
||||
{
|
||||
get_span_inside_border (widget,
|
||||
aux_info->halign,
|
||||
aux_info->margin.left,
|
||||
aux_info->margin.right,
|
||||
allocated_outside_width,
|
||||
natural_inside_width,
|
||||
x_inside_p,
|
||||
width_inside_p);
|
||||
}
|
||||
|
||||
static void
|
||||
get_span_inside_border_vertical (GtkWidget *widget,
|
||||
const GtkWidgetAuxInfo *aux_info,
|
||||
int allocated_outside_height,
|
||||
int natural_inside_height,
|
||||
int *y_inside_p,
|
||||
int *height_inside_p)
|
||||
{
|
||||
get_span_inside_border (widget,
|
||||
aux_info->valign,
|
||||
aux_info->margin.top,
|
||||
aux_info->margin.bottom,
|
||||
allocated_outside_height,
|
||||
natural_inside_height,
|
||||
y_inside_p,
|
||||
height_inside_p);
|
||||
*natural_size -= (start_margin + end_margin);
|
||||
*allocated_pos += start_margin;
|
||||
*allocated_size -= (start_margin + end_margin);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_widget_real_adjust_size_allocation (GtkWidget *widget,
|
||||
GtkAllocation *allocation)
|
||||
GtkOrientation orientation,
|
||||
gint *natural_size,
|
||||
gint *allocated_pos,
|
||||
gint *allocated_size)
|
||||
{
|
||||
const GtkWidgetAuxInfo *aux_info;
|
||||
gint natural_width;
|
||||
gint natural_height;
|
||||
int x, y, w, h;
|
||||
|
||||
aux_info = _gtk_widget_get_aux_info_or_defaults (widget);
|
||||
|
||||
if (gtk_widget_get_request_mode (widget) == GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH)
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
gtk_widget_get_preferred_width (widget, NULL, &natural_width);
|
||||
get_span_inside_border_horizontal (widget,
|
||||
aux_info,
|
||||
allocation->width,
|
||||
natural_width,
|
||||
&x, &w);
|
||||
|
||||
gtk_widget_get_preferred_height_for_width (widget, w, NULL, &natural_height);
|
||||
get_span_inside_border_vertical (widget,
|
||||
aux_info,
|
||||
allocation->height,
|
||||
natural_height,
|
||||
&y, &h);
|
||||
adjust_for_margin (aux_info->margin.left,
|
||||
aux_info->margin.right,
|
||||
natural_size, allocated_pos, allocated_size);
|
||||
adjust_for_align (aux_info->halign,
|
||||
natural_size, allocated_pos, allocated_size);
|
||||
}
|
||||
else /* GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT */
|
||||
else
|
||||
{
|
||||
gtk_widget_get_preferred_height (widget, NULL, &natural_height);
|
||||
get_span_inside_border_vertical (widget,
|
||||
aux_info,
|
||||
allocation->height,
|
||||
natural_height,
|
||||
&y, &h);
|
||||
|
||||
gtk_widget_get_preferred_width_for_height (widget, h, NULL, &natural_width);
|
||||
get_span_inside_border_horizontal (widget,
|
||||
aux_info,
|
||||
allocation->width,
|
||||
natural_width,
|
||||
&x, &w);
|
||||
adjust_for_margin (aux_info->margin.top,
|
||||
aux_info->margin.bottom,
|
||||
natural_size, allocated_pos, allocated_size);
|
||||
adjust_for_align (aux_info->valign,
|
||||
natural_size, allocated_pos, allocated_size);
|
||||
}
|
||||
|
||||
allocation->x += x;
|
||||
allocation->y += y;
|
||||
allocation->width = w;
|
||||
allocation->height = h;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -5861,56 +5944,6 @@ gtk_widget_activate (GtkWidget *widget)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_widget_set_scroll_adjustments:
|
||||
* @widget: a #GtkWidget
|
||||
* @hadjustment: (allow-none): an adjustment for horizontal scrolling, or %NULL
|
||||
* @vadjustment: (allow-none): an adjustment for vertical scrolling, or %NULL
|
||||
*
|
||||
* For widgets that support scrolling, sets the scroll adjustments and
|
||||
* returns %TRUE. For widgets that don't support scrolling, does
|
||||
* nothing and returns %FALSE. Widgets that don't support scrolling
|
||||
* can be scrolled by placing them in a #GtkViewport, which does
|
||||
* support scrolling.
|
||||
*
|
||||
* Return value: %TRUE if the widget supports scrolling
|
||||
**/
|
||||
gboolean
|
||||
gtk_widget_set_scroll_adjustments (GtkWidget *widget,
|
||||
GtkAdjustment *hadjustment,
|
||||
GtkAdjustment *vadjustment)
|
||||
{
|
||||
guint signal_id;
|
||||
GSignalQuery query;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
|
||||
|
||||
if (hadjustment)
|
||||
g_return_val_if_fail (GTK_IS_ADJUSTMENT (hadjustment), FALSE);
|
||||
if (vadjustment)
|
||||
g_return_val_if_fail (GTK_IS_ADJUSTMENT (vadjustment), FALSE);
|
||||
|
||||
signal_id = WIDGET_CLASS (widget)->set_scroll_adjustments_signal;
|
||||
if (!signal_id)
|
||||
return FALSE;
|
||||
|
||||
g_signal_query (signal_id, &query);
|
||||
if (!query.signal_id ||
|
||||
!g_type_is_a (query.itype, GTK_TYPE_WIDGET) ||
|
||||
query.return_type != G_TYPE_NONE ||
|
||||
query.n_params != 2 ||
|
||||
query.param_types[0] != GTK_TYPE_ADJUSTMENT ||
|
||||
query.param_types[1] != GTK_TYPE_ADJUSTMENT)
|
||||
{
|
||||
g_warning (G_STRLOC ": signal \"%s::%s\" has wrong signature",
|
||||
G_OBJECT_TYPE_NAME (widget), query.signal_name);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_signal_emit (widget, signal_id, 0, hadjustment, vadjustment);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_widget_reparent_subwindows (GtkWidget *widget,
|
||||
GdkWindow *new_window)
|
||||
@ -9897,7 +9930,6 @@ gtk_widget_real_size_request (GtkWidget *widget,
|
||||
static void
|
||||
gtk_widget_real_adjust_size_request (GtkWidget *widget,
|
||||
GtkOrientation orientation,
|
||||
gint for_size,
|
||||
gint *minimum_size,
|
||||
gint *natural_size)
|
||||
{
|
||||
|
@ -131,10 +131,6 @@ struct _GtkWidget
|
||||
* @activate_signal: The signal to emit when a widget of this class is
|
||||
* activated, gtk_widget_activate() handles the emission.
|
||||
* Implementation of this signal is optional.
|
||||
* @set_scroll_adjustments_signal: This signal is emitted when a widget of
|
||||
* this class is added to a scrolling aware parent,
|
||||
* gtk_widget_set_scroll_adjustments() handles the emission.
|
||||
* Implementation of this signal is optional.
|
||||
* @adjust_size_request: Convert an initial size request from a widget's
|
||||
* #GtkSizeRequest virtual method implementations into a size request to
|
||||
* be used by parent containers in laying out the widget.
|
||||
@ -161,7 +157,10 @@ struct _GtkWidget
|
||||
* and alignment properties of #GtkWidget. Chain up
|
||||
* <emphasis>before</emphasis> performing your own adjustments so your
|
||||
* own adjustments remove more allocation after the #GtkWidget base
|
||||
* class has already removed margin and alignment.
|
||||
* class has already removed margin and alignment. The natural size
|
||||
* passed in should be adjusted in the same way as the allocated size,
|
||||
* which allows adjustments to perform alignments or other changes
|
||||
* based on natural size.
|
||||
*/
|
||||
struct _GtkWidgetClass
|
||||
{
|
||||
@ -171,8 +170,6 @@ struct _GtkWidgetClass
|
||||
|
||||
guint activate_signal;
|
||||
|
||||
guint set_scroll_adjustments_signal;
|
||||
|
||||
/* seldomly overidden */
|
||||
void (*dispatch_child_properties_changed) (GtkWidget *widget,
|
||||
guint n_pspecs,
|
||||
@ -378,11 +375,13 @@ struct _GtkWidgetClass
|
||||
|
||||
void (* adjust_size_request) (GtkWidget *widget,
|
||||
GtkOrientation orientation,
|
||||
gint for_size,
|
||||
gint *minimum_size,
|
||||
gint *natural_size);
|
||||
void (* adjust_size_allocation) (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
GtkOrientation orientation,
|
||||
gint *natural_size,
|
||||
gint *allocated_pos,
|
||||
gint *allocated_size);
|
||||
|
||||
/*< private >*/
|
||||
|
||||
@ -499,9 +498,6 @@ gboolean gtk_widget_send_focus_change (GtkWidget *widget,
|
||||
GdkEvent *event);
|
||||
|
||||
gboolean gtk_widget_activate (GtkWidget *widget);
|
||||
gboolean gtk_widget_set_scroll_adjustments (GtkWidget *widget,
|
||||
GtkAdjustment *hadjustment,
|
||||
GtkAdjustment *vadjustment);
|
||||
|
||||
void gtk_widget_reparent (GtkWidget *widget,
|
||||
GtkWidget *new_parent);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user