Commit Graph

488 Commits

Author SHA1 Message Date
Timm Bäder
9992a616ef widget: Use ::measure vfunc to measure size
Add a new ::measure vfunc similar to GtkCssGadget's that widget
implementations have to override instead of the old get_preferred_width,
get_preferred_height, get_preferred_width_for_height,
get_preferred_height_for_width and
get_preferred_height_and_baseline_for_width.
2016-10-22 19:05:47 +02:00
Benjamin Otte
3fc32511b5 iconview: Use gdk_window_new_child() 2016-10-18 00:22:35 +02:00
Emmanuele Bassi
5880d1b990 gtk: Cast static strings assigned to non-const variables
GtkTargetEntry.target is particularly egregious, and it should really be
constified.
2016-10-17 11:44:10 +01:00
Timm Bäder
999d45b4e8 Remove various unused style properties 2016-10-16 18:17:21 +02:00
Timm Bäder
040db1efcd Remove some deprecated GdkColor style properties 2016-10-16 18:17:21 +02:00
Benjamin Otte
662001b60a API: Remove ability to set visuals on windows
And with it, gtk_widget_get_visual() and gtk_widget_set_visual() are
gone.

We now always use the RGBA visual (if available) and otherwise fall back
to the system visual.
2016-10-16 18:17:21 +02:00
Alberto Ruiz
496f0892fc introspection: This patch fixes nullable return values fixes for the following symbols in gtk
gtk_accel_group_query
  gtk_accel_group_from_accel_closure
  gtk_accel_label_get_accel_widget
  gtk_accessible_get_widget
  gtk_actionable_get_action_name
  gtk_app_chooser_get_app_info
  gtk_app_chooser_button_get_heading
  gtk_app_chooser_dialog_get_heading
  gtk_application_get_window_by_id
  gtk_assistant_get_nth_page
  gtk_binding_set_find
  gtk_builder_get_object
  gtk_builder_lookup_callback_symbol
  gtk_builder_get_application
  gtk_button_get_image
  gtk_cell_area_get_focus_from_sibling
  gtk_cell_renderer_start_editing
  gtk_cell_view_get_model
  gtk_cell_view_get_displayed_row
  gtk_clipboard_get_owner
  gtk_container_get_focus_child
  gtk_container_get_focus_vadjustment
  gtk_container_get_focus_hadjustment
  gtk_dialog_get_widget_for_response
  gtk_drag_get_source_widget
  gtk_drag_dest_get_target_list
  gtk_drag_source_get_target_list
  gtk_entry_completion_get_model
  gtk_entry_completion_compute_prefix
  gtk_expander_get_label_widget
  gtk_file_chooser_get_filename
  gtk_file_chooser_get_current_folder
  gtk_file_chooser_get_uri
  gtk_file_chooser_get_current_folder_uri
  gtk_file_chooser_get_preview_widget
  gtk_file_chooser_get_preview_file
  gtk_file_chooser_get_preview_filename
  gtk_file_chooser_get_preview_uri
  gtk_file_chooser_get_extra_widget
  gtk_file_chooser_get_filter
  gtk_file_chooser_native_get_accept_label
  gtk_file_chooser_native_get_cancel_label
  gtk_file_filter_get_name
  gtk_font_chooser_get_font_family
  gtk_font_chooser_get_font_face
  gtk_font_chooser_get_font
  gtk_font_chooser_get_font_desc
  gtk_font_chooser_get_font_map
  gtk_frame_get_label
  gtk_gesture_get_device
  gtk_gesture_get_window
  gtk_gl_area_get_error
  gtk_header_bar_get_title
  gtk_header_bar_get_subtitle
  gtk_header_bar_get_custom_title
  gtk_icon_info_get_filename
  gtk_icon_view_get_path_at_pos
  gtk_icon_view_get_model
  gtk_image_get_pixbuf
  gtk_image_get_animation
  gtk_label_get_mnemonic_widget
  gtk_label_get_attributes
  gtk_check_version
  gtk_menu_button_get_popup
  gtk_menu_button_get_menu_model
  gtk_menu_button_get_align_widget
  gtk_menu_button_get_popover
  gtk_menu_item_get_submenu
  gtk_menu_item_get_accel_path
  gtk_native_dialog_get_title
  gtk_native_dialog_get_transient_for
  gtk_notebook_get_nth_page
  gtk_notebook_get_tab_label_text
  gtk_notebook_get_menu_label
  gtk_notebook_get_menu_label_text
  gtk_notebook_get_group_name
  gtk_notebook_get_action_widget
  gtk_offscreen_window_get_surface
  gtk_offscreen_window_get_pixbuf
  gtk_paned_get_child1
  gtk_paned_get_child2
  gtk_places_sidebar_get_location
  gtk_places_sidebar_get_nth_bookmark
  gtk_plug_get_socket_window
  gtk_popover_get_default_widget
  gtk_progress_bar_get_text
  gtk_recent_filter_get_name
  gtk_recent_manager_lookup_item
  gtk_settings_get_default
  gtk_socket_get_plug_window
  gtk_stack_sidebar_get_stack
  gtk_stack_switcher_get_stack
  gtk_style_context_get_section
  gtk_style_context_get_parent
  gtk_style_context_get_frame_clock
  gtk_test_find_widget
  gtk_text_buffer_get_mark
  gtk_text_tag_table_lookup
  gtk_text_view_get_tabs
  gtk_text_view_toggle_cursor_visible
  gtk_text_view_get_window
  gtk_toolbar_get_nth_item
  gtk_tool_button_get_label
  gtk_tool_button_get_icon_name
  gtk_tool_button_get_label_widget
  gtk_tool_button_get_icon_widget
  gtk_tool_palette_get_drop_item
  gtk_tool_palette_get_drop_group
  gtk_tree_model_filter_convert_child_path_to_path
  gtk_tree_model_filter_convert_path_to_child_path
  gtk_tree_model_sort_convert_child_path_to_path
  gtk_tree_model_sort_convert_path_to_child_path
  gtk_tree_view_get_column
  gtk_tree_view_get_bin_window
  gtk_tree_view_column_get_widget
  gtk_tree_view_column_get_tree_view
  gtk_widget_get_frame_clock
  gtk_window_group_get_current_device_grab
  GtkTextBufferSerializeFunc
