Commit Graph

973 Commits

Author SHA1 Message Date
Benjamin Otte
807a449f29 treeview: Fix crash when scrolling to end
This broke in a4630d0e7b

https://bugzilla.gnome.org/show_bug.cgi?id=665741
2011-12-07 20:12:12 +01:00
Benjamin Otte
7d3109a855 treeview: Properly change cursor when row is collapsed
Previously, when the cursor was a descendant of the collapsed row,
the cursor path was set to the collapsed row, but this was not
communicated via cursor-changed events.
2011-11-29 20:44:57 +01:00
Benjamin Otte
bbf00265fc treeview: Reorder code a bit
This is mainly in preparation for the next commit, but also to reorder
the code to
1) prepare modification of tree
2) modify tree
3) emit signals
2011-11-29 20:44:57 +01:00
Benjamin Otte
c070e7acf5 treeview: Simplify code
Since the changes in commit 2b3de3dd this simplification is possible.
2011-11-29 20:44:57 +01:00
Benjamin Otte
806dca0677 treeview: Rename function
_gtk_tree_view_find_path() was not a name that not really described what
the function does. And I kept forgetting it. Also, it took the tree view
as an argument and that was completely unnecessary.
2011-11-29 20:44:57 +01:00
Benjamin Otte
416b3ed204 treeview: Notify a11y about reordered rows
That way, no more signal handler is needed in the a11y code. Plus, we
avoid needless signal emissions for rows we don't care about.
2011-11-24 18:29:44 +01:00
Benjamin Otte
a4630d0e7b rbtree: Introduce _gtk_rbtree_is_nil()
Makes for more readable code than "== tree->nil" and allows removing the
nil member later.
2011-11-22 03:32:56 +01:00
Benjamin Otte
c3056951db rbtree: Introduce _gtk_rbtree_first()
... and use it.
2011-11-22 03:32:56 +01:00
Rui Matos
e60fa49fa7 Bug 653676 - Expand/Collapse doesn't respond after one click
Ignore leave-notify-event when mode is GDK_CROSSING_GTK_[UN]GRAB.
Just [un]grabbing shouldn't cause us to [un]prelight the current arrow
and node.
2011-11-20 21:00:08 +01:00
Kristian Rietveld
44a064fe30 Don't call scroll to cell if the tree view is empty
Account for the case when gtk_drag_finish() didn't actually add a row
(can happen when dragging from an empty tree view to itself ...).
2011-11-20 20:15:48 +01:00
Kristian Rietveld
a069ec662f Bug 660554 - gtk_tree_view_drag_begin: assertion `path != NULL' failed
Turned assertion into silent return.

This assertion is only hit when dragging from an empty tree view.  In
this case, gtk_tree_view_begin_drag() is triggered from gtkdnd.c and not
from gtk_tree_view_maybe_begin_dragging_row().  We actually want to
cancel the drag at this point, but that is not possible with the GTK+
API as far as I can see.

The alternative is to not allowing the drag to start.  This could be
done by simply unsetting the tree view as drag source when it is empty
and setting it as drag source again when rows are added.  I didn't
choose to go with this for now, since this will likely break third party
code.
2011-11-20 20:15:39 +01:00
Xan Lopez
2c065d716b treeview: fix the build 2011-11-16 22:41:57 +01:00
Cosimo Cecchi
9986b26c0b treeview: use gtk_tree_view_ensure_background() consistently
In gtk_tree_view_state_flags_changed() we were setting the background on
the bin_window without the necessary "view" style class, making the
treeview render with the wrong color in some circumstances (such as when
adding an empty treeview in a window, as spotted by Brian Smith).
2011-11-16 16:09:00 -05:00
Cosimo Cecchi
8d97d8ca3c treeview: factor out gtk_tree_view_ensure_background()
We'll use it shortly.
2011-11-16 15:59:47 -05:00
Benjamin Otte
a4b88c47cd treeview: Call a11y functions for culmn changes directly
This way, the a11y code knows if a column was reordered, added or
removed and can do the right things instead of trying to guess and
getting it wrong.

Also, this patch finalizes the changes so that only visible columns
exist to the accessibility interface.
2011-11-16 04:39:25 +01:00
Benjamin Otte
18181f5417 API: treeview: Add gtk_tree_view_get_n_columns() 2011-11-16 04:39:25 +01:00
Benjamin Otte
aa1cab1ec2 treeview: Simplify a check
Use the same method as elsewhere.
2011-11-16 04:39:25 +01:00
Benjamin Otte
81f9082d2a treeview: Minor beautification 2011-11-16 04:39:24 +01:00
Benjamin Otte
a890a61253 treeview: Add _gtk_rbtree_node_get_index()
.. as a replacement for _gtk_rbtree_node_find_parity(). Instead of 1 or
0, the function now returns the index of node in the complete tree
(counting from the root). And this is of course identical to the row
number.
2011-11-16 04:39:24 +01:00
Benjamin Otte
e927a5b2c7 treeview: Redo row tracking
Track the RBNode/RBTree instead of keeping a TreeRowReference. This is a
whole lot faster and less error-prone.

Also, notify the accessible of removal of rows before actually removing
them, so we have a chance to clean up.
2011-11-16 04:39:23 +01:00
Benjamin Otte
5096df14c3 treeview: Remove unnecessary variable
tmptree has the same value as tree everywhere, so just use tree instead.
2011-11-16 04:39:23 +01:00
Benjamin Otte
b526375e8f gtk: Fix compiler warnings from include fixes 2011-11-16 04:31:06 +01:00
Benjamin Otte
1a241f2348 treeview: Only compute parity once when rendering
This shouldn't affect performance too much, but it I just found it so I
fixed it.
2011-11-16 04:31:05 +01:00
Martin Pitt
1c222372d9 Fix gtk_tree_view_get_tooltip_context() transfer annotation
The default (out) transfer mode is "full", but the passed "model" pointer gets
set to gtk_tree_view_get_model() which is "transfer none". This caused Python
programs to free the model after calling this, causing crashes.
2011-11-14 14:33:51 +01:00
Alexander Larsson
96bae6ad08 Add include to fix the build 2011-11-10 17:25:02 +01:00
Matthias Clasen
a7958f06e3 treeview: Work around deprecations 2011-11-09 23:42:11 -05:00
Kristian Rietveld
91ae19768e Bug 661997 - Gtk crashes when changing the TreeView model while ...
Simply stopping rubber banding in gtk_tree_view_set_model() eliminates
the crash.  Reported by Thomas Perl.
2011-11-09 08:45:34 +01:00
Benjamin Otte
2783158f8d treeview: Do a simple replace for gdk_window_get_pointer()
Replace it with the equivalent gdk_window_get_device_position() with the
core pointer.
2011-11-09 03:23:43 +01:00
Benjamin Otte
28d3d6e039 treeview: Remove unused crack code
No, querying the pointer position in a draw callback is not a good idea.
No, setting FOCUSSED based on that position is not a good idea either.
2011-11-08 21:14:06 +01:00
Benjamin Otte
a1fb2c863b treeview: Remove call to gtk_widget_get_pointer() 2011-11-08 21:14:06 +01:00
Benjamin Otte
1425ecbc52 treeview: Fix warnings from fixing warnings
Warnings introdcued by fixing deprecation warnings in
2ead4c6038
2011-11-08 21:14:05 +01:00
Matthias Clasen
2ead4c6038 Remove some more uses of gdk_window_get_pointer 2011-11-02 08:10:42 -04:00
Matthias Clasen
8370052180 Don't use *DISABLE_DEPRECATED guards
Instead define GDK_DISABLE_DEPRECATION_WARNINGS where appropriate.
2011-11-01 22:35:57 -04:00
Michael Natterer
5c4f2ef0c1 gtk: move _gtk_modules_has_mixed_deps() to gtkmodlesprivate.h
and remove gtkmainprivate.h completely.
2011-10-23 13:57:07 +02:00
Javier Jardón
0853ce3077 Use G_VALUE_INIT
Instead of an explicit { 0, } when declaring the variable.
2011-10-15 16:45:16 +01:00
Michael Natterer
87cc0dc79f gtk: use the new modifier API instead of GTK_DEFAULT_ACCEL_MOD_MASK
in gtkimcontextsimple and gtktreeview, which are the easy places,
but also true bugfixes, because on OSX we can't use the virtual META
here, we needs MOD2 as delivered in key events.
2011-10-07 09:33:07 +02:00
Benjamin Otte
58d9c7e53e docs: Fix typo in treeview docs 2011-09-30 00:26:22 +02: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
Matthias Clasen
5ff8fe6971 Documentation fixes
Mostly making sure that return values and varargs don't loose
their docs.
2011-09-25 21:04:49 -04:00
Benjamin Otte
9e8b2f2521 treeview: Return FALSE from draw handler
... like every widget should.

https://bugzilla.gnome.org/show_bug.cgi?id=658981
2011-09-14 16:10:14 +02:00
Matthias Clasen
3a1ce87c7e Fix typos in gtk_tree_view_set_reorderable docs
As pointed out in bug 530253.
2011-09-04 23:52:36 -04:00
Matthias Clasen
eaed6d1912 Improve gtk_tree_view_set_drag_dest_row docs
As requested in bug 581435.
2011-09-04 23:42:42 -04:00
Cosimo Cecchi
640f06928f treeview: add GTK_STYLE_CLASS_SEPARATOR for tree view separators
https://bugzilla.gnome.org/show_bug.cgi?id=657985
2011-09-02 15:11:15 -04:00
Matthias Clasen
6f39855c08 More include cleanups 2011-08-28 01:54:55 -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
Kristian Rietveld
dca9db124b Bug 655545 - condition can never be true in gtk_tree_view_real_set_cursor
Spotted by Ben Pfaff.
2011-07-30 23:01:38 +02:00
Matthias Clasen
6012f096c9 Convert GailTreeView to GtkTreeViewAccessible
Mostly code rearrangement and cleanup, but also a memory
leak fix in gtk_tree_view_accessible_get_column_description().
2011-07-05 16:08:56 -04:00
Matthias Clasen
8771f2ce9c Don't rely on button allocations for invisible headers
Now that we are not allocating treeview column buttons anymore
with invisible headers, we can't rely on their allocations for
other things like cell area computations anymore. Use x-offset
and width of the column directly, instead.
2011-06-10 00:17:56 -04:00
Matthias Clasen
a081485269 GtkTreeView: Don't short-circuit header-height calculation
The code was putting header_height at zero when there is
no model. That leads to temporary underallocation of header
buttons.
2011-06-09 21:40:08 -04:00
Matthias Clasen
7d3c5b2763 Drop unneeded includes: gtkalignment.h 2011-06-07 21:53:11 -04:00
Benjamin Otte
a6daba5e78 API: Change semantics of gtk_container_get_child_path()
Include the child widget path in the returned path now. This allows
customizing the path of the current widgets - like adding flags to child
widgets (and maybe siblings in the future).
2011-06-02 02:03:50 +02:00
Benjamin Otte
c5af8c7e3a treeview: Remove unused variables
... and all the code doing complex computations to assign values to
them.
2011-05-27 16:11:10 +02:00
Cosimo Cecchi
f398745a15 treeview: don't arbitrairly add 2 to the expander size
Bump the default expander size by 2 pixels instead.

https://bugzilla.gnome.org/show_bug.cgi?id=650424
2011-05-18 11:12:47 -04:00
Cosimo Cecchi
42f5856e77 treeview: render a frame around the rows, after drawing their background
https://bugzilla.gnome.org/show_bug.cgi?id=650424
2011-05-18 11:12:31 -04:00
Micah Carrick
86f5849158 Fix annotation for Gtk.TreeView.enable_model_drag_source
https://bugzilla.gnome.org/show_bug.cgi?id=649979
2011-05-11 16:15:23 -04:00
Kristian Rietveld
874dfc24b2 treeview: Do not unconditionally set width_changed to TRUE, which redraws
Patches by Benjamin Otte.

The "invalidate last column" hack is removed.  It is now of no use since
the entire widget will be redrawn when a single column changes.
2011-04-17 01:14:51 +02:00
Kristian Rietveld
4d5d915afe treeview: if we are below rows that changed height: redraw
We have to redraw if we are below a couple of rows that changed height
in do_validate_rows().  This will still require a redraw for a large
amount of cases, can we do better?  You would expect that a redraw of
the tree view is not required when the dy changes with the same delta
as the delta of the height accrued when validating the nodes.  This
further optimization will likely require changes to the top_row/dy
synchronization code.
2011-04-17 01:14:51 +02:00
Kristian Rietveld
4594370b46 treeview: Avoid queueing a redraw in do_validate_rows()
If the changed rows are not visible, we likely do not have to redraw
in conjunction to resize.  Spotted by Benjamin Otte.
2011-04-17 01:14:51 +02:00
Kristian Rietveld
84ebafc305 Merge two if-blocks with same condition 2011-04-16 20:16:03 +02:00
Xavier Claessens
00fa4a2fc0 Do not call invalidate_empty_focus() when not realized
Fixes bug 626503
2011-04-16 20:13:51 +02:00
Garrett Regier
793d12d70d Fix leaking calls to gdk_device_manager_list_devices()
gdk_device_manager_list_devices() returns a newly allocated list.

https://bugzilla.gnome.org/show_bug.cgi?id=645234
2011-03-21 10:37:10 -04:00
Cosimo Cecchi
151cf7204b treeview: add the separator style class to the tree view separator lines 2011-03-17 17:12:58 -04:00
Cosimo Cecchi
96d6c2d108 treeview: propagate the selected state from the row
An expander in a row can't be selected on its own otherwise. This way
themes can override the expander colors when the row is selected.

https://bugzilla.gnome.org/show_bug.cgi?id=644089
2011-03-07 08:12:48 -05:00
Matthias Clasen
405b54c72e Check the return value of gtk_tree_model_get_iter
Noticed in passing, didn't really see it crash there, but
better safe than sorry.
2011-02-16 18:48:42 -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
8448780a6c Make treeview expanders work reliably
It turns out that the gtk_grab_remove() can trigger a do_prelight()
call, which may end up changing prelight_node, and then the state
gets messed up. Moving the grab removal until after we're done with
button_pressed_node and prlight_node makes expanders work reliably.

One thing that is still not right is that the expander doesn't get
prelight again after the animation is done, if you manage to release
without any additional motion events.

https://bugzilla.gnome.org/show_bug.cgi?id=641039
2011-02-01 01:32:02 -05:00
Carlos Garnacho
08af1783c5 Make GtkTreeView use GtkStyleContext
Expander animation has been replaced by implicit animations
from the style context.

Column headers are also properly themed, GtkContainer::get_path_for_child()
is implemented and the treeview resets column buttons style on columns
being reordered.

The default CSS has changed to theme treeviews sensibly.
2011-01-27 20:57:11 +01:00
Martin Pitt
d7b71be49b [GI] Fix gtk_tree_view_get_cursor() transfer annotation 2011-01-26 14:39:50 +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
374e76a19d [GI] Mark unintrospectable constructs as (skip)
Also adds 'Rename to:' annotation to some constructs replacing the
skipped ones.
2011-01-20 13:57:21 +01: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
Sebastian Pölsterl
cbbfe48ee4 [GI] Added missing (transfer none) annotation to gtk_tree_view_get_path_at_pos 2011-01-19 15:09:05 +01:00
Kristian Rietveld
4ed781778d Introduce gtk_tree_view_is_blank_at_pos()
This function is useful to figure out whether the tree view is "blank"
at a given location.  For such locations you might want to popup a
custom popup menu, clear the current selection or start rubber banding.
In the future, we are planning on updating GtkTreeView's user
interactions to take advantage of this new function.

Part of bug 350618.
2011-01-07 15:38:06 +01:00
Benjamin Otte
f65fa81e3a treeview: Update adjustment usage for sealing
Use getters instead of direct structure access.
2011-01-05 14:30:59 +01:00
Benjamin Otte
6ff585e189 treeview: Update adjustment usage for sealing
Use gtk_adjustment_set_upper() instead of doing its work manually.
2011-01-05 14:30:59 +01:00
Benjamin Otte
e93eb20794 treeview: Update adjustment usage for sealing
Use gtk_adjustment_configure() when toggling header visibility.
2011-01-05 14:30:58 +01:00
Matthias Clasen
b123bc41fd Move docs for gtkmain inline
At the same time, introduce a gtkmainprivate.h header
and various other cleanups.

Based on a patch by Tadej Borovšak.
https://bugzilla.gnome.org/show_bug.cgi?id=617471
2011-01-04 17:32:12 -05:00
Matthias Clasen
98440ad031 Remove gtktypeutils altogether
Based on patches by Javier Jardón.

https://bugzilla.gnome.org/show_bug.cgi?id=629955
2011-01-04 14:51:19 -05:00
Matthias Clasen
b5c6904c2f Drop explicit includes of gdkkeysyms.h
These are no longer needed. At the same time, port gtkimcontextsimpleseqs.h
to use the new GDK_KEY_ symbols.
2011-01-04 12:21:41 -05:00
Matthias Clasen
59ea137fa0 GtkTreeView: Don't use deprecated grab api 2010-12-26 23:40:59 -05:00
Matthias Clasen
bde1d072e5 Don't use gdk_{pointer,keyboard}_grab
Instead use gdk_device_grab.
2010-12-24 20:00:19 -05:00
Kristian Rietveld
31536736ea Hide GtkTreeViewColumn buttons when header_window is not visible 2010-12-23 18:19:56 +01:00
Javier Jardón
74a7bc3a77 gtk/gtktreeview.c: Use accessor to access GtkTreeSelection 2010-12-19 04:56:32 +00:00
Tristan Van Berkom
71e7cd0ec4 Merge branch 'master' into treeview-refactor
Conflicts:
	tests/testtreeedit.c
2010-12-17 15:25:15 +09:00
Kristian Rietveld
735fa8b197 Avoid recursion in do_validate_rows()
I have never really liked the updates done to the adjustments in
do_validate_rows() and other validation functions.  But it is really
required.  I have to come up with a real solution to this one day.
2010-12-16 23:33:42 +01:00
Javier Jardón
1cfd78269e gtk/gtktreeview.c: Use accessor functions to access GtkSelectionData 2010-12-15 23:58:15 +00:00
Kristian Rietveld
c8d130efa7 Revisit "Handle clicks in indentation area"
Check (x, y) is inside background area.  If yes, continue processing
and clamp the coordinates into cell area.  This way we will properly
handle getting a cell (which is only used for setting the focus cell)
for clicks in the indentation area (in LTR and RTL mode) and clicks
in the focus rectangle area in case focus-line-width is large.
2010-12-15 23:55:26 +01:00
Kristian Rietveld
8e98333d8b RTL fix for gtk_tree_view_focus_to_cursor() 2010-12-15 21:31:35 +01:00
Kristian Rietveld
92e145e719 No need to correct direction for rtl, GtkCellArea takes care of that 2010-12-15 21:27:40 +01:00
Tristan Van Berkom
2e1e97305f Make GtkTreeView explicitly focus the first cell in the first column when grabbing focus
When focus is initially grabbed and there is no focus column, when selecting
the first column for focus, further explicitly focus into the first cell
using gtk_cell_area_focus().
2010-12-12 17:21:28 +01:00
Tristan Van Berkom
31226ebfb2 Fixed GtkTreeView to give focus back to the last focued cell when hitting
the edge.

When focusing left/right or up/down inside GtkCellArea, now we save what
was the last focused cell and if we hit the side (or top or bottom) of
the view we then restore focus to the last focused cell.
2010-12-12 17:21:28 +01:00
Tristan Van Berkom
632f1f3ac4 Modified gtk_tree_view_move_cursor_up_down to move focus inside the cell area
This currently leaves us the problem of maintaining the right cell in
focus for horizontal areas, the solution for that comming in the
next patch.
2010-12-12 17:21:28 +01:00
Tristan Van Berkom
2752fd0f16 Removing gtk_tree_view_move_focus_column() and only calling gtk_cell_area_focus()
This function did alot of nothing, gtk_cell_area_focus() simply returns whether
the focus stays in the area (column) or not, seems not to cause regressions to
just call it directly instead.
2010-12-12 17:21:28 +01:00
Kristian Rietveld
ff39c76bfd Welcome _gtk_tree_view_column_get_cell_at_pos to the second dimension 2010-12-12 15:22:49 +01:00
Kristian Rietveld
cbfc3f5bf0 Make gtk_tree_view_get_cell_area() aware of row separators 2010-12-12 15:09:27 +01:00
Kristian Rietveld
d142d8bb6c Do not enforce a minimum of expander_size in gtk_tree_view_get_row_height
Instead this is now enforced in gtk_tree_view_get_cell_area_height().
There are rows for which a height in between 0 and expander_size is
allowed, for example separator rows.
2010-12-12 14:34:26 +01:00
Tristan Van Berkom
2f4e451075 Added "edit_only" argument to gtk_cell_area_activate()
This argument allows the caller to specify that only an editable
cell should start editing but an activatable cell should not toggle
it's state, this is important for public apis like
gtk_tree_view_set_cursor_on_cell() which are only intended to
programatically bring attention to the editing of a specific
row or cell but not actually change any data.

GtkTreeView & CellAreaScaffold updated for the last minute api change.
2010-12-12 17:15:46 +09:00
Matthias Clasen
83204928b9 Don't access GdkDragContext fields directly
Instead use the accessors.
2010-12-10 00:59:07 -05:00