2016-01-08 12:18:23 +00:00
Matthias Clasen
43f822e70f Annotate deprecated style properties
Use G_PARAM_DEPRECATED with deprecated style properties.
This will make it easier to identify and remove such stale
properties from css, since it will now trigger warnings.
2015-11-16 15:13:33 -05:00
Matthias Clasen
af04390b29 icon view: Document some style properties as deprecated
No code change.
2015-11-16 07:20:18 -05:00
Matthias Clasen
740fa2cd70 iconview: Add a diagram to CSS documentation 2015-11-10 07:37:25 -05:00
Matthias Clasen
318269550b iconview: Use a CSS node for rubberband drawing
Use a CSS node with name rubberband to draw the rubberband
selection.
2015-11-10 00:27:11 -05:00
Matthias Clasen
ee3799f151 icon view: Add an element name
Not surprising anybody, I decided to call it iconview.
2015-10-30 17:44:36 -04:00
Alexander Larsson
d5f1754981 gtk: Stop setting GDK_EXPOSURE_MASK on random widgets
These days exposure happens only on the native windows (generally the
toplevel window) and is propagated down recursively. The expose event
is only useful for backwards compat, and in fact, for double buffered
widgets we totally ignore the event (and non-double buffering breaks
on wayland).

So, by not setting the mask we avoid emitting these events and then
later ignoring them.

We still keep it on eventbox, fixed and layout as these are used
in weird ways that want backwards compat.
2015-09-14 11:01:13 +02:00
Cosimo Cecchi
ba2f479aa0 iconview: don't call gtk_style_context_set_background() 2015-07-01 16:09:22 -07:00
Matthias Clasen
138e958614 icon view: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:15 -04:00
Carlos Garnacho
61cc10760d iconview: Avoid usage of gdk_window_get_device_position() during DnD
Just use the last coordinates given on XdndPosition/drag_motion() in
order to trigger scrolling.

When running on Xwayland, the pointer position is unknown at this
stage on the X11 side, so the coordinates given here are bogus.
This change avoids both roundtrips and this situation.

https://bugzilla.gnome.org/show_bug.cgi?id=749679
2015-05-21 18:11:21 +02:00
Matthias Clasen
647889c2e3 GtkIconView: Stop using gtk_adjustment_changed
This should not be needed at all.
2015-05-10 02:35:07 -04:00
Benjamin Otte
6b16c795ba iconview: Unset prelit item in leave-notify
We don't want to keep a prelit item when the mouse cursor is elsewhere.
2014-09-16 04:30:01 +02:00
Benjamin Otte
072c417416 iconview: Remove iterm->prelight
item->prelight
is always equal to
  iconview->priv->last_prelight == item
so there is no need to track it separately.
2014-09-16 04:30:00 +02:00
Benjamin Otte
48d56c4077 iconview: always draw a cell background
Don't just draw it for selected cells.
2014-09-16 04:30:00 +02:00
Benjamin Otte
86607c0f21 iconview: Don't queue redraws when nothing changes
We were queueing redraws for the old and the new prelit item, even when
they were the same item.
2014-09-15 16:35:40 +02:00
Matthias Clasen
d331c949d6 GtkIconView: Animate keybindings 2014-07-02 20:58:16 -04:00
William Jon McCann
aa30278e6b Allow activating an item after single click on a different item
We were ignoring double click events when a different item was
previously selected.

https://bugzilla.gnome.org/show_bug.cgi?id=484640
2014-06-28 00:23:02 -04:00
Jasper St. Pierre
9c37b3de74 gtk: Don't use GObjectClass.constructor
Use the newer constructed instead, which has a fast path in GObject.
2014-06-26 19:06:43 -04:00
Matthias Clasen
72ece5a62c GtkIconView: Remove a no-longer-valid optimization
The rubberband rendering code was assuming that we just have
a 1-pixel border and the rest of the rubberband is uniform.
That is not a safe assumption to make with css-styled
rubberbands, so remove it.
2014-06-19 13:52:11 -04:00
Matthias Clasen
720561475d GtkIconView: Use G_PARAM_EXPLICIT_NOTIFY 2014-06-09 13:31:04 -04:00
Carlos Garnacho
bae68b5511 iconview: remove superfluous GTK+ grabs 2014-05-23 19:54:24 +02:00
Matthias Clasen
49cf5142ba Deprecate GdkColor
It has been replaced by GdkRGBA. Time to make it official.
http://bugzilla.gnome.org/show_bug.cgi?id=636695
2014-05-22 09:09:55 -04:00
William Jon McCann
469d333aa2 docs: use Returns: consistently
Instead of Return value:
2014-02-19 18:56:05 -05:00
Matthias Clasen
7f6a964c47 Docs: Remove all entities and turn off sgml mode
With all element markup gone, it is time to turn off
sgml mode, and get rid of entities as well.
2014-02-09 17:58:07 -05:00
William Jon McCann
326da2da58 docs: don't use <anchor> 2014-02-07 15:40:52 -05:00
William Jon McCann
e34bd4137d docs: use apostrophes in *n't 2014-02-07 13:32:47 -05:00
William Jon McCann
7a208fbbf3 docs: use proper apostrophe
https://wiki.gnome.org/Design/OS/Typography
2014-02-07 13:06:10 -05:00
William Jon McCann
0ce016650b docs: Use markup for links 2014-02-07 09:42:12 -05:00
William Jon McCann
a22358c0c0 docs: use ` instead of <literal> 2014-02-04 18:24:29 -05:00
Benjamin Otte
43baa213b2 a11y: Ignore deprecation warnings for ATK focus tracker 2014-02-03 21:38:16 +01:00
Matthias Clasen
30cc1512e6 Docs: Use markdown for lists
This greatly reduces the amount of xml in the docs.
2014-02-02 01:07:39 -05:00
William Jon McCann
4c8bd8e7cf docs: Identify examples that are C code
https://bugzilla.gnome.org/show_bug.cgi?id=723119
2014-01-29 12:45:49 -05:00
Bastien Nocera
438cd857c4 all: Add names to timeouts
Add names to every timeout we setup, so it's easier to track their
usage, and debug possible misbehaviour.

https://bugzilla.gnome.org/show_bug.cgi?id=710651
2013-10-23 13:31:18 +02:00
Matthias Clasen
445204acca Fix an age-old typo
GtkIconView was not properly propagating key release events,
since forever.

https://bugzilla.gnome.org/show_bug.cgi?id=706740
2013-08-31 12:27:31 -04:00
Carlos Garcia Campos
247ebbd17c iconview: Respect the fixed item width when adjusting the wrap width
Restore the code the way it was in GTK2.

https://bugzilla.gnome.org/show_bug.cgi?id=680953
2013-08-26 18:23:55 +02:00
Jasper St. Pierre
030b62d122 gtkdnd: Introduce a new API for more accurate drag origin data
When trying to drag, we currently the position of the first motion
event to determine where the drag came from. This might be alright
in the case of the old animation, but the data will be inaccurate
if the user has moved the pointer quite a bit since pressing the
cursor to start dragging. While we could monkey patch the GdkEvent
at the widget layer, this is unintuitive and strange.

Add a new API that takes a set of pointer coordinates describing
the origin of the drag. Additionally, adapt most widgets to use
it and use it with correct coordinates.

https://bugzilla.gnome.org/show_bug.cgi?id=705605
2013-08-14 07:12:52 -04:00
Jasper St. Pierre
5674f2ce50 gtkiconview: Take padding into account when getting the cursor hotspot
This makes the icon view look completely seamless when dragging.

https://bugzilla.gnome.org/show_bug.cgi?id=705605
2013-08-07 11:53:05 -04:00
Jasper St. Pierre
d72252c7d6 gtkiconview: Remove the border and background from drag icons
This doesn't look good when combined with rounded corners on
selected items.

https://bugzilla.gnome.org/show_bug.cgi?id=705605
2013-08-07 11:53:04 -04:00
Simon Feltman
b1a0773112 Add explicit transfer annotations to gtk_icon_view_get_cursor
The cell out argument to gtk_icon_view_get_cursor is a pass-through
for gtk_cell_area_get_focus_cell which is transfer none. Without
this explicit annotation, transfer full is defaulted and introspection
bindings will assume ownership of the GtkIconViews reference to the
cell, causing crashes. Additionally add explicit transfer full to
the path parameter because it is expected the caller will free the
returned memory.

https://bugzilla.gnome.org/show_bug.cgi?id=704700
2013-07-28 21:25:57 -07:00
Emmanuele Bassi
0899ef7cc9 gtk: Use new macros for defining private data
https://bugzilla.gnome.org/show_bug.cgi?id=702996
2013-07-09 09:30:02 +01:00
Alexander Larsson
3d4cd4db3e Add gtk_widget_(un)register_window
This replaces the previously hardcoded calls to gdk_window_set_user_data,
and also lets us track which windows are a part of a widget. Old code
should continue working as is, but new features that require the
windows may not work perfectly.

We need this for the transparent widget support to work, as we need
to specially mark the windows of child widgets.

https://bugzilla.gnome.org/show_bug.cgi?id=687842
2013-02-07 11:11:37 +01:00
Matthias Clasen
5f41eb74a5 Fix a few parameter mismatches in the symbols 2013-02-01 22:54:21 -05:00
Cosimo Cecchi
c4183405fe icon-view: add back gtk_style_context_set_background()
Commit da09447914 removed the call to
gtk_style_context_set_background() in favour of always rendering it with
gtk_render_background() during the draw vfunc.
This has the side effect of making the backing window always
transparent, which blocks GTK from applying some optimizations during
the paint cycle. The result is that, especially in clutter-gtk
applications, scrolling performance gets really bad.

This commit partially reverts da09447914
and changes the code so that both gtk_style_context_set_background() and
gtk_render_background() are called.
2013-02-01 11:27:14 +01:00
William Jon McCann
c7169e119e Add optional single click activation mode for icon view
https://bugzilla.gnome.org/show_bug.cgi?id=345023
2013-01-20 16:49:30 -05:00
Matthias Clasen
e4b5e94eb9 Make accessible implementations public
This commit exposes the get_type() functions and standard
headers for accessible implementations. This makes it possible
to derive from the GTK accessible implementations without
GType magic tricks. This is necessary, because we require the
a11y type hierarchy to be parallel to the widget type hierarchy.
So, if you derive a widget and need to adjust its a11y implementation,
you have to be able to derive its accessible implementation.

This commit probably exposes more than is absolutely necessary,
it also exposes accessibles of widgets that are unlikely candidates
for deriving from.
2012-12-27 11:23:22 -05:00
Cosimo Cecchi
da09447914 iconview: don't use gtk_style_context_set_background()
Render a background with gtk_render_background() during draw instead.

https://bugzilla.gnome.org/show_bug.cgi?id=688744
2012-11-20 13:41:39 -05:00
Alexander Larsson
ecd84fac48 iconview: Render focus even in non-selected items
This is needed for the SELECTION_NONE mode where nothing is ever
selected, but its also needed for CTRL-<key> keynav that moves the
focus without changing the selection.

https://bugzilla.gnome.org/show_bug.cgi?id=684984
2012-09-27 19:43:50 +02:00
William Jon McCann
b3a65248f5 Fix a typo in the the comments
https://bugzilla.gnome.org/show_bug.cgi?id=682724
2012-08-26 22:54:55 +08:00
William Jon McCann
c5c46a125e icon-view: emit selection-changed when changing the model
Only if there was a selection active.

https://bugzilla.gnome.org/show_bug.cgi?id=681613
2012-08-20 13:59:09 -04:00
William Jon McCann
374d48c37b Fix typo in documentation 2012-08-10 13:03:10 -04:00
René Stadler
e5269ebbcd iconview: fix get_tooltip_context transfer annotation
Just like treeview.

https://bugzilla.gnome.org/show_bug.cgi?id=681005
2012-08-01 19:00:36 +02:00
Cosimo Cecchi
f70fc49ebc docs: fix a number of typos and obsolete references 2012-07-02 10:41:11 -04:00
Alexander Larsson
6c04296f03 Rename gtk_icon_view_get_cell_area to gtk_icon_view_get_cell_rect
get_cell_area was "conflicting" with the property named "cell-area"
which is something different.
2012-06-25 15:07:13 +02:00
Alexander Larsson
fb91fa2fbd Add gtk_icon_view_get_cell_area
This gets the current cell area of a particular item. Its similar
to gtk_tree_view_get_cell_area().

The code is extracted from gtk_icon_view_set_tooltip_cell which now
just calls the old code.

https://bugzilla.gnome.org/show_bug.cgi?id=678418
2012-06-22 13:50:33 -04:00
Benjamin Otte
5c46f81e7b iconview: Special case the empty iconview
If the icon view is empty, we cannot get a reasonable size request from
the cell renderers. So all values we would compute are pretty much
useless.
So we special case it.

This also gets rid of a bunch of crashers from div-by-0 in corner cases.

https://bugzilla.gnome.org/show_bug.cgi?id=677809
2012-06-15 02:44:45 +02:00
Benjamin Otte
c187386fe1 iconview: Add a descriptive function
I want to special-case empty icon views in the sizing code to avoid
various bugs, and having such a function is nice.
2012-06-14 18:52:09 +02:00
Benjamin Otte
fd4c330500 iconview: Ensure icons are at least 1x1 pixels
This is useful for 2 reasons:
(1) Items actually exist and are clickable
(2) Size computations don't divide by 0

I've not seen problems with this in the wild (mostly because
item-padding defaults to non-0), but noticed this while fixing other
bugs.
2012-06-14 18:44:44 +02:00
Benjamin Otte
62292dc247 iconview: Don't add item-padding
... to item sizes when there are no items.
2012-06-14 07:41:40 +02:00
Benjamin Otte
6d9d87806a iconview: clamp item size to be in [minimum, natural]
Minimum size is necessary so you can see the item. If we can't get that
we need to scroll.
Natural as the maximum is used so that the spacing between items doesn't
increase when resizing the iconview, but empty space is added to the
right/bottom instead.

https://bugzilla.gnome.org/show_bug.cgi?id=677809
2012-06-14 07:41:40 +02:00
Benjamin Otte
7c1b561194 iconview: Include column spacing in calculation
The function is probably almost never used, so nobody has ever seen this
bug, but we should still get it right.

https://bugzilla.gnome.org/show_bug.cgi?id=677809
2012-06-14 07:41:40 +02:00
Benjamin Otte
4b83be0e26 iconview: Add documentation abour different sizes
Did I mention I hate code that has different kinds of "boxes" or
coordinate systems but no clear way to distinguish them?
It's all ints here...

https://bugzilla.gnome.org/show_bug.cgi?id=677809
2012-06-14 07:41:40 +02:00
Hans de Goede
c32a5a80b7 iconview: gtk_icon_view_compute_n_items_for_size bugfix
While working on the "iconview: Don't shrink items" patch I noticed that
gtk_icon_view_compute_n_items_for_size modifies the natural and minimum
item sizes it got from gtk_icon_view_get_preferred_item_size when
calculating the max number of items which will fit, but later on it
checks against these sizes when calculating the item_size, and these
checks expect these values to be unmodified.

This patch fixes this by modifying the natural and minimum values in
advance and doing all computations with modified values.

https://bugzilla.gnome.org/show_bug.cgi?id=677809
2012-06-14 07:41:39 +02:00
Benjamin Otte
ec755541ab iconview: Don't shrink items
The previous code assumed that the width was always enough for more than
one column, which is obviously not correct when a number of columns is
hardcoded.

With this patch, it will now always check that the width is enough and
otherwise cause scrolling.

https://bugzilla.gnome.org/show_bug.cgi?id=677809
2012-06-14 07:41:39 +02:00
Matthias Clasen
1685b2b220 iconview: Bring back rtl flipping
This was lost in the recent layout rewrite.
2012-05-15 01:12:28 -04:00
Benjamin Otte
cc057d5c4e iconview: Don't draw unallocated items
This is more a workaround for Clutter-GTK than anything else. Most of
all, it makes gnome-boxes start again.
2012-05-09 14:23:10 +02:00
Benjamin Otte
d736d06db8 iconview: Only compute item sizes in one place
Code was using different places to compute the icon size when layouting
and when doing size requests. This resulted in non-matching behavior in
obscure cases. And that lead to iconviews that were too small.
2012-05-08 03:58:23 +02:00
Benjamin Otte
e31fb77c22 iconview: Bring back per-row contexts
Apparently GtkCellAreaContext is broken enough to not allow multiple
allocations...
2012-05-08 03:58:23 +02:00
Benjamin Otte
e8eeb39d98 iconview: Move wrap width adjustment to size request code 2012-05-08 03:58:23 +02:00
Benjamin Otte
86cebc9b43 iconview: Fix negative natural size request on empty iconview 2012-05-07 17:19:10 +02:00
Benjamin Otte
e133c6cb71 iconview: Don't expand items to more than natural size
This ensures that items stay left-aligned instead of slowly expanding into
empty space when widening the iconview. It's also what the iconview did
pre-refactoring.

Note that for cases where natural width != minimum width, the cells
might still expand and shrink back.
2012-05-07 01:37:27 +02:00
Benjamin Otte
d20d7c54d3 iconview: Redo layouting 2012-05-07 00:12:26 +02:00
Benjamin Otte
b7385ffcab iconview: Respect item width in size requestr code 2012-05-07 00:12:26 +02:00
Benjamin Otte
d406bf96d4 iconview: Reduce complexity of sizing code
Always assume max-columns and min-rows. The old approach was kinda
insane.

As an example, try to write an algorithm that optimizes the minimum size
for infinite (take a reasonably large number like 2520) word-wrapped
Monospace text cells containing the text "XXXXX XXX XXX XXXXX" (keep in
mind that this is the easy problem, because it's assuming equal cell
renderers). There's 4 ways to reasonably lay out this text:
19 glyphs (19x1):
  XXXXX XXX XXX XXXXX
18 glyphs (9x2):
  XXXXX XXX
  XXX XXXXX
21 glyphs (7x3):
  XXXXX
  XXX XXX
  XXXXX
20 glyphs (5x4):
  XXXXX
  XXX
  XXX
  XXXXX
The best thing to do usually is using the 9x2 approach, but that's
neither the one using the natural nor the one using the minimum size.

As a side note, this does not include spacing and padding, which might
also influence the decision. Nor does it include height-for-width
considerations. Look at this table (numbers given in glyphs, not pixels,
as for pixel-sizes it gets even more interesting):
  given  best solution
  width  columns  sizing  glyphs per cell
   6      1       6x4           20
   7      1       7x3           21
   8      1       7x3           24
   9      1       9x2           18
  10      1/2     9x2/5x4       20
  11      1/2     9x2/5x4       22
  12      1/2     9x2/5x4       24
  13      1/2     9x2/5x4       26
  14      2       7x3           21
  15      3       5x4           20
  16      3       5x4           21.3
  17      3       5x4           22.7
  18      2       9x2           18
  19      1/2    19x1/8x2       19
  20      1/2/4  19x1/8x2/5x4   20
  21      1-4     any           21
  22      1-4     any           22
  23      1-4     any           23
  24      1-4     any           24
  25      5       5x4           20
  26      5       5x4           20.8
  27      3       9x2           18
  28      3       9x2           18.7
  29      3       9x2           19.3
  30      3/6     9x2/5x4       20

Now of course, nobody wants the number of columns to randomly change in
inexplicable ways while they enlarge or shrink an iconview, so we not
only have to optimize for smallest or other size measurements, but we
also have to optimize for "most pleasing to the eye".

And last but not least, I'd like to once again remind you - if you kept
up until now - that this discussion was for identically-sized cells
only.
2012-05-07 00:12:26 +02:00
Benjamin Otte
65ad492c24 iconview: Redo size requests
Instead of just returning the last allocated numbers, we now compute the
proper sizes from scratch. This is a bit less trivial, but it results in
proper height-for-width handling.
2012-05-07 00:12:26 +02:00
Benjamin Otte
63ddb3f2c7 iconview: Don't cache iters
This is a huge quest to remove all caching from GtkIconview to simplify
the code. As it turns out, iconview performance is a joke, so the caches
are kinda unnecessary.

If we need caching, we can add it in a useful way later.
2012-05-07 00:12:26 +02:00
Benjamin Otte
ee91e272a8 iconview: Remove needless requirement
If we use
  &item->cell_area
instead of
  (GdkRectangle *) item
there is no need anymore to keep the cell_area as the first member of
the the item. And we cget compile-time checks for changes to the item
struct.
2012-05-07 00:12:26 +02:00
Benjamin Otte
917ca6a802 gtk: Don't call gdk_window_process_updates() when scrolling
This can cause lagging when scrolling as it causes us to repaint
on every scroll event. This wasn't historically a great problem,
but with smooth scrolling we get a lot more events, so this
now creates visible lagging on slower machines.
2012-04-05 15:48:51 +02:00
Benjamin Otte
ccbcebdddf iconview: Don't resize on size allocation
Let's see how much this breaks. But then, it also fixes things, so more
power to me!

https://bugzilla.gnome.org/show_bug.cgi?id=672173
2012-03-16 17:53:30 +01:00
Benjamin Otte
0794143f41 iconview: Fix autoscroll
... when the iconview is not the only child in it's parent GdkWindow.
2012-03-03 21:18:12 +01:00
Benjamin Otte
2353d60b8a types: Move GtkAdustment declaration to gtktypes.h
... and make all the headers to not include gtkadjustment.h anymore. Of
course, also include it in the source files instead.
2012-03-03 19:45:03 +01:00
Carlos Garnacho
7381a2788b iconview: set GDK_SMOOTH_SCROLL_MASK
This is so smooth scroll events are send/handled by the
parent GtkScrolledWindow if any.
2012-03-01 16:28:59 -05:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Carlos Garnacho
72f86d6bfb iconview: Set background on the widget's window
The widget window is usually covered by the bin_window.
Its background color will become relevant when we introduce
kinetic scrolling with overshooting.
2012-02-23 22:28:32 -05:00
Murray Cumming
a0b4ab109d Documentation: Correct references to properties.
These should use :, not ::, though signals would use ::.
See
http://developer.gnome.org/gtk-doc-manual/unstable/documenting_syntax.html.en
and
http://developer.gnome.org/gtk-doc-manual/unstable/documenting_symbols.html.en
2012-02-15 11:43:33 +01:00
Carlos Garcia Campos
c7756f0410 gtkiconview: Use symbolic names for button numbers 2012-01-27 09:47:43 +01:00
Javier Jardón
d005b01319 gtk/*: Use g_list_free_full() convenience function 2012-01-05 04:22:43 +01:00
Rui Matos
f4b9562f46 iconview: Use the widget state flags as a base for drawing items 2011-12-19 19:21:16 +00:00
Rui Matos
ffd5126a42 iconview: Stop setting state flags on the style context for drawing 2011-12-19 19:21:16 +00:00
Benjamin Otte
1961be9ee9 iconview: Simplify adjustment monitoring for accessible 2011-12-19 16:17:13 +01:00
Benjamin Otte
1305815bde iconview: Split out iconview accessible 2011-12-19 16:17:12 +01:00
Claudio Saavedra
f9c24e8f03 GtkIconView: fix a memory corruption in the drag-n-drop code
You shall free with g_slice_free() what you allocate with
g_slice_new().

https://bugzilla.gnome.org/show_bug.cgi?id=665338
2011-12-01 22:56:43 +01:00
Matthias Clasen
b84d37af4d GtkIconView: Fix a segfault
Keynav on an empty iconview was causing segfaults. This
was reported in https://bugzilla.gnome.org/show_bug.cgi?id=664456
2011-11-23 17:51:58 -05:00
Benjamin Otte
54d6ef115b iconview: Keep the device for dnd autoscroll
This is necessary to query the device's coordinates when doing the
scrolling.
2011-11-02 02:32:54 +01:00
Cosimo Cecchi
d808daccc1 iconview: layout items immediately when setting a GtkTreeModel
As the draw handler expects the items to be laid out already, we cannot
queue a layout here to avoid a race condition with the resize that is
queued immediately after, which in turn would lead to a segfault later
in the paint_item() implementation.

https://bugzilla.gnome.org/show_bug.cgi?id=663138
2011-11-01 11:15:50 -04:00
Michael Natterer
11f8c1ba6f gtk: remove the private GTK_EXTEND/MODIFY_SELECTION_MOD_MASK
and use the new public modifier abstraction API instead.
2011-09-27 12:06:10 +02:00
Michael Natterer
0955a59563 app: abstract which modifiers are used for extending and modifying selections
which are SHIFT and MOD2 on the Mac, and SHIFT and CONTROL otherwise.
Use the new define all over the place and rename variables and
members to not say "shift" or "control".
2011-09-26 16:01:50 +02:00
Cosimo Cecchi
e9de907f9e iconview: add support for prelight cells
Render GtkIconView cell items with the prelight state flag when they're
being mouse hovered.
This works basically in the same way it's done for GtkTreeView cells,
and e.g. GtkCellRendererPixbuf will need to have its follow-state
property to opt in to prelight rendering.

https://bugzilla.gnome.org/show_bug.cgi?id=615501
2011-09-15 09:34:04 -04:00
Benjamin Otte
9ddc11fbb5 iconview: Don't rturn TRUE from draw handler 2011-09-14 16:10:14 +02:00
Cosimo Cecchi
8b9f0402b0 iconview: fix a typo while removing the a11y adjustment weak ref
The code sets old_adj_ptr to the location containing the old weak ref,
but then wants to remove a weak ref from &view->old_hadj, causing warnings
when disposing the widget.
2011-09-06 19:09:19 -04:00
Matthias Clasen
1090eba9a8 a11y: don't return random numbers
Return 0 for the image size if we don't have a pixbuf to measure.
2011-08-29 10:50:01 -04:00
Colin Walters
c8fdd5e847 Squash two compilation warnings about possibly-uninitialzed 2011-08-25 14:47:21 -04:00
Matthias Clasen
2ba9c4b4a7 Make focus rectangles optional
This commit introduces a new setting, gtk-visible-focus, backed
by the Gtk/VisibleFocus X setting. Its three values control how
focus rectangles are displayed.

'always' is equivalent to the traditional GTK+ behaviour of always
rendering focus rectangles.

'never' does what it says, and is intended for keyboardless
situations, e.g. tablets.

'automatic' hides focus rectangles initially, until the user
interacts with the keyboard, at which point focus rectangles
become visible.

https://bugzilla.gnome.org/show_bug.cgi?id=649567
2011-08-10 16:34:20 +02:00
Matthias Clasen
093612a46c Use G_DEFINE_TYPE for GtkIconViewItemAccessible 2011-07-25 00:46:34 -04:00
Matthias Clasen
2c6c0fe329 Minor cleanups 2011-07-25 00:34:08 -04:00
Matthias Clasen
a4560cdfbb Rework AtkText implementation
Use a PangoLayout, instead of storing a text buffer per item.
And use gtkpango api instead of implementing it all ourselves.
2011-07-25 00:27:42 -04:00
Matthias Clasen
26a040e81b Drop some grandiosity from the AtkAction implementation
There is only one action here, no need to pretend otherwise.
2011-07-24 23:59:00 -04:00
Matthias Clasen
625947f9f2 Use G_DEFINE_TYPE for GtkIconViewAccessible 2011-07-24 23:48:41 -04:00
Matthias Clasen
fadd58a0fb Drop GtkIconViewAccessiblePrivate
Just put the members in GtkIconViewAccessible itself.
2011-07-24 23:28:57 -04:00
Matthias Clasen
8a544d54ea Move GtkBuildable implementation up before accessibility
Just code rearrangement, no other changes.
2011-07-24 23:04:02 -04:00
Matthias Clasen
3e05518881 Drop unneeded includes
We no longer use the private GtkAccessible api here.
2011-07-14 19:40:50 -04:00
Cosimo Cecchi
1fdfb18c37 iconview: make it possible for selected cells to render a border
Call gtk_render_frame() after gtk_render_background() there.

https://bugzilla.gnome.org/show_bug.cgi?id=654179
2011-07-08 11:36:04 -04:00
Matthias Clasen
521807f33d Drop the factory from the icon view accessible 2011-07-05 16:10:26 -04:00
Matthias Clasen
89e57c6978 Convert GailContainer to GtkContainerAccessible 2011-07-05 16:08:57 -04:00
Matthias Clasen
6c9f20e58d GtkIconViewPrivate: Improve struct packing 2011-04-12 12:33:24 -04:00
Tristan Van Berkom
f85e80aada More patchwork for icon view subclasses that access the icon view api prematurely.
In this patch we adress rows_reordered() and row_deleted() callbacks
(since some icon view subclasses manipulate the connected treemodel
from _init()).
2011-02-25 16:00:20 +09:00
Tristan Van Berkom
2408b1c59e More patchwork to ensure GtkIconView subclasses can use the icon view api
from the subclass's instance structure initializer
2011-02-25 15:07:55 +09:00
Tristan Van Berkom
4164a49b84 Added documentation to "cell-area" construct-only properties.
Indicate what kind of area will be used by default if none is
provided by the user.
2011-02-24 16:05:41 +09:00
Tristan Van Berkom
4d76644f5c Add more defensive code to avoid accessing GtkIconView's cell area before it exists.
Adding these cases here to cater to icon view subclasses that want to
access icon view APIs from the instance structure initializer instead
of properly waiting for the super class to initialize and adding renderers
from the ->constructor() vfunc.
2011-02-23 20:50:50 +09:00
Matthias Clasen
c9b152ec71 Remove a leaking get_name implementation
This was leaking a lot of memory; just rely on atk_object_get_name.
2011-02-17 15:57:39 -05:00
Matthias Clasen
e757d1b2d2 Use _gtk_accessible_set_factory_type for GtkIconView 2011-02-17 01:30:33 -05:00
Matthias Clasen
beb8c290d1 Always chain up in ::style-updated
This was not handled consistently, but the default handler
does useful things, so we should always chain up.
2011-02-07 07:30:37 -05:00
Matthias Clasen
726b0d8736 Bandaid fix for icon view subclassing
I've decided that it is isn't feasible to make cell areas runtime-settable
in the time we have left before 3.0, therefore, I'm going with the
approach to allow init() functions to instantiate the default cell area
and issue a warning if a construct property is ignored.

This is not ideal, but it keeps existing icon view and combo box
subclasses working.

https://bugzilla.gnome.org/show_bug.cgi?id=639139
2011-01-31 17:39:42 -05:00
Carlos Garnacho
3efc1b0b4f Make GtkIconView use GtkStyleContext 2011-01-27 20:57:11 +01:00
Carlos Garnacho
41d6837fa2 Make GtkCellArea use GtkStyleContext
gtk_cell_area_[gs]et_style_detail() is no longer needed, as
the passed widget's context would already have all necessary
info.
2011-01-27 19:32:07 +01:00
Matthias Clasen
d9fcc4c630 Silence new gcc warnings
gcc 4.6.0 has started to warn about set-but-unused variables.
So don't do that, then.
2011-01-23 21:51:38 -05:00
Pavel Holejsovsky
2fb1c06402 [GI] Add missing (out) and (array) annotations 2011-01-20 13:57:20 +01:00
Pavel Holejsovsky
3c8fc21e9b [GI] Fixes of existing incorrect annotations 2011-01-20 13:56:06 +01:00
Pavel Holejsovsky
a1c297a310 [GI] Cosmetic cleanups of annotations and doc comments
This change does not introduce any functionality change, mostly
cosmtic cleanups, like re-linebreak when introduced annotations messed
up indentation or whitespace errors fixes.
2011-01-18 17:31:59 +01:00
Martin Pitt
b208b9c0e9 Fix GtkIconView GI annotations
Add the missing (out) annotations, and a missing allow-none.
2011-01-18 12:32:52 +01:00
Martin Pitt
234b3b2c6f Annotate GtkIconView array arguments 2011-01-17 16:01:40 +01:00
Tristan Van Berkom
4d8c7c5782 Ensure that GtkIconView items get redrawn when the focus cell changes.
Seems the redraw was not happenning from keynav when set_focus_cell()
was called because keynav already updates the focus-cell. Now we
just unconditionally redraw the focus item when set_focus_cell() is
called.
2011-01-06 13:51:49 +09:00
Tristan Van Berkom
bab0f5a5c1 Fixed GtkIconView keynav
Icon View was not initially setting focus on a cell when
focus initially comes into the view. Focusing into whatever
is the first cell in the cursor item when set_cursor_item
is called with a NULL cell fixes this.
2011-01-06 13:51:49 +09:00
Tristan Van Berkom
b7c25c41d6 Fixed gtkiconview dispose cycle to not fire warnings. 2011-01-06 13:51:49 +09:00
Tristan Van Berkom
56580d1b8b Restored the old GtkIconView guess for wrap-width/width size of text cell
GtkIconView sets the minimum width of the text cell to be at least 50
pixels and otherwise twice the width of the first pixbuf cell found
in the icon list.
2011-01-06 13:51:49 +09:00
Tristan Van Berkom
60e5fcf4db Made GtkIconView reset the context and invalidate all sizes when a row changes.
GtkIconView should have a "grow-only" mode to handle optimization to
only allow icons to grow in width when rows change, however since
GtkIconView still does not handle large numbers of rows for now we'll
just relayout the whole thing whenever a series of rows change.

Also fixed up to watch the context incase of implicit resets.
2011-01-06 13:51:49 +09:00
Tristan Van Berkom
6036c51d52 Removed gtk_icon_view_get_item_area()
Now use a GdkRectangle at the begining of the GtkIconViewItem
structure and just re-cast the struct to get the item area.
2011-01-06 13:51:49 +09:00
Tristan Van Berkom
d0f13ae52c Fixed GtkIconView buildable custom tag end to let cell layout properly
handle <cell-packing>
2011-01-06 13:51:48 +09:00
Tristan Van Berkom
01a35e4483 Added gtk_icon_view_new_with_area() 2011-01-06 13:51:48 +09:00
Tristan Van Berkom
a160358830 GtkIconView now uses a per-row GtkCellAreaContext to store the alignments
of each row.

GtkIconView now properly calculates the height of each row separately
using a separate GtkCellAreaContext stored in an array which it can
always easily index with the item->row index for all purposes.
2011-01-06 13:51:48 +09:00
Tristan Van Berkom
2d5eadb7f9 Alignments with variable row heights almost works perfectly.
However, I'm going to have to figure a way to store the alignments
for rows separately, this may involve using a separate GtkCellAreaContext
for each row, unfortunately.
2011-01-06 13:51:48 +09:00
Tristan Van Berkom
e51592c0b3 Experimenting with allocating the context a different height for each row. 2011-01-06 13:51:48 +09:00
Tristan Van Berkom
c77abe1f83 Committing working version of GtkIconView using GtkCellArea.
Some things still not sorted out, GtkCellAreaContext is not allocated
so icons dont recieve alignments yet, focus navigation is not exactly
what it used to be (maybe we can work around that by observing the
item orientation and explicitly setting focus to the same cell when
navigating in the wrong orientation).
2011-01-06 13:51:48 +09:00
Tristan Van Berkom
951ea857cc Initial messy commit of GtkIconView using GtkCellArea (nothing works yet). 2011-01-06 13:51:48 +09:00
Tristan Van Berkom
6d483ed930 Added GtkCellArea & GtkCellAreaContext to GtkIconView
First commit to icon-view-refactor, essentially only adds the
construct-only "cell-area" property and the context but doesnt
use it.
2011-01-06 13:51:48 +09:00