gtk2/gtk/gtktreeview.c

12916 lines
372 KiB
C
Raw Normal View History

/* gtktreeview.c
* Copyright (C) 2000 Red Hat, Inc., Jonathan Blandford <jrb@redhat.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library 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.
*/
#include <config.h>
#include <string.h>
#include <gdk/gdkkeysyms.h>
#include "gtktreeview.h"
#include "gtkrbtree.h"
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
#include "gtktreednd.h"
#include "gtktreeprivate.h"
#include "gtkcellrenderer.h"
#include "gtkmain.h"
#include "gtkmarshalers.h"
#include "gtkbutton.h"
#include "gtkalignment.h"
#include "gtklabel.h"
remove validation idle 2001-02-08 Havoc Pennington <hp@redhat.com> * gtk/gtktextview.c (gtk_text_view_destroy_layout): remove validation idle * demos/gtk-demo/main.c (create_tree): adjust to changes in text cell renderer * demos/pixbuf-demo.c (timeout): remove deprecated gtk_widget_draw * demos/testpixbuf-save.c (main): remove deprecated gtk_drawing_area_size * gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate buttons even if the model isn't setup. gtk_tree_view_check_dirty() at the start of the allocation. (gtk_tree_view_check_dirty): handle column->button == NULL, handle unsetup or NULL model. * gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the even/odd/sorted cells in the tree view. * gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all): bugfixes * gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row backgrounds with draw_flat_box using different detail for even/odd rows. * gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each row, so we can draw the alternating colors thing * gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a property from a synonym property, notify for the synonym. Also, nuke the background_gdk_set and foreground_gdk_set synonyms (gtk_text_tag_get_property): Always return the font, even if all its fields aren't set * gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't store the attr list; it leaves us with no way to change attributes in _render according to the render flags, and no way to implement get_property. Instead store all the specific text attributes. Separate whether an attribute is enabled from its value. Sync all properties with GtkTextTag, make them all consistent, etc. * gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so renderers can highlight the sort row/column * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use accessor functions to get values; this has the side effect of showing up which accessor functions were missing. Added those. * gtk/gtktreeviewcolumn.h: Replace set_justification with set_alignment, to be consistent with GtkLabel, GtkMisc * gtk/gtktreeviewcolumn.c: Added code to display sort indicator arrow. * gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h * gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
#include "gtkhbox.h"
#include "gtkvbox.h"
remove validation idle 2001-02-08 Havoc Pennington <hp@redhat.com> * gtk/gtktextview.c (gtk_text_view_destroy_layout): remove validation idle * demos/gtk-demo/main.c (create_tree): adjust to changes in text cell renderer * demos/pixbuf-demo.c (timeout): remove deprecated gtk_widget_draw * demos/testpixbuf-save.c (main): remove deprecated gtk_drawing_area_size * gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate buttons even if the model isn't setup. gtk_tree_view_check_dirty() at the start of the allocation. (gtk_tree_view_check_dirty): handle column->button == NULL, handle unsetup or NULL model. * gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the even/odd/sorted cells in the tree view. * gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all): bugfixes * gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row backgrounds with draw_flat_box using different detail for even/odd rows. * gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each row, so we can draw the alternating colors thing * gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a property from a synonym property, notify for the synonym. Also, nuke the background_gdk_set and foreground_gdk_set synonyms (gtk_text_tag_get_property): Always return the font, even if all its fields aren't set * gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't store the attr list; it leaves us with no way to change attributes in _render according to the render flags, and no way to implement get_property. Instead store all the specific text attributes. Separate whether an attribute is enabled from its value. Sync all properties with GtkTextTag, make them all consistent, etc. * gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so renderers can highlight the sort row/column * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use accessor functions to get values; this has the side effect of showing up which accessor functions were missing. Added those. * gtk/gtktreeviewcolumn.h: Replace set_justification with set_alignment, to be consistent with GtkLabel, GtkMisc * gtk/gtktreeviewcolumn.c: Added code to display sort indicator arrow. * gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h * gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
#include "gtkarrow.h"
#include "gtkintl.h"
#include "gtkbindings.h"
#include "gtkcontainer.h"
#include "gtkentry.h"
#include "gtkframe.h"
#include "gtktreemodelsort.h"
#define GTK_TREE_VIEW_PRIORITY_VALIDATE (GDK_PRIORITY_REDRAW + 5)
#define GTK_TREE_VIEW_PRIORITY_SCROLL_SYNC (GTK_TREE_VIEW_PRIORITY_VALIDATE + 2)
start implementing Thu Mar 7 02:58:16 2002 Jonathan Blandford <jrb@redhat.com> * gtk/tmpl/gtkliststore.sgml: start implementing * gtk/question_index.sgml: "I can set with the tree, but not get???!?!" Wed Mar 6 23:20:51 2002 Jonathan Blandford <jrb@redhat.com> and Kristian Rietveld <kris@gtk.org> Finishing touch for 2.0.0 release, fixes #70782, #72729, the 'stealth' bug and other last-minute minor issues. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): set dnd dest line drawing right. We can't draw the line at the position of the next row, because that one still has to be drawn. So draw everthing at a -1 offset. (validate_visible_area): add check for invalid descendants and NULL scroll_to_path path, get scrolling right. Also, fix the area_above value. Pretty amazing I got it wrong. (get_logical_dest_row): add gtk-tree-model-drop-append magic, so dragging a row to the end of the model works right. (gtk_tree_view_get_dest_row_at_pos): minor floating point fix (gtk_tree_view_start_editing): add call to validate_row (gtk_tree_view_tree_to_widget_coords): Never subtract HEADER_HEIGHT from y values anymore!!! (gtk_tree_view_widget_coords_to_tree): ditto. (gtk_tree_view_scroll_to_point): allow -1 as values for the scroll_to coords (gtk_tree_view_move_cursor_page_up_down): Don't need scroll_to_y as clamp_node_visible will make it work. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): also check path depth, as we can't get iters from empty paths * gtk/gtkliststore.c (gtk_list_store_drag_data_received): handle gtk-tree-model-drop-append * gtk/gtktreednd.c (gtk_tree_set_row_drag_data): free path_str * tests/testtreeflow.c (main): select path where we are scrolling to
2002-03-07 08:03:09 +00:00
#define GTK_TREE_VIEW_NUM_ROWS_PER_IDLE 500
#define SCROLL_EDGE_SIZE 15
Add support for animating expanders. 2001-07-22 Anders Carlsson <andersca@gnome.org> * gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the expander_height and expander_width properties with a single property, expander_size. (gtk_tree_view_init): Set the tab_offset to expander_size plus some padding. (gtk_tree_view_unrealize): Remove the expand/collapse timeout if it exists. (coords_are_over_arrow): Fix a small bug. (gtk_tree_view_motion_draw_column_motion_arrow): Use expander_size. (gtk_tree_view_draw_focus): Use "treeview" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_bin_expose): Use "treeview-drop-indicator" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_deleted): If we have a node currently being expanded or collapsed, remove the timeout and set the node to NULL. (gtk_tree_view_queue_draw_arrow): New function that just redraws the arrow of a node. (gtk_tree_view_draw_arrow): Use expander_size instead of expander_width/expander_height, also pass a different expander_style to gtk_paint_expander depending on the state of the node being drawn. (expand_collapse_timeout): New function for expanding or collapsing a node depending on the previous state. (gtk_tree_view_real_expand_row): Add timeout and set correct state for node being expanded. (gtk_tree_view_real_collapse_row): Add timeout and set correct state for node being collapsed. * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add information about the node currently being expanded or collapsed, and also a timeout id. * gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open with expander_style for draw_expander. * gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with expander_style. (create_expander_affine): New function for creating an expander affine. (apply_affine_on_point): New function for applying an affine to a point. (gtk_default_draw_expander): Modified to take expander_style instead of is_open, and to draw the rectangle rotated differently depending on the expander style. (gtk_paint_expander): Replace is_open with expander_style. * gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor. * gtk/gtkenums.h: Add expander style enum.
2001-07-22 20:09:00 +00:00
#define EXPANDER_EXTRA_PADDING 4
#define GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT 5000
#define AUTO_EXPAND_TIMEOUT 500
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
/* The "background" areas of all rows/cells add up to cover the entire tree.
* The background includes all inter-row and inter-cell spacing.
* The "cell" areas are the cell_area passed in to gtk_cell_renderer_render(),
* i.e. just the cells, no spacing.
*/
#define BACKGROUND_HEIGHT(node) (GTK_RBNODE_GET_HEIGHT (node))
#define CELL_HEIGHT(node, separator) ((BACKGROUND_HEIGHT (node)) - (separator))
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
#define TREE_WINDOW_Y_TO_RBTREE_Y(tree_view,y) ((y) + tree_view->priv->dy)
#define RBTREE_Y_TO_TREE_WINDOW_Y(tree_view,y) ((y) - tree_view->priv->dy)
/* This is in Window coordinates */
#define BACKGROUND_FIRST_PIXEL(tree_view,tree,node) (RBTREE_Y_TO_TREE_WINDOW_Y (tree_view, _gtk_rbtree_node_find_offset ((tree), (node))))
#define CELL_FIRST_PIXEL(tree_view,tree,node,separator) (BACKGROUND_FIRST_PIXEL (tree_view,tree,node) + separator/2)
#define ROW_HEIGHT(tree_view,height) \
((height > 0) ? (height) : (tree_view)->priv->expander_size)
Support separators in combo boxes and more generally in tree views 2004-07-07 Matthias Clasen <mclasen@redhat.com> Support separators in combo boxes and more generally in tree views (#135873): * gtk/gtkcombobox.h: * gtk/gtkcombobox.c (gtk_combo_box_get_row_separator_column): * gtk/gtkcombobox.c (gtk_combo_box_set_row_separator_column): Add a ::row-separator-column property with getter and setter, which can indicate a boolean model column to determine which rows are separators. * gtk/gtkcombobox.c: Display separator rows as separator menu items in menu mode, and by using the new treeview separator functionality in list mode. * gtk/gtktreeview.h: * gtk/gtktreeview.c (gtk_tree_view_get_row_separator_func): * gtk/gtktreeview.c (gtk_tree_view_set_row_separator_func): Add a callback to determine whether a row is a separator. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): * gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon): * gtk/gtktreeview.c (validate_row): Use the new callback to determine whether a row is a separator, and draw it as a separator then. Since separators should take up less vertical space than regular rows, this requires removing the redundant MAX(...,expander_size) calls which appear in many places. Instead, the MAX() is now only done in validate_row(), and only if the row is not a separator. To catch possible side effects of this intrusive change, I have left EXPANDER_MAX() calls in place of the MAX() calls which will emit a warning if something breaks. They should be removed before 2.6. * gtk/gtktreeselection.c (row_is_selectable): Don't let separator rows be selected. * tests/testcombo.c (create_blaat): Add a separator column.
2004-07-07 15:15:35 +00:00
typedef struct _GtkTreeViewChild GtkTreeViewChild;
struct _GtkTreeViewChild
{
GtkWidget *widget;
gint x;
gint y;
gint width;
gint height;
};
typedef struct _TreeViewDragInfo TreeViewDragInfo;
struct _TreeViewDragInfo
{
GdkModifierType start_button_mask;
GtkTargetList *source_target_list;
GdkDragAction source_actions;
GtkTargetList *dest_target_list;
guint source_set : 1;
guint dest_set : 1;
};
/* Signals */
enum
{
ROW_ACTIVATED,
TEST_EXPAND_ROW,
TEST_COLLAPSE_ROW,
ROW_EXPANDED,
ROW_COLLAPSED,
COLUMNS_CHANGED,
CURSOR_CHANGED,
MOVE_CURSOR,
SELECT_ALL,
UNSELECT_ALL,
SELECT_CURSOR_ROW,
TOGGLE_CURSOR_ROW,
EXPAND_COLLAPSE_CURSOR_ROW,
SELECT_CURSOR_PARENT,
START_INTERACTIVE_SEARCH,
LAST_SIGNAL
};
/* Properties */
enum {
PROP_0,
PROP_MODEL,
PROP_HADJUSTMENT,
PROP_VADJUSTMENT,
PROP_HEADERS_VISIBLE,
PROP_HEADERS_CLICKABLE,
PROP_EXPANDER_COLUMN,
PROP_REORDERABLE,
PROP_RULES_HINT,
PROP_ENABLE_SEARCH,
PROP_SEARCH_COLUMN,
PROP_FIXED_HEIGHT_MODE,
PROP_HOVER_SELECTION,
PROP_HOVER_EXPAND
};
static void gtk_tree_view_class_init (GtkTreeViewClass *klass);
static void gtk_tree_view_init (GtkTreeView *tree_view);
/* object signals */
static void gtk_tree_view_finalize (GObject *object);
static void gtk_tree_view_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void gtk_tree_view_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
/* gtkobject signals */
static void gtk_tree_view_destroy (GtkObject *object);
/* gtkwidget signals */
static void gtk_tree_view_realize (GtkWidget *widget);
static void gtk_tree_view_unrealize (GtkWidget *widget);
static void gtk_tree_view_map (GtkWidget *widget);
static void gtk_tree_view_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void gtk_tree_view_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static gboolean gtk_tree_view_expose (GtkWidget *widget,
GdkEventExpose *event);
static gboolean gtk_tree_view_key_press (GtkWidget *widget,
GdkEventKey *event);
static gboolean gtk_tree_view_key_release (GtkWidget *widget,
GdkEventKey *event);
static gboolean gtk_tree_view_motion (GtkWidget *widget,
GdkEventMotion *event);
static gboolean gtk_tree_view_enter_notify (GtkWidget *widget,
GdkEventCrossing *event);
static gboolean gtk_tree_view_leave_notify (GtkWidget *widget,
GdkEventCrossing *event);
static gboolean gtk_tree_view_button_press (GtkWidget *widget,
GdkEventButton *event);
static gboolean gtk_tree_view_button_release (GtkWidget *widget,
GdkEventButton *event);
#if 0
static gboolean gtk_tree_view_configure (GtkWidget *widget,
GdkEventConfigure *event);
#endif
static void gtk_tree_view_set_focus_child (GtkContainer *container,
GtkWidget *child);
static gint gtk_tree_view_focus_out (GtkWidget *widget,
GdkEventFocus *event);
static gint gtk_tree_view_focus (GtkWidget *widget,
GtkDirectionType direction);
static void gtk_tree_view_grab_focus (GtkWidget *widget);
static void gtk_tree_view_style_set (GtkWidget *widget,
GtkStyle *previous_style);
/* container signals */
static void gtk_tree_view_remove (GtkContainer *container,
GtkWidget *widget);
static void gtk_tree_view_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
/* Source side drag signals */
static void gtk_tree_view_drag_begin (GtkWidget *widget,
GdkDragContext *context);
static void gtk_tree_view_drag_end (GtkWidget *widget,
GdkDragContext *context);
static void gtk_tree_view_drag_data_get (GtkWidget *widget,
GdkDragContext *context,
GtkSelectionData *selection_data,
guint info,
guint time);
static void gtk_tree_view_drag_data_delete (GtkWidget *widget,
GdkDragContext *context);
/* Target side drag signals */
static void gtk_tree_view_drag_leave (GtkWidget *widget,
GdkDragContext *context,
guint time);
static gboolean gtk_tree_view_drag_motion (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
guint time);
static gboolean gtk_tree_view_drag_drop (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
guint time);
static void gtk_tree_view_drag_data_received (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
GtkSelectionData *selection_data,
guint info,
guint time);
/* tree_model signals */
static void gtk_tree_view_set_adjustments (GtkTreeView *tree_view,
GtkAdjustment *hadj,
GtkAdjustment *vadj);
static gboolean gtk_tree_view_real_move_cursor (GtkTreeView *tree_view,
GtkMovementStep step,
gint count);
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
static gboolean gtk_tree_view_real_select_all (GtkTreeView *tree_view);
static gboolean gtk_tree_view_real_unselect_all (GtkTreeView *tree_view);
static gboolean gtk_tree_view_real_select_cursor_row (GtkTreeView *tree_view,
gboolean start_editing);
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
static gboolean gtk_tree_view_real_toggle_cursor_row (GtkTreeView *tree_view);
static gboolean gtk_tree_view_real_expand_collapse_cursor_row (GtkTreeView *tree_view,
gboolean logical,
gboolean expand,
gboolean open_all);
static gboolean gtk_tree_view_real_select_cursor_parent (GtkTreeView *tree_view);
static void gtk_tree_view_row_changed (GtkTreeModel *model,
GtkTreePath *path,
GtkTreeIter *iter,
gpointer data);
static void gtk_tree_view_row_inserted (GtkTreeModel *model,
GtkTreePath *path,
GtkTreeIter *iter,
gpointer data);
static void gtk_tree_view_row_has_child_toggled (GtkTreeModel *model,
GtkTreePath *path,
GtkTreeIter *iter,
gpointer data);
static void gtk_tree_view_row_deleted (GtkTreeModel *model,
GtkTreePath *path,
gpointer data);
static void gtk_tree_view_rows_reordered (GtkTreeModel *model,
GtkTreePath *parent,
GtkTreeIter *iter,
gint *new_order,
gpointer data);
/* Incremental reflow */
static gboolean validate_row (GtkTreeView *tree_view,
GtkRBTree *tree,
GtkRBNode *node,
GtkTreeIter *iter,
GtkTreePath *path);
static void validate_visible_area (GtkTreeView *tree_view);
static gboolean validate_rows_handler (GtkTreeView *tree_view);
static gboolean validate_rows (GtkTreeView *tree_view);
static gboolean presize_handler_callback (gpointer data);
static void install_presize_handler (GtkTreeView *tree_view);
static void install_scroll_sync_handler (GtkTreeView *tree_view);
static void gtk_tree_view_dy_to_top_row (GtkTreeView *tree_view);
static void gtk_tree_view_top_row_to_dy (GtkTreeView *tree_view);
/* Internal functions */
static gboolean gtk_tree_view_is_expander_column (GtkTreeView *tree_view,
GtkTreeViewColumn *column);
static void gtk_tree_view_add_move_binding (GtkBindingSet *binding_set,
guint keyval,
guint modmask,
GtkMovementStep step,
gint count);
static gint gtk_tree_view_unref_and_check_selection_tree (GtkTreeView *tree_view,
GtkRBTree *tree);
static void gtk_tree_view_queue_draw_path (GtkTreeView *tree_view,
GtkTreePath *path,
GdkRectangle *clip_rect);
static void gtk_tree_view_queue_draw_arrow (GtkTreeView *tree_view,
GtkRBTree *tree,
GtkRBNode *node,
GdkRectangle *clip_rect);
static void gtk_tree_view_draw_arrow (GtkTreeView *tree_view,
GtkRBTree *tree,
GtkRBNode *node,
gint x,
gint y);
static void gtk_tree_view_get_arrow_xrange (GtkTreeView *tree_view,
GtkRBTree *tree,
gint *x1,
gint *x2);
static gint gtk_tree_view_new_column_width (GtkTreeView *tree_view,
gint i,
gint *x);
static void gtk_tree_view_adjustment_changed (GtkAdjustment *adjustment,
GtkTreeView *tree_view);
static void gtk_tree_view_build_tree (GtkTreeView *tree_view,
GtkRBTree *tree,
GtkTreeIter *iter,
gint depth,
gboolean recurse);
static gboolean gtk_tree_view_discover_dirty_iter (GtkTreeView *tree_view,
GtkTreeIter *iter,
gint depth,
gint *height,
GtkRBNode *node);
static void gtk_tree_view_discover_dirty (GtkTreeView *tree_view,
GtkRBTree *tree,
GtkTreeIter *iter,
gint depth);
static void gtk_tree_view_clamp_node_visible (GtkTreeView *tree_view,
GtkRBTree *tree,
GtkRBNode *node);
static void gtk_tree_view_clamp_column_visible (GtkTreeView *tree_view,
GtkTreeViewColumn *column);
static gboolean gtk_tree_view_maybe_begin_dragging_row (GtkTreeView *tree_view,
GdkEventMotion *event);
static void gtk_tree_view_focus_to_cursor (GtkTreeView *tree_view);
static void gtk_tree_view_move_cursor_up_down (GtkTreeView *tree_view,
gint count);
static void gtk_tree_view_move_cursor_page_up_down (GtkTreeView *tree_view,
gint count);
static void gtk_tree_view_move_cursor_left_right (GtkTreeView *tree_view,
gint count);
static void gtk_tree_view_move_cursor_start_end (GtkTreeView *tree_view,
gint count);
static gboolean gtk_tree_view_real_collapse_row (GtkTreeView *tree_view,
GtkTreePath *path,
GtkRBTree *tree,
GtkRBNode *node,
gboolean animate);
static gboolean gtk_tree_view_real_expand_row (GtkTreeView *tree_view,
GtkTreePath *path,
GtkRBTree *tree,
GtkRBNode *node,
gboolean open_all,
gboolean animate);
static void gtk_tree_view_real_set_cursor (GtkTreeView *tree_view,
GtkTreePath *path,
gboolean clear_and_select,
gboolean clamp_node);
The "big treeview focus patch". Fixes several issues and adds some Sun May 5 16:42:32 2002 Kristian Rietveld <kris@gtk.org> The "big treeview focus patch". Fixes several issues and adds some goodies. Related bugs: #73676, #73734, #78660. * gtk/gtktreeview.h: add gtk_tree_view_set_cursor_on_cell * gtk/gtktreeview.c (gtk_tree_view_button_press): focus on a cell if applicable, (gtk_tree_view_bin_expose): set_cell_data before iterating columns, add support for row-spanning focus rectangles, (gtk_tree_view_has_special_cell): new function, (gtk_tree_view_move_cursor_left_right): add support for multiple focusable cells in one column, (gtk_tree_view_set_cursor): call _set_cursor_on_cell now, (gtk_tree_view_set_cursor_on_cell): copy of _set_cursor, extended with focus_cell parameter, (gtk_tree_view_search_iter): removed unused column variable, (gtk_tree_view_start_editing): add neighbor size code to allow for multiple editable cells in one column. * gtk/gtktreeviewcolumn.c (_GtkTreeViewColumnCellInfo): add in_editing_mode field, (gtk_tree_view_column_get_edited_cell): new function, removed _get_editable_cell, (_gtk_tree_view_column_get_cell_at_pos): new function, (gtk_tree_view_column_pack_end): s/g_new/g_new0/ ..., (gtk_tree_view_column_cell_process_action): loads of changes to get it right and to allow for multiple special cells, etc, (gtk_tree_view_column_cell_first): new function, (gtk_tree_view_column_cell_last): ditto, (gtk_tree_view_column_cell_next): ditto, (gtk_tree_view_column_cell_prev): ditto, (gtk_tree_view_column_cell_focus): add left and right parameters, allow for multiple special cells, (gtk_tree_view_column_cell_is_visible): add assertion, (gtk_tree_view_column_focus_cell): new function, (gtk_tree_view_column_stop_editing): unset in_editing_mode flag, (_gtk_tree_view_column_get_neighbor_sizes): iterate through cells correctly * gtk/gtktreeviewcolumn.h: add gtk_tree_view_column_focus_cell * gtk/gtktreeprivate.h: s/_get_editable_cell/_get_edited_cell/, add _gtk_tree_view_column_get_cell_at_pos, add new parameters to _gtk_tree_view_column_cell_focus. * tests/testtreeedit.c: add some cells in order to test new code.
2002-05-05 14:54:00 +00:00
static gboolean gtk_tree_view_has_special_cell (GtkTreeView *tree_view);
static void column_sizing_notify (GObject *object,
GParamSpec *pspec,
gpointer data);
static gboolean expand_collapse_timeout (gpointer data);
static gboolean do_expand_collapse (GtkTreeView *tree_view);
/* interactive search */
static void gtk_tree_view_ensure_interactive_directory (GtkTreeView *tree_view);
static void gtk_tree_view_search_dialog_hide (GtkWidget *search_dialog,
GtkTreeView *tree_view);
static void gtk_tree_view_search_position_func (GtkTreeView *tree_view,
GtkWidget *search_dialog);
static void gtk_tree_view_search_disable_popdown (GtkEntry *entry,
GtkMenu *menu,
gpointer data);
static void gtk_tree_view_search_preedit_changed (GtkIMContext *im_context,
GtkTreeView *tree_view);
static gboolean gtk_tree_view_real_search_enable_popdown(gpointer data);
static void gtk_tree_view_search_enable_popdown (GtkWidget *widget,
gpointer data);
static gboolean gtk_tree_view_search_delete_event (GtkWidget *widget,
GdkEventAny *event,
GtkTreeView *tree_view);
static gboolean gtk_tree_view_search_button_press_event (GtkWidget *widget,
GdkEventButton *event,
GtkTreeView *tree_view);
static gboolean gtk_tree_view_search_key_press_event (GtkWidget *entry,
GdkEventKey *event,
GtkTreeView *tree_view);
static void gtk_tree_view_search_move (GtkWidget *window,
GtkTreeView *tree_view,
gboolean up);
static gboolean gtk_tree_view_search_equal_func (GtkTreeModel *model,
gint column,
const gchar *key,
GtkTreeIter *iter,
gpointer search_data);
static gboolean gtk_tree_view_search_iter (GtkTreeModel *model,
GtkTreeSelection *selection,
GtkTreeIter *iter,
const gchar *text,
gint *count,
gint n);
static void gtk_tree_view_search_init (GtkWidget *entry,
GtkTreeView *tree_view);
static void gtk_tree_view_put (GtkTreeView *tree_view,
GtkWidget *child_widget,
gint x,
gint y,
gint width,
gint height);
static gboolean gtk_tree_view_start_editing (GtkTreeView *tree_view,
GtkTreePath *cursor_path);
static void gtk_tree_view_real_start_editing (GtkTreeView *tree_view,
GtkTreeViewColumn *column,
GtkTreePath *path,
GtkCellEditable *cell_editable,
GdkRectangle *cell_area,
GdkEvent *event,
guint flags);
static void gtk_tree_view_stop_editing (GtkTreeView *tree_view,
gboolean cancel_editing);
static gboolean gtk_tree_view_real_start_interactive_search (GtkTreeView *tree_view,
gboolean keybinding);
static gboolean gtk_tree_view_start_interactive_search (GtkTreeView *tree_view);
static GtkTreeViewColumn *gtk_tree_view_get_drop_column (GtkTreeView *tree_view,
GtkTreeViewColumn *column,
gint drop_position);
static void gtk_tree_view_tree_window_to_tree_coords (GtkTreeView *tree_view,
gint wx,
gint wy,
gint *tx,
gint *ty);
Support separators in combo boxes and more generally in tree views 2004-07-07 Matthias Clasen <mclasen@redhat.com> Support separators in combo boxes and more generally in tree views (#135873): * gtk/gtkcombobox.h: * gtk/gtkcombobox.c (gtk_combo_box_get_row_separator_column): * gtk/gtkcombobox.c (gtk_combo_box_set_row_separator_column): Add a ::row-separator-column property with getter and setter, which can indicate a boolean model column to determine which rows are separators. * gtk/gtkcombobox.c: Display separator rows as separator menu items in menu mode, and by using the new treeview separator functionality in list mode. * gtk/gtktreeview.h: * gtk/gtktreeview.c (gtk_tree_view_get_row_separator_func): * gtk/gtktreeview.c (gtk_tree_view_set_row_separator_func): Add a callback to determine whether a row is a separator. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): * gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon): * gtk/gtktreeview.c (validate_row): Use the new callback to determine whether a row is a separator, and draw it as a separator then. Since separators should take up less vertical space than regular rows, this requires removing the redundant MAX(...,expander_size) calls which appear in many places. Instead, the MAX() is now only done in validate_row(), and only if the row is not a separator. To catch possible side effects of this intrusive change, I have left EXPANDER_MAX() calls in place of the MAX() calls which will emit a warning if something breaks. They should be removed before 2.6. * gtk/gtktreeselection.c (row_is_selectable): Don't let separator rows be selected. * tests/testcombo.c (create_blaat): Add a separator column.
2004-07-07 15:15:35 +00:00
static GtkContainerClass *parent_class = NULL;
static guint tree_view_signals [LAST_SIGNAL] = { 0 };
/* GType Methods
*/
GType
gtk_tree_view_get_type (void)
{
static GType tree_view_type = 0;
if (!tree_view_type)
{
static const GTypeInfo tree_view_info =
{
sizeof (GtkTreeViewClass),
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) gtk_tree_view_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GtkTreeView),
0, /* n_preallocs */
(GInstanceInitFunc) gtk_tree_view_init
};
tree_view_type =
g_type_register_static (GTK_TYPE_CONTAINER, "GtkTreeView",
&tree_view_info, 0);
}
return tree_view_type;
}
static void
gtk_tree_view_class_init (GtkTreeViewClass *class)
{
GObjectClass *o_class;
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkContainerClass *container_class;
GtkBindingSet *binding_set;
parent_class = g_type_class_peek_parent (class);
binding_set = gtk_binding_set_by_class (class);
o_class = (GObjectClass *) class;
object_class = (GtkObjectClass *) class;
widget_class = (GtkWidgetClass *) class;
container_class = (GtkContainerClass *) class;
/* GObject signals */
o_class->set_property = gtk_tree_view_set_property;
o_class->get_property = gtk_tree_view_get_property;
o_class->finalize = gtk_tree_view_finalize;
/* GtkObject signals */
object_class->destroy = gtk_tree_view_destroy;
/* GtkWidget signals */
widget_class->map = gtk_tree_view_map;
widget_class->realize = gtk_tree_view_realize;
widget_class->unrealize = gtk_tree_view_unrealize;
widget_class->size_request = gtk_tree_view_size_request;
widget_class->size_allocate = gtk_tree_view_size_allocate;
widget_class->button_press_event = gtk_tree_view_button_press;
widget_class->button_release_event = gtk_tree_view_button_release;
/*widget_class->configure_event = gtk_tree_view_configure;*/
widget_class->motion_notify_event = gtk_tree_view_motion;
widget_class->expose_event = gtk_tree_view_expose;
widget_class->key_press_event = gtk_tree_view_key_press;
widget_class->key_release_event = gtk_tree_view_key_release;
widget_class->enter_notify_event = gtk_tree_view_enter_notify;
widget_class->leave_notify_event = gtk_tree_view_leave_notify;
widget_class->focus_out_event = gtk_tree_view_focus_out;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
widget_class->drag_begin = gtk_tree_view_drag_begin;
widget_class->drag_end = gtk_tree_view_drag_end;
widget_class->drag_data_get = gtk_tree_view_drag_data_get;
widget_class->drag_data_delete = gtk_tree_view_drag_data_delete;
widget_class->drag_leave = gtk_tree_view_drag_leave;
widget_class->drag_motion = gtk_tree_view_drag_motion;
widget_class->drag_drop = gtk_tree_view_drag_drop;
widget_class->drag_data_received = gtk_tree_view_drag_data_received;
widget_class->focus = gtk_tree_view_focus;
widget_class->grab_focus = gtk_tree_view_grab_focus;
widget_class->style_set = gtk_tree_view_style_set;
/* GtkContainer signals */
container_class->remove = gtk_tree_view_remove;
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;
class->select_cursor_row = gtk_tree_view_real_select_cursor_row;
class->toggle_cursor_row = gtk_tree_view_real_toggle_cursor_row;
class->expand_collapse_cursor_row = gtk_tree_view_real_expand_collapse_cursor_row;
class->select_cursor_parent = gtk_tree_view_real_select_cursor_parent;
class->start_interactive_search = gtk_tree_view_start_interactive_search;
/* Properties */
g_object_class_install_property (o_class,
PROP_MODEL,
g_param_spec_object ("model",
P_("TreeView Model"),
P_("The model for the tree view"),
GTK_TYPE_TREE_MODEL,
G_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,
G_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,
G_PARAM_READWRITE));
g_object_class_install_property (o_class,
PROP_HEADERS_VISIBLE,
g_param_spec_boolean ("headers_visible",
P_("Visible"),
P_("Show the column header buttons"),
TRUE,
G_PARAM_READWRITE));
g_object_class_install_property (o_class,
PROP_HEADERS_CLICKABLE,
g_param_spec_boolean ("headers_clickable",
P_("Headers Clickable"),
P_("Column headers respond to click events"),
FALSE,
G_PARAM_WRITABLE));
g_object_class_install_property (o_class,
PROP_EXPANDER_COLUMN,
g_param_spec_object ("expander_column",
P_("Expander Column"),
P_("Set the column for the expander column"),
GTK_TYPE_TREE_VIEW_COLUMN,
G_PARAM_READWRITE));
g_object_class_install_property (o_class,
PROP_REORDERABLE,
g_param_spec_boolean ("reorderable",
P_("Reorderable"),
P_("View is reorderable"),
FALSE,
G_PARAM_READWRITE));
g_object_class_install_property (o_class,
PROP_RULES_HINT,
g_param_spec_boolean ("rules_hint",
P_("Rules Hint"),
P_("Set a hint to the theme engine to draw rows in alternating colors"),
FALSE,
G_PARAM_READWRITE));
g_object_class_install_property (o_class,
PROP_ENABLE_SEARCH,
g_param_spec_boolean ("enable_search",
P_("Enable Search"),
P_("View allows user to search through columns interactively"),
TRUE,
G_PARAM_READWRITE));
g_object_class_install_property (o_class,
PROP_SEARCH_COLUMN,
g_param_spec_int ("search_column",
P_("Search Column"),
P_("Model column to search through when searching through code"),
-1,
G_MAXINT,
-1,
G_PARAM_READWRITE));
/**
* GtkTreeView:fixed-height-mode:
*
* Setting the ::fixed-height-mode property to %TRUE speeds up
* #GtkTreeView by assuming that all rows have the same height.
* Only enable this option if all rows are the same height.
* Please see gtk_tree_view_set_fixed_height_mode() for more
* information on this option.
*
* Since: 2.4
**/
g_object_class_install_property (o_class,
PROP_FIXED_HEIGHT_MODE,
g_param_spec_boolean ("fixed_height_mode",
P_("Fixed Height Mode"),
P_("Speeds up GtkTreeView by assuming that all rows have the same height"),
FALSE,
G_PARAM_READWRITE));
/**
* GtkTreeView:hover-selection:
*
* Enables of disables the hover selection mode of @tree_view.
* Hover selection makes the selected row follow the pointer.
* Currently, this works only for the selection modes
* %GTK_SELECTION_SINGLE and %GTK_SELECTION_BROWSE.
*
* This mode is primarily indended for treeviews in popups, e.g.
* in #GtkComboBox or #GtkEntryCompletion.
*
* Since: 2.6
*/
g_object_class_install_property (o_class,
PROP_HOVER_SELECTION,
g_param_spec_boolean ("hover_selection",
P_("Hover Selection"),
P_("Whether the selection should follow the pointer"),
FALSE,
G_PARAM_READWRITE));
/**
* GtkTreeView:hover-expand:
*
* Enables of disables the hover expansion mode of @tree_view.
* Hover expansion makes rows expand or collaps if the pointer moves
* over them.
*
* This mode is primarily indended for treeviews in popups, e.g.
* in #GtkComboBox or #GtkEntryCompletion.
*
* Since: 2.6
*/
g_object_class_install_property (o_class,
PROP_HOVER_EXPAND,
g_param_spec_boolean ("hover_expand",
P_("Hover Expand"),
P_("Whether rows should be expanded/collaped when the pointer moves over them"),
FALSE,
G_PARAM_READWRITE));
/* Style properties */
Add support for animating expanders. 2001-07-22 Anders Carlsson <andersca@gnome.org> * gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the expander_height and expander_width properties with a single property, expander_size. (gtk_tree_view_init): Set the tab_offset to expander_size plus some padding. (gtk_tree_view_unrealize): Remove the expand/collapse timeout if it exists. (coords_are_over_arrow): Fix a small bug. (gtk_tree_view_motion_draw_column_motion_arrow): Use expander_size. (gtk_tree_view_draw_focus): Use "treeview" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_bin_expose): Use "treeview-drop-indicator" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_deleted): If we have a node currently being expanded or collapsed, remove the timeout and set the node to NULL. (gtk_tree_view_queue_draw_arrow): New function that just redraws the arrow of a node. (gtk_tree_view_draw_arrow): Use expander_size instead of expander_width/expander_height, also pass a different expander_style to gtk_paint_expander depending on the state of the node being drawn. (expand_collapse_timeout): New function for expanding or collapsing a node depending on the previous state. (gtk_tree_view_real_expand_row): Add timeout and set correct state for node being expanded. (gtk_tree_view_real_collapse_row): Add timeout and set correct state for node being collapsed. * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add information about the node currently being expanded or collapsed, and also a timeout id. * gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open with expander_style for draw_expander. * gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with expander_style. (create_expander_affine): New function for creating an expander affine. (apply_affine_on_point): New function for applying an affine to a point. (gtk_default_draw_expander): Modified to take expander_style instead of is_open, and to draw the rectangle rotated differently depending on the expander style. (gtk_paint_expander): Replace is_open with expander_style. * gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor. * gtk/gtkenums.h: Add expander style enum.
2001-07-22 20:09:00 +00:00
#define _TREE_VIEW_EXPANDER_SIZE 10
#define _TREE_VIEW_VERTICAL_SEPARATOR 2
#define _TREE_VIEW_HORIZONTAL_SEPARATOR 2
gtk_widget_class_install_style_property (widget_class,
Add support for animating expanders. 2001-07-22 Anders Carlsson <andersca@gnome.org> * gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the expander_height and expander_width properties with a single property, expander_size. (gtk_tree_view_init): Set the tab_offset to expander_size plus some padding. (gtk_tree_view_unrealize): Remove the expand/collapse timeout if it exists. (coords_are_over_arrow): Fix a small bug. (gtk_tree_view_motion_draw_column_motion_arrow): Use expander_size. (gtk_tree_view_draw_focus): Use "treeview" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_bin_expose): Use "treeview-drop-indicator" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_deleted): If we have a node currently being expanded or collapsed, remove the timeout and set the node to NULL. (gtk_tree_view_queue_draw_arrow): New function that just redraws the arrow of a node. (gtk_tree_view_draw_arrow): Use expander_size instead of expander_width/expander_height, also pass a different expander_style to gtk_paint_expander depending on the state of the node being drawn. (expand_collapse_timeout): New function for expanding or collapsing a node depending on the previous state. (gtk_tree_view_real_expand_row): Add timeout and set correct state for node being expanded. (gtk_tree_view_real_collapse_row): Add timeout and set correct state for node being collapsed. * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add information about the node currently being expanded or collapsed, and also a timeout id. * gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open with expander_style for draw_expander. * gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with expander_style. (create_expander_affine): New function for creating an expander affine. (apply_affine_on_point): New function for applying an affine to a point. (gtk_default_draw_expander): Modified to take expander_style instead of is_open, and to draw the rectangle rotated differently depending on the expander style. (gtk_paint_expander): Replace is_open with expander_style. * gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor. * gtk/gtkenums.h: Add expander style enum.
2001-07-22 20:09:00 +00:00
g_param_spec_int ("expander_size",
P_("Expander Size"),
P_("Size of the expander arrow"),
0,
G_MAXINT,
Add support for animating expanders. 2001-07-22 Anders Carlsson <andersca@gnome.org> * gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the expander_height and expander_width properties with a single property, expander_size. (gtk_tree_view_init): Set the tab_offset to expander_size plus some padding. (gtk_tree_view_unrealize): Remove the expand/collapse timeout if it exists. (coords_are_over_arrow): Fix a small bug. (gtk_tree_view_motion_draw_column_motion_arrow): Use expander_size. (gtk_tree_view_draw_focus): Use "treeview" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_bin_expose): Use "treeview-drop-indicator" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_deleted): If we have a node currently being expanded or collapsed, remove the timeout and set the node to NULL. (gtk_tree_view_queue_draw_arrow): New function that just redraws the arrow of a node. (gtk_tree_view_draw_arrow): Use expander_size instead of expander_width/expander_height, also pass a different expander_style to gtk_paint_expander depending on the state of the node being drawn. (expand_collapse_timeout): New function for expanding or collapsing a node depending on the previous state. (gtk_tree_view_real_expand_row): Add timeout and set correct state for node being expanded. (gtk_tree_view_real_collapse_row): Add timeout and set correct state for node being collapsed. * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add information about the node currently being expanded or collapsed, and also a timeout id. * gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open with expander_style for draw_expander. * gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with expander_style. (create_expander_affine): New function for creating an expander affine. (apply_affine_on_point): New function for applying an affine to a point. (gtk_default_draw_expander): Modified to take expander_style instead of is_open, and to draw the rectangle rotated differently depending on the expander style. (gtk_paint_expander): Replace is_open with expander_style. * gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor. * gtk/gtkenums.h: Add expander style enum.
2001-07-22 20:09:00 +00:00
_TREE_VIEW_EXPANDER_SIZE,
G_PARAM_READABLE));
gtk_widget_class_install_style_property (widget_class,
g_param_spec_int ("vertical_separator",
P_("Vertical Separator Width"),
P_("Vertical space between cells. Must be an even number"),
0,
G_MAXINT,
_TREE_VIEW_VERTICAL_SEPARATOR,
G_PARAM_READABLE));
Add support for animating expanders. 2001-07-22 Anders Carlsson <andersca@gnome.org> * gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the expander_height and expander_width properties with a single property, expander_size. (gtk_tree_view_init): Set the tab_offset to expander_size plus some padding. (gtk_tree_view_unrealize): Remove the expand/collapse timeout if it exists. (coords_are_over_arrow): Fix a small bug. (gtk_tree_view_motion_draw_column_motion_arrow): Use expander_size. (gtk_tree_view_draw_focus): Use "treeview" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_bin_expose): Use "treeview-drop-indicator" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_deleted): If we have a node currently being expanded or collapsed, remove the timeout and set the node to NULL. (gtk_tree_view_queue_draw_arrow): New function that just redraws the arrow of a node. (gtk_tree_view_draw_arrow): Use expander_size instead of expander_width/expander_height, also pass a different expander_style to gtk_paint_expander depending on the state of the node being drawn. (expand_collapse_timeout): New function for expanding or collapsing a node depending on the previous state. (gtk_tree_view_real_expand_row): Add timeout and set correct state for node being expanded. (gtk_tree_view_real_collapse_row): Add timeout and set correct state for node being collapsed. * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add information about the node currently being expanded or collapsed, and also a timeout id. * gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open with expander_style for draw_expander. * gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with expander_style. (create_expander_affine): New function for creating an expander affine. (apply_affine_on_point): New function for applying an affine to a point. (gtk_default_draw_expander): Modified to take expander_style instead of is_open, and to draw the rectangle rotated differently depending on the expander style. (gtk_paint_expander): Replace is_open with expander_style. * gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor. * gtk/gtkenums.h: Add expander style enum.
2001-07-22 20:09:00 +00:00
gtk_widget_class_install_style_property (widget_class,
g_param_spec_int ("horizontal_separator",
P_("Horizontal Separator Width"),
P_("Horizontal space between cells. Must be an even number"),
0,
G_MAXINT,
_TREE_VIEW_HORIZONTAL_SEPARATOR,
G_PARAM_READABLE));
gtk_widget_class_install_style_property (widget_class,
g_param_spec_boolean ("allow_rules",
P_("Allow Rules"),
P_("Allow drawing of alternating color rows"),
TRUE,
G_PARAM_READABLE));
gtk_widget_class_install_style_property (widget_class,
g_param_spec_boolean ("indent_expanders",
P_("Indent Expanders"),
P_("Make the expanders indented"),
TRUE,
G_PARAM_READABLE));
2002-10-22 23:05:29 +00:00
gtk_widget_class_install_style_property (widget_class,
g_param_spec_boxed ("even_row_color",
P_("Even Row Color"),
P_("Color to use for even rows"),
2002-10-22 23:05:29 +00:00
GDK_TYPE_COLOR,
G_PARAM_READABLE));
gtk_widget_class_install_style_property (widget_class,
g_param_spec_boxed ("odd_row_color",
P_("Odd Row Color"),
P_("Color to use for odd rows"),
2002-10-22 23:05:29 +00:00
GDK_TYPE_COLOR,
G_PARAM_READABLE));
/* Signals */
widget_class->set_scroll_adjustments_signal =
g_signal_new ("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);
tree_view_signals[ROW_ACTIVATED] =
g_signal_new ("row_activated",
G_TYPE_FROM_CLASS (o_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (GtkTreeViewClass, row_activated),
NULL, NULL,
_gtk_marshal_VOID__BOXED_OBJECT,
G_TYPE_NONE, 2,
GTK_TYPE_TREE_PATH,
GTK_TYPE_TREE_VIEW_COLUMN);
tree_view_signals[TEST_EXPAND_ROW] =
g_signal_new ("test_expand_row",
G_TYPE_FROM_CLASS (o_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkTreeViewClass, test_expand_row),
_gtk_boolean_handled_accumulator, NULL,
_gtk_marshal_BOOLEAN__BOXED_BOXED,
G_TYPE_BOOLEAN, 2,
GTK_TYPE_TREE_ITER,
GTK_TYPE_TREE_PATH);
tree_view_signals[TEST_COLLAPSE_ROW] =
g_signal_new ("test_collapse_row",
G_TYPE_FROM_CLASS (o_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkTreeViewClass, test_collapse_row),
_gtk_boolean_handled_accumulator, NULL,
_gtk_marshal_BOOLEAN__BOXED_BOXED,
G_TYPE_BOOLEAN, 2,
GTK_TYPE_TREE_ITER,
GTK_TYPE_TREE_PATH);
tree_view_signals[ROW_EXPANDED] =
g_signal_new ("row_expanded",
G_TYPE_FROM_CLASS (o_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkTreeViewClass, row_expanded),
NULL, NULL,
_gtk_marshal_VOID__BOXED_BOXED,
G_TYPE_NONE, 2,
GTK_TYPE_TREE_ITER,
GTK_TYPE_TREE_PATH);
tree_view_signals[ROW_COLLAPSED] =
g_signal_new ("row_collapsed",
G_TYPE_FROM_CLASS (o_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkTreeViewClass, row_collapsed),
NULL, NULL,
_gtk_marshal_VOID__BOXED_BOXED,
G_TYPE_NONE, 2,
GTK_TYPE_TREE_ITER,
GTK_TYPE_TREE_PATH);
tree_view_signals[COLUMNS_CHANGED] =
g_signal_new ("columns_changed",
G_TYPE_FROM_CLASS (o_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkTreeViewClass, columns_changed),
NULL, NULL,
_gtk_marshal_NONE__NONE,
G_TYPE_NONE, 0);
tree_view_signals[CURSOR_CHANGED] =
g_signal_new ("cursor_changed",
G_TYPE_FROM_CLASS (o_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkTreeViewClass, cursor_changed),
NULL, NULL,
_gtk_marshal_NONE__NONE,
G_TYPE_NONE, 0);
tree_view_signals[MOVE_CURSOR] =
g_signal_new ("move_cursor",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (GtkTreeViewClass, move_cursor),
NULL, NULL,
_gtk_marshal_BOOLEAN__ENUM_INT,
G_TYPE_BOOLEAN, 2,
GTK_TYPE_MOVEMENT_STEP,
G_TYPE_INT);
tree_view_signals[SELECT_ALL] =
g_signal_new ("select_all",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (GtkTreeViewClass, select_all),
NULL, NULL,
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
_gtk_marshal_BOOLEAN__NONE,
G_TYPE_BOOLEAN, 0);
tree_view_signals[UNSELECT_ALL] =
g_signal_new ("unselect_all",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (GtkTreeViewClass, unselect_all),
NULL, NULL,
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
_gtk_marshal_BOOLEAN__NONE,
G_TYPE_BOOLEAN, 0);
tree_view_signals[SELECT_CURSOR_ROW] =
g_signal_new ("select_cursor_row",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (GtkTreeViewClass, select_cursor_row),
NULL, NULL,
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
_gtk_marshal_BOOLEAN__BOOLEAN,
G_TYPE_BOOLEAN, 1,
G_TYPE_BOOLEAN);
tree_view_signals[TOGGLE_CURSOR_ROW] =
g_signal_new ("toggle_cursor_row",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (GtkTreeViewClass, toggle_cursor_row),
NULL, NULL,
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
_gtk_marshal_BOOLEAN__NONE,
G_TYPE_BOOLEAN, 0);
tree_view_signals[EXPAND_COLLAPSE_CURSOR_ROW] =
g_signal_new ("expand_collapse_cursor_row",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (GtkTreeViewClass, expand_collapse_cursor_row),
NULL, NULL,
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
_gtk_marshal_BOOLEAN__BOOLEAN_BOOLEAN_BOOLEAN,
G_TYPE_BOOLEAN, 3,
G_TYPE_BOOLEAN,
G_TYPE_BOOLEAN,
G_TYPE_BOOLEAN);
tree_view_signals[SELECT_CURSOR_PARENT] =
g_signal_new ("select_cursor_parent",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (GtkTreeViewClass, select_cursor_parent),
NULL, NULL,
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
_gtk_marshal_BOOLEAN__NONE,
G_TYPE_BOOLEAN, 0);
tree_view_signals[START_INTERACTIVE_SEARCH] =
g_signal_new ("start_interactive_search",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (GtkTreeViewClass, start_interactive_search),
NULL, NULL,
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
_gtk_marshal_BOOLEAN__NONE,
G_TYPE_BOOLEAN, 0);
/* Key bindings */
gtk_tree_view_add_move_binding (binding_set, GDK_Up, 0,
GTK_MOVEMENT_DISPLAY_LINES, -1);
gtk_tree_view_add_move_binding (binding_set, GDK_KP_Up, 0,
GTK_MOVEMENT_DISPLAY_LINES, -1);
gtk_tree_view_add_move_binding (binding_set, GDK_Down, 0,
GTK_MOVEMENT_DISPLAY_LINES, 1);
gtk_tree_view_add_move_binding (binding_set, GDK_KP_Down, 0,
GTK_MOVEMENT_DISPLAY_LINES, 1);
gtk_tree_view_add_move_binding (binding_set, GDK_p, GDK_CONTROL_MASK,
GTK_MOVEMENT_DISPLAY_LINES, -1);
gtk_tree_view_add_move_binding (binding_set, GDK_n, GDK_CONTROL_MASK,
GTK_MOVEMENT_DISPLAY_LINES, 1);
gtk_tree_view_add_move_binding (binding_set, GDK_Home, 0,
GTK_MOVEMENT_BUFFER_ENDS, -1);
gtk_tree_view_add_move_binding (binding_set, GDK_KP_Home, 0,
GTK_MOVEMENT_BUFFER_ENDS, -1);
gtk_tree_view_add_move_binding (binding_set, GDK_End, 0,
GTK_MOVEMENT_BUFFER_ENDS, 1);
gtk_tree_view_add_move_binding (binding_set, GDK_KP_End, 0,
GTK_MOVEMENT_BUFFER_ENDS, 1);
gtk_tree_view_add_move_binding (binding_set, GDK_Page_Up, 0,
GTK_MOVEMENT_PAGES, -1);
gtk_tree_view_add_move_binding (binding_set, GDK_KP_Page_Up, 0,
GTK_MOVEMENT_PAGES, -1);
gtk_tree_view_add_move_binding (binding_set, GDK_Page_Down, 0,
GTK_MOVEMENT_PAGES, 1);
gtk_tree_view_add_move_binding (binding_set, GDK_KP_Page_Down, 0,
GTK_MOVEMENT_PAGES, 1);
gtk_binding_entry_add_signal (binding_set, GDK_Right, 0, "move_cursor", 2,
G_TYPE_ENUM, GTK_MOVEMENT_VISUAL_POSITIONS,
G_TYPE_INT, 1);
gtk_binding_entry_add_signal (binding_set, GDK_Left, 0, "move_cursor", 2,
G_TYPE_ENUM, GTK_MOVEMENT_VISUAL_POSITIONS,
G_TYPE_INT, -1);
gtk_binding_entry_add_signal (binding_set, GDK_KP_Right, 0, "move_cursor", 2,
G_TYPE_ENUM, GTK_MOVEMENT_VISUAL_POSITIONS,
G_TYPE_INT, 1);
gtk_binding_entry_add_signal (binding_set, GDK_KP_Left, 0, "move_cursor", 2,
G_TYPE_ENUM, GTK_MOVEMENT_VISUAL_POSITIONS,
G_TYPE_INT, -1);
gtk_binding_entry_add_signal (binding_set, GDK_Right, GDK_CONTROL_MASK,
"move_cursor", 2,
G_TYPE_ENUM, GTK_MOVEMENT_VISUAL_POSITIONS,
G_TYPE_INT, 1);
gtk_binding_entry_add_signal (binding_set, GDK_Left, GDK_CONTROL_MASK,
"move_cursor", 2,
G_TYPE_ENUM, GTK_MOVEMENT_VISUAL_POSITIONS,
G_TYPE_INT, -1);
gtk_binding_entry_add_signal (binding_set, GDK_KP_Right, GDK_CONTROL_MASK,
"move_cursor", 2,
G_TYPE_ENUM, GTK_MOVEMENT_VISUAL_POSITIONS,
G_TYPE_INT, 1);
gtk_binding_entry_add_signal (binding_set, GDK_KP_Left, GDK_CONTROL_MASK,
"move_cursor", 2,
G_TYPE_ENUM, GTK_MOVEMENT_VISUAL_POSITIONS,
G_TYPE_INT, -1);
gtk_binding_entry_add_signal (binding_set, GDK_space, GDK_CONTROL_MASK, "toggle_cursor_row", 0);
gtk_binding_entry_add_signal (binding_set, GDK_a, GDK_CONTROL_MASK, "select_all", 0);
gtk_binding_entry_add_signal (binding_set, GDK_slash, GDK_CONTROL_MASK, "select_all", 0);
gtk_binding_entry_add_signal (binding_set, GDK_A, GDK_CONTROL_MASK | GDK_SHIFT_MASK, "unselect_all", 0);
gtk_binding_entry_add_signal (binding_set, GDK_backslash, GDK_CONTROL_MASK, "unselect_all", 0);
gtk_binding_entry_add_signal (binding_set, GDK_space, GDK_SHIFT_MASK, "select_cursor_row", 1,
G_TYPE_BOOLEAN, TRUE);
gtk_binding_entry_add_signal (binding_set, GDK_space, 0, "select_cursor_row", 1,
G_TYPE_BOOLEAN, TRUE);
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
gtk_binding_entry_add_signal (binding_set, GDK_Return, 0, "select_cursor_row", 1,
G_TYPE_BOOLEAN, TRUE);
gtk_binding_entry_add_signal (binding_set, GDK_ISO_Enter, 0, "select_cursor_row", 1,
G_TYPE_BOOLEAN, TRUE);
gtk_binding_entry_add_signal (binding_set, GDK_KP_Enter, 0, "select_cursor_row", 1,
G_TYPE_BOOLEAN, TRUE);
/* expand and collapse rows */
gtk_binding_entry_add_signal (binding_set, GDK_plus, 0, "expand_collapse_cursor_row", 3,
G_TYPE_BOOLEAN, TRUE,
G_TYPE_BOOLEAN, TRUE,
G_TYPE_BOOLEAN, FALSE);
gtk_binding_entry_add_signal (binding_set, GDK_asterisk, 0,
"expand_collapse_cursor_row", 3,
G_TYPE_BOOLEAN, TRUE,
G_TYPE_BOOLEAN, TRUE,
G_TYPE_BOOLEAN, TRUE);
gtk_binding_entry_add_signal (binding_set, GDK_KP_Multiply, 0,
"expand_collapse_cursor_row", 3,
G_TYPE_BOOLEAN, TRUE,
G_TYPE_BOOLEAN, TRUE,
G_TYPE_BOOLEAN, TRUE);
gtk_binding_entry_add_signal (binding_set, GDK_slash, 0,
"expand_collapse_cursor_row", 3,
G_TYPE_BOOLEAN, TRUE,
G_TYPE_BOOLEAN, FALSE,
G_TYPE_BOOLEAN, FALSE);
gtk_binding_entry_add_signal (binding_set, GDK_KP_Divide, 0,
"expand_collapse_cursor_row", 3,
G_TYPE_BOOLEAN, TRUE,
G_TYPE_BOOLEAN, FALSE,
G_TYPE_BOOLEAN, FALSE);
/* Not doable on US keyboards */
gtk_binding_entry_add_signal (binding_set, GDK_plus, GDK_SHIFT_MASK, "expand_collapse_cursor_row", 3,
G_TYPE_BOOLEAN, TRUE,
G_TYPE_BOOLEAN, TRUE,
G_TYPE_BOOLEAN, TRUE);
gtk_binding_entry_add_signal (binding_set, GDK_KP_Add, 0, "expand_collapse_cursor_row", 3,
G_TYPE_BOOLEAN, TRUE,
G_TYPE_BOOLEAN, TRUE,
G_TYPE_BOOLEAN, FALSE);
gtk_binding_entry_add_signal (binding_set, GDK_KP_Add, GDK_SHIFT_MASK, "expand_collapse_cursor_row", 3,
G_TYPE_BOOLEAN, TRUE,
G_TYPE_BOOLEAN, TRUE,
G_TYPE_BOOLEAN, TRUE);
gtk_binding_entry_add_signal (binding_set, GDK_KP_Add, GDK_SHIFT_MASK, "expand_collapse_cursor_row", 3,
G_TYPE_BOOLEAN, TRUE,
G_TYPE_BOOLEAN, TRUE,
G_TYPE_BOOLEAN, TRUE);
gtk_binding_entry_add_signal (binding_set, GDK_Right, GDK_SHIFT_MASK,
"expand_collapse_cursor_row", 3,
G_TYPE_BOOLEAN, FALSE,
G_TYPE_BOOLEAN, TRUE,
G_TYPE_BOOLEAN, TRUE);
gtk_binding_entry_add_signal (binding_set, GDK_KP_Right, GDK_SHIFT_MASK,
"expand_collapse_cursor_row", 3,
G_TYPE_BOOLEAN, FALSE,
G_TYPE_BOOLEAN, TRUE,
G_TYPE_BOOLEAN, TRUE);
gtk_binding_entry_add_signal (binding_set, GDK_Right,
GDK_CONTROL_MASK | GDK_SHIFT_MASK,
"expand_collapse_cursor_row", 3,
G_TYPE_BOOLEAN, FALSE,
G_TYPE_BOOLEAN, TRUE,
G_TYPE_BOOLEAN, TRUE);
gtk_binding_entry_add_signal (binding_set, GDK_KP_Right,
GDK_CONTROL_MASK | GDK_SHIFT_MASK,
"expand_collapse_cursor_row", 3,
G_TYPE_BOOLEAN, FALSE,
G_TYPE_BOOLEAN, TRUE,
G_TYPE_BOOLEAN, TRUE);
gtk_binding_entry_add_signal (binding_set, GDK_minus, 0, "expand_collapse_cursor_row", 3,
G_TYPE_BOOLEAN, TRUE,
G_TYPE_BOOLEAN, FALSE,
G_TYPE_BOOLEAN, FALSE);
gtk_binding_entry_add_signal (binding_set, GDK_minus, GDK_SHIFT_MASK, "expand_collapse_cursor_row", 3,
G_TYPE_BOOLEAN, TRUE,
G_TYPE_BOOLEAN, FALSE,
G_TYPE_BOOLEAN, TRUE);
gtk_binding_entry_add_signal (binding_set, GDK_KP_Subtract, 0, "expand_collapse_cursor_row", 3,
G_TYPE_BOOLEAN, TRUE,
G_TYPE_BOOLEAN, FALSE,
G_TYPE_BOOLEAN, FALSE);
gtk_binding_entry_add_signal (binding_set, GDK_KP_Subtract, GDK_SHIFT_MASK, "expand_collapse_cursor_row", 3,
G_TYPE_BOOLEAN, TRUE,
G_TYPE_BOOLEAN, FALSE,
G_TYPE_BOOLEAN, TRUE);
gtk_binding_entry_add_signal (binding_set, GDK_Left, GDK_SHIFT_MASK,
"expand_collapse_cursor_row", 3,
G_TYPE_BOOLEAN, FALSE,
G_TYPE_BOOLEAN, FALSE,
G_TYPE_BOOLEAN, TRUE);
gtk_binding_entry_add_signal (binding_set, GDK_KP_Left, GDK_SHIFT_MASK,
"expand_collapse_cursor_row", 3,
G_TYPE_BOOLEAN, FALSE,
G_TYPE_BOOLEAN, FALSE,
G_TYPE_BOOLEAN, TRUE);
gtk_binding_entry_add_signal (binding_set, GDK_Left,
GDK_CONTROL_MASK | GDK_SHIFT_MASK,
"expand_collapse_cursor_row", 3,
G_TYPE_BOOLEAN, FALSE,
G_TYPE_BOOLEAN, FALSE,
G_TYPE_BOOLEAN, TRUE);
gtk_binding_entry_add_signal (binding_set, GDK_KP_Left,
GDK_CONTROL_MASK | GDK_SHIFT_MASK,
"expand_collapse_cursor_row", 3,
G_TYPE_BOOLEAN, FALSE,
G_TYPE_BOOLEAN, FALSE,
G_TYPE_BOOLEAN, TRUE);
gtk_binding_entry_add_signal (binding_set, GDK_BackSpace, 0, "select_cursor_parent", 0);
gtk_binding_entry_add_signal (binding_set, GDK_f, GDK_CONTROL_MASK, "start_interactive_search", 0);
gtk_binding_entry_add_signal (binding_set, GDK_F, GDK_CONTROL_MASK, "start_interactive_search", 0);
}
static void
gtk_tree_view_init (GtkTreeView *tree_view)
{
tree_view->priv = g_new0 (GtkTreeViewPrivate, 1);
GTK_WIDGET_SET_FLAGS (tree_view, GTK_CAN_FOCUS);
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (tree_view), FALSE);
tree_view->priv->flags = GTK_TREE_VIEW_SHOW_EXPANDERS
| GTK_TREE_VIEW_DRAW_KEYFOCUS
| GTK_TREE_VIEW_HEADERS_VISIBLE;
Add support for animating expanders. 2001-07-22 Anders Carlsson <andersca@gnome.org> * gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the expander_height and expander_width properties with a single property, expander_size. (gtk_tree_view_init): Set the tab_offset to expander_size plus some padding. (gtk_tree_view_unrealize): Remove the expand/collapse timeout if it exists. (coords_are_over_arrow): Fix a small bug. (gtk_tree_view_motion_draw_column_motion_arrow): Use expander_size. (gtk_tree_view_draw_focus): Use "treeview" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_bin_expose): Use "treeview-drop-indicator" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_deleted): If we have a node currently being expanded or collapsed, remove the timeout and set the node to NULL. (gtk_tree_view_queue_draw_arrow): New function that just redraws the arrow of a node. (gtk_tree_view_draw_arrow): Use expander_size instead of expander_width/expander_height, also pass a different expander_style to gtk_paint_expander depending on the state of the node being drawn. (expand_collapse_timeout): New function for expanding or collapsing a node depending on the previous state. (gtk_tree_view_real_expand_row): Add timeout and set correct state for node being expanded. (gtk_tree_view_real_collapse_row): Add timeout and set correct state for node being collapsed. * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add information about the node currently being expanded or collapsed, and also a timeout id. * gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open with expander_style for draw_expander. * gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with expander_style. (create_expander_affine): New function for creating an expander affine. (apply_affine_on_point): New function for applying an affine to a point. (gtk_default_draw_expander): Modified to take expander_style instead of is_open, and to draw the rectangle rotated differently depending on the expander style. (gtk_paint_expander): Replace is_open with expander_style. * gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor. * gtk/gtkenums.h: Add expander style enum.
2001-07-22 20:09:00 +00:00
/* We need some padding */
tree_view->priv->dy = 0;
Port to GObject, can go back in gdk-pixbuf after setting up a 2000-12-16 Havoc Pennington <hp@pobox.com> * gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c: Port to GObject, can go back in gdk-pixbuf after setting up a gdk-pixbuf-marshal.h header over there. * gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g; (gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal args (gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be set (gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons here, do it when we create the buttons later (gtk_tree_view_realize_buttons): add some g_return_if_fail (gtk_tree_view_map): paranoia checks that column->button is shown and unmapped (gtk_tree_view_size_request): only request visible children. Move header size calculation in here, for cleanliness, and to maintain invariants for child widgets if we eventually let users set different children inside the buttons (gtk_tree_view_map_buttons): factor out code to map buttons, since it was being called several times (gtk_tree_view_size_allocate_buttons): move_resize the drag windows instead of just moving them; their height may change if we allow random widgets in there, or the theme changes. (gtk_tree_view_size_allocate): move button size allocation above emitting the scroll signals, to ensure a sane state when we hit user code (gtk_tree_view_button_release): remove queue_resize after tree_view_set_size(), set_size() will handle any resize queuing that's needed (gtk_tree_view_focus_in): just queue a draw, don't fool with draw_focus goo (gtk_tree_view_focus): use gtk_get_current_event() and gdk_event_get_state() (gtk_tree_view_deleted): don't queue_resize() after calling set_size() (gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove semicolon (gtk_tree_view_create_button): show the button here (gtk_tree_view_button_clicked): actually emit the clicked signal on the column (_gtk_tree_view_set_size): return right away if the size is unchanged, as a cheesy optimization (gtk_tree_view_setup_model): rename set_model_realized to setup_model to match the flag that indicates whether we've called it (gtk_tree_view_get_hadjustment): create adjustment if it doesn't exist, because set_scroll_adjustment does that and it shouldn't matter what order you call these in (gtk_tree_view_get_vadjustment): ditto (gtk_tree_view_set_headers_visible): canonicalize the bool, for paranoia (gtk_tree_view_set_headers_visible): call gtk_tree_view_map_buttons() instead of using cut-and-paste code (gtk_tree_view_append_column): clarify whether the return value is the count of columns before or after, and do the increment separately from the return statement so you can tell from the code. (gtk_tree_view_remove_column): ditto (gtk_tree_view_insert_column): ditto (gtk_tree_view_get_column): remove g_return_if_fail for columns outside the existing range, the docs say that outside-range columns are allowed, so we handle them as documented. (Presumably this allows a nice loop with column != NULL as test.) (gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments mean (left/right/center etc.). (gtk_tree_view_collapse_all): only queue a draw if we're mapped (gtk_tree_view_expand_row): add docs (gtk_tree_view_collapse_row): add docs * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new function to emit the clicked signal on a column * gdk/gdkevents.c (gdk_event_get_state): new function, to get the state of an event (gdk_event_get_time): don't treat GDK_SCROLL as a button event, remove default case from switch so gcc will whine if we don't explicitly handle all event types * gtk/gtktreeselection.h: added some FIXME * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename "columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
tree_view->priv->n_columns = 0;
tree_view->priv->header_height = 1;
tree_view->priv->x_drag = 0;
tree_view->priv->drag_pos = -1;
tree_view->priv->header_has_focus = FALSE;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
tree_view->priv->pressed_button = -1;
tree_view->priv->press_start_x = -1;
tree_view->priv->press_start_y = -1;
tree_view->priv->reorderable = FALSE;
tree_view->priv->presize_handler_timer = 0;
tree_view->priv->scroll_sync_timer = 0;
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;
tree_view->priv->search_dialog_position_func = gtk_tree_view_search_position_func;
tree_view->priv->search_equal_func = gtk_tree_view_search_equal_func;
tree_view->priv->typeselect_flush_timeout = 0;
tree_view->priv->init_hadjust_value = TRUE;
tree_view->priv->width = 0;
tree_view->priv->hover_selection = FALSE;
tree_view->priv->hover_expand = FALSE;
}
/* GObject Methods
*/
static void
gtk_tree_view_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GtkTreeView *tree_view;
tree_view = GTK_TREE_VIEW (object);
switch (prop_id)
{
case PROP_MODEL:
gtk_tree_view_set_model (tree_view, g_value_get_object (value));
break;
case PROP_HADJUSTMENT:
gtk_tree_view_set_hadjustment (tree_view, g_value_get_object (value));
break;
case PROP_VADJUSTMENT:
gtk_tree_view_set_vadjustment (tree_view, g_value_get_object (value));
break;
case PROP_HEADERS_VISIBLE:
gtk_tree_view_set_headers_visible (tree_view, g_value_get_boolean (value));
break;
case PROP_HEADERS_CLICKABLE:
gtk_tree_view_set_headers_clickable (tree_view, g_value_get_boolean (value));
break;
case PROP_EXPANDER_COLUMN:
gtk_tree_view_set_expander_column (tree_view, g_value_get_object (value));
break;
case PROP_REORDERABLE:
gtk_tree_view_set_reorderable (tree_view, g_value_get_boolean (value));
break;
case PROP_RULES_HINT:
gtk_tree_view_set_rules_hint (tree_view, g_value_get_boolean (value));
break;
case PROP_ENABLE_SEARCH:
gtk_tree_view_set_enable_search (tree_view, g_value_get_boolean (value));
break;
case PROP_SEARCH_COLUMN:
gtk_tree_view_set_search_column (tree_view, g_value_get_int (value));
break;
case PROP_FIXED_HEIGHT_MODE:
gtk_tree_view_set_fixed_height_mode (tree_view, g_value_get_boolean (value));
break;
case PROP_HOVER_SELECTION:
tree_view->priv->hover_selection = g_value_get_boolean (value);
break;
case PROP_HOVER_EXPAND:
tree_view->priv->hover_expand = g_value_get_boolean (value);
break;
default:
break;
}
}
static void
gtk_tree_view_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GtkTreeView *tree_view;
tree_view = GTK_TREE_VIEW (object);
switch (prop_id)
{
case PROP_MODEL:
g_value_set_object (value, tree_view->priv->model);
break;
case PROP_HADJUSTMENT:
g_value_set_object (value, tree_view->priv->hadjustment);
break;
case PROP_VADJUSTMENT:
g_value_set_object (value, tree_view->priv->vadjustment);
break;
case PROP_HEADERS_VISIBLE:
g_value_set_boolean (value, gtk_tree_view_get_headers_visible (tree_view));
break;
case PROP_EXPANDER_COLUMN:
g_value_set_object (value, tree_view->priv->expander_column);
break;
case PROP_REORDERABLE:
g_value_set_boolean (value, tree_view->priv->reorderable);
break;
case PROP_RULES_HINT:
g_value_set_boolean (value, tree_view->priv->has_rules);
break;
case PROP_ENABLE_SEARCH:
g_value_set_boolean (value, tree_view->priv->enable_search);
break;
case PROP_SEARCH_COLUMN:
g_value_set_int (value, tree_view->priv->search_column);
break;
case PROP_FIXED_HEIGHT_MODE:
g_value_set_boolean (value, tree_view->priv->fixed_height_mode);
break;
case PROP_HOVER_SELECTION:
g_value_set_boolean (value, tree_view->priv->hover_selection);
break;
case PROP_HOVER_EXPAND:
g_value_set_boolean (value, tree_view->priv->hover_expand);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_tree_view_finalize (GObject *object)
{
GtkTreeView *tree_view = (GtkTreeView *) object;
g_free (tree_view->priv);
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
}
/* GtkObject Methods
*/
static void
gtk_tree_view_destroy (GtkObject *object)
{
GtkTreeView *tree_view = GTK_TREE_VIEW (object);
GList *list;
gtk_tree_view_stop_editing (tree_view, TRUE);
if (tree_view->priv->columns != NULL)
2001-08-21 03:53:13 +00:00
{
list = tree_view->priv->columns;
while (list)
{
GtkTreeViewColumn *column;
column = GTK_TREE_VIEW_COLUMN (list->data);
list = list->next;
gtk_tree_view_remove_column (tree_view, column);
}
2001-08-21 03:53:13 +00:00
tree_view->priv->columns = NULL;
}
if (tree_view->priv->tree != NULL)
{
gtk_tree_view_unref_and_check_selection_tree (tree_view, tree_view->priv->tree);
_gtk_rbtree_free (tree_view->priv->tree);
tree_view->priv->tree = NULL;
}
if (tree_view->priv->selection != NULL)
{
_gtk_tree_selection_set_tree_view (tree_view->priv->selection, NULL);
g_object_unref (tree_view->priv->selection);
tree_view->priv->selection = NULL;
}
if (tree_view->priv->scroll_to_path != NULL)
{
gtk_tree_row_reference_free (tree_view->priv->scroll_to_path);
tree_view->priv->scroll_to_path = NULL;
}
if (tree_view->priv->drag_dest_row != NULL)
{
gtk_tree_row_reference_free (tree_view->priv->drag_dest_row);
tree_view->priv->drag_dest_row = NULL;
}
if (tree_view->priv->last_button_press != NULL)
{
gtk_tree_row_reference_free (tree_view->priv->last_button_press);
tree_view->priv->last_button_press = NULL;
}
if (tree_view->priv->last_button_press_2 != NULL)
{
gtk_tree_row_reference_free (tree_view->priv->last_button_press_2);
tree_view->priv->last_button_press_2 = NULL;
}
if (tree_view->priv->top_row != NULL)
{
gtk_tree_row_reference_free (tree_view->priv->top_row);
tree_view->priv->top_row = NULL;
}
if (tree_view->priv->column_drop_func_data &&
tree_view->priv->column_drop_func_data_destroy)
{
(* tree_view->priv->column_drop_func_data_destroy) (tree_view->priv->column_drop_func_data);
tree_view->priv->column_drop_func_data = NULL;
}
if (tree_view->priv->destroy_count_destroy &&
tree_view->priv->destroy_count_data)
{
(* tree_view->priv->destroy_count_destroy) (tree_view->priv->destroy_count_data);
tree_view->priv->destroy_count_data = NULL;
}
gtk_tree_row_reference_free (tree_view->priv->cursor);
tree_view->priv->cursor = NULL;
gtk_tree_row_reference_free (tree_view->priv->anchor);
tree_view->priv->anchor = NULL;
/* destroy interactive search dialog */
if (tree_view->priv->search_window)
{
gtk_widget_destroy (tree_view->priv->search_window);
tree_view->priv->search_window = NULL;
tree_view->priv->search_entry = NULL;
}
if (tree_view->priv->search_destroy)
{
(* tree_view->priv->search_destroy) (tree_view->priv->search_user_data);
tree_view->priv->search_user_data = NULL;
}
Support separators in combo boxes and more generally in tree views 2004-07-07 Matthias Clasen <mclasen@redhat.com> Support separators in combo boxes and more generally in tree views (#135873): * gtk/gtkcombobox.h: * gtk/gtkcombobox.c (gtk_combo_box_get_row_separator_column): * gtk/gtkcombobox.c (gtk_combo_box_set_row_separator_column): Add a ::row-separator-column property with getter and setter, which can indicate a boolean model column to determine which rows are separators. * gtk/gtkcombobox.c: Display separator rows as separator menu items in menu mode, and by using the new treeview separator functionality in list mode. * gtk/gtktreeview.h: * gtk/gtktreeview.c (gtk_tree_view_get_row_separator_func): * gtk/gtktreeview.c (gtk_tree_view_set_row_separator_func): Add a callback to determine whether a row is a separator. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): * gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon): * gtk/gtktreeview.c (validate_row): Use the new callback to determine whether a row is a separator, and draw it as a separator then. Since separators should take up less vertical space than regular rows, this requires removing the redundant MAX(...,expander_size) calls which appear in many places. Instead, the MAX() is now only done in validate_row(), and only if the row is not a separator. To catch possible side effects of this intrusive change, I have left EXPANDER_MAX() calls in place of the MAX() calls which will emit a warning if something breaks. They should be removed before 2.6. * gtk/gtktreeselection.c (row_is_selectable): Don't let separator rows be selected. * tests/testcombo.c (create_blaat): Add a separator column.
2004-07-07 15:15:35 +00:00
if (tree_view->priv->row_separator_destroy)
{
(* tree_view->priv->row_separator_destroy) (tree_view->priv->row_separator_data);
tree_view->priv->row_separator_data = NULL;
}
gtk_tree_view_set_model (tree_view, NULL);
if (tree_view->priv->hadjustment)
{
g_object_unref (tree_view->priv->hadjustment);
tree_view->priv->hadjustment = NULL;
}
if (tree_view->priv->vadjustment)
{
g_object_unref (tree_view->priv->vadjustment);
tree_view->priv->vadjustment = NULL;
}
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
/* GtkWidget Methods
*/
/* GtkWidget::map helper */
static void
gtk_tree_view_map_buttons (GtkTreeView *tree_view)
{
GList *list;
g_return_if_fail (GTK_WIDGET_MAPPED (tree_view));
if (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_HEADERS_VISIBLE))
{
GtkTreeViewColumn *column;
for (list = tree_view->priv->columns; list; list = list->next)
{
column = list->data;
if (GTK_WIDGET_VISIBLE (column->button) &&
!GTK_WIDGET_MAPPED (column->button))
gtk_widget_map (column->button);
}
for (list = tree_view->priv->columns; list; list = list->next)
{
column = list->data;
if (column->visible == FALSE)
continue;
if (column->resizable)
{
gdk_window_raise (column->window);
gdk_window_show (column->window);
}
else
gdk_window_hide (column->window);
}
gdk_window_show (tree_view->priv->header_window);
}
}
static void
gtk_tree_view_map (GtkWidget *widget)
{
GList *tmp_list;
GtkTreeView *tree_view;
g_return_if_fail (GTK_IS_TREE_VIEW (widget));
tree_view = GTK_TREE_VIEW (widget);
GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
tmp_list = tree_view->priv->children;
while (tmp_list)
{
GtkTreeViewChild *child = tmp_list->data;
tmp_list = tmp_list->next;
if (GTK_WIDGET_VISIBLE (child->widget))
{
if (!GTK_WIDGET_MAPPED (child->widget))
gtk_widget_map (child->widget);
}
}
gdk_window_show (tree_view->priv->bin_window);
gtk_tree_view_map_buttons (tree_view);
gdk_window_show (widget->window);
}
static void
gtk_tree_view_realize (GtkWidget *widget)
{
GList *tmp_list;
GtkTreeView *tree_view;
GdkGCValues values;
GdkWindowAttr attributes;
gint attributes_mask;
g_return_if_fail (GTK_IS_TREE_VIEW (widget));
tree_view = GTK_TREE_VIEW (widget);
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
/* Make the main, clipping window */
attributes.window_type = GDK_WINDOW_CHILD;
attributes.x = widget->allocation.x;
attributes.y = widget->allocation.y;
attributes.width = widget->allocation.width;
attributes.height = widget->allocation.height;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = gtk_widget_get_visual (widget);
attributes.colormap = gtk_widget_get_colormap (widget);
attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK;
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask);
gdk_window_set_user_data (widget->window, widget);
/* Make the window for the tree */
attributes.x = 0;
attributes.y = TREE_VIEW_HEADER_HEIGHT (tree_view);
attributes.width = tree_view->priv->width;
attributes.height = widget->allocation.height;
attributes.event_mask = GDK_EXPOSURE_MASK |
GDK_SCROLL_MASK |
GDK_POINTER_MOTION_MASK |
GDK_ENTER_NOTIFY_MASK |
GDK_LEAVE_NOTIFY_MASK |
GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
gtk_widget_get_events (widget);
tree_view->priv->bin_window = gdk_window_new (widget->window,
&attributes, attributes_mask);
gdk_window_set_user_data (tree_view->priv->bin_window, widget);
/* Make the column header window */
attributes.x = 0;
attributes.y = 0;
attributes.width = MAX (tree_view->priv->width, widget->allocation.width);
attributes.height = tree_view->priv->header_height;
attributes.event_mask = (GDK_EXPOSURE_MASK |
GDK_SCROLL_MASK |
GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
GDK_KEY_PRESS_MASK |
GDK_KEY_RELEASE_MASK) |
gtk_widget_get_events (widget);
tree_view->priv->header_window = gdk_window_new (widget->window,
&attributes, attributes_mask);
gdk_window_set_user_data (tree_view->priv->header_window, widget);
values.foreground = (widget->style->white.pixel==0 ?
widget->style->black:widget->style->white);
values.function = GDK_XOR;
values.subwindow_mode = GDK_INCLUDE_INFERIORS;
/* Add them all up. */
widget->style = gtk_style_attach (widget->style, widget->window);
gdk_window_set_background (widget->window, &widget->style->base[widget->state]);
gdk_window_set_background (tree_view->priv->bin_window, &widget->style->base[widget->state]);
gtk_style_set_background (widget->style, tree_view->priv->header_window, GTK_STATE_NORMAL);
tmp_list = tree_view->priv->children;
while (tmp_list)
{
GtkTreeViewChild *child = tmp_list->data;
tmp_list = tmp_list->next;
gtk_widget_set_parent_window (child->widget, tree_view->priv->bin_window);
}
for (tmp_list = tree_view->priv->columns; tmp_list; tmp_list = tmp_list->next)
_gtk_tree_view_column_realize_button (GTK_TREE_VIEW_COLUMN (tmp_list->data));
install_presize_handler (tree_view);
}
static void
gtk_tree_view_unrealize (GtkWidget *widget)
{
GtkTreeView *tree_view;
GList *list;
g_return_if_fail (GTK_IS_TREE_VIEW (widget));
tree_view = GTK_TREE_VIEW (widget);
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
if (tree_view->priv->scroll_timeout != 0)
{
g_source_remove (tree_view->priv->scroll_timeout);
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
tree_view->priv->scroll_timeout = 0;
}
if (tree_view->priv->open_dest_timeout != 0)
{
g_source_remove (tree_view->priv->open_dest_timeout);
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
tree_view->priv->open_dest_timeout = 0;
}
Add support for animating expanders. 2001-07-22 Anders Carlsson <andersca@gnome.org> * gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the expander_height and expander_width properties with a single property, expander_size. (gtk_tree_view_init): Set the tab_offset to expander_size plus some padding. (gtk_tree_view_unrealize): Remove the expand/collapse timeout if it exists. (coords_are_over_arrow): Fix a small bug. (gtk_tree_view_motion_draw_column_motion_arrow): Use expander_size. (gtk_tree_view_draw_focus): Use "treeview" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_bin_expose): Use "treeview-drop-indicator" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_deleted): If we have a node currently being expanded or collapsed, remove the timeout and set the node to NULL. (gtk_tree_view_queue_draw_arrow): New function that just redraws the arrow of a node. (gtk_tree_view_draw_arrow): Use expander_size instead of expander_width/expander_height, also pass a different expander_style to gtk_paint_expander depending on the state of the node being drawn. (expand_collapse_timeout): New function for expanding or collapsing a node depending on the previous state. (gtk_tree_view_real_expand_row): Add timeout and set correct state for node being expanded. (gtk_tree_view_real_collapse_row): Add timeout and set correct state for node being collapsed. * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add information about the node currently being expanded or collapsed, and also a timeout id. * gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open with expander_style for draw_expander. * gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with expander_style. (create_expander_affine): New function for creating an expander affine. (apply_affine_on_point): New function for applying an affine to a point. (gtk_default_draw_expander): Modified to take expander_style instead of is_open, and to draw the rectangle rotated differently depending on the expander style. (gtk_paint_expander): Replace is_open with expander_style. * gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor. * gtk/gtkenums.h: Add expander style enum.
2001-07-22 20:09:00 +00:00
if (tree_view->priv->expand_collapse_timeout != 0)
{
g_source_remove (tree_view->priv->expand_collapse_timeout);
Add support for animating expanders. 2001-07-22 Anders Carlsson <andersca@gnome.org> * gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the expander_height and expander_width properties with a single property, expander_size. (gtk_tree_view_init): Set the tab_offset to expander_size plus some padding. (gtk_tree_view_unrealize): Remove the expand/collapse timeout if it exists. (coords_are_over_arrow): Fix a small bug. (gtk_tree_view_motion_draw_column_motion_arrow): Use expander_size. (gtk_tree_view_draw_focus): Use "treeview" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_bin_expose): Use "treeview-drop-indicator" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_deleted): If we have a node currently being expanded or collapsed, remove the timeout and set the node to NULL. (gtk_tree_view_queue_draw_arrow): New function that just redraws the arrow of a node. (gtk_tree_view_draw_arrow): Use expander_size instead of expander_width/expander_height, also pass a different expander_style to gtk_paint_expander depending on the state of the node being drawn. (expand_collapse_timeout): New function for expanding or collapsing a node depending on the previous state. (gtk_tree_view_real_expand_row): Add timeout and set correct state for node being expanded. (gtk_tree_view_real_collapse_row): Add timeout and set correct state for node being collapsed. * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add information about the node currently being expanded or collapsed, and also a timeout id. * gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open with expander_style for draw_expander. * gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with expander_style. (create_expander_affine): New function for creating an expander affine. (apply_affine_on_point): New function for applying an affine to a point. (gtk_default_draw_expander): Modified to take expander_style instead of is_open, and to draw the rectangle rotated differently depending on the expander style. (gtk_paint_expander): Replace is_open with expander_style. * gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor. * gtk/gtkenums.h: Add expander style enum.
2001-07-22 20:09:00 +00:00
tree_view->priv->expand_collapse_timeout = 0;
}
if (tree_view->priv->presize_handler_timer != 0)
{
g_source_remove (tree_view->priv->presize_handler_timer);
tree_view->priv->presize_handler_timer = 0;
}
if (tree_view->priv->validate_rows_timer != 0)
{
g_source_remove (tree_view->priv->validate_rows_timer);
tree_view->priv->validate_rows_timer = 0;
}
if (tree_view->priv->scroll_sync_timer != 0)
{
g_source_remove (tree_view->priv->scroll_sync_timer);
tree_view->priv->scroll_sync_timer = 0;
}
if (tree_view->priv->typeselect_flush_timeout)
{
g_source_remove (tree_view->priv->typeselect_flush_timeout);
tree_view->priv->typeselect_flush_timeout = 0;
}
for (list = tree_view->priv->columns; list; list = list->next)
_gtk_tree_view_column_unrealize_button (GTK_TREE_VIEW_COLUMN (list->data));
gdk_window_set_user_data (tree_view->priv->bin_window, NULL);
gdk_window_destroy (tree_view->priv->bin_window);
tree_view->priv->bin_window = NULL;
gdk_window_set_user_data (tree_view->priv->header_window, NULL);
gdk_window_destroy (tree_view->priv->header_window);
tree_view->priv->header_window = NULL;
if (tree_view->priv->drag_window)
{
gdk_window_set_user_data (tree_view->priv->drag_window, NULL);
gdk_window_destroy (tree_view->priv->drag_window);
tree_view->priv->drag_window = NULL;
}
if (tree_view->priv->drag_highlight_window)
{
gdk_window_set_user_data (tree_view->priv->drag_highlight_window, NULL);
gdk_window_destroy (tree_view->priv->drag_highlight_window);
tree_view->priv->drag_highlight_window = NULL;
}
/* GtkWidget::unrealize destroys children and widget->window */
if (GTK_WIDGET_CLASS (parent_class)->unrealize)
(* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
}
/* GtkWidget::size_request helper */
Port to GObject, can go back in gdk-pixbuf after setting up a 2000-12-16 Havoc Pennington <hp@pobox.com> * gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c: Port to GObject, can go back in gdk-pixbuf after setting up a gdk-pixbuf-marshal.h header over there. * gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g; (gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal args (gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be set (gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons here, do it when we create the buttons later (gtk_tree_view_realize_buttons): add some g_return_if_fail (gtk_tree_view_map): paranoia checks that column->button is shown and unmapped (gtk_tree_view_size_request): only request visible children. Move header size calculation in here, for cleanliness, and to maintain invariants for child widgets if we eventually let users set different children inside the buttons (gtk_tree_view_map_buttons): factor out code to map buttons, since it was being called several times (gtk_tree_view_size_allocate_buttons): move_resize the drag windows instead of just moving them; their height may change if we allow random widgets in there, or the theme changes. (gtk_tree_view_size_allocate): move button size allocation above emitting the scroll signals, to ensure a sane state when we hit user code (gtk_tree_view_button_release): remove queue_resize after tree_view_set_size(), set_size() will handle any resize queuing that's needed (gtk_tree_view_focus_in): just queue a draw, don't fool with draw_focus goo (gtk_tree_view_focus): use gtk_get_current_event() and gdk_event_get_state() (gtk_tree_view_deleted): don't queue_resize() after calling set_size() (gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove semicolon (gtk_tree_view_create_button): show the button here (gtk_tree_view_button_clicked): actually emit the clicked signal on the column (_gtk_tree_view_set_size): return right away if the size is unchanged, as a cheesy optimization (gtk_tree_view_setup_model): rename set_model_realized to setup_model to match the flag that indicates whether we've called it (gtk_tree_view_get_hadjustment): create adjustment if it doesn't exist, because set_scroll_adjustment does that and it shouldn't matter what order you call these in (gtk_tree_view_get_vadjustment): ditto (gtk_tree_view_set_headers_visible): canonicalize the bool, for paranoia (gtk_tree_view_set_headers_visible): call gtk_tree_view_map_buttons() instead of using cut-and-paste code (gtk_tree_view_append_column): clarify whether the return value is the count of columns before or after, and do the increment separately from the return statement so you can tell from the code. (gtk_tree_view_remove_column): ditto (gtk_tree_view_insert_column): ditto (gtk_tree_view_get_column): remove g_return_if_fail for columns outside the existing range, the docs say that outside-range columns are allowed, so we handle them as documented. (Presumably this allows a nice loop with column != NULL as test.) (gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments mean (left/right/center etc.). (gtk_tree_view_collapse_all): only queue a draw if we're mapped (gtk_tree_view_expand_row): add docs (gtk_tree_view_collapse_row): add docs * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new function to emit the clicked signal on a column * gdk/gdkevents.c (gdk_event_get_state): new function, to get the state of an event (gdk_event_get_time): don't treat GDK_SCROLL as a button event, remove default case from switch so gcc will whine if we don't explicitly handle all event types * gtk/gtktreeselection.h: added some FIXME * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename "columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
static void
gtk_tree_view_size_request_columns (GtkTreeView *tree_view)
Port to GObject, can go back in gdk-pixbuf after setting up a 2000-12-16 Havoc Pennington <hp@pobox.com> * gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c: Port to GObject, can go back in gdk-pixbuf after setting up a gdk-pixbuf-marshal.h header over there. * gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g; (gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal args (gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be set (gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons here, do it when we create the buttons later (gtk_tree_view_realize_buttons): add some g_return_if_fail (gtk_tree_view_map): paranoia checks that column->button is shown and unmapped (gtk_tree_view_size_request): only request visible children. Move header size calculation in here, for cleanliness, and to maintain invariants for child widgets if we eventually let users set different children inside the buttons (gtk_tree_view_map_buttons): factor out code to map buttons, since it was being called several times (gtk_tree_view_size_allocate_buttons): move_resize the drag windows instead of just moving them; their height may change if we allow random widgets in there, or the theme changes. (gtk_tree_view_size_allocate): move button size allocation above emitting the scroll signals, to ensure a sane state when we hit user code (gtk_tree_view_button_release): remove queue_resize after tree_view_set_size(), set_size() will handle any resize queuing that's needed (gtk_tree_view_focus_in): just queue a draw, don't fool with draw_focus goo (gtk_tree_view_focus): use gtk_get_current_event() and gdk_event_get_state() (gtk_tree_view_deleted): don't queue_resize() after calling set_size() (gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove semicolon (gtk_tree_view_create_button): show the button here (gtk_tree_view_button_clicked): actually emit the clicked signal on the column (_gtk_tree_view_set_size): return right away if the size is unchanged, as a cheesy optimization (gtk_tree_view_setup_model): rename set_model_realized to setup_model to match the flag that indicates whether we've called it (gtk_tree_view_get_hadjustment): create adjustment if it doesn't exist, because set_scroll_adjustment does that and it shouldn't matter what order you call these in (gtk_tree_view_get_vadjustment): ditto (gtk_tree_view_set_headers_visible): canonicalize the bool, for paranoia (gtk_tree_view_set_headers_visible): call gtk_tree_view_map_buttons() instead of using cut-and-paste code (gtk_tree_view_append_column): clarify whether the return value is the count of columns before or after, and do the increment separately from the return statement so you can tell from the code. (gtk_tree_view_remove_column): ditto (gtk_tree_view_insert_column): ditto (gtk_tree_view_get_column): remove g_return_if_fail for columns outside the existing range, the docs say that outside-range columns are allowed, so we handle them as documented. (Presumably this allows a nice loop with column != NULL as test.) (gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments mean (left/right/center etc.). (gtk_tree_view_collapse_all): only queue a draw if we're mapped (gtk_tree_view_expand_row): add docs (gtk_tree_view_collapse_row): add docs * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new function to emit the clicked signal on a column * gdk/gdkevents.c (gdk_event_get_state): new function, to get the state of an event (gdk_event_get_time): don't treat GDK_SCROLL as a button event, remove default case from switch so gcc will whine if we don't explicitly handle all event types * gtk/gtktreeselection.h: added some FIXME * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename "columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
{
GList *list;
tree_view->priv->header_height = 0;
if (tree_view->priv->model)
{
Port to GObject, can go back in gdk-pixbuf after setting up a 2000-12-16 Havoc Pennington <hp@pobox.com> * gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c: Port to GObject, can go back in gdk-pixbuf after setting up a gdk-pixbuf-marshal.h header over there. * gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g; (gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal args (gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be set (gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons here, do it when we create the buttons later (gtk_tree_view_realize_buttons): add some g_return_if_fail (gtk_tree_view_map): paranoia checks that column->button is shown and unmapped (gtk_tree_view_size_request): only request visible children. Move header size calculation in here, for cleanliness, and to maintain invariants for child widgets if we eventually let users set different children inside the buttons (gtk_tree_view_map_buttons): factor out code to map buttons, since it was being called several times (gtk_tree_view_size_allocate_buttons): move_resize the drag windows instead of just moving them; their height may change if we allow random widgets in there, or the theme changes. (gtk_tree_view_size_allocate): move button size allocation above emitting the scroll signals, to ensure a sane state when we hit user code (gtk_tree_view_button_release): remove queue_resize after tree_view_set_size(), set_size() will handle any resize queuing that's needed (gtk_tree_view_focus_in): just queue a draw, don't fool with draw_focus goo (gtk_tree_view_focus): use gtk_get_current_event() and gdk_event_get_state() (gtk_tree_view_deleted): don't queue_resize() after calling set_size() (gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove semicolon (gtk_tree_view_create_button): show the button here (gtk_tree_view_button_clicked): actually emit the clicked signal on the column (_gtk_tree_view_set_size): return right away if the size is unchanged, as a cheesy optimization (gtk_tree_view_setup_model): rename set_model_realized to setup_model to match the flag that indicates whether we've called it (gtk_tree_view_get_hadjustment): create adjustment if it doesn't exist, because set_scroll_adjustment does that and it shouldn't matter what order you call these in (gtk_tree_view_get_vadjustment): ditto (gtk_tree_view_set_headers_visible): canonicalize the bool, for paranoia (gtk_tree_view_set_headers_visible): call gtk_tree_view_map_buttons() instead of using cut-and-paste code (gtk_tree_view_append_column): clarify whether the return value is the count of columns before or after, and do the increment separately from the return statement so you can tell from the code. (gtk_tree_view_remove_column): ditto (gtk_tree_view_insert_column): ditto (gtk_tree_view_get_column): remove g_return_if_fail for columns outside the existing range, the docs say that outside-range columns are allowed, so we handle them as documented. (Presumably this allows a nice loop with column != NULL as test.) (gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments mean (left/right/center etc.). (gtk_tree_view_collapse_all): only queue a draw if we're mapped (gtk_tree_view_expand_row): add docs (gtk_tree_view_collapse_row): add docs * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new function to emit the clicked signal on a column * gdk/gdkevents.c (gdk_event_get_state): new function, to get the state of an event (gdk_event_get_time): don't treat GDK_SCROLL as a button event, remove default case from switch so gcc will whine if we don't explicitly handle all event types * gtk/gtktreeselection.h: added some FIXME * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename "columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
for (list = tree_view->priv->columns; list; list = list->next)
{
GtkRequisition requisition;
GtkTreeViewColumn *column = list->data;
if (column->button == NULL)
continue;
Port to GObject, can go back in gdk-pixbuf after setting up a 2000-12-16 Havoc Pennington <hp@pobox.com> * gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c: Port to GObject, can go back in gdk-pixbuf after setting up a gdk-pixbuf-marshal.h header over there. * gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g; (gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal args (gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be set (gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons here, do it when we create the buttons later (gtk_tree_view_realize_buttons): add some g_return_if_fail (gtk_tree_view_map): paranoia checks that column->button is shown and unmapped (gtk_tree_view_size_request): only request visible children. Move header size calculation in here, for cleanliness, and to maintain invariants for child widgets if we eventually let users set different children inside the buttons (gtk_tree_view_map_buttons): factor out code to map buttons, since it was being called several times (gtk_tree_view_size_allocate_buttons): move_resize the drag windows instead of just moving them; their height may change if we allow random widgets in there, or the theme changes. (gtk_tree_view_size_allocate): move button size allocation above emitting the scroll signals, to ensure a sane state when we hit user code (gtk_tree_view_button_release): remove queue_resize after tree_view_set_size(), set_size() will handle any resize queuing that's needed (gtk_tree_view_focus_in): just queue a draw, don't fool with draw_focus goo (gtk_tree_view_focus): use gtk_get_current_event() and gdk_event_get_state() (gtk_tree_view_deleted): don't queue_resize() after calling set_size() (gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove semicolon (gtk_tree_view_create_button): show the button here (gtk_tree_view_button_clicked): actually emit the clicked signal on the column (_gtk_tree_view_set_size): return right away if the size is unchanged, as a cheesy optimization (gtk_tree_view_setup_model): rename set_model_realized to setup_model to match the flag that indicates whether we've called it (gtk_tree_view_get_hadjustment): create adjustment if it doesn't exist, because set_scroll_adjustment does that and it shouldn't matter what order you call these in (gtk_tree_view_get_vadjustment): ditto (gtk_tree_view_set_headers_visible): canonicalize the bool, for paranoia (gtk_tree_view_set_headers_visible): call gtk_tree_view_map_buttons() instead of using cut-and-paste code (gtk_tree_view_append_column): clarify whether the return value is the count of columns before or after, and do the increment separately from the return statement so you can tell from the code. (gtk_tree_view_remove_column): ditto (gtk_tree_view_insert_column): ditto (gtk_tree_view_get_column): remove g_return_if_fail for columns outside the existing range, the docs say that outside-range columns are allowed, so we handle them as documented. (Presumably this allows a nice loop with column != NULL as test.) (gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments mean (left/right/center etc.). (gtk_tree_view_collapse_all): only queue a draw if we're mapped (gtk_tree_view_expand_row): add docs (gtk_tree_view_collapse_row): add docs * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new function to emit the clicked signal on a column * gdk/gdkevents.c (gdk_event_get_state): new function, to get the state of an event (gdk_event_get_time): don't treat GDK_SCROLL as a button event, remove default case from switch so gcc will whine if we don't explicitly handle all event types * gtk/gtktreeselection.h: added some FIXME * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename "columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
column = list->data;
Port to GObject, can go back in gdk-pixbuf after setting up a 2000-12-16 Havoc Pennington <hp@pobox.com> * gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c: Port to GObject, can go back in gdk-pixbuf after setting up a gdk-pixbuf-marshal.h header over there. * gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g; (gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal args (gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be set (gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons here, do it when we create the buttons later (gtk_tree_view_realize_buttons): add some g_return_if_fail (gtk_tree_view_map): paranoia checks that column->button is shown and unmapped (gtk_tree_view_size_request): only request visible children. Move header size calculation in here, for cleanliness, and to maintain invariants for child widgets if we eventually let users set different children inside the buttons (gtk_tree_view_map_buttons): factor out code to map buttons, since it was being called several times (gtk_tree_view_size_allocate_buttons): move_resize the drag windows instead of just moving them; their height may change if we allow random widgets in there, or the theme changes. (gtk_tree_view_size_allocate): move button size allocation above emitting the scroll signals, to ensure a sane state when we hit user code (gtk_tree_view_button_release): remove queue_resize after tree_view_set_size(), set_size() will handle any resize queuing that's needed (gtk_tree_view_focus_in): just queue a draw, don't fool with draw_focus goo (gtk_tree_view_focus): use gtk_get_current_event() and gdk_event_get_state() (gtk_tree_view_deleted): don't queue_resize() after calling set_size() (gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove semicolon (gtk_tree_view_create_button): show the button here (gtk_tree_view_button_clicked): actually emit the clicked signal on the column (_gtk_tree_view_set_size): return right away if the size is unchanged, as a cheesy optimization (gtk_tree_view_setup_model): rename set_model_realized to setup_model to match the flag that indicates whether we've called it (gtk_tree_view_get_hadjustment): create adjustment if it doesn't exist, because set_scroll_adjustment does that and it shouldn't matter what order you call these in (gtk_tree_view_get_vadjustment): ditto (gtk_tree_view_set_headers_visible): canonicalize the bool, for paranoia (gtk_tree_view_set_headers_visible): call gtk_tree_view_map_buttons() instead of using cut-and-paste code (gtk_tree_view_append_column): clarify whether the return value is the count of columns before or after, and do the increment separately from the return statement so you can tell from the code. (gtk_tree_view_remove_column): ditto (gtk_tree_view_insert_column): ditto (gtk_tree_view_get_column): remove g_return_if_fail for columns outside the existing range, the docs say that outside-range columns are allowed, so we handle them as documented. (Presumably this allows a nice loop with column != NULL as test.) (gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments mean (left/right/center etc.). (gtk_tree_view_collapse_all): only queue a draw if we're mapped (gtk_tree_view_expand_row): add docs (gtk_tree_view_collapse_row): add docs * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new function to emit the clicked signal on a column * gdk/gdkevents.c (gdk_event_get_state): new function, to get the state of an event (gdk_event_get_time): don't treat GDK_SCROLL as a button event, remove default case from switch so gcc will whine if we don't explicitly handle all event types * gtk/gtktreeselection.h: added some FIXME * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename "columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
gtk_widget_size_request (column->button, &requisition);
column->button_request = requisition.width;
Port to GObject, can go back in gdk-pixbuf after setting up a 2000-12-16 Havoc Pennington <hp@pobox.com> * gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c: Port to GObject, can go back in gdk-pixbuf after setting up a gdk-pixbuf-marshal.h header over there. * gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g; (gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal args (gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be set (gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons here, do it when we create the buttons later (gtk_tree_view_realize_buttons): add some g_return_if_fail (gtk_tree_view_map): paranoia checks that column->button is shown and unmapped (gtk_tree_view_size_request): only request visible children. Move header size calculation in here, for cleanliness, and to maintain invariants for child widgets if we eventually let users set different children inside the buttons (gtk_tree_view_map_buttons): factor out code to map buttons, since it was being called several times (gtk_tree_view_size_allocate_buttons): move_resize the drag windows instead of just moving them; their height may change if we allow random widgets in there, or the theme changes. (gtk_tree_view_size_allocate): move button size allocation above emitting the scroll signals, to ensure a sane state when we hit user code (gtk_tree_view_button_release): remove queue_resize after tree_view_set_size(), set_size() will handle any resize queuing that's needed (gtk_tree_view_focus_in): just queue a draw, don't fool with draw_focus goo (gtk_tree_view_focus): use gtk_get_current_event() and gdk_event_get_state() (gtk_tree_view_deleted): don't queue_resize() after calling set_size() (gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove semicolon (gtk_tree_view_create_button): show the button here (gtk_tree_view_button_clicked): actually emit the clicked signal on the column (_gtk_tree_view_set_size): return right away if the size is unchanged, as a cheesy optimization (gtk_tree_view_setup_model): rename set_model_realized to setup_model to match the flag that indicates whether we've called it (gtk_tree_view_get_hadjustment): create adjustment if it doesn't exist, because set_scroll_adjustment does that and it shouldn't matter what order you call these in (gtk_tree_view_get_vadjustment): ditto (gtk_tree_view_set_headers_visible): canonicalize the bool, for paranoia (gtk_tree_view_set_headers_visible): call gtk_tree_view_map_buttons() instead of using cut-and-paste code (gtk_tree_view_append_column): clarify whether the return value is the count of columns before or after, and do the increment separately from the return statement so you can tell from the code. (gtk_tree_view_remove_column): ditto (gtk_tree_view_insert_column): ditto (gtk_tree_view_get_column): remove g_return_if_fail for columns outside the existing range, the docs say that outside-range columns are allowed, so we handle them as documented. (Presumably this allows a nice loop with column != NULL as test.) (gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments mean (left/right/center etc.). (gtk_tree_view_collapse_all): only queue a draw if we're mapped (gtk_tree_view_expand_row): add docs (gtk_tree_view_collapse_row): add docs * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new function to emit the clicked signal on a column * gdk/gdkevents.c (gdk_event_get_state): new function, to get the state of an event (gdk_event_get_time): don't treat GDK_SCROLL as a button event, remove default case from switch so gcc will whine if we don't explicitly handle all event types * gtk/gtktreeselection.h: added some FIXME * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename "columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
tree_view->priv->header_height = MAX (tree_view->priv->header_height, requisition.height);
}
}
}
/* Called only by ::size_request */
static void
gtk_tree_view_update_size (GtkTreeView *tree_view)
{
GList *list;
GtkTreeViewColumn *column;
gint i;
if (tree_view->priv->model == NULL)
{
tree_view->priv->width = 0;
tree_view->priv->prev_width = 0;
tree_view->priv->height = 0;
return;
}
tree_view->priv->prev_width = tree_view->priv->width;
tree_view->priv->width = 0;
/* keep this in sync with size_allocate below */
for (list = tree_view->priv->columns, i = 0; list; list = list->next, i++)
{
gint real_requested_width = 0;
column = list->data;
if (!column->visible)
continue;
if (column->use_resized_width)
{
real_requested_width = column->resized_width;
}
else if (column->column_type == GTK_TREE_VIEW_COLUMN_FIXED)
{
real_requested_width = column->fixed_width;
}
else if (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_HEADERS_VISIBLE))
{
real_requested_width = MAX (column->requested_width, column->button_request);
}
else
{
real_requested_width = column->requested_width;
}
if (column->min_width != -1)
real_requested_width = MAX (real_requested_width, column->min_width);
if (column->max_width != -1)
real_requested_width = MIN (real_requested_width, column->max_width);
tree_view->priv->width += real_requested_width;
}
if (tree_view->priv->tree == NULL)
tree_view->priv->height = 0;
else
tree_view->priv->height = tree_view->priv->tree->root->offset;
}
static void
gtk_tree_view_size_request (GtkWidget *widget,
GtkRequisition *requisition)
{
GtkTreeView *tree_view;
GList *tmp_list;
g_return_if_fail (GTK_IS_TREE_VIEW (widget));
tree_view = GTK_TREE_VIEW (widget);
/* we validate GTK_TREE_VIEW_NUM_ROWS_PER_IDLE rows initially just to make
* sure we have some size. In practice, with a lot of static lists, this
* should get a good width.
*/
validate_rows (tree_view);
gtk_tree_view_size_request_columns (tree_view);
gtk_tree_view_update_size (GTK_TREE_VIEW (widget));
requisition->width = tree_view->priv->width;
requisition->height = tree_view->priv->height + TREE_VIEW_HEADER_HEIGHT (tree_view);
tmp_list = tree_view->priv->children;
while (tmp_list)
{
GtkTreeViewChild *child = tmp_list->data;
GtkRequisition child_requisition;
tmp_list = tmp_list->next;
Port to GObject, can go back in gdk-pixbuf after setting up a 2000-12-16 Havoc Pennington <hp@pobox.com> * gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c: Port to GObject, can go back in gdk-pixbuf after setting up a gdk-pixbuf-marshal.h header over there. * gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g; (gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal args (gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be set (gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons here, do it when we create the buttons later (gtk_tree_view_realize_buttons): add some g_return_if_fail (gtk_tree_view_map): paranoia checks that column->button is shown and unmapped (gtk_tree_view_size_request): only request visible children. Move header size calculation in here, for cleanliness, and to maintain invariants for child widgets if we eventually let users set different children inside the buttons (gtk_tree_view_map_buttons): factor out code to map buttons, since it was being called several times (gtk_tree_view_size_allocate_buttons): move_resize the drag windows instead of just moving them; their height may change if we allow random widgets in there, or the theme changes. (gtk_tree_view_size_allocate): move button size allocation above emitting the scroll signals, to ensure a sane state when we hit user code (gtk_tree_view_button_release): remove queue_resize after tree_view_set_size(), set_size() will handle any resize queuing that's needed (gtk_tree_view_focus_in): just queue a draw, don't fool with draw_focus goo (gtk_tree_view_focus): use gtk_get_current_event() and gdk_event_get_state() (gtk_tree_view_deleted): don't queue_resize() after calling set_size() (gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove semicolon (gtk_tree_view_create_button): show the button here (gtk_tree_view_button_clicked): actually emit the clicked signal on the column (_gtk_tree_view_set_size): return right away if the size is unchanged, as a cheesy optimization (gtk_tree_view_setup_model): rename set_model_realized to setup_model to match the flag that indicates whether we've called it (gtk_tree_view_get_hadjustment): create adjustment if it doesn't exist, because set_scroll_adjustment does that and it shouldn't matter what order you call these in (gtk_tree_view_get_vadjustment): ditto (gtk_tree_view_set_headers_visible): canonicalize the bool, for paranoia (gtk_tree_view_set_headers_visible): call gtk_tree_view_map_buttons() instead of using cut-and-paste code (gtk_tree_view_append_column): clarify whether the return value is the count of columns before or after, and do the increment separately from the return statement so you can tell from the code. (gtk_tree_view_remove_column): ditto (gtk_tree_view_insert_column): ditto (gtk_tree_view_get_column): remove g_return_if_fail for columns outside the existing range, the docs say that outside-range columns are allowed, so we handle them as documented. (Presumably this allows a nice loop with column != NULL as test.) (gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments mean (left/right/center etc.). (gtk_tree_view_collapse_all): only queue a draw if we're mapped (gtk_tree_view_expand_row): add docs (gtk_tree_view_collapse_row): add docs * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new function to emit the clicked signal on a column * gdk/gdkevents.c (gdk_event_get_state): new function, to get the state of an event (gdk_event_get_time): don't treat GDK_SCROLL as a button event, remove default case from switch so gcc will whine if we don't explicitly handle all event types * gtk/gtktreeselection.h: added some FIXME * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename "columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
if (GTK_WIDGET_VISIBLE (child->widget))
gtk_widget_size_request (child->widget, &child_requisition);
}
}
static void
invalidate_column (GtkTreeView *tree_view,
GtkTreeViewColumn *column)
{
gint column_offset = 0;
GList *list;
GtkWidget *widget = GTK_WIDGET (tree_view);
gboolean rtl;
if (!GTK_WIDGET_REALIZED (widget))
return;
rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
for (list = (rtl ? g_list_last (tree_view->priv->columns) : g_list_first (tree_view->priv->columns));
list;
list = (rtl ? list->prev : list->next))
{
GtkTreeViewColumn *tmpcolumn = list->data;
if (tmpcolumn == column)
{
GdkRectangle invalid_rect;
invalid_rect.x = column_offset;
invalid_rect.y = 0;
invalid_rect.width = column->width;
invalid_rect.height = widget->allocation.height;
gdk_window_invalidate_rect (widget->window, &invalid_rect, TRUE);
break;
}
column_offset += tmpcolumn->width;
}
}
static void
invalidate_last_column (GtkTreeView *tree_view)
{
GList *last_column;
gboolean rtl;
rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
for (last_column = (rtl ? g_list_first (tree_view->priv->columns) : g_list_last (tree_view->priv->columns));
last_column;
last_column = (rtl ? last_column->next : last_column->prev))
{
if (GTK_TREE_VIEW_COLUMN (last_column->data)->visible)
{
invalidate_column (tree_view, last_column->data);
return;
}
}
}
static gint
gtk_tree_view_get_real_requested_width_from_column (GtkTreeView *tree_view,
GtkTreeViewColumn *column)
{
gint real_requested_width;
if (column->use_resized_width)
{
real_requested_width = column->resized_width;
}
else if (column->column_type == GTK_TREE_VIEW_COLUMN_FIXED)
{
real_requested_width = column->fixed_width;
}
else if (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_HEADERS_VISIBLE))
{
real_requested_width = MAX (column->requested_width, column->button_request);
}
else
{
real_requested_width = column->requested_width;
if (real_requested_width < 0)
real_requested_width = 0;
}
if (column->min_width != -1)
real_requested_width = MAX (real_requested_width, column->min_width);
if (column->max_width != -1)
real_requested_width = MIN (real_requested_width, column->max_width);
return real_requested_width;
}
/* GtkWidget::size_allocate helper */
static void
gtk_tree_view_size_allocate_columns (GtkWidget *widget)
{
GtkTreeView *tree_view;
GList *list, *first_column, *last_column;
GtkTreeViewColumn *column;
GtkAllocation allocation;
gint width = 0;
gint extra, extra_per_column;
gint full_requested_width = 0;
gint number_of_expand_columns = 0;
gboolean rtl;
tree_view = GTK_TREE_VIEW (widget);
for (last_column = g_list_last (tree_view->priv->columns);
last_column && !(GTK_TREE_VIEW_COLUMN (last_column->data)->visible);
last_column = last_column->prev)
;
if (last_column == NULL)
return;
for (first_column = g_list_first (tree_view->priv->columns);
first_column && !(GTK_TREE_VIEW_COLUMN (first_column->data)->visible);
first_column = first_column->next)
;
allocation.y = 0;
allocation.height = tree_view->priv->header_height;
rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
/* find out how many extra space and expandable columns we have */
for (list = tree_view->priv->columns; list != last_column->next; list = list->next)
{
column = (GtkTreeViewColumn *)list->data;
if (!column->visible)
continue;
full_requested_width += gtk_tree_view_get_real_requested_width_from_column (tree_view, column);
if (column->expand)
number_of_expand_columns++;
}
extra = MAX (widget->allocation.width - full_requested_width, 0);
if (number_of_expand_columns > 0)
extra_per_column = extra/number_of_expand_columns;
else
extra_per_column = 0;
for (list = (rtl ? last_column : first_column);
list != (rtl ? first_column->prev : last_column->next);
list = (rtl ? list->prev : list->next))
{
gint real_requested_width = 0;
gint old_width;
column = list->data;
old_width = column->width;
if (!column->visible)
continue;
/* We need to handle the dragged button specially.
*/
if (column == tree_view->priv->drag_column)
{
GtkAllocation drag_allocation;
gdk_drawable_get_size (tree_view->priv->drag_window,
&(drag_allocation.width),
&(drag_allocation.height));
drag_allocation.x = 0;
drag_allocation.y = 0;
gtk_widget_size_allocate (tree_view->priv->drag_column->button,
&drag_allocation);
width += drag_allocation.width;
continue;
}
real_requested_width = gtk_tree_view_get_real_requested_width_from_column (tree_view, column);
allocation.x = width;
column->width = real_requested_width;
if (column->expand)
{
if (number_of_expand_columns == 1)
{
/* We add the remander to the last column as
* */
column->width += extra;
}
else
{
column->width += extra_per_column;
extra -= extra_per_column;
number_of_expand_columns --;
}
}
else if (number_of_expand_columns == 0 &&
list == last_column)
{
column->width += extra;
}
g_object_notify (G_OBJECT (column), "width");
allocation.width = column->width;
width += column->width;
if (column->width > old_width)
invalidate_column (tree_view, column);
gtk_widget_size_allocate (column->button, &allocation);
if (column->window)
Port to GObject, can go back in gdk-pixbuf after setting up a 2000-12-16 Havoc Pennington <hp@pobox.com> * gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c: Port to GObject, can go back in gdk-pixbuf after setting up a gdk-pixbuf-marshal.h header over there. * gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g; (gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal args (gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be set (gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons here, do it when we create the buttons later (gtk_tree_view_realize_buttons): add some g_return_if_fail (gtk_tree_view_map): paranoia checks that column->button is shown and unmapped (gtk_tree_view_size_request): only request visible children. Move header size calculation in here, for cleanliness, and to maintain invariants for child widgets if we eventually let users set different children inside the buttons (gtk_tree_view_map_buttons): factor out code to map buttons, since it was being called several times (gtk_tree_view_size_allocate_buttons): move_resize the drag windows instead of just moving them; their height may change if we allow random widgets in there, or the theme changes. (gtk_tree_view_size_allocate): move button size allocation above emitting the scroll signals, to ensure a sane state when we hit user code (gtk_tree_view_button_release): remove queue_resize after tree_view_set_size(), set_size() will handle any resize queuing that's needed (gtk_tree_view_focus_in): just queue a draw, don't fool with draw_focus goo (gtk_tree_view_focus): use gtk_get_current_event() and gdk_event_get_state() (gtk_tree_view_deleted): don't queue_resize() after calling set_size() (gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove semicolon (gtk_tree_view_create_button): show the button here (gtk_tree_view_button_clicked): actually emit the clicked signal on the column (_gtk_tree_view_set_size): return right away if the size is unchanged, as a cheesy optimization (gtk_tree_view_setup_model): rename set_model_realized to setup_model to match the flag that indicates whether we've called it (gtk_tree_view_get_hadjustment): create adjustment if it doesn't exist, because set_scroll_adjustment does that and it shouldn't matter what order you call these in (gtk_tree_view_get_vadjustment): ditto (gtk_tree_view_set_headers_visible): canonicalize the bool, for paranoia (gtk_tree_view_set_headers_visible): call gtk_tree_view_map_buttons() instead of using cut-and-paste code (gtk_tree_view_append_column): clarify whether the return value is the count of columns before or after, and do the increment separately from the return statement so you can tell from the code. (gtk_tree_view_remove_column): ditto (gtk_tree_view_insert_column): ditto (gtk_tree_view_get_column): remove g_return_if_fail for columns outside the existing range, the docs say that outside-range columns are allowed, so we handle them as documented. (Presumably this allows a nice loop with column != NULL as test.) (gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments mean (left/right/center etc.). (gtk_tree_view_collapse_all): only queue a draw if we're mapped (gtk_tree_view_expand_row): add docs (gtk_tree_view_collapse_row): add docs * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new function to emit the clicked signal on a column * gdk/gdkevents.c (gdk_event_get_state): new function, to get the state of an event (gdk_event_get_time): don't treat GDK_SCROLL as a button event, remove default case from switch so gcc will whine if we don't explicitly handle all event types * gtk/gtktreeselection.h: added some FIXME * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename "columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
gdk_window_move_resize (column->window,
allocation.x + (rtl ? 0 : allocation.width) - TREE_VIEW_DRAG_WIDTH/2,
allocation.y,
Port to GObject, can go back in gdk-pixbuf after setting up a 2000-12-16 Havoc Pennington <hp@pobox.com> * gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c: Port to GObject, can go back in gdk-pixbuf after setting up a gdk-pixbuf-marshal.h header over there. * gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g; (gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal args (gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be set (gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons here, do it when we create the buttons later (gtk_tree_view_realize_buttons): add some g_return_if_fail (gtk_tree_view_map): paranoia checks that column->button is shown and unmapped (gtk_tree_view_size_request): only request visible children. Move header size calculation in here, for cleanliness, and to maintain invariants for child widgets if we eventually let users set different children inside the buttons (gtk_tree_view_map_buttons): factor out code to map buttons, since it was being called several times (gtk_tree_view_size_allocate_buttons): move_resize the drag windows instead of just moving them; their height may change if we allow random widgets in there, or the theme changes. (gtk_tree_view_size_allocate): move button size allocation above emitting the scroll signals, to ensure a sane state when we hit user code (gtk_tree_view_button_release): remove queue_resize after tree_view_set_size(), set_size() will handle any resize queuing that's needed (gtk_tree_view_focus_in): just queue a draw, don't fool with draw_focus goo (gtk_tree_view_focus): use gtk_get_current_event() and gdk_event_get_state() (gtk_tree_view_deleted): don't queue_resize() after calling set_size() (gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove semicolon (gtk_tree_view_create_button): show the button here (gtk_tree_view_button_clicked): actually emit the clicked signal on the column (_gtk_tree_view_set_size): return right away if the size is unchanged, as a cheesy optimization (gtk_tree_view_setup_model): rename set_model_realized to setup_model to match the flag that indicates whether we've called it (gtk_tree_view_get_hadjustment): create adjustment if it doesn't exist, because set_scroll_adjustment does that and it shouldn't matter what order you call these in (gtk_tree_view_get_vadjustment): ditto (gtk_tree_view_set_headers_visible): canonicalize the bool, for paranoia (gtk_tree_view_set_headers_visible): call gtk_tree_view_map_buttons() instead of using cut-and-paste code (gtk_tree_view_append_column): clarify whether the return value is the count of columns before or after, and do the increment separately from the return statement so you can tell from the code. (gtk_tree_view_remove_column): ditto (gtk_tree_view_insert_column): ditto (gtk_tree_view_get_column): remove g_return_if_fail for columns outside the existing range, the docs say that outside-range columns are allowed, so we handle them as documented. (Presumably this allows a nice loop with column != NULL as test.) (gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments mean (left/right/center etc.). (gtk_tree_view_collapse_all): only queue a draw if we're mapped (gtk_tree_view_expand_row): add docs (gtk_tree_view_collapse_row): add docs * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new function to emit the clicked signal on a column * gdk/gdkevents.c (gdk_event_get_state): new function, to get the state of an event (gdk_event_get_time): don't treat GDK_SCROLL as a button event, remove default case from switch so gcc will whine if we don't explicitly handle all event types * gtk/gtktreeselection.h: added some FIXME * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename "columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
TREE_VIEW_DRAG_WIDTH, allocation.height);
}
}
static void
gtk_tree_view_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GList *tmp_list;
GtkTreeView *tree_view;
gboolean width_changed = FALSE;
gboolean dy_changed = FALSE;
gint old_width = widget->allocation.width;
g_return_if_fail (GTK_IS_TREE_VIEW (widget));
if (allocation->width != widget->allocation.width)
width_changed = TRUE;
widget->allocation = *allocation;
tree_view = GTK_TREE_VIEW (widget);
tmp_list = tree_view->priv->children;
while (tmp_list)
{
GtkAllocation allocation;
GtkTreeViewChild *child = tmp_list->data;
tmp_list = tmp_list->next;
/* totally ignore our child's requisition */
allocation.x = child->x;
allocation.y = child->y;
allocation.width = child->width;
allocation.height = child->height;
gtk_widget_size_allocate (child->widget, &allocation);
}
tree_view->priv->hadjustment->page_size = allocation->width;
tree_view->priv->hadjustment->page_increment = allocation->width * 0.9;
tree_view->priv->hadjustment->step_increment = allocation->width * 0.1;
tree_view->priv->hadjustment->lower = 0;
tree_view->priv->hadjustment->upper = MAX (tree_view->priv->hadjustment->page_size, tree_view->priv->width);
remove validation idle 2001-02-08 Havoc Pennington <hp@redhat.com> * gtk/gtktextview.c (gtk_text_view_destroy_layout): remove validation idle * demos/gtk-demo/main.c (create_tree): adjust to changes in text cell renderer * demos/pixbuf-demo.c (timeout): remove deprecated gtk_widget_draw * demos/testpixbuf-save.c (main): remove deprecated gtk_drawing_area_size * gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate buttons even if the model isn't setup. gtk_tree_view_check_dirty() at the start of the allocation. (gtk_tree_view_check_dirty): handle column->button == NULL, handle unsetup or NULL model. * gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the even/odd/sorted cells in the tree view. * gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all): bugfixes * gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row backgrounds with draw_flat_box using different detail for even/odd rows. * gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each row, so we can draw the alternating colors thing * gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a property from a synonym property, notify for the synonym. Also, nuke the background_gdk_set and foreground_gdk_set synonyms (gtk_text_tag_get_property): Always return the font, even if all its fields aren't set * gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't store the attr list; it leaves us with no way to change attributes in _render according to the render flags, and no way to implement get_property. Instead store all the specific text attributes. Separate whether an attribute is enabled from its value. Sync all properties with GtkTextTag, make them all consistent, etc. * gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so renderers can highlight the sort row/column * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use accessor functions to get values; this has the side effect of showing up which accessor functions were missing. Added those. * gtk/gtktreeviewcolumn.h: Replace set_justification with set_alignment, to be consistent with GtkLabel, GtkMisc * gtk/gtktreeviewcolumn.c: Added code to display sort indicator arrow. * gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h * gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
if (gtk_widget_get_direction(widget) == GTK_TEXT_DIR_RTL)
{
if (allocation->width < tree_view->priv->width)
{
if (tree_view->priv->init_hadjust_value)
{
tree_view->priv->hadjustment->value = MAX (tree_view->priv->width - allocation->width, 0);
tree_view->priv->init_hadjust_value = FALSE;
}
else if(allocation->width != old_width)
tree_view->priv->hadjustment->value = CLAMP(tree_view->priv->hadjustment->value - allocation->width + old_width, 0, tree_view->priv->width - allocation->width);
else
tree_view->priv->hadjustment->value = CLAMP(tree_view->priv->width - (tree_view->priv->prev_width - tree_view->priv->hadjustment->value), 0, tree_view->priv->width - allocation->width);
}
else
{
tree_view->priv->hadjustment->value = 0;
tree_view->priv->init_hadjust_value = TRUE;
}
}
else
if (tree_view->priv->hadjustment->value + allocation->width > tree_view->priv->width)
tree_view->priv->hadjustment->value = MAX (tree_view->priv->width - allocation->width, 0);
gtk_adjustment_changed (tree_view->priv->hadjustment);
tree_view->priv->vadjustment->page_size = allocation->height - TREE_VIEW_HEADER_HEIGHT (tree_view);
tree_view->priv->vadjustment->step_increment = tree_view->priv->vadjustment->page_size * 0.1;
tree_view->priv->vadjustment->page_increment = tree_view->priv->vadjustment->page_size * 0.9;
tree_view->priv->vadjustment->lower = 0;
tree_view->priv->vadjustment->upper = MAX (tree_view->priv->vadjustment->page_size, tree_view->priv->height);
remove validation idle 2001-02-08 Havoc Pennington <hp@redhat.com> * gtk/gtktextview.c (gtk_text_view_destroy_layout): remove validation idle * demos/gtk-demo/main.c (create_tree): adjust to changes in text cell renderer * demos/pixbuf-demo.c (timeout): remove deprecated gtk_widget_draw * demos/testpixbuf-save.c (main): remove deprecated gtk_drawing_area_size * gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate buttons even if the model isn't setup. gtk_tree_view_check_dirty() at the start of the allocation. (gtk_tree_view_check_dirty): handle column->button == NULL, handle unsetup or NULL model. * gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the even/odd/sorted cells in the tree view. * gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all): bugfixes * gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row backgrounds with draw_flat_box using different detail for even/odd rows. * gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each row, so we can draw the alternating colors thing * gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a property from a synonym property, notify for the synonym. Also, nuke the background_gdk_set and foreground_gdk_set synonyms (gtk_text_tag_get_property): Always return the font, even if all its fields aren't set * gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't store the attr list; it leaves us with no way to change attributes in _render according to the render flags, and no way to implement get_property. Instead store all the specific text attributes. Separate whether an attribute is enabled from its value. Sync all properties with GtkTextTag, make them all consistent, etc. * gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so renderers can highlight the sort row/column * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use accessor functions to get values; this has the side effect of showing up which accessor functions were missing. Added those. * gtk/gtktreeviewcolumn.h: Replace set_justification with set_alignment, to be consistent with GtkLabel, GtkMisc * gtk/gtktreeviewcolumn.c: Added code to display sort indicator arrow. * gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h * gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
if (tree_view->priv->vadjustment->value + allocation->height - TREE_VIEW_HEADER_HEIGHT (tree_view) > tree_view->priv->height)
{
double before = tree_view->priv->vadjustment->value;
gtk_adjustment_set_value (tree_view->priv->vadjustment,
MAX (tree_view->priv->height - tree_view->priv->vadjustment->page_size, 0));
if (before != tree_view->priv->vadjustment->value)
dy_changed = TRUE;
}
gtk_adjustment_changed (tree_view->priv->vadjustment);
if (GTK_WIDGET_REALIZED (widget))
{
gdk_window_move_resize (widget->window,
allocation->x, allocation->y,
allocation->width, allocation->height);
gdk_window_move_resize (tree_view->priv->header_window,
- (gint) tree_view->priv->hadjustment->value,
0,
MAX (tree_view->priv->width, allocation->width),
tree_view->priv->header_height);
gdk_window_move_resize (tree_view->priv->bin_window,
- (gint) tree_view->priv->hadjustment->value,
TREE_VIEW_HEADER_HEIGHT (tree_view),
MAX (tree_view->priv->width, allocation->width),
allocation->height - TREE_VIEW_HEADER_HEIGHT (tree_view));
}
gtk_tree_view_size_allocate_columns (widget);
if (GTK_WIDGET_REALIZED (widget))
{
gboolean has_expand_column = FALSE;
for (tmp_list = tree_view->priv->columns; tmp_list; tmp_list = tmp_list->next)
{
if (gtk_tree_view_column_get_expand (GTK_TREE_VIEW_COLUMN (tmp_list->data)))
{
has_expand_column = TRUE;
break;
}
}
/* This little hack only works if we have an LTR locale, and no column has the */
if (width_changed)
{
if (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_LTR &&
! has_expand_column)
invalidate_last_column (tree_view);
else
gtk_widget_queue_draw (widget);
}
if (dy_changed)
gtk_widget_queue_draw (widget);
}
}
/* Grabs the focus and unsets the GTK_TREE_VIEW_DRAW_KEYFOCUS flag */
static void
grab_focus_and_unset_draw_keyfocus (GtkTreeView *tree_view)
{
if (!GTK_WIDGET_HAS_FOCUS (tree_view))
gtk_widget_grab_focus (GTK_WIDGET (tree_view));
GTK_TREE_VIEW_UNSET_FLAG (tree_view, GTK_TREE_VIEW_DRAW_KEYFOCUS);
}
static gboolean
gtk_tree_view_button_press (GtkWidget *widget,
GdkEventButton *event)
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
{
GtkTreeView *tree_view;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
GList *list;
GtkTreeViewColumn *column = NULL;
gint i;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
GdkRectangle background_area;
GdkRectangle cell_area;
gint vertical_separator;
gint horizontal_separator;
gboolean rtl;
g_return_val_if_fail (GTK_IS_TREE_VIEW (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
tree_view = GTK_TREE_VIEW (widget);
rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
gtk_tree_view_stop_editing (tree_view, FALSE);
gtk_widget_style_get (widget,
"vertical_separator", &vertical_separator,
"horizontal_separator", &horizontal_separator,
NULL);
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
/* Because grab_focus can cause reentrancy, we delay grab_focus until after
* we're done handling the button press.
*/
if (event->window == tree_view->priv->bin_window)
{
GtkRBNode *node;
GtkRBTree *tree;
GtkTreePath *path;
gchar *path_string;
gint depth;
gint new_y;
gint y_offset;
gint dval;
gint pre_val, aft_val;
GtkTreeViewColumn *column = NULL;
The "big treeview focus patch". Fixes several issues and adds some Sun May 5 16:42:32 2002 Kristian Rietveld <kris@gtk.org> The "big treeview focus patch". Fixes several issues and adds some goodies. Related bugs: #73676, #73734, #78660. * gtk/gtktreeview.h: add gtk_tree_view_set_cursor_on_cell * gtk/gtktreeview.c (gtk_tree_view_button_press): focus on a cell if applicable, (gtk_tree_view_bin_expose): set_cell_data before iterating columns, add support for row-spanning focus rectangles, (gtk_tree_view_has_special_cell): new function, (gtk_tree_view_move_cursor_left_right): add support for multiple focusable cells in one column, (gtk_tree_view_set_cursor): call _set_cursor_on_cell now, (gtk_tree_view_set_cursor_on_cell): copy of _set_cursor, extended with focus_cell parameter, (gtk_tree_view_search_iter): removed unused column variable, (gtk_tree_view_start_editing): add neighbor size code to allow for multiple editable cells in one column. * gtk/gtktreeviewcolumn.c (_GtkTreeViewColumnCellInfo): add in_editing_mode field, (gtk_tree_view_column_get_edited_cell): new function, removed _get_editable_cell, (_gtk_tree_view_column_get_cell_at_pos): new function, (gtk_tree_view_column_pack_end): s/g_new/g_new0/ ..., (gtk_tree_view_column_cell_process_action): loads of changes to get it right and to allow for multiple special cells, etc, (gtk_tree_view_column_cell_first): new function, (gtk_tree_view_column_cell_last): ditto, (gtk_tree_view_column_cell_next): ditto, (gtk_tree_view_column_cell_prev): ditto, (gtk_tree_view_column_cell_focus): add left and right parameters, allow for multiple special cells, (gtk_tree_view_column_cell_is_visible): add assertion, (gtk_tree_view_column_focus_cell): new function, (gtk_tree_view_column_stop_editing): unset in_editing_mode flag, (_gtk_tree_view_column_get_neighbor_sizes): iterate through cells correctly * gtk/gtktreeviewcolumn.h: add gtk_tree_view_column_focus_cell * gtk/gtktreeprivate.h: s/_get_editable_cell/_get_edited_cell/, add _gtk_tree_view_column_get_cell_at_pos, add new parameters to _gtk_tree_view_column_cell_focus. * tests/testtreeedit.c: add some cells in order to test new code.
2002-05-05 14:54:00 +00:00
GtkCellRenderer *focus_cell = NULL;
gint column_handled_click = FALSE;
gboolean row_double_click = FALSE;
gboolean rtl;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
/* Empty tree? */
if (tree_view->priv->tree == NULL)
{
grab_focus_and_unset_draw_keyfocus (tree_view);
return TRUE;
}
/* are we in an arrow? */
if (tree_view->priv->prelight_node &&
GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_ARROW_PRELIT))
{
if (event->button == 1)
{
gtk_grab_add (widget);
tree_view->priv->button_pressed_node = tree_view->priv->prelight_node;
tree_view->priv->button_pressed_tree = tree_view->priv->prelight_tree;
gtk_tree_view_draw_arrow (GTK_TREE_VIEW (widget),
tree_view->priv->prelight_tree,
tree_view->priv->prelight_node,
event->x,
event->y);
}
grab_focus_and_unset_draw_keyfocus (tree_view);
return TRUE;
}
/* find the node that was clicked */
new_y = TREE_WINDOW_Y_TO_RBTREE_Y(tree_view, event->y);
if (new_y < 0)
new_y = 0;
y_offset = -_gtk_rbtree_find_offset (tree_view->priv->tree, new_y, &tree, &node);
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
if (node == NULL)
{
/* We clicked in dead space */
grab_focus_and_unset_draw_keyfocus (tree_view);
return TRUE;
}
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
/* Get the path and the node */
path = _gtk_tree_view_find_path (tree_view, tree, node);
depth = gtk_tree_path_get_depth (path);
background_area.y = y_offset + event->y;
background_area.height = ROW_HEIGHT (tree_view, GTK_RBNODE_GET_HEIGHT (node));
background_area.x = 0;
/* Let the column have a chance at selecting it. */
rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
for (list = (rtl ? g_list_last (tree_view->priv->columns) : g_list_first (tree_view->priv->columns));
list; list = (rtl ? list->prev : list->next))
{
column = list->data;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
if (!column->visible)
continue;
background_area.width = column->width;
if ((background_area.x > (gint) event->x) ||
(background_area.x + background_area.width <= (gint) event->x))
{
background_area.x += background_area.width;
continue;
}
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
/* we found the focus column */
cell_area = background_area;
cell_area.width -= horizontal_separator;
cell_area.height -= vertical_separator;
cell_area.x += horizontal_separator/2;
cell_area.y += vertical_separator/2;
if (gtk_tree_view_is_expander_column (tree_view, column) &&
TREE_VIEW_DRAW_EXPANDERS(tree_view))
{
cell_area.x += depth * tree_view->priv->expander_size;
cell_area.width -= depth * tree_view->priv->expander_size;
}
break;
}
if (column == NULL)
API additions: _move, _reorder and _swap for stores, path constructor. Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org> API additions: _move, _reorder and _swap for stores, path constructor. * gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function. * gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private), gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move. * gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private), gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move. Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org> Merge from stable: * gtk/gtktreestore.c (node_free): return FALSE, (gtk_tree_store_finalize): use g_node_traverse instead of g_node_children_foreach, so the whole tree will be freed (#88854, patch from Emmanuel Briot). Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org> Merge from stable: * gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks, (#84426, patch from Matthias Clasen). Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org> Merge from stable: * gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children check shouldn't be in g_return_return_val_if_fail (pointed out by Josh Green, #88997), (gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model for each column when we unset the model (part of #82484), (gtk_tree_view_get_cell_area): return if we ran out of tree or if we got an invalid path (#82376). * gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model. * gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model which disconnects the sort_column_changed_signal (part of #82484). * gtk/gtkliststore.c (gtk_list_store_insert): append row if the given postion is off the end of the tree (#85813). * gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use 2-space indent, commit changes if up/down keys has been pressed, this overrides the focus key foo so the user won't be surprised (#84665).
2002-07-26 20:51:13 +00:00
{
gtk_tree_path_free (path);
grab_focus_and_unset_draw_keyfocus (tree_view);
API additions: _move, _reorder and _swap for stores, path constructor. Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org> API additions: _move, _reorder and _swap for stores, path constructor. * gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function. * gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private), gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move. * gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private), gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move. Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org> Merge from stable: * gtk/gtktreestore.c (node_free): return FALSE, (gtk_tree_store_finalize): use g_node_traverse instead of g_node_children_foreach, so the whole tree will be freed (#88854, patch from Emmanuel Briot). Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org> Merge from stable: * gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks, (#84426, patch from Matthias Clasen). Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org> Merge from stable: * gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children check shouldn't be in g_return_return_val_if_fail (pointed out by Josh Green, #88997), (gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model for each column when we unset the model (part of #82484), (gtk_tree_view_get_cell_area): return if we ran out of tree or if we got an invalid path (#82376). * gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model. * gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model which disconnects the sort_column_changed_signal (part of #82484). * gtk/gtkliststore.c (gtk_list_store_insert): append row if the given postion is off the end of the tree (#85813). * gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use 2-space indent, commit changes if up/down keys has been pressed, this overrides the focus key foo so the user won't be surprised (#84665).
2002-07-26 20:51:13 +00:00
return FALSE;
}
tree_view->priv->focus_column = column;
/* decide if we edit */
if (event->type == GDK_BUTTON_PRESS && event->button == 1 &&
!(event->state & gtk_accelerator_get_default_mod_mask ()))
{
GtkTreePath *anchor;
GtkTreeIter iter;
if (tree_view->priv->anchor)
{
anchor = gtk_tree_row_reference_get_path (tree_view->priv->anchor);
gtk_tree_model_get_iter (tree_view->priv->model, &iter, path);
gtk_tree_view_column_cell_set_cell_data (column,
tree_view->priv->model,
&iter,
GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_PARENT),
node->children?TRUE:FALSE);
}
else
anchor = NULL;
if ((anchor && !gtk_tree_path_compare (anchor, path))
|| !_gtk_tree_view_column_has_editable_cell (column))
{
GtkCellEditable *cell_editable = NULL;
/* FIXME: get the right flags */
guint flags = 0;
path_string = gtk_tree_path_to_string (path);
if (_gtk_tree_view_column_cell_event (column,
&cell_editable,
(GdkEvent *)event,
path_string,
&background_area,
&cell_area, flags))
{
if (cell_editable != NULL)
{
gint left, right;
GdkRectangle area;
area = cell_area;
The "big treeview focus patch". Fixes several issues and adds some Sun May 5 16:42:32 2002 Kristian Rietveld <kris@gtk.org> The "big treeview focus patch". Fixes several issues and adds some goodies. Related bugs: #73676, #73734, #78660. * gtk/gtktreeview.h: add gtk_tree_view_set_cursor_on_cell * gtk/gtktreeview.c (gtk_tree_view_button_press): focus on a cell if applicable, (gtk_tree_view_bin_expose): set_cell_data before iterating columns, add support for row-spanning focus rectangles, (gtk_tree_view_has_special_cell): new function, (gtk_tree_view_move_cursor_left_right): add support for multiple focusable cells in one column, (gtk_tree_view_set_cursor): call _set_cursor_on_cell now, (gtk_tree_view_set_cursor_on_cell): copy of _set_cursor, extended with focus_cell parameter, (gtk_tree_view_search_iter): removed unused column variable, (gtk_tree_view_start_editing): add neighbor size code to allow for multiple editable cells in one column. * gtk/gtktreeviewcolumn.c (_GtkTreeViewColumnCellInfo): add in_editing_mode field, (gtk_tree_view_column_get_edited_cell): new function, removed _get_editable_cell, (_gtk_tree_view_column_get_cell_at_pos): new function, (gtk_tree_view_column_pack_end): s/g_new/g_new0/ ..., (gtk_tree_view_column_cell_process_action): loads of changes to get it right and to allow for multiple special cells, etc, (gtk_tree_view_column_cell_first): new function, (gtk_tree_view_column_cell_last): ditto, (gtk_tree_view_column_cell_next): ditto, (gtk_tree_view_column_cell_prev): ditto, (gtk_tree_view_column_cell_focus): add left and right parameters, allow for multiple special cells, (gtk_tree_view_column_cell_is_visible): add assertion, (gtk_tree_view_column_focus_cell): new function, (gtk_tree_view_column_stop_editing): unset in_editing_mode flag, (_gtk_tree_view_column_get_neighbor_sizes): iterate through cells correctly * gtk/gtktreeviewcolumn.h: add gtk_tree_view_column_focus_cell * gtk/gtktreeprivate.h: s/_get_editable_cell/_get_edited_cell/, add _gtk_tree_view_column_get_cell_at_pos, add new parameters to _gtk_tree_view_column_cell_focus. * tests/testtreeedit.c: add some cells in order to test new code.
2002-05-05 14:54:00 +00:00
_gtk_tree_view_column_get_neighbor_sizes (column, _gtk_tree_view_column_get_edited_cell (column), &left, &right);
area.x += left;
area.width -= right + left;
gtk_tree_view_real_start_editing (tree_view,
column,
path,
cell_editable,
&area,
(GdkEvent *)event,
flags);
API additions: _move, _reorder and _swap for stores, path constructor. Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org> API additions: _move, _reorder and _swap for stores, path constructor. * gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function. * gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private), gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move. * gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private), gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move. Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org> Merge from stable: * gtk/gtktreestore.c (node_free): return FALSE, (gtk_tree_store_finalize): use g_node_traverse instead of g_node_children_foreach, so the whole tree will be freed (#88854, patch from Emmanuel Briot). Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org> Merge from stable: * gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks, (#84426, patch from Matthias Clasen). Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org> Merge from stable: * gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children check shouldn't be in g_return_return_val_if_fail (pointed out by Josh Green, #88997), (gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model for each column when we unset the model (part of #82484), (gtk_tree_view_get_cell_area): return if we ran out of tree or if we got an invalid path (#82376). * gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model. * gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model which disconnects the sort_column_changed_signal (part of #82484). * gtk/gtkliststore.c (gtk_list_store_insert): append row if the given postion is off the end of the tree (#85813). * gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use 2-space indent, commit changes if up/down keys has been pressed, this overrides the focus key foo so the user won't be surprised (#84665).
2002-07-26 20:51:13 +00:00
g_free (path_string);
gtk_tree_path_free (path);
gtk_tree_path_free (anchor);
return TRUE;
}
column_handled_click = TRUE;
}
g_free (path_string);
}
if (anchor)
gtk_tree_path_free (anchor);
}
/* select */
pre_val = tree_view->priv->vadjustment->value;
/* we only handle selection modifications on the first button press
*/
if (event->type == GDK_BUTTON_PRESS)
{
if ((event->state & GDK_CONTROL_MASK) == GDK_CONTROL_MASK)
tree_view->priv->ctrl_pressed = TRUE;
if ((event->state & GDK_SHIFT_MASK) == GDK_SHIFT_MASK)
tree_view->priv->shift_pressed = TRUE;
focus_cell = _gtk_tree_view_column_get_cell_at_pos (column, event->x - background_area.x);
if (focus_cell)
gtk_tree_view_column_focus_cell (column, focus_cell);
if (event->state & GDK_CONTROL_MASK)
{
gtk_tree_view_real_set_cursor (tree_view, path, FALSE, TRUE);
gtk_tree_view_real_toggle_cursor_row (tree_view);
}
else if (event->state & GDK_SHIFT_MASK)
{
gtk_tree_view_real_set_cursor (tree_view, path, FALSE, TRUE);
gtk_tree_view_real_select_cursor_row (tree_view, FALSE);
}
else
{
gtk_tree_view_real_set_cursor (tree_view, path, TRUE, TRUE);
}
tree_view->priv->ctrl_pressed = FALSE;
tree_view->priv->shift_pressed = FALSE;
}
/* the treeview may have been scrolled because of _set_cursor,
* correct here
*/
aft_val = tree_view->priv->vadjustment->value;
dval = pre_val - aft_val;
cell_area.y += dval;
background_area.y += dval;
/* Save press to possibly begin a drag
*/
if (!column_handled_click &&
tree_view->priv->pressed_button < 0)
{
tree_view->priv->pressed_button = event->button;
tree_view->priv->press_start_x = event->x;
tree_view->priv->press_start_y = event->y;
}
/* Test if a double click happened on the same row. */
if (event->button == 1)
{
/* We also handle triple clicks here, because a user could have done
* a first click and a second double click on different rows.
*/
if ((event->type == GDK_2BUTTON_PRESS
|| event->type == GDK_3BUTTON_PRESS)
&& tree_view->priv->last_button_press)
{
GtkTreePath *lsc;
lsc = gtk_tree_row_reference_get_path (tree_view->priv->last_button_press);
if (lsc)
{
row_double_click = !gtk_tree_path_compare (lsc, path);
gtk_tree_path_free (lsc);
}
}
if (row_double_click)
{
if (tree_view->priv->last_button_press)
gtk_tree_row_reference_free (tree_view->priv->last_button_press);
if (tree_view->priv->last_button_press_2)
gtk_tree_row_reference_free (tree_view->priv->last_button_press_2);
tree_view->priv->last_button_press = NULL;
tree_view->priv->last_button_press_2 = NULL;
}
else
{
if (tree_view->priv->last_button_press)
gtk_tree_row_reference_free (tree_view->priv->last_button_press);
tree_view->priv->last_button_press = tree_view->priv->last_button_press_2;
tree_view->priv->last_button_press_2 = gtk_tree_row_reference_new_proxy (G_OBJECT (tree_view), tree_view->priv->model, path);
}
}
if (row_double_click)
{
gtk_grab_remove (widget);
gtk_tree_view_row_activated (tree_view, path, column);
if (tree_view->priv->pressed_button == event->button)
tree_view->priv->pressed_button = -1;
}
gtk_tree_path_free (path);
/* If we activated the row through a double click we don't want to grab
* focus back, as moving focus to another widget is pretty common.
*/
if (!row_double_click)
grab_focus_and_unset_draw_keyfocus (tree_view);
return TRUE;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
}
/* We didn't click in the window. Let's check to see if we clicked on a column resize window.
*/
for (i = 0, list = tree_view->priv->columns; list; list = list->next, i++)
{
column = list->data;
if (event->window == column->window &&
column->resizable &&
column->window)
{
gpointer drag_data;
if (event->type == GDK_2BUTTON_PRESS &&
gtk_tree_view_column_get_sizing (column) != GTK_TREE_VIEW_COLUMN_AUTOSIZE)
{
_gtk_tree_view_column_autosize (tree_view, column);
return TRUE;
}
if (gdk_pointer_grab (column->window, FALSE,
GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON1_MOTION_MASK |
GDK_BUTTON_RELEASE_MASK,
NULL, NULL, event->time))
return FALSE;
gtk_grab_add (widget);
GTK_TREE_VIEW_SET_FLAG (tree_view, GTK_TREE_VIEW_IN_COLUMN_RESIZE);
column->resized_width = column->width;
column->use_resized_width = TRUE;
/* block attached dnd signal handler */
drag_data = g_object_get_data (G_OBJECT (widget), "gtk-site-data");
if (drag_data)
g_signal_handlers_block_matched (widget,
G_SIGNAL_MATCH_DATA,
0, 0, NULL, NULL,
drag_data);
tree_view->priv->drag_pos = i;
tree_view->priv->x_drag = column->button->allocation.x + (rtl ? 0 : column->button->allocation.width);
if (!GTK_WIDGET_HAS_FOCUS (widget))
gtk_widget_grab_focus (widget);
return TRUE;
}
}
return FALSE;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
}
/* GtkWidget::button_release_event helper */
static gboolean
gtk_tree_view_button_release_drag_column (GtkWidget *widget,
GdkEventButton *event)
{
GtkTreeView *tree_view;
gboolean rtl;
tree_view = GTK_TREE_VIEW (widget);
rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
Integrate Erwann Chenede's multihead changes for the gtk/ directory. Mon Apr 29 18:28:00 2002 Owen Taylor <otaylor@redhat.com> Integrate Erwann Chenede's multihead changes for the gtk/ directory. * gtk/gtkclipboard.[ch]: Add gtk_clipboard_get_for_display(), make internals multihead aware. * gtk/gtkcolorsel.[ch]: Add gtk_color_selection_set_change_palette_with_screen_hook () [ugh!] make up for non-multihead safety of gtk_color_selection_set_change_palette_hook() * gtk/gtkinvisible.[ch] gtk/gtkmenu.[ch] gtkwindow.[ch]: Add gtk_{invisible,menu,window}_set_screen(); add "screen" properties for GtkWindow and GtkMenu. * gtk/gtkplug.[ch]: Add gtk_plug_construct_for_display(), gtk_plug_new_for_display(). Multihead fixes. * gtk/gtkselection.[ch]: Add gtk_selection_owner_set_for_display(), make internals multihead aware. * gtk/gtksettings.[ch]: Add gtk_settings_get_for_screen(), get rid of now-useless gtk_settings_constructor(). * gtk/gtkstyle.[ch]: Add gtk_style_get_font_for_display(), fix check/radio button indicators bitmap handling to be multihead safe. * gtk/gtkwidget.[ch]: Add gtk_widget_get_screen(), gtk_widget_has_screen(), gtk_widget_get_display(), gtk_widget_get_clipboard(), gtk_widget_get_root_window(). * gtk/gtkbindings.c gtk/gtkbutton.c gtk/gtkclist.c gtk/gtkcombo.c gtk/gtkctree.c gtk/gtkdnd.c gtk/gtkfilesel.c gtk/gtkgamma.c gtk/gtkhandlebox.c gtk/gtkhsv.c gtk/gtkimcontext.c gtk/gtklabel.c gtk/gtklist.c gtk/gtkmain.c gtk/gtkmenuitem.c gtk/gtkmenushell.c gtk/gtknotebook.c gtk/gtkoldeditable.c gtk/gtkoptionmenu.c gtk/gtkpaned.c gtk/gtkpreview.c gtk/gtksocket.c gtk/gtktext.c gtk/gtktextbuffer.c gtk/gtktextview.c gtk/gtktipsquery.c gtk/gtktooltips.c gtk/gtktreeview.c gtk/gtktreeviewcolumn.c: misc mechanical multihead-safety fixes. * gtk/gtkclipboard.c: Use a GtkImage rather than a pixmap for the dropper, look up the color palette only at realization time, other multihead fixes. * gtk/gtkcombo.c (gtk_combo_unrealize): Popdown the list when unrealizing. * gtk/gtkentry.c: Only claim ownership of the primary selection when realized, misc multihead fixes. * gtk/gtkfontsel.c: Only fill in fonts when attached to a screen, fix gtk_font_selection_get_font() for multihead. * gtk/gtkgc.c: make the depth => drawable hash per-screen. * gtk/gtkinvisible.c: Add a constructor that realizes the widget, so we get a realized widget with g_object_new() as well gtk_invisible_new() as before. * gtk/gtkmain.c: Get rid of unused gtk_visual/gtk_colormap variables. * gtk/gtktextdisplay.c: Add warnings if stipple bitmaps are used on the wrong screen. * gtk/gtktoolbar.c: Make handling of GtkSettings-based layout read properties and connect to settings when the screen is changed, rather than on init/finalize. * gtk/gtkwindow.c: Fix icon handing to be multihead safe ... default icon pixmaps/mask are only shared between windows on the same screen. Misc multihead fixes. Sat Apr 27 13:49:53 2002 Owen Taylor <otaylor@redhat.com> * gtk/gtkclipboard.c (gtk_clipboard_get_for_display): Update docs to reference GDK_SELECTION_CLIPBOARD rather GDK_NONE. 2002-04-29 Alex Larsson <alexl@redhat.com> * gdk/linux-fb/gdkproperty-fb.c (gdk_property_get): Fix silly bug, noticed by Sven Neumann. Sun Apr 28 22:43:55 2002 Jonathan Blandford <jrb@gnome.org> * gtk/gtktreemodelsort.c (gtk_tree_model_sort_set_sort_func): Fix so that you can set a new sort func.
2002-04-29 22:53:45 +00:00
gdk_display_pointer_ungrab (gtk_widget_get_display (widget), GDK_CURRENT_TIME);
gdk_display_keyboard_ungrab (gtk_widget_get_display (widget), GDK_CURRENT_TIME);
/* Move the button back */
g_object_ref (tree_view->priv->drag_column->button);
gtk_container_remove (GTK_CONTAINER (tree_view), tree_view->priv->drag_column->button);
gtk_widget_set_parent_window (tree_view->priv->drag_column->button, tree_view->priv->header_window);
gtk_widget_set_parent (tree_view->priv->drag_column->button, GTK_WIDGET (tree_view));
g_object_unref (tree_view->priv->drag_column->button);
gtk_widget_queue_resize (widget);
2002-01-28 17:08:54 +00:00
if (tree_view->priv->drag_column->resizable)
{
gdk_window_raise (tree_view->priv->drag_column->window);
gdk_window_show (tree_view->priv->drag_column->window);
}
else
gdk_window_hide (tree_view->priv->drag_column->window);
gtk_widget_grab_focus (tree_view->priv->drag_column->button);
if (rtl)
{
if (tree_view->priv->cur_reorder &&
tree_view->priv->cur_reorder->right_column != tree_view->priv->drag_column)
gtk_tree_view_move_column_after (tree_view, tree_view->priv->drag_column,
tree_view->priv->cur_reorder->right_column);
}
else
{
if (tree_view->priv->cur_reorder &&
tree_view->priv->cur_reorder->left_column != tree_view->priv->drag_column)
gtk_tree_view_move_column_after (tree_view, tree_view->priv->drag_column,
tree_view->priv->cur_reorder->left_column);
}
tree_view->priv->drag_column = NULL;
gdk_window_hide (tree_view->priv->drag_window);
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
g_list_foreach (tree_view->priv->column_drag_info, (GFunc) g_free, NULL);
g_list_free (tree_view->priv->column_drag_info);
tree_view->priv->column_drag_info = NULL;
tree_view->priv->cur_reorder = NULL;
if (tree_view->priv->drag_highlight_window)
gdk_window_hide (tree_view->priv->drag_highlight_window);
/* Reset our flags */
tree_view->priv->drag_column_window_state = DRAG_COLUMN_WINDOW_STATE_UNSET;
GTK_TREE_VIEW_UNSET_FLAG (tree_view, GTK_TREE_VIEW_IN_COLUMN_DRAG);
return TRUE;
}
/* GtkWidget::button_release_event helper */
static gboolean
gtk_tree_view_button_release_column_resize (GtkWidget *widget,
GdkEventButton *event)
{
GtkTreeView *tree_view;
gpointer drag_data;
gint x;
gint i;
tree_view = GTK_TREE_VIEW (widget);
i = tree_view->priv->drag_pos;
tree_view->priv->drag_pos = -1;
/* unblock attached dnd signal handler */
drag_data = g_object_get_data (G_OBJECT (widget), "gtk-site-data");
if (drag_data)
g_signal_handlers_unblock_matched (widget,
G_SIGNAL_MATCH_DATA,
0, 0, NULL, NULL,
drag_data);
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
GTK_TREE_VIEW_UNSET_FLAG (tree_view, GTK_TREE_VIEW_IN_COLUMN_RESIZE);
gtk_widget_get_pointer (widget, &x, NULL);
gtk_grab_remove (widget);
Integrate Erwann Chenede's multihead changes for the gtk/ directory. Mon Apr 29 18:28:00 2002 Owen Taylor <otaylor@redhat.com> Integrate Erwann Chenede's multihead changes for the gtk/ directory. * gtk/gtkclipboard.[ch]: Add gtk_clipboard_get_for_display(), make internals multihead aware. * gtk/gtkcolorsel.[ch]: Add gtk_color_selection_set_change_palette_with_screen_hook () [ugh!] make up for non-multihead safety of gtk_color_selection_set_change_palette_hook() * gtk/gtkinvisible.[ch] gtk/gtkmenu.[ch] gtkwindow.[ch]: Add gtk_{invisible,menu,window}_set_screen(); add "screen" properties for GtkWindow and GtkMenu. * gtk/gtkplug.[ch]: Add gtk_plug_construct_for_display(), gtk_plug_new_for_display(). Multihead fixes. * gtk/gtkselection.[ch]: Add gtk_selection_owner_set_for_display(), make internals multihead aware. * gtk/gtksettings.[ch]: Add gtk_settings_get_for_screen(), get rid of now-useless gtk_settings_constructor(). * gtk/gtkstyle.[ch]: Add gtk_style_get_font_for_display(), fix check/radio button indicators bitmap handling to be multihead safe. * gtk/gtkwidget.[ch]: Add gtk_widget_get_screen(), gtk_widget_has_screen(), gtk_widget_get_display(), gtk_widget_get_clipboard(), gtk_widget_get_root_window(). * gtk/gtkbindings.c gtk/gtkbutton.c gtk/gtkclist.c gtk/gtkcombo.c gtk/gtkctree.c gtk/gtkdnd.c gtk/gtkfilesel.c gtk/gtkgamma.c gtk/gtkhandlebox.c gtk/gtkhsv.c gtk/gtkimcontext.c gtk/gtklabel.c gtk/gtklist.c gtk/gtkmain.c gtk/gtkmenuitem.c gtk/gtkmenushell.c gtk/gtknotebook.c gtk/gtkoldeditable.c gtk/gtkoptionmenu.c gtk/gtkpaned.c gtk/gtkpreview.c gtk/gtksocket.c gtk/gtktext.c gtk/gtktextbuffer.c gtk/gtktextview.c gtk/gtktipsquery.c gtk/gtktooltips.c gtk/gtktreeview.c gtk/gtktreeviewcolumn.c: misc mechanical multihead-safety fixes. * gtk/gtkclipboard.c: Use a GtkImage rather than a pixmap for the dropper, look up the color palette only at realization time, other multihead fixes. * gtk/gtkcombo.c (gtk_combo_unrealize): Popdown the list when unrealizing. * gtk/gtkentry.c: Only claim ownership of the primary selection when realized, misc multihead fixes. * gtk/gtkfontsel.c: Only fill in fonts when attached to a screen, fix gtk_font_selection_get_font() for multihead. * gtk/gtkgc.c: make the depth => drawable hash per-screen. * gtk/gtkinvisible.c: Add a constructor that realizes the widget, so we get a realized widget with g_object_new() as well gtk_invisible_new() as before. * gtk/gtkmain.c: Get rid of unused gtk_visual/gtk_colormap variables. * gtk/gtktextdisplay.c: Add warnings if stipple bitmaps are used on the wrong screen. * gtk/gtktoolbar.c: Make handling of GtkSettings-based layout read properties and connect to settings when the screen is changed, rather than on init/finalize. * gtk/gtkwindow.c: Fix icon handing to be multihead safe ... default icon pixmaps/mask are only shared between windows on the same screen. Misc multihead fixes. Sat Apr 27 13:49:53 2002 Owen Taylor <otaylor@redhat.com> * gtk/gtkclipboard.c (gtk_clipboard_get_for_display): Update docs to reference GDK_SELECTION_CLIPBOARD rather GDK_NONE. 2002-04-29 Alex Larsson <alexl@redhat.com> * gdk/linux-fb/gdkproperty-fb.c (gdk_property_get): Fix silly bug, noticed by Sven Neumann. Sun Apr 28 22:43:55 2002 Jonathan Blandford <jrb@gnome.org> * gtk/gtktreemodelsort.c (gtk_tree_model_sort_set_sort_func): Fix so that you can set a new sort func.
2002-04-29 22:53:45 +00:00
gdk_display_pointer_ungrab (gdk_drawable_get_display (event->window),
event->time);
return TRUE;
}
static gboolean
gtk_tree_view_button_release (GtkWidget *widget,
GdkEventButton *event)
{
GtkTreeView *tree_view;
g_return_val_if_fail (GTK_IS_TREE_VIEW (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
tree_view = GTK_TREE_VIEW (widget);
if (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_IN_COLUMN_DRAG))
return gtk_tree_view_button_release_drag_column (widget, event);
if (tree_view->priv->pressed_button == event->button)
tree_view->priv->pressed_button = -1;
if (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_IN_COLUMN_RESIZE))
return gtk_tree_view_button_release_column_resize (widget, event);
if (tree_view->priv->button_pressed_node == NULL)
return FALSE;
if (event->button == 1)
{
gtk_grab_remove (widget);
if (tree_view->priv->button_pressed_node == tree_view->priv->prelight_node &&
GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_ARROW_PRELIT))
{
GtkTreePath *path = NULL;
path = _gtk_tree_view_find_path (tree_view,
tree_view->priv->button_pressed_tree,
tree_view->priv->button_pressed_node);
/* Actually activate the node */
if (tree_view->priv->button_pressed_node->children == NULL)
gtk_tree_view_real_expand_row (tree_view, path,
tree_view->priv->button_pressed_tree,
tree_view->priv->button_pressed_node,
FALSE, TRUE);
else
gtk_tree_view_real_collapse_row (GTK_TREE_VIEW (widget), path,
tree_view->priv->button_pressed_tree,
tree_view->priv->button_pressed_node, TRUE);
gtk_tree_path_free (path);
}
tree_view->priv->button_pressed_tree = NULL;
tree_view->priv->button_pressed_node = NULL;
}
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
return TRUE;
}
#if 0
static gboolean
gtk_tree_view_configure (GtkWidget *widget,
GdkEventConfigure *event)
{
GtkTreeView *tree_view;
tree_view = GTK_TREE_VIEW (widget);
tree_view->priv->search_dialog_position_func (tree_view, tree_view->priv->search_window);
return FALSE;
}
#endif
/* GtkWidget::motion_event function set.
*/
static gboolean
coords_are_over_arrow (GtkTreeView *tree_view,
GtkRBTree *tree,
GtkRBNode *node,
/* these are in window coords */
gint x,
gint y)
{
GdkRectangle arrow;
gint x2;
if (!GTK_WIDGET_REALIZED (tree_view))
return FALSE;
if ((node->flags & GTK_RBNODE_IS_PARENT) == 0)
return FALSE;
arrow.y = BACKGROUND_FIRST_PIXEL (tree_view, tree, node);
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
arrow.height = ROW_HEIGHT (tree_view, BACKGROUND_HEIGHT (node));
gtk_tree_view_get_arrow_xrange (tree_view, tree, &arrow.x, &x2);
arrow.width = x2 - arrow.x;
remove validation idle 2001-02-08 Havoc Pennington <hp@redhat.com> * gtk/gtktextview.c (gtk_text_view_destroy_layout): remove validation idle * demos/gtk-demo/main.c (create_tree): adjust to changes in text cell renderer * demos/pixbuf-demo.c (timeout): remove deprecated gtk_widget_draw * demos/testpixbuf-save.c (main): remove deprecated gtk_drawing_area_size * gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate buttons even if the model isn't setup. gtk_tree_view_check_dirty() at the start of the allocation. (gtk_tree_view_check_dirty): handle column->button == NULL, handle unsetup or NULL model. * gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the even/odd/sorted cells in the tree view. * gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all): bugfixes * gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row backgrounds with draw_flat_box using different detail for even/odd rows. * gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each row, so we can draw the alternating colors thing * gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a property from a synonym property, notify for the synonym. Also, nuke the background_gdk_set and foreground_gdk_set synonyms (gtk_text_tag_get_property): Always return the font, even if all its fields aren't set * gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't store the attr list; it leaves us with no way to change attributes in _render according to the render flags, and no way to implement get_property. Instead store all the specific text attributes. Separate whether an attribute is enabled from its value. Sync all properties with GtkTextTag, make them all consistent, etc. * gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so renderers can highlight the sort row/column * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use accessor functions to get values; this has the side effect of showing up which accessor functions were missing. Added those. * gtk/gtktreeviewcolumn.h: Replace set_justification with set_alignment, to be consistent with GtkLabel, GtkMisc * gtk/gtktreeviewcolumn.c: Added code to display sort indicator arrow. * gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h * gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
return (x >= arrow.x &&
Add support for animating expanders. 2001-07-22 Anders Carlsson <andersca@gnome.org> * gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the expander_height and expander_width properties with a single property, expander_size. (gtk_tree_view_init): Set the tab_offset to expander_size plus some padding. (gtk_tree_view_unrealize): Remove the expand/collapse timeout if it exists. (coords_are_over_arrow): Fix a small bug. (gtk_tree_view_motion_draw_column_motion_arrow): Use expander_size. (gtk_tree_view_draw_focus): Use "treeview" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_bin_expose): Use "treeview-drop-indicator" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_deleted): If we have a node currently being expanded or collapsed, remove the timeout and set the node to NULL. (gtk_tree_view_queue_draw_arrow): New function that just redraws the arrow of a node. (gtk_tree_view_draw_arrow): Use expander_size instead of expander_width/expander_height, also pass a different expander_style to gtk_paint_expander depending on the state of the node being drawn. (expand_collapse_timeout): New function for expanding or collapsing a node depending on the previous state. (gtk_tree_view_real_expand_row): Add timeout and set correct state for node being expanded. (gtk_tree_view_real_collapse_row): Add timeout and set correct state for node being collapsed. * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add information about the node currently being expanded or collapsed, and also a timeout id. * gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open with expander_style for draw_expander. * gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with expander_style. (create_expander_affine): New function for creating an expander affine. (apply_affine_on_point): New function for applying an affine to a point. (gtk_default_draw_expander): Modified to take expander_style instead of is_open, and to draw the rectangle rotated differently depending on the expander style. (gtk_paint_expander): Replace is_open with expander_style. * gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor. * gtk/gtkenums.h: Add expander style enum.
2001-07-22 20:09:00 +00:00
x < (arrow.x + arrow.width) &&
y >= arrow.y &&
y < (arrow.y + arrow.height));
}
static gboolean
auto_expand_timeout (gpointer data)
{
GtkTreeView *tree_view = GTK_TREE_VIEW (data);
GtkTreePath *path;
GDK_THREADS_ENTER ();
if (tree_view->priv->prelight_node)
{
path = _gtk_tree_view_find_path (tree_view,
tree_view->priv->prelight_tree,
tree_view->priv->prelight_node);
if (tree_view->priv->prelight_node->children)
gtk_tree_view_collapse_row (tree_view, path);
else
gtk_tree_view_expand_row (tree_view, path, FALSE);
gtk_tree_path_free (path);
}
tree_view->priv->auto_expand_timeout = 0;
GDK_THREADS_LEAVE ();
return FALSE;
}
static void
remove_auto_expand_timeout (GtkTreeView *tree_view)
{
if (tree_view->priv->auto_expand_timeout != 0)
{
g_source_remove (tree_view->priv->auto_expand_timeout);
tree_view->priv->auto_expand_timeout = 0;
}
}
static void
do_prelight (GtkTreeView *tree_view,
GtkRBTree *tree,
GtkRBNode *node,
/* these are in tree_window coords */
gint x,
gint y)
{
if (tree_view->priv->prelight_tree == tree &&
tree_view->priv->prelight_node == node)
{
/* We are still on the same node,
but we might need to take care of the arrow */
if (tree && node)
{
gboolean over_arrow;
gboolean flag_set;
over_arrow = coords_are_over_arrow (tree_view, tree, node, x, y);
flag_set = GTK_TREE_VIEW_FLAG_SET (tree_view,
GTK_TREE_VIEW_ARROW_PRELIT);
if (over_arrow != flag_set)
{
if (over_arrow)
GTK_TREE_VIEW_SET_FLAG (tree_view,
GTK_TREE_VIEW_ARROW_PRELIT);
else
GTK_TREE_VIEW_UNSET_FLAG (tree_view,
GTK_TREE_VIEW_ARROW_PRELIT);
gtk_tree_view_draw_arrow (tree_view, tree, node, x, y);
}
}
return;
}
if (tree_view->priv->prelight_tree && tree_view->priv->prelight_node)
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
{
/* Unprelight the old node and arrow */
GTK_RBNODE_UNSET_FLAG (tree_view->priv->prelight_node,
GTK_RBNODE_IS_PRELIT);
if (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_ARROW_PRELIT))
{
GTK_TREE_VIEW_UNSET_FLAG (tree_view, GTK_TREE_VIEW_ARROW_PRELIT);
gtk_tree_view_draw_arrow (tree_view,
tree_view->priv->prelight_tree,
tree_view->priv->prelight_node,
x,
y);
}
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
_gtk_tree_view_queue_draw_node (tree_view,
tree_view->priv->prelight_tree,
tree_view->priv->prelight_node,
NULL);
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
}
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
if (tree_view->priv->hover_expand)
remove_auto_expand_timeout (tree_view);
/* Set the new prelight values */
tree_view->priv->prelight_node = node;
tree_view->priv->prelight_tree = tree;
if (!node || !tree)
return;
/* Prelight the new node and arrow */
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
if (coords_are_over_arrow (tree_view, tree, node, x, y))
{
GTK_TREE_VIEW_SET_FLAG (tree_view, GTK_TREE_VIEW_ARROW_PRELIT);
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
gtk_tree_view_draw_arrow (tree_view, tree, node, x, y);
}
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
GTK_RBNODE_SET_FLAG (node, GTK_RBNODE_IS_PRELIT);
_gtk_tree_view_queue_draw_node (tree_view, tree, node, NULL);
if (tree_view->priv->hover_expand)
{
tree_view->priv->auto_expand_timeout =
g_timeout_add (AUTO_EXPAND_TIMEOUT, auto_expand_timeout, tree_view);
}
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
}
static void
prelight_or_select (GtkTreeView *tree_view,
GtkRBTree *tree,
GtkRBNode *node,
/* these are in tree_window coords */
gint x,
gint y)
{
GtkSelectionMode mode = gtk_tree_selection_get_mode (tree_view->priv->selection);
if (tree_view->priv->hover_selection &&
(mode == GTK_SELECTION_SINGLE || mode == GTK_SELECTION_BROWSE) &&
!(tree_view->priv->edited_column &&
tree_view->priv->edited_column->editable_widget))
{
if (node)
{
if (!GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_SELECTED))
{
GtkTreePath *path;
path = _gtk_tree_view_find_path (tree_view, tree, node);
gtk_tree_selection_select_path (tree_view->priv->selection, path);
if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_SELECTED))
{
GTK_TREE_VIEW_UNSET_FLAG (tree_view, GTK_TREE_VIEW_DRAW_KEYFOCUS);
gtk_tree_view_real_set_cursor (tree_view, path, FALSE, FALSE);
}
gtk_tree_path_free (path);
}
}
else if (mode == GTK_SELECTION_SINGLE)
gtk_tree_selection_unselect_all (tree_view->priv->selection);
}
do_prelight (tree_view, tree, node, x, y);
}
remove validation idle 2001-02-08 Havoc Pennington <hp@redhat.com> * gtk/gtktextview.c (gtk_text_view_destroy_layout): remove validation idle * demos/gtk-demo/main.c (create_tree): adjust to changes in text cell renderer * demos/pixbuf-demo.c (timeout): remove deprecated gtk_widget_draw * demos/testpixbuf-save.c (main): remove deprecated gtk_drawing_area_size * gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate buttons even if the model isn't setup. gtk_tree_view_check_dirty() at the start of the allocation. (gtk_tree_view_check_dirty): handle column->button == NULL, handle unsetup or NULL model. * gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the even/odd/sorted cells in the tree view. * gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all): bugfixes * gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row backgrounds with draw_flat_box using different detail for even/odd rows. * gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each row, so we can draw the alternating colors thing * gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a property from a synonym property, notify for the synonym. Also, nuke the background_gdk_set and foreground_gdk_set synonyms (gtk_text_tag_get_property): Always return the font, even if all its fields aren't set * gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't store the attr list; it leaves us with no way to change attributes in _render according to the render flags, and no way to implement get_property. Instead store all the specific text attributes. Separate whether an attribute is enabled from its value. Sync all properties with GtkTextTag, make them all consistent, etc. * gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so renderers can highlight the sort row/column * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use accessor functions to get values; this has the side effect of showing up which accessor functions were missing. Added those. * gtk/gtktreeviewcolumn.h: Replace set_justification with set_alignment, to be consistent with GtkLabel, GtkMisc * gtk/gtktreeviewcolumn.c: Added code to display sort indicator arrow. * gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h * gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
static void
ensure_unprelighted (GtkTreeView *tree_view)
{
do_prelight (tree_view,
NULL, NULL,
-1000, -1000); /* coords not possibly over an arrow */
g_assert (tree_view->priv->prelight_node == NULL);
remove validation idle 2001-02-08 Havoc Pennington <hp@redhat.com> * gtk/gtktextview.c (gtk_text_view_destroy_layout): remove validation idle * demos/gtk-demo/main.c (create_tree): adjust to changes in text cell renderer * demos/pixbuf-demo.c (timeout): remove deprecated gtk_widget_draw * demos/testpixbuf-save.c (main): remove deprecated gtk_drawing_area_size * gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate buttons even if the model isn't setup. gtk_tree_view_check_dirty() at the start of the allocation. (gtk_tree_view_check_dirty): handle column->button == NULL, handle unsetup or NULL model. * gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the even/odd/sorted cells in the tree view. * gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all): bugfixes * gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row backgrounds with draw_flat_box using different detail for even/odd rows. * gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each row, so we can draw the alternating colors thing * gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a property from a synonym property, notify for the synonym. Also, nuke the background_gdk_set and foreground_gdk_set synonyms (gtk_text_tag_get_property): Always return the font, even if all its fields aren't set * gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't store the attr list; it leaves us with no way to change attributes in _render according to the render flags, and no way to implement get_property. Instead store all the specific text attributes. Separate whether an attribute is enabled from its value. Sync all properties with GtkTextTag, make them all consistent, etc. * gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so renderers can highlight the sort row/column * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use accessor functions to get values; this has the side effect of showing up which accessor functions were missing. Added those. * gtk/gtktreeviewcolumn.h: Replace set_justification with set_alignment, to be consistent with GtkLabel, GtkMisc * gtk/gtktreeviewcolumn.c: Added code to display sort indicator arrow. * gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h * gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
}
/* Our motion arrow is either a box (in the case of the original spot)
Add support for animating expanders. 2001-07-22 Anders Carlsson <andersca@gnome.org> * gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the expander_height and expander_width properties with a single property, expander_size. (gtk_tree_view_init): Set the tab_offset to expander_size plus some padding. (gtk_tree_view_unrealize): Remove the expand/collapse timeout if it exists. (coords_are_over_arrow): Fix a small bug. (gtk_tree_view_motion_draw_column_motion_arrow): Use expander_size. (gtk_tree_view_draw_focus): Use "treeview" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_bin_expose): Use "treeview-drop-indicator" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_deleted): If we have a node currently being expanded or collapsed, remove the timeout and set the node to NULL. (gtk_tree_view_queue_draw_arrow): New function that just redraws the arrow of a node. (gtk_tree_view_draw_arrow): Use expander_size instead of expander_width/expander_height, also pass a different expander_style to gtk_paint_expander depending on the state of the node being drawn. (expand_collapse_timeout): New function for expanding or collapsing a node depending on the previous state. (gtk_tree_view_real_expand_row): Add timeout and set correct state for node being expanded. (gtk_tree_view_real_collapse_row): Add timeout and set correct state for node being collapsed. * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add information about the node currently being expanded or collapsed, and also a timeout id. * gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open with expander_style for draw_expander. * gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with expander_style. (create_expander_affine): New function for creating an expander affine. (apply_affine_on_point): New function for applying an affine to a point. (gtk_default_draw_expander): Modified to take expander_style instead of is_open, and to draw the rectangle rotated differently depending on the expander style. (gtk_paint_expander): Replace is_open with expander_style. * gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor. * gtk/gtkenums.h: Add expander style enum.
2001-07-22 20:09:00 +00:00
* or an arrow. It is expander_size wide.
*/
/*
* 11111111111111
* 01111111111110
* 00111111111100
* 00011111111000
* 00001111110000
* 00000111100000
* 00000111100000
* 00000111100000
* ~ ~ ~ ~ ~ ~ ~
* 00000111100000
* 00000111100000
* 00000111100000
* 00001111110000
* 00011111111000
* 00111111111100
* 01111111111110
* 11111111111111
*/
static void
gtk_tree_view_motion_draw_column_motion_arrow (GtkTreeView *tree_view)
{
GtkTreeViewColumnReorder *reorder = tree_view->priv->cur_reorder;
GtkWidget *widget = GTK_WIDGET (tree_view);
GdkBitmap *mask = NULL;
gint x;
gint y;
gint width;
gint height;
gint arrow_type = DRAG_COLUMN_WINDOW_STATE_UNSET;
GdkWindowAttr attributes;
guint attributes_mask;
if (!reorder ||
reorder->left_column == tree_view->priv->drag_column ||
reorder->right_column == tree_view->priv->drag_column)
arrow_type = DRAG_COLUMN_WINDOW_STATE_ORIGINAL;
else if (reorder->left_column || reorder->right_column)
{
GdkRectangle visible_rect;
gtk_tree_view_get_visible_rect (tree_view, &visible_rect);
if (reorder->left_column)
x = reorder->left_column->button->allocation.x + reorder->left_column->button->allocation.width;
else
x = reorder->right_column->button->allocation.x;
if (x < visible_rect.x)
arrow_type = DRAG_COLUMN_WINDOW_STATE_ARROW_LEFT;
else if (x > visible_rect.x + visible_rect.width)
arrow_type = DRAG_COLUMN_WINDOW_STATE_ARROW_RIGHT;
else
arrow_type = DRAG_COLUMN_WINDOW_STATE_ARROW;
}
/* We want to draw the rectangle over the initial location. */
if (arrow_type == DRAG_COLUMN_WINDOW_STATE_ORIGINAL)
{
GdkGC *gc;
GdkColor col;
if (tree_view->priv->drag_column_window_state != DRAG_COLUMN_WINDOW_STATE_ORIGINAL)
{
if (tree_view->priv->drag_highlight_window)
{
gdk_window_set_user_data (tree_view->priv->drag_highlight_window,
NULL);
gdk_window_destroy (tree_view->priv->drag_highlight_window);
}
attributes.window_type = GDK_WINDOW_CHILD;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = gtk_widget_get_visual (GTK_WIDGET (tree_view));
attributes.colormap = gtk_widget_get_colormap (GTK_WIDGET (tree_view));
attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK | GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK;
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
tree_view->priv->drag_highlight_window = gdk_window_new (tree_view->priv->header_window, &attributes, attributes_mask);
gdk_window_set_user_data (tree_view->priv->drag_highlight_window, GTK_WIDGET (tree_view));
width = tree_view->priv->drag_column->button->allocation.width;
height = tree_view->priv->drag_column->button->allocation.height;
gdk_window_move_resize (tree_view->priv->drag_highlight_window,
tree_view->priv->drag_column_x, 0, width, height);
mask = gdk_pixmap_new (tree_view->priv->drag_highlight_window, width, height, 1);
gc = gdk_gc_new (mask);
col.pixel = 1;
gdk_gc_set_foreground (gc, &col);
gdk_draw_rectangle (mask, gc, TRUE, 0, 0, width, height);
col.pixel = 0;
gdk_gc_set_foreground(gc, &col);
gdk_draw_rectangle (mask, gc, TRUE, 2, 2, width - 4, height - 4);
g_object_unref (gc);
gdk_window_shape_combine_mask (tree_view->priv->drag_highlight_window,
mask, 0, 0);
if (mask) g_object_unref (mask);
tree_view->priv->drag_column_window_state = DRAG_COLUMN_WINDOW_STATE_ORIGINAL;
}
}
else if (arrow_type == DRAG_COLUMN_WINDOW_STATE_ARROW)
{
gint i, j = 1;
GdkGC *gc;
GdkColor col;
width = tree_view->priv->expander_size;
/* Get x, y, width, height of arrow */
gdk_window_get_origin (tree_view->priv->header_window, &x, &y);
if (reorder->left_column)
{
x += reorder->left_column->button->allocation.x + reorder->left_column->button->allocation.width - width/2;
height = reorder->left_column->button->allocation.height;
}
else
{
x += reorder->right_column->button->allocation.x - width/2;
height = reorder->right_column->button->allocation.height;
}
y -= tree_view->priv->expander_size/2; /* The arrow takes up only half the space */
height += tree_view->priv->expander_size;
/* Create the new window */
if (tree_view->priv->drag_column_window_state != DRAG_COLUMN_WINDOW_STATE_ARROW)
{
if (tree_view->priv->drag_highlight_window)
{
gdk_window_set_user_data (tree_view->priv->drag_highlight_window,
NULL);
gdk_window_destroy (tree_view->priv->drag_highlight_window);
}
attributes.window_type = GDK_WINDOW_TEMP;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = gtk_widget_get_visual (GTK_WIDGET (tree_view));
attributes.colormap = gtk_widget_get_colormap (GTK_WIDGET (tree_view));
attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK | GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK;
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
attributes.width = width;
attributes.height = height;
Integrate Erwann Chenede's multihead changes for the gtk/ directory. Mon Apr 29 18:28:00 2002 Owen Taylor <otaylor@redhat.com> Integrate Erwann Chenede's multihead changes for the gtk/ directory. * gtk/gtkclipboard.[ch]: Add gtk_clipboard_get_for_display(), make internals multihead aware. * gtk/gtkcolorsel.[ch]: Add gtk_color_selection_set_change_palette_with_screen_hook () [ugh!] make up for non-multihead safety of gtk_color_selection_set_change_palette_hook() * gtk/gtkinvisible.[ch] gtk/gtkmenu.[ch] gtkwindow.[ch]: Add gtk_{invisible,menu,window}_set_screen(); add "screen" properties for GtkWindow and GtkMenu. * gtk/gtkplug.[ch]: Add gtk_plug_construct_for_display(), gtk_plug_new_for_display(). Multihead fixes. * gtk/gtkselection.[ch]: Add gtk_selection_owner_set_for_display(), make internals multihead aware. * gtk/gtksettings.[ch]: Add gtk_settings_get_for_screen(), get rid of now-useless gtk_settings_constructor(). * gtk/gtkstyle.[ch]: Add gtk_style_get_font_for_display(), fix check/radio button indicators bitmap handling to be multihead safe. * gtk/gtkwidget.[ch]: Add gtk_widget_get_screen(), gtk_widget_has_screen(), gtk_widget_get_display(), gtk_widget_get_clipboard(), gtk_widget_get_root_window(). * gtk/gtkbindings.c gtk/gtkbutton.c gtk/gtkclist.c gtk/gtkcombo.c gtk/gtkctree.c gtk/gtkdnd.c gtk/gtkfilesel.c gtk/gtkgamma.c gtk/gtkhandlebox.c gtk/gtkhsv.c gtk/gtkimcontext.c gtk/gtklabel.c gtk/gtklist.c gtk/gtkmain.c gtk/gtkmenuitem.c gtk/gtkmenushell.c gtk/gtknotebook.c gtk/gtkoldeditable.c gtk/gtkoptionmenu.c gtk/gtkpaned.c gtk/gtkpreview.c gtk/gtksocket.c gtk/gtktext.c gtk/gtktextbuffer.c gtk/gtktextview.c gtk/gtktipsquery.c gtk/gtktooltips.c gtk/gtktreeview.c gtk/gtktreeviewcolumn.c: misc mechanical multihead-safety fixes. * gtk/gtkclipboard.c: Use a GtkImage rather than a pixmap for the dropper, look up the color palette only at realization time, other multihead fixes. * gtk/gtkcombo.c (gtk_combo_unrealize): Popdown the list when unrealizing. * gtk/gtkentry.c: Only claim ownership of the primary selection when realized, misc multihead fixes. * gtk/gtkfontsel.c: Only fill in fonts when attached to a screen, fix gtk_font_selection_get_font() for multihead. * gtk/gtkgc.c: make the depth => drawable hash per-screen. * gtk/gtkinvisible.c: Add a constructor that realizes the widget, so we get a realized widget with g_object_new() as well gtk_invisible_new() as before. * gtk/gtkmain.c: Get rid of unused gtk_visual/gtk_colormap variables. * gtk/gtktextdisplay.c: Add warnings if stipple bitmaps are used on the wrong screen. * gtk/gtktoolbar.c: Make handling of GtkSettings-based layout read properties and connect to settings when the screen is changed, rather than on init/finalize. * gtk/gtkwindow.c: Fix icon handing to be multihead safe ... default icon pixmaps/mask are only shared between windows on the same screen. Misc multihead fixes. Sat Apr 27 13:49:53 2002 Owen Taylor <otaylor@redhat.com> * gtk/gtkclipboard.c (gtk_clipboard_get_for_display): Update docs to reference GDK_SELECTION_CLIPBOARD rather GDK_NONE. 2002-04-29 Alex Larsson <alexl@redhat.com> * gdk/linux-fb/gdkproperty-fb.c (gdk_property_get): Fix silly bug, noticed by Sven Neumann. Sun Apr 28 22:43:55 2002 Jonathan Blandford <jrb@gnome.org> * gtk/gtktreemodelsort.c (gtk_tree_model_sort_set_sort_func): Fix so that you can set a new sort func.
2002-04-29 22:53:45 +00:00
tree_view->priv->drag_highlight_window = gdk_window_new (gtk_widget_get_root_window (widget),
&attributes, attributes_mask);
gdk_window_set_user_data (tree_view->priv->drag_highlight_window, GTK_WIDGET (tree_view));
mask = gdk_pixmap_new (tree_view->priv->drag_highlight_window, width, height, 1);
gc = gdk_gc_new (mask);
col.pixel = 1;
gdk_gc_set_foreground (gc, &col);
gdk_draw_rectangle (mask, gc, TRUE, 0, 0, width, height);
/* Draw the 2 arrows as per above */
col.pixel = 0;
gdk_gc_set_foreground (gc, &col);
for (i = 0; i < width; i ++)
{
if (i == (width/2 - 1))
continue;
gdk_draw_line (mask, gc, i, j, i, height - j);
if (i < (width/2 - 1))
j++;
else
j--;
}
g_object_unref (gc);
gdk_window_shape_combine_mask (tree_view->priv->drag_highlight_window,
mask, 0, 0);
if (mask) g_object_unref (mask);
}
tree_view->priv->drag_column_window_state = DRAG_COLUMN_WINDOW_STATE_ARROW;
gdk_window_move (tree_view->priv->drag_highlight_window, x, y);
}
else if (arrow_type == DRAG_COLUMN_WINDOW_STATE_ARROW_LEFT ||
arrow_type == DRAG_COLUMN_WINDOW_STATE_ARROW_RIGHT)
{
gint i, j = 1;
GdkGC *gc;
GdkColor col;
width = tree_view->priv->expander_size;
/* Get x, y, width, height of arrow */
width = width/2; /* remember, the arrow only takes half the available width */
gdk_window_get_origin (widget->window, &x, &y);
if (arrow_type == DRAG_COLUMN_WINDOW_STATE_ARROW_RIGHT)
x += widget->allocation.width - width;
if (reorder->left_column)
height = reorder->left_column->button->allocation.height;
else
height = reorder->right_column->button->allocation.height;
y -= tree_view->priv->expander_size;
height += 2*tree_view->priv->expander_size;
/* Create the new window */
if (tree_view->priv->drag_column_window_state != DRAG_COLUMN_WINDOW_STATE_ARROW_LEFT &&
tree_view->priv->drag_column_window_state != DRAG_COLUMN_WINDOW_STATE_ARROW_RIGHT)
{
if (tree_view->priv->drag_highlight_window)
{
gdk_window_set_user_data (tree_view->priv->drag_highlight_window,
NULL);
gdk_window_destroy (tree_view->priv->drag_highlight_window);
}
attributes.window_type = GDK_WINDOW_TEMP;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = gtk_widget_get_visual (GTK_WIDGET (tree_view));
attributes.colormap = gtk_widget_get_colormap (GTK_WIDGET (tree_view));
attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK | GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK;
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
attributes.width = width;
attributes.height = height;
tree_view->priv->drag_highlight_window = gdk_window_new (NULL, &attributes, attributes_mask);
gdk_window_set_user_data (tree_view->priv->drag_highlight_window, GTK_WIDGET (tree_view));
mask = gdk_pixmap_new (tree_view->priv->drag_highlight_window, width, height, 1);
gc = gdk_gc_new (mask);
col.pixel = 1;
gdk_gc_set_foreground (gc, &col);
gdk_draw_rectangle (mask, gc, TRUE, 0, 0, width, height);
/* Draw the 2 arrows as per above */
col.pixel = 0;
gdk_gc_set_foreground (gc, &col);
j = tree_view->priv->expander_size;
for (i = 0; i < width; i ++)
{
gint k;
if (arrow_type == DRAG_COLUMN_WINDOW_STATE_ARROW_LEFT)
k = width - i - 1;
else
k = i;
gdk_draw_line (mask, gc, k, j, k, height - j);
gdk_draw_line (mask, gc, k, 0, k, tree_view->priv->expander_size - j);
gdk_draw_line (mask, gc, k, height, k, height - tree_view->priv->expander_size + j);
j--;
}
g_object_unref (gc);
gdk_window_shape_combine_mask (tree_view->priv->drag_highlight_window,
mask, 0, 0);
if (mask) g_object_unref (mask);
}
tree_view->priv->drag_column_window_state = arrow_type;
gdk_window_move (tree_view->priv->drag_highlight_window, x, y);
}
else
{
g_warning (G_STRLOC"Invalid GtkTreeViewColumnReorder struct");
gdk_window_hide (tree_view->priv->drag_highlight_window);
return;
}
gdk_window_show (tree_view->priv->drag_highlight_window);
gdk_window_raise (tree_view->priv->drag_highlight_window);
}
static gboolean
gtk_tree_view_motion_resize_column (GtkWidget *widget,
GdkEventMotion *event)
{
gint x;
gint new_width;
GtkTreeViewColumn *column;
GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
column = gtk_tree_view_get_column (tree_view, tree_view->priv->drag_pos);
if (event->is_hint || event->window != widget->window)
gtk_widget_get_pointer (widget, &x, NULL);
else
x = event->x;
if (tree_view->priv->hadjustment)
x += tree_view->priv->hadjustment->value;
new_width = gtk_tree_view_new_column_width (tree_view,
tree_view->priv->drag_pos, &x);
if (x != tree_view->priv->x_drag &&
(new_width != column->fixed_width));
{
column->resized_width = new_width;
gtk_widget_queue_resize (widget);
}
return FALSE;
}
static void
gtk_tree_view_update_current_reorder (GtkTreeView *tree_view)
{
GtkTreeViewColumnReorder *reorder = NULL;
GList *list;
gint mouse_x;
gdk_window_get_pointer (tree_view->priv->header_window, &mouse_x, NULL, NULL);
for (list = tree_view->priv->column_drag_info; list; list = list->next)
{
reorder = (GtkTreeViewColumnReorder *) list->data;
if (mouse_x >= reorder->left_align && mouse_x < reorder->right_align)
break;
reorder = NULL;
}
/* if (reorder && reorder == tree_view->priv->cur_reorder)
return;*/
tree_view->priv->cur_reorder = reorder;
gtk_tree_view_motion_draw_column_motion_arrow (tree_view);
}
static void
gtk_tree_view_vertical_autoscroll (GtkTreeView *tree_view)
{
GdkRectangle visible_rect;
gint y;
gint offset;
gfloat value;
gdk_window_get_pointer (tree_view->priv->bin_window, NULL, &y, NULL);
y += tree_view->priv->dy;
gtk_tree_view_get_visible_rect (tree_view, &visible_rect);
/* see if we are near the edge. */
offset = y - (visible_rect.y + 2 * SCROLL_EDGE_SIZE);
if (offset > 0)
{
offset = y - (visible_rect.y + visible_rect.height - 2 * SCROLL_EDGE_SIZE);
if (offset < 0)
return;
}
value = CLAMP (tree_view->priv->vadjustment->value + offset, 0.0,
tree_view->priv->vadjustment->upper - tree_view->priv->vadjustment->page_size);
gtk_adjustment_set_value (tree_view->priv->vadjustment, value);
}
static gboolean
gtk_tree_view_horizontal_autoscroll (GtkTreeView *tree_view)
{
GdkRectangle visible_rect;
gint x;
gint offset;
gfloat value;
gdk_window_get_pointer (tree_view->priv->bin_window, &x, NULL, NULL);
gtk_tree_view_get_visible_rect (tree_view, &visible_rect);
/* See if we are near the edge. */
offset = x - (visible_rect.x + SCROLL_EDGE_SIZE);
if (offset > 0)
{
offset = x - (visible_rect.x + visible_rect.width - SCROLL_EDGE_SIZE);
if (offset < 0)
return TRUE;
}
offset = offset/3;
value = CLAMP (tree_view->priv->hadjustment->value + offset,
0.0, tree_view->priv->hadjustment->upper - tree_view->priv->hadjustment->page_size);
gtk_adjustment_set_value (tree_view->priv->hadjustment, value);
return TRUE;
}
static gboolean
gtk_tree_view_motion_drag_column (GtkWidget *widget,
GdkEventMotion *event)
{
GtkTreeView *tree_view = (GtkTreeView *) widget;
GtkTreeViewColumn *column = tree_view->priv->drag_column;
gint x, y;
/* Sanity Check */
if ((column == NULL) ||
(event->window != tree_view->priv->drag_window))
return FALSE;
/* Handle moving the header */
gdk_window_get_position (tree_view->priv->drag_window, &x, &y);
x = CLAMP (x + (gint)event->x - column->drag_x, 0,
MAX (tree_view->priv->width, GTK_WIDGET (tree_view)->allocation.width) - column->button->allocation.width);
gdk_window_move (tree_view->priv->drag_window, x, y);
/* autoscroll, if needed */
gtk_tree_view_horizontal_autoscroll (tree_view);
/* Update the current reorder position and arrow; */
gtk_tree_view_update_current_reorder (tree_view);
return TRUE;
}
static gboolean
gtk_tree_view_motion_bin_window (GtkWidget *widget,
GdkEventMotion *event)
{
GtkTreeView *tree_view;
GtkRBTree *tree;
GtkRBNode *node;
gint new_y;
tree_view = (GtkTreeView *) widget;
if (tree_view->priv->tree == NULL)
return FALSE;
/* only check for an initiated drag when a button is pressed */
if (tree_view->priv->pressed_button >= 0)
gtk_tree_view_maybe_begin_dragging_row (tree_view, event);
new_y = TREE_WINDOW_Y_TO_RBTREE_Y(tree_view, event->y);
if (new_y < 0)
new_y = 0;
_gtk_rbtree_find_offset (tree_view->priv->tree, new_y, &tree, &node);
/* If we are currently pressing down a button, we don't want to prelight anything else. */
if ((tree_view->priv->button_pressed_node != NULL) &&
(tree_view->priv->button_pressed_node != node))
node = NULL;
prelight_or_select (tree_view, tree, node, event->x, event->y);
return TRUE;
}
static gboolean
gtk_tree_view_motion (GtkWidget *widget,
GdkEventMotion *event)
{
GtkTreeView *tree_view;
tree_view = (GtkTreeView *) widget;
/* Resizing a column */
if (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_IN_COLUMN_RESIZE))
return gtk_tree_view_motion_resize_column (widget, event);
/* Drag column */
if (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_IN_COLUMN_DRAG))
return gtk_tree_view_motion_drag_column (widget, event);
/* Sanity check it */
if (event->window == tree_view->priv->bin_window)
return gtk_tree_view_motion_bin_window (widget, event);
return FALSE;
}
/* Draws a focus rectangle near the edge of the bin_window; used when the tree
* is empty.
*/
static void
draw_empty_focus (GtkTreeView *tree_view, GdkRectangle *clip_area)
{
gint w, h;
if (!GTK_WIDGET_HAS_FOCUS (tree_view))
return;
gdk_drawable_get_size (tree_view->priv->bin_window, &w, &h);
w -= 2;
h -= 2;
if (w > 0 && h > 0)
gtk_paint_focus (GTK_WIDGET (tree_view)->style,
tree_view->priv->bin_window,
GTK_WIDGET_STATE (tree_view),
clip_area,
GTK_WIDGET (tree_view),
NULL,
1, 1, w, h);
}
/* Warning: Very scary function.
* Modify at your own risk
*
* KEEP IN SYNC WITH gtk_tree_view_create_row_drag_icon()!
* FIXME: It's not...
*/
static gboolean
gtk_tree_view_bin_expose (GtkWidget *widget,
GdkEventExpose *event)
{
GtkTreeView *tree_view;
GtkTreePath *path;
GtkRBTree *tree;
GList *list;
GtkRBNode *node;
GtkRBNode *cursor = NULL;
GtkRBTree *cursor_tree = NULL;
GtkRBNode *drag_highlight = NULL;
GtkRBTree *drag_highlight_tree = NULL;
GtkTreeIter iter;
gint new_y;
gint y_offset, x_offset, cell_offset;
gint max_height;
gint depth;
GdkRectangle background_area;
GdkRectangle cell_area;
guint flags;
gint highlight_x;
gint bin_window_width;
GtkTreePath *cursor_path;
GtkTreePath *drag_dest_path;
GList *last_column;
gint vertical_separator;
gint horizontal_separator;
The "big treeview focus patch". Fixes several issues and adds some Sun May 5 16:42:32 2002 Kristian Rietveld <kris@gtk.org> The "big treeview focus patch". Fixes several issues and adds some goodies. Related bugs: #73676, #73734, #78660. * gtk/gtktreeview.h: add gtk_tree_view_set_cursor_on_cell * gtk/gtktreeview.c (gtk_tree_view_button_press): focus on a cell if applicable, (gtk_tree_view_bin_expose): set_cell_data before iterating columns, add support for row-spanning focus rectangles, (gtk_tree_view_has_special_cell): new function, (gtk_tree_view_move_cursor_left_right): add support for multiple focusable cells in one column, (gtk_tree_view_set_cursor): call _set_cursor_on_cell now, (gtk_tree_view_set_cursor_on_cell): copy of _set_cursor, extended with focus_cell parameter, (gtk_tree_view_search_iter): removed unused column variable, (gtk_tree_view_start_editing): add neighbor size code to allow for multiple editable cells in one column. * gtk/gtktreeviewcolumn.c (_GtkTreeViewColumnCellInfo): add in_editing_mode field, (gtk_tree_view_column_get_edited_cell): new function, removed _get_editable_cell, (_gtk_tree_view_column_get_cell_at_pos): new function, (gtk_tree_view_column_pack_end): s/g_new/g_new0/ ..., (gtk_tree_view_column_cell_process_action): loads of changes to get it right and to allow for multiple special cells, etc, (gtk_tree_view_column_cell_first): new function, (gtk_tree_view_column_cell_last): ditto, (gtk_tree_view_column_cell_next): ditto, (gtk_tree_view_column_cell_prev): ditto, (gtk_tree_view_column_cell_focus): add left and right parameters, allow for multiple special cells, (gtk_tree_view_column_cell_is_visible): add assertion, (gtk_tree_view_column_focus_cell): new function, (gtk_tree_view_column_stop_editing): unset in_editing_mode flag, (_gtk_tree_view_column_get_neighbor_sizes): iterate through cells correctly * gtk/gtktreeviewcolumn.h: add gtk_tree_view_column_focus_cell * gtk/gtktreeprivate.h: s/_get_editable_cell/_get_edited_cell/, add _gtk_tree_view_column_get_cell_at_pos, add new parameters to _gtk_tree_view_column_cell_focus. * tests/testtreeedit.c: add some cells in order to test new code.
2002-05-05 14:54:00 +00:00
gint focus_line_width;
gboolean allow_rules;
The "big treeview focus patch". Fixes several issues and adds some Sun May 5 16:42:32 2002 Kristian Rietveld <kris@gtk.org> The "big treeview focus patch". Fixes several issues and adds some goodies. Related bugs: #73676, #73734, #78660. * gtk/gtktreeview.h: add gtk_tree_view_set_cursor_on_cell * gtk/gtktreeview.c (gtk_tree_view_button_press): focus on a cell if applicable, (gtk_tree_view_bin_expose): set_cell_data before iterating columns, add support for row-spanning focus rectangles, (gtk_tree_view_has_special_cell): new function, (gtk_tree_view_move_cursor_left_right): add support for multiple focusable cells in one column, (gtk_tree_view_set_cursor): call _set_cursor_on_cell now, (gtk_tree_view_set_cursor_on_cell): copy of _set_cursor, extended with focus_cell parameter, (gtk_tree_view_search_iter): removed unused column variable, (gtk_tree_view_start_editing): add neighbor size code to allow for multiple editable cells in one column. * gtk/gtktreeviewcolumn.c (_GtkTreeViewColumnCellInfo): add in_editing_mode field, (gtk_tree_view_column_get_edited_cell): new function, removed _get_editable_cell, (_gtk_tree_view_column_get_cell_at_pos): new function, (gtk_tree_view_column_pack_end): s/g_new/g_new0/ ..., (gtk_tree_view_column_cell_process_action): loads of changes to get it right and to allow for multiple special cells, etc, (gtk_tree_view_column_cell_first): new function, (gtk_tree_view_column_cell_last): ditto, (gtk_tree_view_column_cell_next): ditto, (gtk_tree_view_column_cell_prev): ditto, (gtk_tree_view_column_cell_focus): add left and right parameters, allow for multiple special cells, (gtk_tree_view_column_cell_is_visible): add assertion, (gtk_tree_view_column_focus_cell): new function, (gtk_tree_view_column_stop_editing): unset in_editing_mode flag, (_gtk_tree_view_column_get_neighbor_sizes): iterate through cells correctly * gtk/gtktreeviewcolumn.h: add gtk_tree_view_column_focus_cell * gtk/gtktreeprivate.h: s/_get_editable_cell/_get_edited_cell/, add _gtk_tree_view_column_get_cell_at_pos, add new parameters to _gtk_tree_view_column_cell_focus. * tests/testtreeedit.c: add some cells in order to test new code.
2002-05-05 14:54:00 +00:00
gboolean has_special_cell;
gboolean rtl;
gint n_visible_columns;
g_return_val_if_fail (GTK_IS_TREE_VIEW (widget), FALSE);
rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
tree_view = GTK_TREE_VIEW (widget);
gtk_widget_style_get (widget,
"horizontal_separator", &horizontal_separator,
"vertical_separator", &vertical_separator,
"allow_rules", &allow_rules,
The "big treeview focus patch". Fixes several issues and adds some Sun May 5 16:42:32 2002 Kristian Rietveld <kris@gtk.org> The "big treeview focus patch". Fixes several issues and adds some goodies. Related bugs: #73676, #73734, #78660. * gtk/gtktreeview.h: add gtk_tree_view_set_cursor_on_cell * gtk/gtktreeview.c (gtk_tree_view_button_press): focus on a cell if applicable, (gtk_tree_view_bin_expose): set_cell_data before iterating columns, add support for row-spanning focus rectangles, (gtk_tree_view_has_special_cell): new function, (gtk_tree_view_move_cursor_left_right): add support for multiple focusable cells in one column, (gtk_tree_view_set_cursor): call _set_cursor_on_cell now, (gtk_tree_view_set_cursor_on_cell): copy of _set_cursor, extended with focus_cell parameter, (gtk_tree_view_search_iter): removed unused column variable, (gtk_tree_view_start_editing): add neighbor size code to allow for multiple editable cells in one column. * gtk/gtktreeviewcolumn.c (_GtkTreeViewColumnCellInfo): add in_editing_mode field, (gtk_tree_view_column_get_edited_cell): new function, removed _get_editable_cell, (_gtk_tree_view_column_get_cell_at_pos): new function, (gtk_tree_view_column_pack_end): s/g_new/g_new0/ ..., (gtk_tree_view_column_cell_process_action): loads of changes to get it right and to allow for multiple special cells, etc, (gtk_tree_view_column_cell_first): new function, (gtk_tree_view_column_cell_last): ditto, (gtk_tree_view_column_cell_next): ditto, (gtk_tree_view_column_cell_prev): ditto, (gtk_tree_view_column_cell_focus): add left and right parameters, allow for multiple special cells, (gtk_tree_view_column_cell_is_visible): add assertion, (gtk_tree_view_column_focus_cell): new function, (gtk_tree_view_column_stop_editing): unset in_editing_mode flag, (_gtk_tree_view_column_get_neighbor_sizes): iterate through cells correctly * gtk/gtktreeviewcolumn.h: add gtk_tree_view_column_focus_cell * gtk/gtktreeprivate.h: s/_get_editable_cell/_get_edited_cell/, add _gtk_tree_view_column_get_cell_at_pos, add new parameters to _gtk_tree_view_column_cell_focus. * tests/testtreeedit.c: add some cells in order to test new code.
2002-05-05 14:54:00 +00:00
"focus-line-width", &focus_line_width,
NULL);
if (tree_view->priv->tree == NULL)
{
draw_empty_focus (tree_view, &event->area);
return TRUE;
}
/* clip event->area to the visible area */
if (event->area.height < 0)
return TRUE;
validate_visible_area (tree_view);
new_y = TREE_WINDOW_Y_TO_RBTREE_Y (tree_view, event->area.y);
if (new_y < 0)
new_y = 0;
y_offset = -_gtk_rbtree_find_offset (tree_view->priv->tree, new_y, &tree, &node);
if (node == NULL)
return TRUE;
/* find the path for the node */
path = _gtk_tree_view_find_path ((GtkTreeView *)widget,
tree,
node);
gtk_tree_model_get_iter (tree_view->priv->model,
&iter,
path);
depth = gtk_tree_path_get_depth (path);
gtk_tree_path_free (path);
Support separators in combo boxes and more generally in tree views 2004-07-07 Matthias Clasen <mclasen@redhat.com> Support separators in combo boxes and more generally in tree views (#135873): * gtk/gtkcombobox.h: * gtk/gtkcombobox.c (gtk_combo_box_get_row_separator_column): * gtk/gtkcombobox.c (gtk_combo_box_set_row_separator_column): Add a ::row-separator-column property with getter and setter, which can indicate a boolean model column to determine which rows are separators. * gtk/gtkcombobox.c: Display separator rows as separator menu items in menu mode, and by using the new treeview separator functionality in list mode. * gtk/gtktreeview.h: * gtk/gtktreeview.c (gtk_tree_view_get_row_separator_func): * gtk/gtktreeview.c (gtk_tree_view_set_row_separator_func): Add a callback to determine whether a row is a separator. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): * gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon): * gtk/gtktreeview.c (validate_row): Use the new callback to determine whether a row is a separator, and draw it as a separator then. Since separators should take up less vertical space than regular rows, this requires removing the redundant MAX(...,expander_size) calls which appear in many places. Instead, the MAX() is now only done in validate_row(), and only if the row is not a separator. To catch possible side effects of this intrusive change, I have left EXPANDER_MAX() calls in place of the MAX() calls which will emit a warning if something breaks. They should be removed before 2.6. * gtk/gtktreeselection.c (row_is_selectable): Don't let separator rows be selected. * tests/testcombo.c (create_blaat): Add a separator column.
2004-07-07 15:15:35 +00:00
cursor_path = NULL;
drag_dest_path = NULL;
if (tree_view->priv->cursor)
cursor_path = gtk_tree_row_reference_get_path (tree_view->priv->cursor);
if (cursor_path)
_gtk_tree_view_find_node (tree_view, cursor_path,
&cursor_tree, &cursor);
if (tree_view->priv->drag_dest_row)
drag_dest_path = gtk_tree_row_reference_get_path (tree_view->priv->drag_dest_row);
if (drag_dest_path)
_gtk_tree_view_find_node (tree_view, drag_dest_path,
&drag_highlight_tree, &drag_highlight);
gdk_drawable_get_size (tree_view->priv->bin_window,
&bin_window_width, NULL);
Support separators in combo boxes and more generally in tree views 2004-07-07 Matthias Clasen <mclasen@redhat.com> Support separators in combo boxes and more generally in tree views (#135873): * gtk/gtkcombobox.h: * gtk/gtkcombobox.c (gtk_combo_box_get_row_separator_column): * gtk/gtkcombobox.c (gtk_combo_box_set_row_separator_column): Add a ::row-separator-column property with getter and setter, which can indicate a boolean model column to determine which rows are separators. * gtk/gtkcombobox.c: Display separator rows as separator menu items in menu mode, and by using the new treeview separator functionality in list mode. * gtk/gtktreeview.h: * gtk/gtktreeview.c (gtk_tree_view_get_row_separator_func): * gtk/gtktreeview.c (gtk_tree_view_set_row_separator_func): Add a callback to determine whether a row is a separator. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): * gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon): * gtk/gtktreeview.c (validate_row): Use the new callback to determine whether a row is a separator, and draw it as a separator then. Since separators should take up less vertical space than regular rows, this requires removing the redundant MAX(...,expander_size) calls which appear in many places. Instead, the MAX() is now only done in validate_row(), and only if the row is not a separator. To catch possible side effects of this intrusive change, I have left EXPANDER_MAX() calls in place of the MAX() calls which will emit a warning if something breaks. They should be removed before 2.6. * gtk/gtktreeselection.c (row_is_selectable): Don't let separator rows be selected. * tests/testcombo.c (create_blaat): Add a separator column.
2004-07-07 15:15:35 +00:00
n_visible_columns = 0;
for (list = tree_view->priv->columns; list; list = list->next)
{
if (! GTK_TREE_VIEW_COLUMN (list->data)->visible)
continue;
n_visible_columns ++;
}
/* Find the last column */
for (last_column = rtl ? g_list_first (tree_view->priv->columns) : g_list_last (tree_view->priv->columns);
last_column &&
!(GTK_TREE_VIEW_COLUMN (last_column->data)->visible) &&
GTK_WIDGET_CAN_FOCUS (GTK_TREE_VIEW_COLUMN (last_column->data)->button);
last_column = rtl ? last_column->next : last_column->prev)
;
/* Actually process the expose event. To do this, we want to
* start at the first node of the event, and walk the tree in
* order, drawing each successive node.
*/
do
{
gboolean parity;
Support separators in combo boxes and more generally in tree views 2004-07-07 Matthias Clasen <mclasen@redhat.com> Support separators in combo boxes and more generally in tree views (#135873): * gtk/gtkcombobox.h: * gtk/gtkcombobox.c (gtk_combo_box_get_row_separator_column): * gtk/gtkcombobox.c (gtk_combo_box_set_row_separator_column): Add a ::row-separator-column property with getter and setter, which can indicate a boolean model column to determine which rows are separators. * gtk/gtkcombobox.c: Display separator rows as separator menu items in menu mode, and by using the new treeview separator functionality in list mode. * gtk/gtktreeview.h: * gtk/gtktreeview.c (gtk_tree_view_get_row_separator_func): * gtk/gtktreeview.c (gtk_tree_view_set_row_separator_func): Add a callback to determine whether a row is a separator. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): * gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon): * gtk/gtktreeview.c (validate_row): Use the new callback to determine whether a row is a separator, and draw it as a separator then. Since separators should take up less vertical space than regular rows, this requires removing the redundant MAX(...,expander_size) calls which appear in many places. Instead, the MAX() is now only done in validate_row(), and only if the row is not a separator. To catch possible side effects of this intrusive change, I have left EXPANDER_MAX() calls in place of the MAX() calls which will emit a warning if something breaks. They should be removed before 2.6. * gtk/gtktreeselection.c (row_is_selectable): Don't let separator rows be selected. * tests/testcombo.c (create_blaat): Add a separator column.
2004-07-07 15:15:35 +00:00
gboolean is_separator = FALSE;
if (tree_view->priv->row_separator_func)
{
is_separator = (* tree_view->priv->row_separator_func) (tree_view->priv->model,
&iter,
tree_view->priv->row_separator_data);
}
max_height = ROW_HEIGHT (tree_view, BACKGROUND_HEIGHT (node));
x_offset = -event->area.x;
cell_offset = 0;
highlight_x = 0; /* should match x coord of first cell */
background_area.y = y_offset + event->area.y;
background_area.height = max_height;
flags = 0;
if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_PRELIT))
flags |= GTK_CELL_RENDERER_PRELIT;
if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_SELECTED))
flags |= GTK_CELL_RENDERER_SELECTED;
parity = _gtk_rbtree_node_find_parity (tree, node);
The "big treeview focus patch". Fixes several issues and adds some Sun May 5 16:42:32 2002 Kristian Rietveld <kris@gtk.org> The "big treeview focus patch". Fixes several issues and adds some goodies. Related bugs: #73676, #73734, #78660. * gtk/gtktreeview.h: add gtk_tree_view_set_cursor_on_cell * gtk/gtktreeview.c (gtk_tree_view_button_press): focus on a cell if applicable, (gtk_tree_view_bin_expose): set_cell_data before iterating columns, add support for row-spanning focus rectangles, (gtk_tree_view_has_special_cell): new function, (gtk_tree_view_move_cursor_left_right): add support for multiple focusable cells in one column, (gtk_tree_view_set_cursor): call _set_cursor_on_cell now, (gtk_tree_view_set_cursor_on_cell): copy of _set_cursor, extended with focus_cell parameter, (gtk_tree_view_search_iter): removed unused column variable, (gtk_tree_view_start_editing): add neighbor size code to allow for multiple editable cells in one column. * gtk/gtktreeviewcolumn.c (_GtkTreeViewColumnCellInfo): add in_editing_mode field, (gtk_tree_view_column_get_edited_cell): new function, removed _get_editable_cell, (_gtk_tree_view_column_get_cell_at_pos): new function, (gtk_tree_view_column_pack_end): s/g_new/g_new0/ ..., (gtk_tree_view_column_cell_process_action): loads of changes to get it right and to allow for multiple special cells, etc, (gtk_tree_view_column_cell_first): new function, (gtk_tree_view_column_cell_last): ditto, (gtk_tree_view_column_cell_next): ditto, (gtk_tree_view_column_cell_prev): ditto, (gtk_tree_view_column_cell_focus): add left and right parameters, allow for multiple special cells, (gtk_tree_view_column_cell_is_visible): add assertion, (gtk_tree_view_column_focus_cell): new function, (gtk_tree_view_column_stop_editing): unset in_editing_mode flag, (_gtk_tree_view_column_get_neighbor_sizes): iterate through cells correctly * gtk/gtktreeviewcolumn.h: add gtk_tree_view_column_focus_cell * gtk/gtktreeprivate.h: s/_get_editable_cell/_get_edited_cell/, add _gtk_tree_view_column_get_cell_at_pos, add new parameters to _gtk_tree_view_column_cell_focus. * tests/testtreeedit.c: add some cells in order to test new code.
2002-05-05 14:54:00 +00:00
has_special_cell = gtk_tree_view_has_special_cell (tree_view);
for (list = (rtl ? g_list_last (tree_view->priv->columns) : g_list_first (tree_view->priv->columns));
list;
list = (rtl ? list->prev : list->next))
{
GtkTreeViewColumn *column = list->data;
const gchar *detail = NULL;
GtkStateType state;
if (!column->visible)
continue;
if (cell_offset > event->area.x + event->area.width ||
cell_offset + column->width < event->area.x)
{
cell_offset += column->width;
continue;
}
if (column->show_sort_indicator)
flags |= GTK_CELL_RENDERER_SORTED;
else
flags &= ~GTK_CELL_RENDERER_SORTED;
if (cursor == node)
flags |= GTK_CELL_RENDERER_FOCUSED;
else
flags &= ~GTK_CELL_RENDERER_FOCUSED;
background_area.x = cell_offset;
background_area.width = column->width;
cell_area = background_area;
cell_area.y += vertical_separator / 2;
cell_area.x += horizontal_separator / 2;
cell_area.height -= vertical_separator;
cell_area.width -= horizontal_separator;
if (gdk_region_rect_in (event->region, &background_area) == GDK_OVERLAP_RECTANGLE_OUT)
{
cell_offset += column->width;
continue;
}
gtk_tree_view_column_cell_set_cell_data (column,
tree_view->priv->model,
&iter,
GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_PARENT),
node->children?TRUE:FALSE);
/* Select the detail for drawing the cell. relevant
* factors are parity, sortedness, and whether to
* display rules.
*/
if (allow_rules && tree_view->priv->has_rules)
{
if ((flags & GTK_CELL_RENDERER_SORTED) &&
n_visible_columns >= 3)
{
if (parity)
detail = "cell_odd_ruled_sorted";
else
detail = "cell_even_ruled_sorted";
}
else
{
if (parity)
detail = "cell_odd_ruled";
else
detail = "cell_even_ruled";
}
}
else
{
if ((flags & GTK_CELL_RENDERER_SORTED) &&
n_visible_columns >= 3)
{
if (parity)
detail = "cell_odd_sorted";
else
detail = "cell_even_sorted";
}
else
{
if (parity)
detail = "cell_odd";
else
detail = "cell_even";
}
}
g_assert (detail);
if (flags & GTK_CELL_RENDERER_SELECTED)
state = GTK_STATE_SELECTED;
else
state = GTK_STATE_NORMAL;
/* Draw background */
gtk_paint_flat_box (widget->style,
event->window,
state,
GTK_SHADOW_NONE,
&event->area,
widget,
detail,
background_area.x,
background_area.y,
background_area.width,
background_area.height);
if (gtk_tree_view_is_expander_column (tree_view, column) &&
TREE_VIEW_DRAW_EXPANDERS(tree_view))
{
if (!rtl)
cell_area.x += depth * tree_view->priv->expander_size;
cell_area.width -= depth * tree_view->priv->expander_size;
/* If we have an expander column, the highlight underline
* starts with that column, so that it indicates which
* level of the tree we're dropping at.
*/
highlight_x = cell_area.x;
Support separators in combo boxes and more generally in tree views 2004-07-07 Matthias Clasen <mclasen@redhat.com> Support separators in combo boxes and more generally in tree views (#135873): * gtk/gtkcombobox.h: * gtk/gtkcombobox.c (gtk_combo_box_get_row_separator_column): * gtk/gtkcombobox.c (gtk_combo_box_set_row_separator_column): Add a ::row-separator-column property with getter and setter, which can indicate a boolean model column to determine which rows are separators. * gtk/gtkcombobox.c: Display separator rows as separator menu items in menu mode, and by using the new treeview separator functionality in list mode. * gtk/gtktreeview.h: * gtk/gtktreeview.c (gtk_tree_view_get_row_separator_func): * gtk/gtktreeview.c (gtk_tree_view_set_row_separator_func): Add a callback to determine whether a row is a separator. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): * gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon): * gtk/gtktreeview.c (validate_row): Use the new callback to determine whether a row is a separator, and draw it as a separator then. Since separators should take up less vertical space than regular rows, this requires removing the redundant MAX(...,expander_size) calls which appear in many places. Instead, the MAX() is now only done in validate_row(), and only if the row is not a separator. To catch possible side effects of this intrusive change, I have left EXPANDER_MAX() calls in place of the MAX() calls which will emit a warning if something breaks. They should be removed before 2.6. * gtk/gtktreeselection.c (row_is_selectable): Don't let separator rows be selected. * tests/testcombo.c (create_blaat): Add a separator column.
2004-07-07 15:15:35 +00:00
if (is_separator)
gtk_paint_hline (widget->style,
event->window,
state,
&cell_area,
widget,
NULL,
cell_area.x,
cell_area.x + cell_area.width,
cell_area.y + cell_area.height / 2);
else
_gtk_tree_view_column_cell_render (column,
event->window,
&background_area,
&cell_area,
&event->area,
flags);
if ((node->flags & GTK_RBNODE_IS_PARENT) == GTK_RBNODE_IS_PARENT)
{
gint x, y;
gdk_window_get_pointer (tree_view->priv->bin_window, &x, &y, 0);
gtk_tree_view_draw_arrow (GTK_TREE_VIEW (widget),
tree,
node,
x, y);
}
}
else
{
Support separators in combo boxes and more generally in tree views 2004-07-07 Matthias Clasen <mclasen@redhat.com> Support separators in combo boxes and more generally in tree views (#135873): * gtk/gtkcombobox.h: * gtk/gtkcombobox.c (gtk_combo_box_get_row_separator_column): * gtk/gtkcombobox.c (gtk_combo_box_set_row_separator_column): Add a ::row-separator-column property with getter and setter, which can indicate a boolean model column to determine which rows are separators. * gtk/gtkcombobox.c: Display separator rows as separator menu items in menu mode, and by using the new treeview separator functionality in list mode. * gtk/gtktreeview.h: * gtk/gtktreeview.c (gtk_tree_view_get_row_separator_func): * gtk/gtktreeview.c (gtk_tree_view_set_row_separator_func): Add a callback to determine whether a row is a separator. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): * gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon): * gtk/gtktreeview.c (validate_row): Use the new callback to determine whether a row is a separator, and draw it as a separator then. Since separators should take up less vertical space than regular rows, this requires removing the redundant MAX(...,expander_size) calls which appear in many places. Instead, the MAX() is now only done in validate_row(), and only if the row is not a separator. To catch possible side effects of this intrusive change, I have left EXPANDER_MAX() calls in place of the MAX() calls which will emit a warning if something breaks. They should be removed before 2.6. * gtk/gtktreeselection.c (row_is_selectable): Don't let separator rows be selected. * tests/testcombo.c (create_blaat): Add a separator column.
2004-07-07 15:15:35 +00:00
if (is_separator)
gtk_paint_hline (widget->style,
event->window,
state,
&cell_area,
widget,
NULL,
cell_area.x,
cell_area.x + cell_area.width,
cell_area.y + cell_area.height / 2);
else
_gtk_tree_view_column_cell_render (column,
event->window,
&background_area,
&cell_area,
&event->area,
flags);
}
The "big treeview focus patch". Fixes several issues and adds some Sun May 5 16:42:32 2002 Kristian Rietveld <kris@gtk.org> The "big treeview focus patch". Fixes several issues and adds some goodies. Related bugs: #73676, #73734, #78660. * gtk/gtktreeview.h: add gtk_tree_view_set_cursor_on_cell * gtk/gtktreeview.c (gtk_tree_view_button_press): focus on a cell if applicable, (gtk_tree_view_bin_expose): set_cell_data before iterating columns, add support for row-spanning focus rectangles, (gtk_tree_view_has_special_cell): new function, (gtk_tree_view_move_cursor_left_right): add support for multiple focusable cells in one column, (gtk_tree_view_set_cursor): call _set_cursor_on_cell now, (gtk_tree_view_set_cursor_on_cell): copy of _set_cursor, extended with focus_cell parameter, (gtk_tree_view_search_iter): removed unused column variable, (gtk_tree_view_start_editing): add neighbor size code to allow for multiple editable cells in one column. * gtk/gtktreeviewcolumn.c (_GtkTreeViewColumnCellInfo): add in_editing_mode field, (gtk_tree_view_column_get_edited_cell): new function, removed _get_editable_cell, (_gtk_tree_view_column_get_cell_at_pos): new function, (gtk_tree_view_column_pack_end): s/g_new/g_new0/ ..., (gtk_tree_view_column_cell_process_action): loads of changes to get it right and to allow for multiple special cells, etc, (gtk_tree_view_column_cell_first): new function, (gtk_tree_view_column_cell_last): ditto, (gtk_tree_view_column_cell_next): ditto, (gtk_tree_view_column_cell_prev): ditto, (gtk_tree_view_column_cell_focus): add left and right parameters, allow for multiple special cells, (gtk_tree_view_column_cell_is_visible): add assertion, (gtk_tree_view_column_focus_cell): new function, (gtk_tree_view_column_stop_editing): unset in_editing_mode flag, (_gtk_tree_view_column_get_neighbor_sizes): iterate through cells correctly * gtk/gtktreeviewcolumn.h: add gtk_tree_view_column_focus_cell * gtk/gtktreeprivate.h: s/_get_editable_cell/_get_edited_cell/, add _gtk_tree_view_column_get_cell_at_pos, add new parameters to _gtk_tree_view_column_cell_focus. * tests/testtreeedit.c: add some cells in order to test new code.
2002-05-05 14:54:00 +00:00
if (node == cursor && has_special_cell &&
((column == tree_view->priv->focus_column &&
GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_DRAW_KEYFOCUS) &&
GTK_WIDGET_HAS_FOCUS (widget)) ||
(column == tree_view->priv->edited_column)))
{
_gtk_tree_view_column_cell_draw_focus (column,
event->window,
&background_area,
&cell_area,
&event->area,
flags);
}
cell_offset += column->width;
}
if (node == drag_highlight)
{
/* Draw indicator for the drop
*/
gint highlight_y = -1;
GtkRBTree *tree = NULL;
GtkRBNode *node = NULL;
gint width;
gint focus_line_width;
switch (tree_view->priv->drag_dest_pos)
{
case GTK_TREE_VIEW_DROP_BEFORE:
start implementing Thu Mar 7 02:58:16 2002 Jonathan Blandford <jrb@redhat.com> * gtk/tmpl/gtkliststore.sgml: start implementing * gtk/question_index.sgml: "I can set with the tree, but not get???!?!" Wed Mar 6 23:20:51 2002 Jonathan Blandford <jrb@redhat.com> and Kristian Rietveld <kris@gtk.org> Finishing touch for 2.0.0 release, fixes #70782, #72729, the 'stealth' bug and other last-minute minor issues. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): set dnd dest line drawing right. We can't draw the line at the position of the next row, because that one still has to be drawn. So draw everthing at a -1 offset. (validate_visible_area): add check for invalid descendants and NULL scroll_to_path path, get scrolling right. Also, fix the area_above value. Pretty amazing I got it wrong. (get_logical_dest_row): add gtk-tree-model-drop-append magic, so dragging a row to the end of the model works right. (gtk_tree_view_get_dest_row_at_pos): minor floating point fix (gtk_tree_view_start_editing): add call to validate_row (gtk_tree_view_tree_to_widget_coords): Never subtract HEADER_HEIGHT from y values anymore!!! (gtk_tree_view_widget_coords_to_tree): ditto. (gtk_tree_view_scroll_to_point): allow -1 as values for the scroll_to coords (gtk_tree_view_move_cursor_page_up_down): Don't need scroll_to_y as clamp_node_visible will make it work. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): also check path depth, as we can't get iters from empty paths * gtk/gtkliststore.c (gtk_list_store_drag_data_received): handle gtk-tree-model-drop-append * gtk/gtktreednd.c (gtk_tree_set_row_drag_data): free path_str * tests/testtreeflow.c (main): select path where we are scrolling to
2002-03-07 08:03:09 +00:00
highlight_y = background_area.y - 1;
if (highlight_y < 0)
highlight_y = 0;
break;
case GTK_TREE_VIEW_DROP_AFTER:
start implementing Thu Mar 7 02:58:16 2002 Jonathan Blandford <jrb@redhat.com> * gtk/tmpl/gtkliststore.sgml: start implementing * gtk/question_index.sgml: "I can set with the tree, but not get???!?!" Wed Mar 6 23:20:51 2002 Jonathan Blandford <jrb@redhat.com> and Kristian Rietveld <kris@gtk.org> Finishing touch for 2.0.0 release, fixes #70782, #72729, the 'stealth' bug and other last-minute minor issues. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): set dnd dest line drawing right. We can't draw the line at the position of the next row, because that one still has to be drawn. So draw everthing at a -1 offset. (validate_visible_area): add check for invalid descendants and NULL scroll_to_path path, get scrolling right. Also, fix the area_above value. Pretty amazing I got it wrong. (get_logical_dest_row): add gtk-tree-model-drop-append magic, so dragging a row to the end of the model works right. (gtk_tree_view_get_dest_row_at_pos): minor floating point fix (gtk_tree_view_start_editing): add call to validate_row (gtk_tree_view_tree_to_widget_coords): Never subtract HEADER_HEIGHT from y values anymore!!! (gtk_tree_view_widget_coords_to_tree): ditto. (gtk_tree_view_scroll_to_point): allow -1 as values for the scroll_to coords (gtk_tree_view_move_cursor_page_up_down): Don't need scroll_to_y as clamp_node_visible will make it work. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): also check path depth, as we can't get iters from empty paths * gtk/gtkliststore.c (gtk_list_store_drag_data_received): handle gtk-tree-model-drop-append * gtk/gtktreednd.c (gtk_tree_set_row_drag_data): free path_str * tests/testtreeflow.c (main): select path where we are scrolling to
2002-03-07 08:03:09 +00:00
highlight_y = background_area.y + background_area.height - 1;
break;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
_gtk_tree_view_find_node (tree_view, drag_dest_path, &tree, &node);
if (tree == NULL)
break;
gdk_drawable_get_size (tree_view->priv->bin_window,
&width, NULL);
gtk_widget_style_get (widget, "focus-line-width", &focus_line_width, NULL);
gtk_paint_focus (widget->style,
tree_view->priv->bin_window,
Patch from Bill Haneman (with many modifications) to make the focus color Mon Dec 3 16:39:17 2001 Owen Taylor <otaylor@redhat.com> Patch from Bill Haneman (with many modifications) to make the focus color work on dark themes and to make the focus line width configurable. (#61079, #63074) * gtk/gtkwidget.c: Add style properties, ::focus-widget, ::focus-line-width, and ::focus-padding. * gtk/gtkstyle.[ch]: Make gtk_paint_focus() take a state argument as well so we can use fg[STATE] to draw instead of always drawing with black. Cange paint_focus() to respect GtkWidget::focus-width and GtkWidget::focus-line-pattern. Fix continuity problem where the default 1-1 stipple had a blob in one corner and a gap in the other. Change the interpretation of x/y/width/height to be the bounding box of the focus rect instead of the rectangle passed to gdk_draw_rectangle. * gtk/gtkcheckbutton.c gtk/gtklistitem.c gtk/gtknotebook.c gtk/gtkoptionmenu.c gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktextview.c gtk/gtktreeview.c: Handle ::focus-width and ::focus-line-padding. * gtk/gtkentry.c: Handle :;focus-width property; cleanup and remove duplicated code; fix drawing of focus rectangle when interior-focus = FALSE. (#63072, #63073) * gtk/gtkrange.c gtk/gtktext.c gtk/gtktreeitem.c gtk/gtktreeviewcolumn.c: Basic fixups to make compile; Range and TreeViewColumn will need more extensive fixing. * gtk/gtkcolorsel.c: Honor focus line attributes when drawing the focus on the color swatches. (#63071) * gtk/gtkhsv.c: Honor focus line attributes when drawing the focus for the ring and triangle. * docs/widget_geometry.txt: Start at documenting how various widgets are drawn. * gtk/gtkbutton.c (_gtk_button_paint): Export _gtk_button_paint() librarywide, so we don't have duplicate a bunch of code in gtktogglebutton.c. * gtk/gtktogglebutton.c: Use _gtk_button_paint().
2001-12-04 03:27:30 +00:00
GTK_WIDGET_STATE (widget),
NULL,
widget,
Add support for animating expanders. 2001-07-22 Anders Carlsson <andersca@gnome.org> * gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the expander_height and expander_width properties with a single property, expander_size. (gtk_tree_view_init): Set the tab_offset to expander_size plus some padding. (gtk_tree_view_unrealize): Remove the expand/collapse timeout if it exists. (coords_are_over_arrow): Fix a small bug. (gtk_tree_view_motion_draw_column_motion_arrow): Use expander_size. (gtk_tree_view_draw_focus): Use "treeview" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_bin_expose): Use "treeview-drop-indicator" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_deleted): If we have a node currently being expanded or collapsed, remove the timeout and set the node to NULL. (gtk_tree_view_queue_draw_arrow): New function that just redraws the arrow of a node. (gtk_tree_view_draw_arrow): Use expander_size instead of expander_width/expander_height, also pass a different expander_style to gtk_paint_expander depending on the state of the node being drawn. (expand_collapse_timeout): New function for expanding or collapsing a node depending on the previous state. (gtk_tree_view_real_expand_row): Add timeout and set correct state for node being expanded. (gtk_tree_view_real_collapse_row): Add timeout and set correct state for node being collapsed. * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add information about the node currently being expanded or collapsed, and also a timeout id. * gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open with expander_style for draw_expander. * gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with expander_style. (create_expander_affine): New function for creating an expander affine. (apply_affine_on_point): New function for applying an affine to a point. (gtk_default_draw_expander): Modified to take expander_style instead of is_open, and to draw the rectangle rotated differently depending on the expander style. (gtk_paint_expander): Replace is_open with expander_style. * gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor. * gtk/gtkenums.h: Add expander style enum.
2001-07-22 20:09:00 +00:00
"treeview-drop-indicator",
0, BACKGROUND_FIRST_PIXEL (tree_view, tree, node)
- focus_line_width / 2,
width, ROW_HEIGHT (tree_view, BACKGROUND_HEIGHT (node))
- focus_line_width + 1);
break;
}
if (highlight_y >= 0)
{
gdk_draw_line (event->window,
widget->style->black_gc,
highlight_x,
highlight_y,
bin_window_width - highlight_x,
highlight_y);
}
}
The "big treeview focus patch". Fixes several issues and adds some Sun May 5 16:42:32 2002 Kristian Rietveld <kris@gtk.org> The "big treeview focus patch". Fixes several issues and adds some goodies. Related bugs: #73676, #73734, #78660. * gtk/gtktreeview.h: add gtk_tree_view_set_cursor_on_cell * gtk/gtktreeview.c (gtk_tree_view_button_press): focus on a cell if applicable, (gtk_tree_view_bin_expose): set_cell_data before iterating columns, add support for row-spanning focus rectangles, (gtk_tree_view_has_special_cell): new function, (gtk_tree_view_move_cursor_left_right): add support for multiple focusable cells in one column, (gtk_tree_view_set_cursor): call _set_cursor_on_cell now, (gtk_tree_view_set_cursor_on_cell): copy of _set_cursor, extended with focus_cell parameter, (gtk_tree_view_search_iter): removed unused column variable, (gtk_tree_view_start_editing): add neighbor size code to allow for multiple editable cells in one column. * gtk/gtktreeviewcolumn.c (_GtkTreeViewColumnCellInfo): add in_editing_mode field, (gtk_tree_view_column_get_edited_cell): new function, removed _get_editable_cell, (_gtk_tree_view_column_get_cell_at_pos): new function, (gtk_tree_view_column_pack_end): s/g_new/g_new0/ ..., (gtk_tree_view_column_cell_process_action): loads of changes to get it right and to allow for multiple special cells, etc, (gtk_tree_view_column_cell_first): new function, (gtk_tree_view_column_cell_last): ditto, (gtk_tree_view_column_cell_next): ditto, (gtk_tree_view_column_cell_prev): ditto, (gtk_tree_view_column_cell_focus): add left and right parameters, allow for multiple special cells, (gtk_tree_view_column_cell_is_visible): add assertion, (gtk_tree_view_column_focus_cell): new function, (gtk_tree_view_column_stop_editing): unset in_editing_mode flag, (_gtk_tree_view_column_get_neighbor_sizes): iterate through cells correctly * gtk/gtktreeviewcolumn.h: add gtk_tree_view_column_focus_cell * gtk/gtktreeprivate.h: s/_get_editable_cell/_get_edited_cell/, add _gtk_tree_view_column_get_cell_at_pos, add new parameters to _gtk_tree_view_column_cell_focus. * tests/testtreeedit.c: add some cells in order to test new code.
2002-05-05 14:54:00 +00:00
/* draw the big row-spanning focus rectangle, if needed */
if (!has_special_cell && node == cursor &&
GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_DRAW_KEYFOCUS) &&
GTK_WIDGET_HAS_FOCUS (widget))
{
gint width;
GtkStateType focus_rect_state;
focus_rect_state =
flags & GTK_CELL_RENDERER_SELECTED ? GTK_STATE_SELECTED :
(flags & GTK_CELL_RENDERER_PRELIT ? GTK_STATE_PRELIGHT :
(flags & GTK_CELL_RENDERER_INSENSITIVE ? GTK_STATE_INSENSITIVE :
GTK_STATE_NORMAL));
gdk_drawable_get_size (tree_view->priv->bin_window,
&width, NULL);
gtk_paint_focus (widget->style,
tree_view->priv->bin_window,
focus_rect_state,
NULL,
widget,
"treeview",
0,
BACKGROUND_FIRST_PIXEL (tree_view, tree, node),
width,
ROW_HEIGHT (tree_view, BACKGROUND_HEIGHT (node)));
The "big treeview focus patch". Fixes several issues and adds some Sun May 5 16:42:32 2002 Kristian Rietveld <kris@gtk.org> The "big treeview focus patch". Fixes several issues and adds some goodies. Related bugs: #73676, #73734, #78660. * gtk/gtktreeview.h: add gtk_tree_view_set_cursor_on_cell * gtk/gtktreeview.c (gtk_tree_view_button_press): focus on a cell if applicable, (gtk_tree_view_bin_expose): set_cell_data before iterating columns, add support for row-spanning focus rectangles, (gtk_tree_view_has_special_cell): new function, (gtk_tree_view_move_cursor_left_right): add support for multiple focusable cells in one column, (gtk_tree_view_set_cursor): call _set_cursor_on_cell now, (gtk_tree_view_set_cursor_on_cell): copy of _set_cursor, extended with focus_cell parameter, (gtk_tree_view_search_iter): removed unused column variable, (gtk_tree_view_start_editing): add neighbor size code to allow for multiple editable cells in one column. * gtk/gtktreeviewcolumn.c (_GtkTreeViewColumnCellInfo): add in_editing_mode field, (gtk_tree_view_column_get_edited_cell): new function, removed _get_editable_cell, (_gtk_tree_view_column_get_cell_at_pos): new function, (gtk_tree_view_column_pack_end): s/g_new/g_new0/ ..., (gtk_tree_view_column_cell_process_action): loads of changes to get it right and to allow for multiple special cells, etc, (gtk_tree_view_column_cell_first): new function, (gtk_tree_view_column_cell_last): ditto, (gtk_tree_view_column_cell_next): ditto, (gtk_tree_view_column_cell_prev): ditto, (gtk_tree_view_column_cell_focus): add left and right parameters, allow for multiple special cells, (gtk_tree_view_column_cell_is_visible): add assertion, (gtk_tree_view_column_focus_cell): new function, (gtk_tree_view_column_stop_editing): unset in_editing_mode flag, (_gtk_tree_view_column_get_neighbor_sizes): iterate through cells correctly * gtk/gtktreeviewcolumn.h: add gtk_tree_view_column_focus_cell * gtk/gtktreeprivate.h: s/_get_editable_cell/_get_edited_cell/, add _gtk_tree_view_column_get_cell_at_pos, add new parameters to _gtk_tree_view_column_cell_focus. * tests/testtreeedit.c: add some cells in order to test new code.
2002-05-05 14:54:00 +00:00
}
y_offset += max_height;
if (node->children)
{
GtkTreeIter parent = iter;
gboolean has_child;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
tree = node->children;
node = tree->root;
g_assert (node != tree->nil);
while (node->left != tree->nil)
node = node->left;
has_child = gtk_tree_model_iter_children (tree_view->priv->model,
&iter,
&parent);
depth++;
/* Sanity Check! */
TREE_VIEW_INTERNAL_ASSERT (has_child, FALSE);
}
else
{
gboolean done = FALSE;
do
{
node = _gtk_rbtree_next (tree, node);
if (node != NULL)
{
gboolean has_next = gtk_tree_model_iter_next (tree_view->priv->model, &iter);
done = TRUE;
/* Sanity Check! */
TREE_VIEW_INTERNAL_ASSERT (has_next, FALSE);
}
else
{
GtkTreeIter parent_iter = iter;
gboolean has_parent;
node = tree->parent_node;
tree = tree->parent_tree;
if (tree == NULL)
/* we should go to done to free some memory */
goto done;
has_parent = gtk_tree_model_iter_parent (tree_view->priv->model,
&iter,
&parent_iter);
depth--;
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
/* Sanity check */
TREE_VIEW_INTERNAL_ASSERT (has_parent, FALSE);
}
}
while (!done);
}
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
}
while (y_offset < event->area.height);
done:
if (cursor_path)
gtk_tree_path_free (cursor_path);
if (drag_dest_path)
gtk_tree_path_free (drag_dest_path);
return FALSE;
}
static gboolean
gtk_tree_view_expose (GtkWidget *widget,
GdkEventExpose *event)
{
GtkTreeView *tree_view;
g_return_val_if_fail (GTK_IS_TREE_VIEW (widget), FALSE);
tree_view = GTK_TREE_VIEW (widget);
if (event->window == tree_view->priv->bin_window)
{
gboolean retval;
GList *tmp_list;
retval = gtk_tree_view_bin_expose (widget, event);
/* We can't just chain up to Container::expose as it will try to send the
* event to the headers, so we handle propagating it to our children
* (eg. widgets being edited) ourselves.
*/
tmp_list = tree_view->priv->children;
while (tmp_list)
{
GtkTreeViewChild *child = tmp_list->data;
tmp_list = tmp_list->next;
gtk_container_propagate_expose (GTK_CONTAINER (tree_view), child->widget, event);
}
return retval;
}
else if (event->window == tree_view->priv->header_window)
{
GList *list;
for (list = tree_view->priv->columns; list != NULL; list = list->next)
{
GtkTreeViewColumn *column = list->data;
if (column == tree_view->priv->drag_column)
continue;
if (column->visible)
gtk_container_propagate_expose (GTK_CONTAINER (tree_view),
column->button,
event);
}
}
else if (event->window == tree_view->priv->drag_window)
{
gtk_container_propagate_expose (GTK_CONTAINER (tree_view),
tree_view->priv->drag_column->button,
event);
}
return TRUE;
}
enum
{
DROP_HOME,
DROP_RIGHT,
DROP_LEFT,
DROP_END
};
/* returns 0x1 when no column has been found -- yes it's hackish */
static GtkTreeViewColumn *
gtk_tree_view_get_drop_column (GtkTreeView *tree_view,
GtkTreeViewColumn *column,
gint drop_position)
{
GtkTreeViewColumn *left_column = NULL;
GtkTreeViewColumn *cur_column = NULL;
GList *tmp_list;
if (!column->reorderable)
return (GtkTreeViewColumn *)0x1;
switch (drop_position)
{
case DROP_HOME:
/* find first column where we can drop */
tmp_list = tree_view->priv->columns;
if (column == GTK_TREE_VIEW_COLUMN (tmp_list->data))
return (GtkTreeViewColumn *)0x1;
while (tmp_list)
{
g_assert (tmp_list);
cur_column = GTK_TREE_VIEW_COLUMN (tmp_list->data);
tmp_list = tmp_list->next;
if (left_column && left_column->visible == FALSE)
continue;
if (!tree_view->priv->column_drop_func)
return left_column;
if (!(*tree_view->priv->column_drop_func) (tree_view, column, left_column, cur_column, tree_view->priv->column_drop_func_data))
{
left_column = cur_column;
continue;
}
return cur_column;
}
if (!tree_view->priv->column_drop_func)
return left_column;
if ((*tree_view->priv->column_drop_func) (tree_view, column, left_column, NULL, tree_view->priv->column_drop_func_data))
return left_column;
else
return (GtkTreeViewColumn *)0x1;
break;
case DROP_RIGHT:
/* find first column after column where we can drop */
tmp_list = tree_view->priv->columns;
for (; tmp_list; tmp_list = tmp_list->next)
if (GTK_TREE_VIEW_COLUMN (tmp_list->data) == column)
break;
if (!tmp_list || !tmp_list->next)
return (GtkTreeViewColumn *)0x1;
tmp_list = tmp_list->next;
left_column = GTK_TREE_VIEW_COLUMN (tmp_list->data);
tmp_list = tmp_list->next;
while (tmp_list)
{
g_assert (tmp_list);
cur_column = GTK_TREE_VIEW_COLUMN (tmp_list->data);
tmp_list = tmp_list->next;
if (left_column && left_column->visible == FALSE)
{
left_column = cur_column;
if (tmp_list)
tmp_list = tmp_list->next;
continue;
}
if (!tree_view->priv->column_drop_func)
return left_column;
if (!(*tree_view->priv->column_drop_func) (tree_view, column, left_column, cur_column, tree_view->priv->column_drop_func_data))
{
left_column = cur_column;
continue;
}
return cur_column;
}
if (!tree_view->priv->column_drop_func)
return left_column;
if ((*tree_view->priv->column_drop_func) (tree_view, column, left_column, NULL, tree_view->priv->column_drop_func_data))
return left_column;
else
return (GtkTreeViewColumn *)0x1;
break;
case DROP_LEFT:
/* find first column before column where we can drop */
tmp_list = tree_view->priv->columns;
for (; tmp_list; tmp_list = tmp_list->next)
if (GTK_TREE_VIEW_COLUMN (tmp_list->data) == column)
break;
if (!tmp_list || !tmp_list->prev)
return (GtkTreeViewColumn *)0x1;
tmp_list = tmp_list->prev;
cur_column = GTK_TREE_VIEW_COLUMN (tmp_list->data);
tmp_list = tmp_list->prev;
while (tmp_list)
{
g_assert (tmp_list);
left_column = GTK_TREE_VIEW_COLUMN (tmp_list->data);
if (left_column && !left_column->visible)
{
/*if (!tmp_list->prev)
return (GtkTreeViewColumn *)0x1;
*/
/*
cur_column = GTK_TREE_VIEW_COLUMN (tmp_list->prev->data);
tmp_list = tmp_list->prev->prev;
continue;*/
cur_column = left_column;
if (tmp_list)
tmp_list = tmp_list->prev;
continue;
}
if (!tree_view->priv->column_drop_func)
return left_column;
if ((*tree_view->priv->column_drop_func) (tree_view, column, left_column, cur_column, tree_view->priv->column_drop_func_data))
return left_column;
cur_column = left_column;
tmp_list = tmp_list->prev;
}
if (!tree_view->priv->column_drop_func)
return NULL;
if ((*tree_view->priv->column_drop_func) (tree_view, column, NULL, cur_column, tree_view->priv->column_drop_func_data))
return NULL;
else
return (GtkTreeViewColumn *)0x1;
break;
case DROP_END:
/* same as DROP_HOME case, but doing it backwards */
tmp_list = g_list_last (tree_view->priv->columns);
cur_column = NULL;
if (column == GTK_TREE_VIEW_COLUMN (tmp_list->data))
return (GtkTreeViewColumn *)0x1;
while (tmp_list)
{
g_assert (tmp_list);
left_column = GTK_TREE_VIEW_COLUMN (tmp_list->data);
if (left_column && !left_column->visible)
{
cur_column = left_column;
tmp_list = tmp_list->prev;
}
if (!tree_view->priv->column_drop_func)
return left_column;
if ((*tree_view->priv->column_drop_func) (tree_view, column, left_column, cur_column, tree_view->priv->column_drop_func_data))
return left_column;
cur_column = left_column;
tmp_list = tmp_list->prev;
}
if (!tree_view->priv->column_drop_func)
return NULL;
if ((*tree_view->priv->column_drop_func) (tree_view, column, NULL, cur_column, tree_view->priv->column_drop_func_data))
return NULL;
else
return (GtkTreeViewColumn *)0x1;
break;
}
return (GtkTreeViewColumn *)0x1;
}
static gboolean
gtk_tree_view_key_press (GtkWidget *widget,
GdkEventKey *event)
{
GtkTreeView *tree_view = (GtkTreeView *) widget;
GList *list;
gboolean rtl;
rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
if (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_IN_COLUMN_DRAG))
{
if (event->keyval == GDK_Escape)
{
tree_view->priv->cur_reorder = NULL;
gtk_tree_view_button_release_drag_column (widget, NULL);
}
return TRUE;
}
if (tree_view->priv->columns && (event->state & GDK_SHIFT_MASK)
&& (event->keyval == GDK_Left || event->keyval == GDK_KP_Left
|| event->keyval == GDK_Right || event->keyval == GDK_KP_Right))
{
list = tree_view->priv->columns;
while (list)
{
GtkTreeViewColumn *column = GTK_TREE_VIEW_COLUMN (list->data);
if (GTK_WIDGET_HAS_FOCUS (column->button))
{
if (!column->resizable)
return TRUE;
if (event->keyval == GDK_Left || event->keyval == GDK_KP_Left)
{
column->resized_width = MAX (column->resized_width,
column->width);
column->resized_width -= 2;
if (column->resized_width < 0)
column->resized_width = 0;
if (column->min_width == -1)
column->resized_width = MAX (column->button->requisition.width, column->resized_width);
else
column->resized_width = MAX (column->min_width, column->resized_width);
if (column->max_width != -1)
column->resized_width = MIN (column->resized_width, column->max_width);
column->use_resized_width = TRUE;
gtk_widget_queue_resize (widget);
return TRUE;
}
else if (event->keyval == GDK_Right
|| event->keyval == GDK_KP_Right)
{
column->resized_width = MAX (column->resized_width,
column->width);
column->resized_width += 2;
if (column->max_width != -1)
column->resized_width = MIN (column->resized_width, column->max_width);
column->use_resized_width = TRUE;
gtk_widget_queue_resize (widget);
return TRUE;
}
}
list = list->next;
}
}
if (tree_view->priv->columns && (event->state & GDK_CONTROL_MASK) &&
(event->keyval == GDK_Left || event->keyval == GDK_KP_Left
|| event->keyval == GDK_Right || event->keyval == GDK_KP_Right
|| event->keyval == GDK_Home || event->keyval == GDK_KP_Home
|| event->keyval == GDK_End || event->keyval == GDK_KP_End))
{
list = tree_view->priv->columns;
while (list)
{
GtkTreeViewColumn *column = GTK_TREE_VIEW_COLUMN (list->data);
if (GTK_WIDGET_HAS_FOCUS (column->button))
{
if (event->keyval == (rtl ? GDK_Right : GDK_Left)
|| event->keyval == (rtl ? GDK_KP_Right : GDK_KP_Left))
{
GtkTreeViewColumn *col;
col = gtk_tree_view_get_drop_column (tree_view, column, DROP_LEFT);
if (col != (GtkTreeViewColumn *)0x1)
gtk_tree_view_move_column_after (tree_view, column, col);
return TRUE;
}
else if (event->keyval == (rtl ? GDK_Left : GDK_Right)
|| event->keyval == (rtl ? GDK_KP_Left : GDK_KP_Right))
{
GtkTreeViewColumn *col;
col = gtk_tree_view_get_drop_column (tree_view, column, DROP_RIGHT);
if (col != (GtkTreeViewColumn *)0x1)
gtk_tree_view_move_column_after (tree_view, column, col);
return TRUE;
}
else if (event->keyval == GDK_Home
|| event->keyval == GDK_KP_Home)
{
GtkTreeViewColumn *col;
col = gtk_tree_view_get_drop_column (tree_view, column, DROP_HOME);
if (col != (GtkTreeViewColumn *)0x1)
gtk_tree_view_move_column_after (tree_view, column, col);
return TRUE;
}
else if (event->keyval == GDK_End || event->keyval == GDK_KP_End)
{
GtkTreeViewColumn *col;
col = gtk_tree_view_get_drop_column (tree_view, column, DROP_END);
if (col != (GtkTreeViewColumn *)0x1)
gtk_tree_view_move_column_after (tree_view, column, col);
return TRUE;
}
}
list = list->next;
}
}
if (tree_view->priv->columns &&
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_HEADERS_VISIBLE) &&
(event->keyval == GDK_Left || event->keyval == GDK_KP_Left
|| event->keyval == GDK_Right || event->keyval == GDK_KP_Right))
{
gint width = 0;
list = tree_view->priv->columns;
while (list)
{
GtkTreeViewColumn *column = GTK_TREE_VIEW_COLUMN (list->data);
if (GTK_WIDGET_HAS_FOCUS (column->button))
{
if ((event->keyval == (rtl ? GDK_Right : GDK_Left)
|| event->keyval == (rtl ? GDK_KP_Right : GDK_KP_Left))
&& list->prev)
{
GList *tmp;
for (tmp = list->prev; tmp; tmp = tmp->prev)
if (GTK_TREE_VIEW_COLUMN (tmp->data)->visible)
break;
if (!tmp)
return FALSE;
tree_view->priv->focus_column = GTK_TREE_VIEW_COLUMN (tmp->data);
gtk_widget_grab_focus (tree_view->priv->focus_column->button);
width -= tree_view->priv->focus_column->width;
gtk_adjustment_set_value (tree_view->priv->hadjustment, CLAMP (width, tree_view->priv->hadjustment->lower, tree_view->priv->hadjustment->upper - tree_view->priv->hadjustment->page_size));
return TRUE;
}
else if ((event->keyval == (rtl ? GDK_Left : GDK_Right)
|| event->keyval == (rtl ? GDK_KP_Left : GDK_KP_Right))
&& list->next)
{
GList *tmp;
for (tmp = list->next; tmp; tmp = tmp->next)
if (GTK_TREE_VIEW_COLUMN (tmp->data)->visible)
break;
if (!tmp)
return FALSE;
tree_view->priv->focus_column = GTK_TREE_VIEW_COLUMN (tmp->data);
gtk_widget_grab_focus (tree_view->priv->focus_column->button);
width += tree_view->priv->focus_column->width;
gtk_adjustment_set_value (tree_view->priv->hadjustment, CLAMP (width, tree_view->priv->hadjustment->lower, tree_view->priv->hadjustment->upper - tree_view->priv->hadjustment->page_size));
return TRUE;
}
}
width += GTK_TREE_VIEW_COLUMN (list->data)->width;
list = list->next;
}
}
/* Chain up to the parent class. It handles the keybindings. */
if ((* GTK_WIDGET_CLASS (parent_class)->key_press_event) (widget, event))
return TRUE;
/* We pass the event to the search_entry. If its text changes, then we start
* the typeahead find capabilities. */
if (tree_view->priv->enable_search)
{
GdkEvent *new_event;
char *old_text;
const char *new_text;
gboolean retval;
GdkScreen *screen;
gtk_tree_view_ensure_interactive_directory (tree_view);
/* Make a copy of the current text */
old_text = g_strdup (gtk_entry_get_text (GTK_ENTRY (tree_view->priv->search_entry)));
new_event = gdk_event_copy ((GdkEvent *) event);
((GdkEventKey *) new_event)->window = tree_view->priv->search_entry->window;
gtk_widget_realize (tree_view->priv->search_window);
/* Move the entry off screen */
screen = gtk_widget_get_screen (GTK_WIDGET (tree_view));
gtk_window_move (GTK_WINDOW (tree_view->priv->search_window),
gdk_screen_get_width (screen) + 1,
gdk_screen_get_height (screen) + 1);
gtk_widget_show (tree_view->priv->search_window);
/* Send the event to the window. If the preedit_changed signal is emitted
* during this event, we will set priv->imcontext_changed */
tree_view->priv->imcontext_changed = FALSE;
retval = gtk_widget_event (tree_view->priv->search_entry, new_event);
gtk_widget_hide (tree_view->priv->search_window);
/* We check to make sure that the entry tried to handle the text, and that
* the text has changed.
*/
new_text = gtk_entry_get_text (GTK_ENTRY (tree_view->priv->search_entry));
if (tree_view->priv->imcontext_changed || /* we're in a preedit */
(retval && strcmp (old_text, new_text))) /* ...or the text was modified */
{
g_free (old_text);
if (gtk_tree_view_real_start_interactive_search (tree_view, FALSE))
{
gtk_widget_grab_focus (GTK_WIDGET (tree_view));
return TRUE;
}
else
{
gtk_entry_set_text (GTK_ENTRY (tree_view->priv->search_entry), "");
return FALSE;
}
}
}
return FALSE;
}
static gboolean
gtk_tree_view_key_release (GtkWidget *widget,
GdkEventKey *event)
{
return (* GTK_WIDGET_CLASS (parent_class)->key_release_event) (widget, event);
}
Port to GObject, can go back in gdk-pixbuf after setting up a 2000-12-16 Havoc Pennington <hp@pobox.com> * gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c: Port to GObject, can go back in gdk-pixbuf after setting up a gdk-pixbuf-marshal.h header over there. * gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g; (gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal args (gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be set (gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons here, do it when we create the buttons later (gtk_tree_view_realize_buttons): add some g_return_if_fail (gtk_tree_view_map): paranoia checks that column->button is shown and unmapped (gtk_tree_view_size_request): only request visible children. Move header size calculation in here, for cleanliness, and to maintain invariants for child widgets if we eventually let users set different children inside the buttons (gtk_tree_view_map_buttons): factor out code to map buttons, since it was being called several times (gtk_tree_view_size_allocate_buttons): move_resize the drag windows instead of just moving them; their height may change if we allow random widgets in there, or the theme changes. (gtk_tree_view_size_allocate): move button size allocation above emitting the scroll signals, to ensure a sane state when we hit user code (gtk_tree_view_button_release): remove queue_resize after tree_view_set_size(), set_size() will handle any resize queuing that's needed (gtk_tree_view_focus_in): just queue a draw, don't fool with draw_focus goo (gtk_tree_view_focus): use gtk_get_current_event() and gdk_event_get_state() (gtk_tree_view_deleted): don't queue_resize() after calling set_size() (gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove semicolon (gtk_tree_view_create_button): show the button here (gtk_tree_view_button_clicked): actually emit the clicked signal on the column (_gtk_tree_view_set_size): return right away if the size is unchanged, as a cheesy optimization (gtk_tree_view_setup_model): rename set_model_realized to setup_model to match the flag that indicates whether we've called it (gtk_tree_view_get_hadjustment): create adjustment if it doesn't exist, because set_scroll_adjustment does that and it shouldn't matter what order you call these in (gtk_tree_view_get_vadjustment): ditto (gtk_tree_view_set_headers_visible): canonicalize the bool, for paranoia (gtk_tree_view_set_headers_visible): call gtk_tree_view_map_buttons() instead of using cut-and-paste code (gtk_tree_view_append_column): clarify whether the return value is the count of columns before or after, and do the increment separately from the return statement so you can tell from the code. (gtk_tree_view_remove_column): ditto (gtk_tree_view_insert_column): ditto (gtk_tree_view_get_column): remove g_return_if_fail for columns outside the existing range, the docs say that outside-range columns are allowed, so we handle them as documented. (Presumably this allows a nice loop with column != NULL as test.) (gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments mean (left/right/center etc.). (gtk_tree_view_collapse_all): only queue a draw if we're mapped (gtk_tree_view_expand_row): add docs (gtk_tree_view_collapse_row): add docs * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new function to emit the clicked signal on a column * gdk/gdkevents.c (gdk_event_get_state): new function, to get the state of an event (gdk_event_get_time): don't treat GDK_SCROLL as a button event, remove default case from switch so gcc will whine if we don't explicitly handle all event types * gtk/gtktreeselection.h: added some FIXME * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename "columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
/* FIXME Is this function necessary? Can I get an enter_notify event
* w/o either an expose event or a mouse motion event?
*/
static gboolean
gtk_tree_view_enter_notify (GtkWidget *widget,
GdkEventCrossing *event)
{
GtkTreeView *tree_view;
GtkRBTree *tree;
GtkRBNode *node;
gint new_y;
g_return_val_if_fail (GTK_IS_TREE_VIEW (widget), FALSE);
tree_view = GTK_TREE_VIEW (widget);
/* Sanity check it */
if (event->window != tree_view->priv->bin_window)
return FALSE;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
if (tree_view->priv->tree == NULL)
return FALSE;
/* find the node internally */
new_y = TREE_WINDOW_Y_TO_RBTREE_Y(tree_view, event->y);
if (new_y < 0)
new_y = 0;
_gtk_rbtree_find_offset (tree_view->priv->tree, new_y, &tree, &node);
if ((tree_view->priv->button_pressed_node == NULL) ||
(tree_view->priv->button_pressed_node == node))
prelight_or_select (tree_view, tree, node, event->x, event->y);
return TRUE;
}
static gboolean
gtk_tree_view_leave_notify (GtkWidget *widget,
GdkEventCrossing *event)
{
GtkTreeView *tree_view;
g_return_val_if_fail (GTK_IS_TREE_VIEW (widget), FALSE);
if (event->mode == GDK_CROSSING_GRAB)
return TRUE;
tree_view = GTK_TREE_VIEW (widget);
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
if (tree_view->priv->prelight_node)
_gtk_tree_view_queue_draw_node (tree_view,
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
tree_view->priv->prelight_tree,
tree_view->priv->prelight_node,
NULL);
prelight_or_select (tree_view,
NULL, NULL,
-1000, -1000); /* coords not possibly over an arrow */
return TRUE;
}
static gint
gtk_tree_view_focus_out (GtkWidget *widget,
GdkEventFocus *event)
{
GtkTreeView *tree_view;
tree_view = GTK_TREE_VIEW (widget);
gtk_widget_queue_draw (widget);
/* destroy interactive search dialog */
if (tree_view->priv->search_window)
gtk_tree_view_search_dialog_hide (tree_view->priv->search_window, tree_view);
return FALSE;
}
/* Incremental Reflow
*/
static void
gtk_tree_view_node_queue_redraw (GtkTreeView *tree_view,
GtkRBTree *tree,
GtkRBNode *node)
{
gint y;
y = _gtk_rbtree_node_find_offset (tree, node);
gtk_widget_queue_draw_area (GTK_WIDGET (tree_view),
0, y,
GTK_WIDGET (tree_view)->requisition.width,
GTK_RBNODE_GET_HEIGHT (node));
}
/* Returns TRUE if it updated the size
*/
static gboolean
validate_row (GtkTreeView *tree_view,
GtkRBTree *tree,
GtkRBNode *node,
GtkTreeIter *iter,
GtkTreePath *path)
{
GtkTreeViewColumn *column;
GList *list;
gint height = 0;
gint horizontal_separator;
gint depth = gtk_tree_path_get_depth (path);
gboolean retval = FALSE;
Support separators in combo boxes and more generally in tree views 2004-07-07 Matthias Clasen <mclasen@redhat.com> Support separators in combo boxes and more generally in tree views (#135873): * gtk/gtkcombobox.h: * gtk/gtkcombobox.c (gtk_combo_box_get_row_separator_column): * gtk/gtkcombobox.c (gtk_combo_box_set_row_separator_column): Add a ::row-separator-column property with getter and setter, which can indicate a boolean model column to determine which rows are separators. * gtk/gtkcombobox.c: Display separator rows as separator menu items in menu mode, and by using the new treeview separator functionality in list mode. * gtk/gtktreeview.h: * gtk/gtktreeview.c (gtk_tree_view_get_row_separator_func): * gtk/gtktreeview.c (gtk_tree_view_set_row_separator_func): Add a callback to determine whether a row is a separator. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): * gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon): * gtk/gtktreeview.c (validate_row): Use the new callback to determine whether a row is a separator, and draw it as a separator then. Since separators should take up less vertical space than regular rows, this requires removing the redundant MAX(...,expander_size) calls which appear in many places. Instead, the MAX() is now only done in validate_row(), and only if the row is not a separator. To catch possible side effects of this intrusive change, I have left EXPANDER_MAX() calls in place of the MAX() calls which will emit a warning if something breaks. They should be removed before 2.6. * gtk/gtktreeselection.c (row_is_selectable): Don't let separator rows be selected. * tests/testcombo.c (create_blaat): Add a separator column.
2004-07-07 15:15:35 +00:00
gboolean is_separator = FALSE;
gint focus_pad;
/* double check the row needs validating */
if (! GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_INVALID) &&
! GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_COLUMN_INVALID))
return FALSE;
Support separators in combo boxes and more generally in tree views 2004-07-07 Matthias Clasen <mclasen@redhat.com> Support separators in combo boxes and more generally in tree views (#135873): * gtk/gtkcombobox.h: * gtk/gtkcombobox.c (gtk_combo_box_get_row_separator_column): * gtk/gtkcombobox.c (gtk_combo_box_set_row_separator_column): Add a ::row-separator-column property with getter and setter, which can indicate a boolean model column to determine which rows are separators. * gtk/gtkcombobox.c: Display separator rows as separator menu items in menu mode, and by using the new treeview separator functionality in list mode. * gtk/gtktreeview.h: * gtk/gtktreeview.c (gtk_tree_view_get_row_separator_func): * gtk/gtktreeview.c (gtk_tree_view_set_row_separator_func): Add a callback to determine whether a row is a separator. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): * gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon): * gtk/gtktreeview.c (validate_row): Use the new callback to determine whether a row is a separator, and draw it as a separator then. Since separators should take up less vertical space than regular rows, this requires removing the redundant MAX(...,expander_size) calls which appear in many places. Instead, the MAX() is now only done in validate_row(), and only if the row is not a separator. To catch possible side effects of this intrusive change, I have left EXPANDER_MAX() calls in place of the MAX() calls which will emit a warning if something breaks. They should be removed before 2.6. * gtk/gtktreeselection.c (row_is_selectable): Don't let separator rows be selected. * tests/testcombo.c (create_blaat): Add a separator column.
2004-07-07 15:15:35 +00:00
if (tree_view->priv->row_separator_func)
{
is_separator = (* tree_view->priv->row_separator_func) (tree_view->priv->model,
iter,
tree_view->priv->row_separator_data);
}
gtk_widget_style_get (GTK_WIDGET (tree_view),
Support separators in combo boxes and more generally in tree views 2004-07-07 Matthias Clasen <mclasen@redhat.com> Support separators in combo boxes and more generally in tree views (#135873): * gtk/gtkcombobox.h: * gtk/gtkcombobox.c (gtk_combo_box_get_row_separator_column): * gtk/gtkcombobox.c (gtk_combo_box_set_row_separator_column): Add a ::row-separator-column property with getter and setter, which can indicate a boolean model column to determine which rows are separators. * gtk/gtkcombobox.c: Display separator rows as separator menu items in menu mode, and by using the new treeview separator functionality in list mode. * gtk/gtktreeview.h: * gtk/gtktreeview.c (gtk_tree_view_get_row_separator_func): * gtk/gtktreeview.c (gtk_tree_view_set_row_separator_func): Add a callback to determine whether a row is a separator. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): * gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon): * gtk/gtktreeview.c (validate_row): Use the new callback to determine whether a row is a separator, and draw it as a separator then. Since separators should take up less vertical space than regular rows, this requires removing the redundant MAX(...,expander_size) calls which appear in many places. Instead, the MAX() is now only done in validate_row(), and only if the row is not a separator. To catch possible side effects of this intrusive change, I have left EXPANDER_MAX() calls in place of the MAX() calls which will emit a warning if something breaks. They should be removed before 2.6. * gtk/gtktreeselection.c (row_is_selectable): Don't let separator rows be selected. * tests/testcombo.c (create_blaat): Add a separator column.
2004-07-07 15:15:35 +00:00
"focus-padding", &focus_pad,
"horizontal_separator", &horizontal_separator,
NULL);
Support separators in combo boxes and more generally in tree views 2004-07-07 Matthias Clasen <mclasen@redhat.com> Support separators in combo boxes and more generally in tree views (#135873): * gtk/gtkcombobox.h: * gtk/gtkcombobox.c (gtk_combo_box_get_row_separator_column): * gtk/gtkcombobox.c (gtk_combo_box_set_row_separator_column): Add a ::row-separator-column property with getter and setter, which can indicate a boolean model column to determine which rows are separators. * gtk/gtkcombobox.c: Display separator rows as separator menu items in menu mode, and by using the new treeview separator functionality in list mode. * gtk/gtktreeview.h: * gtk/gtktreeview.c (gtk_tree_view_get_row_separator_func): * gtk/gtktreeview.c (gtk_tree_view_set_row_separator_func): Add a callback to determine whether a row is a separator. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): * gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon): * gtk/gtktreeview.c (validate_row): Use the new callback to determine whether a row is a separator, and draw it as a separator then. Since separators should take up less vertical space than regular rows, this requires removing the redundant MAX(...,expander_size) calls which appear in many places. Instead, the MAX() is now only done in validate_row(), and only if the row is not a separator. To catch possible side effects of this intrusive change, I have left EXPANDER_MAX() calls in place of the MAX() calls which will emit a warning if something breaks. They should be removed before 2.6. * gtk/gtktreeselection.c (row_is_selectable): Don't let separator rows be selected. * tests/testcombo.c (create_blaat): Add a separator column.
2004-07-07 15:15:35 +00:00
for (list = tree_view->priv->columns; list; list = list->next)
{
gint tmp_width;
gint tmp_height;
column = list->data;
if (! column->visible)
continue;
if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_COLUMN_INVALID) && !column->dirty)
continue;
gtk_tree_view_column_cell_set_cell_data (column, tree_view->priv->model, iter,
GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_PARENT),
node->children?TRUE:FALSE);
gtk_tree_view_column_cell_get_size (column,
NULL, NULL, NULL,
&tmp_width, &tmp_height);
API additions: _move, _reorder and _swap for stores, path constructor. Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org> API additions: _move, _reorder and _swap for stores, path constructor. * gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function. * gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private), gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move. * gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private), gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move. Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org> Merge from stable: * gtk/gtktreestore.c (node_free): return FALSE, (gtk_tree_store_finalize): use g_node_traverse instead of g_node_children_foreach, so the whole tree will be freed (#88854, patch from Emmanuel Briot). Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org> Merge from stable: * gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks, (#84426, patch from Matthias Clasen). Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org> Merge from stable: * gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children check shouldn't be in g_return_return_val_if_fail (pointed out by Josh Green, #88997), (gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model for each column when we unset the model (part of #82484), (gtk_tree_view_get_cell_area): return if we ran out of tree or if we got an invalid path (#82376). * gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model. * gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model which disconnects the sort_column_changed_signal (part of #82484). * gtk/gtkliststore.c (gtk_list_store_insert): append row if the given postion is off the end of the tree (#85813). * gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use 2-space indent, commit changes if up/down keys has been pressed, this overrides the focus key foo so the user won't be surprised (#84665).
2002-07-26 20:51:13 +00:00
Support separators in combo boxes and more generally in tree views 2004-07-07 Matthias Clasen <mclasen@redhat.com> Support separators in combo boxes and more generally in tree views (#135873): * gtk/gtkcombobox.h: * gtk/gtkcombobox.c (gtk_combo_box_get_row_separator_column): * gtk/gtkcombobox.c (gtk_combo_box_set_row_separator_column): Add a ::row-separator-column property with getter and setter, which can indicate a boolean model column to determine which rows are separators. * gtk/gtkcombobox.c: Display separator rows as separator menu items in menu mode, and by using the new treeview separator functionality in list mode. * gtk/gtktreeview.h: * gtk/gtktreeview.c (gtk_tree_view_get_row_separator_func): * gtk/gtktreeview.c (gtk_tree_view_set_row_separator_func): Add a callback to determine whether a row is a separator. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): * gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon): * gtk/gtktreeview.c (validate_row): Use the new callback to determine whether a row is a separator, and draw it as a separator then. Since separators should take up less vertical space than regular rows, this requires removing the redundant MAX(...,expander_size) calls which appear in many places. Instead, the MAX() is now only done in validate_row(), and only if the row is not a separator. To catch possible side effects of this intrusive change, I have left EXPANDER_MAX() calls in place of the MAX() calls which will emit a warning if something breaks. They should be removed before 2.6. * gtk/gtktreeselection.c (row_is_selectable): Don't let separator rows be selected. * tests/testcombo.c (create_blaat): Add a separator column.
2004-07-07 15:15:35 +00:00
if (!is_separator)
{
height = MAX (height, tmp_height);
height = MAX (height, tree_view->priv->expander_size);
}
else
height = 2 + 2 * focus_pad;
if (gtk_tree_view_is_expander_column (tree_view, column) && TREE_VIEW_DRAW_EXPANDERS (tree_view))
{
tmp_width = tmp_width + horizontal_separator + depth * (tree_view->priv->expander_size);
}
else
tmp_width = tmp_width + horizontal_separator;
if (tmp_width > column->requested_width)
{
retval = TRUE;
column->requested_width = tmp_width;
}
}
if (height != GTK_RBNODE_GET_HEIGHT (node))
{
retval = TRUE;
_gtk_rbtree_node_set_height (tree, node, height);
}
_gtk_rbtree_node_mark_valid (tree, node);
return retval;
}
static void
validate_visible_area (GtkTreeView *tree_view)
{
GtkTreePath *path = NULL;
GtkTreePath *above_path = NULL;
GtkTreeIter iter;
GtkRBTree *tree = NULL;
GtkRBNode *node = NULL;
gboolean need_redraw = FALSE;
gboolean size_changed = FALSE;
gboolean update_dy = FALSE;
gint total_height;
gint area_above = 0;
gint area_below = 0;
if (tree_view->priv->tree == NULL)
return;
start implementing Thu Mar 7 02:58:16 2002 Jonathan Blandford <jrb@redhat.com> * gtk/tmpl/gtkliststore.sgml: start implementing * gtk/question_index.sgml: "I can set with the tree, but not get???!?!" Wed Mar 6 23:20:51 2002 Jonathan Blandford <jrb@redhat.com> and Kristian Rietveld <kris@gtk.org> Finishing touch for 2.0.0 release, fixes #70782, #72729, the 'stealth' bug and other last-minute minor issues. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): set dnd dest line drawing right. We can't draw the line at the position of the next row, because that one still has to be drawn. So draw everthing at a -1 offset. (validate_visible_area): add check for invalid descendants and NULL scroll_to_path path, get scrolling right. Also, fix the area_above value. Pretty amazing I got it wrong. (get_logical_dest_row): add gtk-tree-model-drop-append magic, so dragging a row to the end of the model works right. (gtk_tree_view_get_dest_row_at_pos): minor floating point fix (gtk_tree_view_start_editing): add call to validate_row (gtk_tree_view_tree_to_widget_coords): Never subtract HEADER_HEIGHT from y values anymore!!! (gtk_tree_view_widget_coords_to_tree): ditto. (gtk_tree_view_scroll_to_point): allow -1 as values for the scroll_to coords (gtk_tree_view_move_cursor_page_up_down): Don't need scroll_to_y as clamp_node_visible will make it work. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): also check path depth, as we can't get iters from empty paths * gtk/gtkliststore.c (gtk_list_store_drag_data_received): handle gtk-tree-model-drop-append * gtk/gtktreednd.c (gtk_tree_set_row_drag_data): free path_str * tests/testtreeflow.c (main): select path where we are scrolling to
2002-03-07 08:03:09 +00:00
if (! GTK_RBNODE_FLAG_SET (tree_view->priv->tree->root, GTK_RBNODE_DESCENDANTS_INVALID) &&
tree_view->priv->scroll_to_path == NULL)
return;
start implementing Thu Mar 7 02:58:16 2002 Jonathan Blandford <jrb@redhat.com> * gtk/tmpl/gtkliststore.sgml: start implementing * gtk/question_index.sgml: "I can set with the tree, but not get???!?!" Wed Mar 6 23:20:51 2002 Jonathan Blandford <jrb@redhat.com> and Kristian Rietveld <kris@gtk.org> Finishing touch for 2.0.0 release, fixes #70782, #72729, the 'stealth' bug and other last-minute minor issues. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): set dnd dest line drawing right. We can't draw the line at the position of the next row, because that one still has to be drawn. So draw everthing at a -1 offset. (validate_visible_area): add check for invalid descendants and NULL scroll_to_path path, get scrolling right. Also, fix the area_above value. Pretty amazing I got it wrong. (get_logical_dest_row): add gtk-tree-model-drop-append magic, so dragging a row to the end of the model works right. (gtk_tree_view_get_dest_row_at_pos): minor floating point fix (gtk_tree_view_start_editing): add call to validate_row (gtk_tree_view_tree_to_widget_coords): Never subtract HEADER_HEIGHT from y values anymore!!! (gtk_tree_view_widget_coords_to_tree): ditto. (gtk_tree_view_scroll_to_point): allow -1 as values for the scroll_to coords (gtk_tree_view_move_cursor_page_up_down): Don't need scroll_to_y as clamp_node_visible will make it work. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): also check path depth, as we can't get iters from empty paths * gtk/gtkliststore.c (gtk_list_store_drag_data_received): handle gtk-tree-model-drop-append * gtk/gtktreednd.c (gtk_tree_set_row_drag_data): free path_str * tests/testtreeflow.c (main): select path where we are scrolling to
2002-03-07 08:03:09 +00:00
total_height = GTK_WIDGET (tree_view)->allocation.height - TREE_VIEW_HEADER_HEIGHT (tree_view);
if (total_height == 0)
return;
/* First, we check to see if we need to scroll anywhere
*/
if (tree_view->priv->scroll_to_path)
{
path = gtk_tree_row_reference_get_path (tree_view->priv->scroll_to_path);
if (path && !_gtk_tree_view_find_node (tree_view, path, &tree, &node))
{
gtk_tree_model_get_iter (tree_view->priv->model, &iter, path);
if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_INVALID) ||
GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_COLUMN_INVALID))
{
need_redraw = TRUE;
if (validate_row (tree_view, tree, node, &iter, path))
size_changed = TRUE;
}
if (tree_view->priv->scroll_to_use_align)
{
gint height = ROW_HEIGHT (tree_view, GTK_RBNODE_GET_HEIGHT (node));
area_above = (total_height - height) *
tree_view->priv->scroll_to_row_align;
start implementing Thu Mar 7 02:58:16 2002 Jonathan Blandford <jrb@redhat.com> * gtk/tmpl/gtkliststore.sgml: start implementing * gtk/question_index.sgml: "I can set with the tree, but not get???!?!" Wed Mar 6 23:20:51 2002 Jonathan Blandford <jrb@redhat.com> and Kristian Rietveld <kris@gtk.org> Finishing touch for 2.0.0 release, fixes #70782, #72729, the 'stealth' bug and other last-minute minor issues. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): set dnd dest line drawing right. We can't draw the line at the position of the next row, because that one still has to be drawn. So draw everthing at a -1 offset. (validate_visible_area): add check for invalid descendants and NULL scroll_to_path path, get scrolling right. Also, fix the area_above value. Pretty amazing I got it wrong. (get_logical_dest_row): add gtk-tree-model-drop-append magic, so dragging a row to the end of the model works right. (gtk_tree_view_get_dest_row_at_pos): minor floating point fix (gtk_tree_view_start_editing): add call to validate_row (gtk_tree_view_tree_to_widget_coords): Never subtract HEADER_HEIGHT from y values anymore!!! (gtk_tree_view_widget_coords_to_tree): ditto. (gtk_tree_view_scroll_to_point): allow -1 as values for the scroll_to coords (gtk_tree_view_move_cursor_page_up_down): Don't need scroll_to_y as clamp_node_visible will make it work. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): also check path depth, as we can't get iters from empty paths * gtk/gtkliststore.c (gtk_list_store_drag_data_received): handle gtk-tree-model-drop-append * gtk/gtktreednd.c (gtk_tree_set_row_drag_data): free path_str * tests/testtreeflow.c (main): select path where we are scrolling to
2002-03-07 08:03:09 +00:00
area_below = total_height - area_above - height;
area_above = MAX (area_above, 0);
area_below = MAX (area_below, 0);
}
else
{
/* two cases:
* 1) row not visible
* 2) row visible
*/
gint dy;
gint height = ROW_HEIGHT (tree_view, GTK_RBNODE_GET_HEIGHT (node));
dy = _gtk_rbtree_node_find_offset (tree, node);
if (dy >= tree_view->priv->vadjustment->value &&
dy < (tree_view->priv->vadjustment->value
+ tree_view->priv->vadjustment->page_size))
{
/* row visible: keep the row at the same position */
area_above = dy - tree_view->priv->vadjustment->value;
area_below = (tree_view->priv->vadjustment->value +
tree_view->priv->vadjustment->page_size)
- dy - height;
}
else
{
/* row not visible */
update_dy = TRUE;
if (dy >= 0 && dy <= tree_view->priv->vadjustment->page_size)
{
/* row at the beginning -- fixed */
area_above = dy;
area_below = tree_view->priv->vadjustment->page_size
- area_above - height;
}
else if (dy >= (tree_view->priv->vadjustment->upper -
tree_view->priv->vadjustment->page_size)
&& dy <= tree_view->priv->vadjustment->upper)
{
/* row at the end -- fixed */
area_above = dy - (tree_view->priv->vadjustment->upper -
tree_view->priv->vadjustment->page_size);
area_below = tree_view->priv->vadjustment->page_size -
area_above - height;
if (area_below < 0)
{
area_above += area_below;
area_below = 0;
}
}
else
{
/* row somewhere in the middle, bring it to the top
* of the view
*/
area_above = 0;
area_below = total_height - height;
}
}
}
}
else
/* the scroll to isn't valid; ignore it.
*/
{
if (tree_view->priv->scroll_to_path && !path)
{
gtk_tree_row_reference_free (tree_view->priv->scroll_to_path);
tree_view->priv->scroll_to_path = NULL;
}
if (path)
gtk_tree_path_free (path);
path = NULL;
}
}
/* We didn't have a scroll_to set, so we just handle things normally
*/
if (path == NULL)
{
gint offset;
offset = _gtk_rbtree_find_offset (tree_view->priv->tree,
TREE_WINDOW_Y_TO_RBTREE_Y (tree_view, 0),
&tree, &node);
if (node == NULL)
{
/* In this case, nothing has been validated */
path = gtk_tree_path_new_first ();
_gtk_tree_view_find_node (tree_view, path, &tree, &node);
}
else
{
path = _gtk_tree_view_find_path (tree_view, tree, node);
total_height += offset;
}
gtk_tree_model_get_iter (tree_view->priv->model, &iter, path);
if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_INVALID) ||
GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_COLUMN_INVALID))
{
need_redraw = TRUE;
if (validate_row (tree_view, tree, node, &iter, path))
size_changed = TRUE;
}
area_above = 0;
area_below = total_height - ROW_HEIGHT (tree_view, GTK_RBNODE_GET_HEIGHT (node));
}
above_path = gtk_tree_path_copy (path);
/* Now, we walk forwards and backwards, measuring rows. Unfortunately,
* backwards is much slower then forward, as there is no iter_prev function.
* We go forwards first in case we run out of tree. Then we go backwards to
* fill out the top.
*/
while (node && area_below > 0)
{
gint new_height;
if (node->children)
{
GtkTreeIter parent = iter;
gboolean has_child;
tree = node->children;
node = tree->root;
g_assert (node != tree->nil);
while (node->left != tree->nil)
node = node->left;
has_child = gtk_tree_model_iter_children (tree_view->priv->model,
&iter,
&parent);
TREE_VIEW_INTERNAL_ASSERT_VOID (has_child);
gtk_tree_path_down (path);
}
else
{
gboolean done = FALSE;
do
{
node = _gtk_rbtree_next (tree, node);
if (node != NULL)
{
gboolean has_next = gtk_tree_model_iter_next (tree_view->priv->model, &iter);
done = TRUE;
gtk_tree_path_next (path);
/* Sanity Check! */
TREE_VIEW_INTERNAL_ASSERT_VOID (has_next);
}
else
{
GtkTreeIter parent_iter = iter;
gboolean has_parent;
node = tree->parent_node;
tree = tree->parent_tree;
if (tree == NULL)
break;
has_parent = gtk_tree_model_iter_parent (tree_view->priv->model,
&iter,
&parent_iter);
gtk_tree_path_up (path);
/* Sanity check */
TREE_VIEW_INTERNAL_ASSERT_VOID (has_parent);
}
}
while (!done);
}
if (!node)
break;
new_height = GTK_RBNODE_GET_HEIGHT (node);
if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_INVALID) ||
GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_COLUMN_INVALID))
{
gint old_height = new_height;
need_redraw = TRUE;
if (validate_row (tree_view, tree, node, &iter, path))
{
new_height = GTK_RBNODE_GET_HEIGHT (node);
size_changed = TRUE;
area_below -= new_height - old_height;
}
}
area_below -= ROW_HEIGHT (tree_view, new_height);
}
gtk_tree_path_free (path);
/* If we ran out of tree, and have extra area_below left, we need to add it
* to area_above */
if (area_below > 0)
area_above += area_below;
_gtk_tree_view_find_node (tree_view, above_path, &tree, &node);
start implementing Thu Mar 7 02:58:16 2002 Jonathan Blandford <jrb@redhat.com> * gtk/tmpl/gtkliststore.sgml: start implementing * gtk/question_index.sgml: "I can set with the tree, but not get???!?!" Wed Mar 6 23:20:51 2002 Jonathan Blandford <jrb@redhat.com> and Kristian Rietveld <kris@gtk.org> Finishing touch for 2.0.0 release, fixes #70782, #72729, the 'stealth' bug and other last-minute minor issues. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): set dnd dest line drawing right. We can't draw the line at the position of the next row, because that one still has to be drawn. So draw everthing at a -1 offset. (validate_visible_area): add check for invalid descendants and NULL scroll_to_path path, get scrolling right. Also, fix the area_above value. Pretty amazing I got it wrong. (get_logical_dest_row): add gtk-tree-model-drop-append magic, so dragging a row to the end of the model works right. (gtk_tree_view_get_dest_row_at_pos): minor floating point fix (gtk_tree_view_start_editing): add call to validate_row (gtk_tree_view_tree_to_widget_coords): Never subtract HEADER_HEIGHT from y values anymore!!! (gtk_tree_view_widget_coords_to_tree): ditto. (gtk_tree_view_scroll_to_point): allow -1 as values for the scroll_to coords (gtk_tree_view_move_cursor_page_up_down): Don't need scroll_to_y as clamp_node_visible will make it work. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): also check path depth, as we can't get iters from empty paths * gtk/gtkliststore.c (gtk_list_store_drag_data_received): handle gtk-tree-model-drop-append * gtk/gtktreednd.c (gtk_tree_set_row_drag_data): free path_str * tests/testtreeflow.c (main): select path where we are scrolling to
2002-03-07 08:03:09 +00:00
/* We walk backwards */
while (area_above > 0)
{
gint new_height;
start implementing Thu Mar 7 02:58:16 2002 Jonathan Blandford <jrb@redhat.com> * gtk/tmpl/gtkliststore.sgml: start implementing * gtk/question_index.sgml: "I can set with the tree, but not get???!?!" Wed Mar 6 23:20:51 2002 Jonathan Blandford <jrb@redhat.com> and Kristian Rietveld <kris@gtk.org> Finishing touch for 2.0.0 release, fixes #70782, #72729, the 'stealth' bug and other last-minute minor issues. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): set dnd dest line drawing right. We can't draw the line at the position of the next row, because that one still has to be drawn. So draw everthing at a -1 offset. (validate_visible_area): add check for invalid descendants and NULL scroll_to_path path, get scrolling right. Also, fix the area_above value. Pretty amazing I got it wrong. (get_logical_dest_row): add gtk-tree-model-drop-append magic, so dragging a row to the end of the model works right. (gtk_tree_view_get_dest_row_at_pos): minor floating point fix (gtk_tree_view_start_editing): add call to validate_row (gtk_tree_view_tree_to_widget_coords): Never subtract HEADER_HEIGHT from y values anymore!!! (gtk_tree_view_widget_coords_to_tree): ditto. (gtk_tree_view_scroll_to_point): allow -1 as values for the scroll_to coords (gtk_tree_view_move_cursor_page_up_down): Don't need scroll_to_y as clamp_node_visible will make it work. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): also check path depth, as we can't get iters from empty paths * gtk/gtkliststore.c (gtk_list_store_drag_data_received): handle gtk-tree-model-drop-append * gtk/gtktreednd.c (gtk_tree_set_row_drag_data): free path_str * tests/testtreeflow.c (main): select path where we are scrolling to
2002-03-07 08:03:09 +00:00
_gtk_rbtree_prev_full (tree, node, &tree, &node);
if (! gtk_tree_path_prev (above_path) && node != NULL)
{
gtk_tree_path_free (above_path);
above_path = _gtk_tree_view_find_path (tree_view, tree, node);
}
gtk_tree_model_get_iter (tree_view->priv->model, &iter, above_path);
start implementing Thu Mar 7 02:58:16 2002 Jonathan Blandford <jrb@redhat.com> * gtk/tmpl/gtkliststore.sgml: start implementing * gtk/question_index.sgml: "I can set with the tree, but not get???!?!" Wed Mar 6 23:20:51 2002 Jonathan Blandford <jrb@redhat.com> and Kristian Rietveld <kris@gtk.org> Finishing touch for 2.0.0 release, fixes #70782, #72729, the 'stealth' bug and other last-minute minor issues. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): set dnd dest line drawing right. We can't draw the line at the position of the next row, because that one still has to be drawn. So draw everthing at a -1 offset. (validate_visible_area): add check for invalid descendants and NULL scroll_to_path path, get scrolling right. Also, fix the area_above value. Pretty amazing I got it wrong. (get_logical_dest_row): add gtk-tree-model-drop-append magic, so dragging a row to the end of the model works right. (gtk_tree_view_get_dest_row_at_pos): minor floating point fix (gtk_tree_view_start_editing): add call to validate_row (gtk_tree_view_tree_to_widget_coords): Never subtract HEADER_HEIGHT from y values anymore!!! (gtk_tree_view_widget_coords_to_tree): ditto. (gtk_tree_view_scroll_to_point): allow -1 as values for the scroll_to coords (gtk_tree_view_move_cursor_page_up_down): Don't need scroll_to_y as clamp_node_visible will make it work. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): also check path depth, as we can't get iters from empty paths * gtk/gtkliststore.c (gtk_list_store_drag_data_received): handle gtk-tree-model-drop-append * gtk/gtktreednd.c (gtk_tree_set_row_drag_data): free path_str * tests/testtreeflow.c (main): select path where we are scrolling to
2002-03-07 08:03:09 +00:00
if (node == NULL)
break;
new_height = GTK_RBNODE_GET_HEIGHT (node);
if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_INVALID) ||
GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_COLUMN_INVALID))
{
gint old_height = new_height;
need_redraw = TRUE;
if (validate_row (tree_view, tree, node, &iter, above_path))
{
new_height = GTK_RBNODE_GET_HEIGHT (node);
size_changed = TRUE;
area_above -= new_height - old_height;
}
}
area_above -= ROW_HEIGHT (tree_view, new_height);
update_dy = TRUE;
}
if (size_changed)
{
GtkRequisition requisition;
/* We temporarily guess a size, under the assumption that it will be the
* same when we get our next size_allocate. If we don't do this, we'll be
* in an inconsistent state if we call top_row_to_dy. */
gtk_widget_size_request (GTK_WIDGET (tree_view), &requisition);
tree_view->priv->hadjustment->upper = MAX (tree_view->priv->hadjustment->upper, (gfloat)requisition.width);
tree_view->priv->vadjustment->upper = MAX (tree_view->priv->vadjustment->upper, (gfloat)requisition.height);
gtk_adjustment_changed (tree_view->priv->hadjustment);
gtk_adjustment_changed (tree_view->priv->vadjustment);
gtk_widget_queue_resize (GTK_WIDGET (tree_view));
}
/* if we scroll at all, always update dy and kill the top_row */
if (tree_view->priv->scroll_to_path &&
! GTK_RBNODE_FLAG_SET (tree_view->priv->tree->root, GTK_RBNODE_DESCENDANTS_INVALID))
{
update_dy = TRUE;
if (tree_view->priv->top_row)
{
gtk_tree_row_reference_free (tree_view->priv->top_row);
tree_view->priv->top_row = NULL;
}
}
/* if we walk backwards at all, then we need to reset our dy. */
if (update_dy)
{
gint dy;
start implementing Thu Mar 7 02:58:16 2002 Jonathan Blandford <jrb@redhat.com> * gtk/tmpl/gtkliststore.sgml: start implementing * gtk/question_index.sgml: "I can set with the tree, but not get???!?!" Wed Mar 6 23:20:51 2002 Jonathan Blandford <jrb@redhat.com> and Kristian Rietveld <kris@gtk.org> Finishing touch for 2.0.0 release, fixes #70782, #72729, the 'stealth' bug and other last-minute minor issues. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): set dnd dest line drawing right. We can't draw the line at the position of the next row, because that one still has to be drawn. So draw everthing at a -1 offset. (validate_visible_area): add check for invalid descendants and NULL scroll_to_path path, get scrolling right. Also, fix the area_above value. Pretty amazing I got it wrong. (get_logical_dest_row): add gtk-tree-model-drop-append magic, so dragging a row to the end of the model works right. (gtk_tree_view_get_dest_row_at_pos): minor floating point fix (gtk_tree_view_start_editing): add call to validate_row (gtk_tree_view_tree_to_widget_coords): Never subtract HEADER_HEIGHT from y values anymore!!! (gtk_tree_view_widget_coords_to_tree): ditto. (gtk_tree_view_scroll_to_point): allow -1 as values for the scroll_to coords (gtk_tree_view_move_cursor_page_up_down): Don't need scroll_to_y as clamp_node_visible will make it work. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): also check path depth, as we can't get iters from empty paths * gtk/gtkliststore.c (gtk_list_store_drag_data_received): handle gtk-tree-model-drop-append * gtk/gtktreednd.c (gtk_tree_set_row_drag_data): free path_str * tests/testtreeflow.c (main): select path where we are scrolling to
2002-03-07 08:03:09 +00:00
if (node != NULL)
{
dy = _gtk_rbtree_node_find_offset (tree, node) - area_above;
start implementing Thu Mar 7 02:58:16 2002 Jonathan Blandford <jrb@redhat.com> * gtk/tmpl/gtkliststore.sgml: start implementing * gtk/question_index.sgml: "I can set with the tree, but not get???!?!" Wed Mar 6 23:20:51 2002 Jonathan Blandford <jrb@redhat.com> and Kristian Rietveld <kris@gtk.org> Finishing touch for 2.0.0 release, fixes #70782, #72729, the 'stealth' bug and other last-minute minor issues. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): set dnd dest line drawing right. We can't draw the line at the position of the next row, because that one still has to be drawn. So draw everthing at a -1 offset. (validate_visible_area): add check for invalid descendants and NULL scroll_to_path path, get scrolling right. Also, fix the area_above value. Pretty amazing I got it wrong. (get_logical_dest_row): add gtk-tree-model-drop-append magic, so dragging a row to the end of the model works right. (gtk_tree_view_get_dest_row_at_pos): minor floating point fix (gtk_tree_view_start_editing): add call to validate_row (gtk_tree_view_tree_to_widget_coords): Never subtract HEADER_HEIGHT from y values anymore!!! (gtk_tree_view_widget_coords_to_tree): ditto. (gtk_tree_view_scroll_to_point): allow -1 as values for the scroll_to coords (gtk_tree_view_move_cursor_page_up_down): Don't need scroll_to_y as clamp_node_visible will make it work. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): also check path depth, as we can't get iters from empty paths * gtk/gtkliststore.c (gtk_list_store_drag_data_received): handle gtk-tree-model-drop-append * gtk/gtktreednd.c (gtk_tree_set_row_drag_data): free path_str * tests/testtreeflow.c (main): select path where we are scrolling to
2002-03-07 08:03:09 +00:00
}
else
{
dy = 0;
start implementing Thu Mar 7 02:58:16 2002 Jonathan Blandford <jrb@redhat.com> * gtk/tmpl/gtkliststore.sgml: start implementing * gtk/question_index.sgml: "I can set with the tree, but not get???!?!" Wed Mar 6 23:20:51 2002 Jonathan Blandford <jrb@redhat.com> and Kristian Rietveld <kris@gtk.org> Finishing touch for 2.0.0 release, fixes #70782, #72729, the 'stealth' bug and other last-minute minor issues. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): set dnd dest line drawing right. We can't draw the line at the position of the next row, because that one still has to be drawn. So draw everthing at a -1 offset. (validate_visible_area): add check for invalid descendants and NULL scroll_to_path path, get scrolling right. Also, fix the area_above value. Pretty amazing I got it wrong. (get_logical_dest_row): add gtk-tree-model-drop-append magic, so dragging a row to the end of the model works right. (gtk_tree_view_get_dest_row_at_pos): minor floating point fix (gtk_tree_view_start_editing): add call to validate_row (gtk_tree_view_tree_to_widget_coords): Never subtract HEADER_HEIGHT from y values anymore!!! (gtk_tree_view_widget_coords_to_tree): ditto. (gtk_tree_view_scroll_to_point): allow -1 as values for the scroll_to coords (gtk_tree_view_move_cursor_page_up_down): Don't need scroll_to_y as clamp_node_visible will make it work. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): also check path depth, as we can't get iters from empty paths * gtk/gtkliststore.c (gtk_list_store_drag_data_received): handle gtk-tree-model-drop-append * gtk/gtktreednd.c (gtk_tree_set_row_drag_data): free path_str * tests/testtreeflow.c (main): select path where we are scrolling to
2002-03-07 08:03:09 +00:00
}
gtk_adjustment_set_value (tree_view->priv->vadjustment, dy);
need_redraw = TRUE;
}
if (tree_view->priv->scroll_to_path)
{
gtk_tree_row_reference_free (tree_view->priv->scroll_to_path);
tree_view->priv->scroll_to_path = NULL;
}
if (above_path)
gtk_tree_path_free (above_path);
if (tree_view->priv->scroll_to_column)
{
tree_view->priv->scroll_to_column = NULL;
}
if (need_redraw)
gtk_widget_queue_draw (GTK_WIDGET (tree_view));
}
static void
initialize_fixed_height_mode (GtkTreeView *tree_view)
{
if (!tree_view->priv->tree)
return;
if (tree_view->priv->fixed_height < 0)
{
GtkTreeIter iter;
GtkTreePath *path;
GtkRBTree *tree = NULL;
GtkRBNode *node = NULL;
tree = tree_view->priv->tree;
node = tree->root;
path = _gtk_tree_view_find_path (tree_view, tree, node);
gtk_tree_model_get_iter (tree_view->priv->model, &iter, path);
validate_row (tree_view, tree, node, &iter, path);
gtk_tree_path_free (path);
tree_view->priv->fixed_height = ROW_HEIGHT (tree_view, GTK_RBNODE_GET_HEIGHT (node));
}
_gtk_rbtree_set_fixed_height (tree_view->priv->tree,
tree_view->priv->fixed_height);
}
/* Our strategy for finding nodes to validate is a little convoluted. We find
* the left-most uninvalidated node. We then try walking right, validating
* nodes. Once we find a valid node, we repeat the previous process of finding
* the first invalid node.
*/
static gboolean
do_validate_rows (GtkTreeView *tree_view)
{
GtkRBTree *tree = NULL;
GtkRBNode *node = NULL;
gboolean validated_area = FALSE;
gint retval = TRUE;
GtkTreePath *path = NULL;
GtkTreeIter iter;
gint i = 0;
gint prev_height = -1;
gboolean fixed_height = TRUE;
g_assert (tree_view);
if (tree_view->priv->tree == NULL)
return FALSE;
if (tree_view->priv->fixed_height_mode)
{
if (tree_view->priv->fixed_height < 0)
initialize_fixed_height_mode (tree_view);
return FALSE;
}
do
{
if (! GTK_RBNODE_FLAG_SET (tree_view->priv->tree->root, GTK_RBNODE_DESCENDANTS_INVALID))
{
retval = FALSE;
goto done;
}
if (path != NULL)
{
node = _gtk_rbtree_next (tree, node);
if (node != NULL)
{
TREE_VIEW_INTERNAL_ASSERT (gtk_tree_model_iter_next (tree_view->priv->model, &iter), FALSE);
gtk_tree_path_next (path);
}
else
{
gtk_tree_path_free (path);
path = NULL;
}
}
if (path == NULL)
{
tree = tree_view->priv->tree;
node = tree_view->priv->tree->root;
g_assert (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_DESCENDANTS_INVALID));
do
{
if (node->left != tree->nil &&
GTK_RBNODE_FLAG_SET (node->left, GTK_RBNODE_DESCENDANTS_INVALID))
{
node = node->left;
}
else if (node->right != tree->nil &&
GTK_RBNODE_FLAG_SET (node->right, GTK_RBNODE_DESCENDANTS_INVALID))
{
node = node->right;
}
else if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_INVALID) ||
GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_COLUMN_INVALID))
{
break;
}
else if (node->children != NULL)
{
tree = node->children;
node = tree->root;
}
else
/* RBTree corruption! All bad */
g_assert_not_reached ();
}
while (TRUE);
path = _gtk_tree_view_find_path (tree_view, tree, node);
gtk_tree_model_get_iter (tree_view->priv->model, &iter, path);
}
validated_area = validate_row (tree_view, tree, node, &iter, path) ||
validated_area;
if (!tree_view->priv->fixed_height_check)
{
gint height;
height = ROW_HEIGHT (tree_view, GTK_RBNODE_GET_HEIGHT (node));
if (prev_height < 0)
prev_height = height;
else if (prev_height != height)
fixed_height = FALSE;
}
i++;
}
while (i < GTK_TREE_VIEW_NUM_ROWS_PER_IDLE);
if (!tree_view->priv->fixed_height_check)
{
if (fixed_height)
_gtk_rbtree_set_fixed_height (tree_view->priv->tree, prev_height);
tree_view->priv->fixed_height_check = 1;
}
done:
if (validated_area)
{
GtkRequisition requisition;
/* We temporarily guess a size, under the assumption that it will be the
* same when we get our next size_allocate. If we don't do this, we'll be
* in an inconsistent state when we call top_row_to_dy. */
gtk_widget_size_request (GTK_WIDGET (tree_view), &requisition);
tree_view->priv->hadjustment->upper = MAX (tree_view->priv->hadjustment->upper, (gfloat)requisition.width);
tree_view->priv->vadjustment->upper = MAX (tree_view->priv->vadjustment->upper, (gfloat)requisition.height);
gtk_adjustment_changed (tree_view->priv->hadjustment);
gtk_adjustment_changed (tree_view->priv->vadjustment);
gtk_widget_queue_resize (GTK_WIDGET (tree_view));
}
if (gtk_tree_row_reference_valid (tree_view->priv->top_row))
gtk_tree_view_top_row_to_dy (tree_view);
else
gtk_tree_view_dy_to_top_row (tree_view);
if (path) gtk_tree_path_free (path);
return retval;
}
static gboolean
validate_rows (GtkTreeView *tree_view)
{
gboolean retval;
retval = do_validate_rows (tree_view);
if (! retval && tree_view->priv->validate_rows_timer)
{
g_source_remove (tree_view->priv->validate_rows_timer);
tree_view->priv->validate_rows_timer = 0;
}
return retval;
}
static gboolean
validate_rows_handler (GtkTreeView *tree_view)
{
gboolean retval;
GDK_THREADS_ENTER ();
retval = do_validate_rows (tree_view);
if (! retval && tree_view->priv->validate_rows_timer)
{
g_source_remove (tree_view->priv->validate_rows_timer);
tree_view->priv->validate_rows_timer = 0;
}
GDK_THREADS_LEAVE ();
return retval;
}
static gboolean
do_presize_handler (GtkTreeView *tree_view)
{
if (tree_view->priv->mark_rows_col_dirty)
{
if (tree_view->priv->tree)
_gtk_rbtree_column_invalid (tree_view->priv->tree);
tree_view->priv->mark_rows_col_dirty = FALSE;
}
validate_visible_area (tree_view);
tree_view->priv->presize_handler_timer = 0;
return FALSE;
}
static gboolean
presize_handler_callback (gpointer data)
{
GDK_THREADS_ENTER ();
do_presize_handler (GTK_TREE_VIEW (data));
GDK_THREADS_LEAVE ();
return FALSE;
}
static void
install_presize_handler (GtkTreeView *tree_view)
{
if (! GTK_WIDGET_REALIZED (tree_view))
return;
if (! tree_view->priv->presize_handler_timer)
{
tree_view->priv->presize_handler_timer =
g_idle_add_full (GTK_PRIORITY_RESIZE - 2, presize_handler_callback, tree_view, NULL);
}
if (! tree_view->priv->validate_rows_timer)
{
tree_view->priv->validate_rows_timer =
g_idle_add_full (GTK_TREE_VIEW_PRIORITY_VALIDATE, (GSourceFunc) validate_rows_handler, tree_view, NULL);
}
}
static gboolean
scroll_sync_handler (GtkTreeView *tree_view)
{
GDK_THREADS_ENTER ();
if (gtk_tree_row_reference_valid (tree_view->priv->top_row))
gtk_tree_view_top_row_to_dy (tree_view);
else
gtk_tree_view_dy_to_top_row (tree_view);
tree_view->priv->scroll_sync_timer = 0;
GDK_THREADS_LEAVE ();
return FALSE;
}
static void
install_scroll_sync_handler (GtkTreeView *tree_view)
{
if (! GTK_WIDGET_REALIZED (tree_view))
return;
if (!tree_view->priv->scroll_sync_timer)
{
tree_view->priv->scroll_sync_timer =
g_idle_add_full (GTK_TREE_VIEW_PRIORITY_SCROLL_SYNC, (GSourceFunc) scroll_sync_handler, tree_view, NULL);
}
}
/* Always call this iff dy is in the visible range. If the tree is empty, then
* it's set to be NULL, and top_row_dy is 0;
*/
static void
gtk_tree_view_dy_to_top_row (GtkTreeView *tree_view)
{
GtkTreePath *path;
GtkRBTree *tree;
GtkRBNode *node;
gtk_tree_row_reference_free (tree_view->priv->top_row);
if (tree_view->priv->tree == NULL)
tree = NULL;
else
tree_view->priv->top_row_dy = _gtk_rbtree_find_offset (tree_view->priv->tree,
tree_view->priv->dy,
&tree, &node);
if (tree == NULL)
{
tree_view->priv->top_row = NULL;
tree_view->priv->top_row_dy = 0;
return;
}
path = _gtk_tree_view_find_path (tree_view, tree, node);
tree_view->priv->top_row = gtk_tree_row_reference_new_proxy (G_OBJECT (tree_view), tree_view->priv->model, path);
gtk_tree_path_free (path);
}
static void
gtk_tree_view_top_row_to_dy (GtkTreeView *tree_view)
{
GtkTreePath *path;
GtkRBTree *tree;
GtkRBNode *node;
if (tree_view->priv->top_row)
path = gtk_tree_row_reference_get_path (tree_view->priv->top_row);
else
path = NULL;
if (!path)
tree = NULL;
else
_gtk_tree_view_find_node (tree_view, path, &tree, &node);
if (path)
gtk_tree_path_free (path);
if (tree == NULL)
{
/* keep dy and set new toprow */
gtk_tree_row_reference_free (tree_view->priv->top_row);
tree_view->priv->top_row = NULL;
tree_view->priv->top_row_dy = 0;
/* DO NOT install the idle handler */
gtk_tree_view_dy_to_top_row (tree_view);
return;
}
if (ROW_HEIGHT (tree_view, BACKGROUND_HEIGHT (node))
< tree_view->priv->top_row_dy)
{
/* new top row -- do NOT install the idle handler */
gtk_tree_view_dy_to_top_row (tree_view);
return;
}
tree_view->priv->dy = _gtk_rbtree_node_find_offset (tree, node);
tree_view->priv->dy += tree_view->priv->top_row_dy;
gtk_adjustment_set_value (tree_view->priv->vadjustment,
(gdouble)tree_view->priv->dy);
}
void
_gtk_tree_view_install_mark_rows_col_dirty (GtkTreeView *tree_view)
{
tree_view->priv->mark_rows_col_dirty = TRUE;
install_presize_handler (tree_view);
}
/*
* This function works synchronously (due to the while (validate_rows...)
* loop).
*
* There was a check for column_type != GTK_TREE_VIEW_COLUMN_AUTOSIZE
* here. You now need to check that yourself.
*/
void
_gtk_tree_view_column_autosize (GtkTreeView *tree_view,
GtkTreeViewColumn *column)
{
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (column));
_gtk_tree_view_column_cell_set_dirty (column, FALSE);
do_presize_handler (tree_view);
while (validate_rows (tree_view));
gtk_widget_queue_resize (GTK_WIDGET (tree_view));
}
/* Drag-and-drop */
static void
set_source_row (GdkDragContext *context,
GtkTreeModel *model,
GtkTreePath *source_row)
{
g_object_set_data_full (G_OBJECT (context),
"gtk-tree-view-source-row",
source_row ? gtk_tree_row_reference_new (model, source_row) : NULL,
(GDestroyNotify) (source_row ? gtk_tree_row_reference_free : NULL));
}
static GtkTreePath*
get_source_row (GdkDragContext *context)
{
GtkTreeRowReference *ref =
g_object_get_data (G_OBJECT (context), "gtk-tree-view-source-row");
if (ref)
return gtk_tree_row_reference_get_path (ref);
else
return NULL;
}
Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore Wed Sep 10 01:06:44 2003 Kristian Rietveld <kris@gtk.org> Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore DnD work and gets rid of gtk-tree-model-drop-append. Related bugs #95362 and #113314. I don't want to touch this code ever again. * gtk/gtktreeprivate.h (GtkTreePrivate): add empty_view_drop field. * gtk/gtktreednd.c (gtk_tree_get_row_drag_data): add check for selection_data->length. * gtk/gtktreeview.c (struct DestRow), (dest_row_free), (set_dest_row), (get_dest_row): we don't store just the row ref anymore, but a struct with the row ref and additional info, (set_destination_row): handle drops on empty space and some style fixes, (get_logical_dest_row): also return path_down_mode/drop_append_mode flags, handle dropping childs on their new parents, rewrite drop append handling into something saner, (gtk_tree_view_drag_motion): show a "drop possible arrow" on empty spaces, (gtk_tree_view_drag_drop): updates for updated backend, (gtk_tree_view_drag_data_received): updates for updated backend, path down mode (treestore DnD) handling, (gtk_tree_view_set_drag_dest_row): set empty_view_drop flag, when we are trying to drop a row on an empty model, (gtk_tree_view_get_drag_dest_row): handle empty_view_drop flag. * gtk/gtkliststore.c (gtk_list_store_drag_data_received), (gtk_list_store_row_drop_possible): style and drop-append fixes. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): ditto.
2003-09-09 23:13:39 +00:00
typedef struct
{
GtkTreeRowReference *dest_row;
gboolean path_down_mode;
gboolean empty_view_drop;
gboolean drop_append_mode;
}
DestRow;
static void
dest_row_free (gpointer data)
{
DestRow *dr = (DestRow *)data;
gtk_tree_row_reference_free (dr->dest_row);
g_free (dr);
}
static void
set_dest_row (GdkDragContext *context,
GtkTreeModel *model,
Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore Wed Sep 10 01:06:44 2003 Kristian Rietveld <kris@gtk.org> Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore DnD work and gets rid of gtk-tree-model-drop-append. Related bugs #95362 and #113314. I don't want to touch this code ever again. * gtk/gtktreeprivate.h (GtkTreePrivate): add empty_view_drop field. * gtk/gtktreednd.c (gtk_tree_get_row_drag_data): add check for selection_data->length. * gtk/gtktreeview.c (struct DestRow), (dest_row_free), (set_dest_row), (get_dest_row): we don't store just the row ref anymore, but a struct with the row ref and additional info, (set_destination_row): handle drops on empty space and some style fixes, (get_logical_dest_row): also return path_down_mode/drop_append_mode flags, handle dropping childs on their new parents, rewrite drop append handling into something saner, (gtk_tree_view_drag_motion): show a "drop possible arrow" on empty spaces, (gtk_tree_view_drag_drop): updates for updated backend, (gtk_tree_view_drag_data_received): updates for updated backend, path down mode (treestore DnD) handling, (gtk_tree_view_set_drag_dest_row): set empty_view_drop flag, when we are trying to drop a row on an empty model, (gtk_tree_view_get_drag_dest_row): handle empty_view_drop flag. * gtk/gtkliststore.c (gtk_list_store_drag_data_received), (gtk_list_store_row_drop_possible): style and drop-append fixes. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): ditto.
2003-09-09 23:13:39 +00:00
GtkTreePath *dest_row,
gboolean path_down_mode,
gboolean empty_view_drop,
gboolean drop_append_mode)
{
Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore Wed Sep 10 01:06:44 2003 Kristian Rietveld <kris@gtk.org> Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore DnD work and gets rid of gtk-tree-model-drop-append. Related bugs #95362 and #113314. I don't want to touch this code ever again. * gtk/gtktreeprivate.h (GtkTreePrivate): add empty_view_drop field. * gtk/gtktreednd.c (gtk_tree_get_row_drag_data): add check for selection_data->length. * gtk/gtktreeview.c (struct DestRow), (dest_row_free), (set_dest_row), (get_dest_row): we don't store just the row ref anymore, but a struct with the row ref and additional info, (set_destination_row): handle drops on empty space and some style fixes, (get_logical_dest_row): also return path_down_mode/drop_append_mode flags, handle dropping childs on their new parents, rewrite drop append handling into something saner, (gtk_tree_view_drag_motion): show a "drop possible arrow" on empty spaces, (gtk_tree_view_drag_drop): updates for updated backend, (gtk_tree_view_drag_data_received): updates for updated backend, path down mode (treestore DnD) handling, (gtk_tree_view_set_drag_dest_row): set empty_view_drop flag, when we are trying to drop a row on an empty model, (gtk_tree_view_get_drag_dest_row): handle empty_view_drop flag. * gtk/gtkliststore.c (gtk_list_store_drag_data_received), (gtk_list_store_row_drop_possible): style and drop-append fixes. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): ditto.
2003-09-09 23:13:39 +00:00
DestRow *dr;
if (!dest_row)
{
g_object_set_data_full (G_OBJECT (context), "gtk-tree-view-dest-row",
NULL, NULL);
return;
}
dr = g_new0 (DestRow, 1);
dr->dest_row = gtk_tree_row_reference_new (model, dest_row);
dr->path_down_mode = path_down_mode;
dr->empty_view_drop = empty_view_drop;
dr->drop_append_mode = drop_append_mode;
g_object_set_data_full (G_OBJECT (context), "gtk-tree-view-dest-row",
dr, (GDestroyNotify) dest_row_free);
}
static GtkTreePath*
Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore Wed Sep 10 01:06:44 2003 Kristian Rietveld <kris@gtk.org> Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore DnD work and gets rid of gtk-tree-model-drop-append. Related bugs #95362 and #113314. I don't want to touch this code ever again. * gtk/gtktreeprivate.h (GtkTreePrivate): add empty_view_drop field. * gtk/gtktreednd.c (gtk_tree_get_row_drag_data): add check for selection_data->length. * gtk/gtktreeview.c (struct DestRow), (dest_row_free), (set_dest_row), (get_dest_row): we don't store just the row ref anymore, but a struct with the row ref and additional info, (set_destination_row): handle drops on empty space and some style fixes, (get_logical_dest_row): also return path_down_mode/drop_append_mode flags, handle dropping childs on their new parents, rewrite drop append handling into something saner, (gtk_tree_view_drag_motion): show a "drop possible arrow" on empty spaces, (gtk_tree_view_drag_drop): updates for updated backend, (gtk_tree_view_drag_data_received): updates for updated backend, path down mode (treestore DnD) handling, (gtk_tree_view_set_drag_dest_row): set empty_view_drop flag, when we are trying to drop a row on an empty model, (gtk_tree_view_get_drag_dest_row): handle empty_view_drop flag. * gtk/gtkliststore.c (gtk_list_store_drag_data_received), (gtk_list_store_row_drop_possible): style and drop-append fixes. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): ditto.
2003-09-09 23:13:39 +00:00
get_dest_row (GdkDragContext *context,
gboolean *path_down_mode)
{
Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore Wed Sep 10 01:06:44 2003 Kristian Rietveld <kris@gtk.org> Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore DnD work and gets rid of gtk-tree-model-drop-append. Related bugs #95362 and #113314. I don't want to touch this code ever again. * gtk/gtktreeprivate.h (GtkTreePrivate): add empty_view_drop field. * gtk/gtktreednd.c (gtk_tree_get_row_drag_data): add check for selection_data->length. * gtk/gtktreeview.c (struct DestRow), (dest_row_free), (set_dest_row), (get_dest_row): we don't store just the row ref anymore, but a struct with the row ref and additional info, (set_destination_row): handle drops on empty space and some style fixes, (get_logical_dest_row): also return path_down_mode/drop_append_mode flags, handle dropping childs on their new parents, rewrite drop append handling into something saner, (gtk_tree_view_drag_motion): show a "drop possible arrow" on empty spaces, (gtk_tree_view_drag_drop): updates for updated backend, (gtk_tree_view_drag_data_received): updates for updated backend, path down mode (treestore DnD) handling, (gtk_tree_view_set_drag_dest_row): set empty_view_drop flag, when we are trying to drop a row on an empty model, (gtk_tree_view_get_drag_dest_row): handle empty_view_drop flag. * gtk/gtkliststore.c (gtk_list_store_drag_data_received), (gtk_list_store_row_drop_possible): style and drop-append fixes. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): ditto.
2003-09-09 23:13:39 +00:00
DestRow *dr =
g_object_get_data (G_OBJECT (context), "gtk-tree-view-dest-row");
Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore Wed Sep 10 01:06:44 2003 Kristian Rietveld <kris@gtk.org> Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore DnD work and gets rid of gtk-tree-model-drop-append. Related bugs #95362 and #113314. I don't want to touch this code ever again. * gtk/gtktreeprivate.h (GtkTreePrivate): add empty_view_drop field. * gtk/gtktreednd.c (gtk_tree_get_row_drag_data): add check for selection_data->length. * gtk/gtktreeview.c (struct DestRow), (dest_row_free), (set_dest_row), (get_dest_row): we don't store just the row ref anymore, but a struct with the row ref and additional info, (set_destination_row): handle drops on empty space and some style fixes, (get_logical_dest_row): also return path_down_mode/drop_append_mode flags, handle dropping childs on their new parents, rewrite drop append handling into something saner, (gtk_tree_view_drag_motion): show a "drop possible arrow" on empty spaces, (gtk_tree_view_drag_drop): updates for updated backend, (gtk_tree_view_drag_data_received): updates for updated backend, path down mode (treestore DnD) handling, (gtk_tree_view_set_drag_dest_row): set empty_view_drop flag, when we are trying to drop a row on an empty model, (gtk_tree_view_get_drag_dest_row): handle empty_view_drop flag. * gtk/gtkliststore.c (gtk_list_store_drag_data_received), (gtk_list_store_row_drop_possible): style and drop-append fixes. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): ditto.
2003-09-09 23:13:39 +00:00
if (dr)
{
GtkTreePath *path = NULL;
if (path_down_mode)
*path_down_mode = dr->path_down_mode;
if (dr->dest_row)
path = gtk_tree_row_reference_get_path (dr->dest_row);
else if (dr->empty_view_drop)
path = gtk_tree_path_new_from_indices (0, -1);
else
path = NULL;
if (path && dr->drop_append_mode)
gtk_tree_path_next (path);
return path;
}
else
return NULL;
}
/* Get/set whether drag_motion requested the drag data and
* drag_data_received should thus not actually insert the data,
* since the data doesn't result from a drop.
*/
static void
set_status_pending (GdkDragContext *context,
GdkDragAction suggested_action)
{
g_object_set_data (G_OBJECT (context),
"gtk-tree-view-status-pending",
GINT_TO_POINTER (suggested_action));
}
static GdkDragAction
get_status_pending (GdkDragContext *context)
{
return GPOINTER_TO_INT (g_object_get_data (G_OBJECT (context),
"gtk-tree-view-status-pending"));
}
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
static TreeViewDragInfo*
get_info (GtkTreeView *tree_view)
{
return g_object_get_data (G_OBJECT (tree_view), "gtk-tree-view-drag-info");
}
static void
clear_source_info (TreeViewDragInfo *di)
{
if (di->source_target_list)
gtk_target_list_unref (di->source_target_list);
di->source_target_list = NULL;
}
static void
clear_dest_info (TreeViewDragInfo *di)
{
if (di->dest_target_list)
gtk_target_list_unref (di->dest_target_list);
di->dest_target_list = NULL;
}
static void
destroy_info (TreeViewDragInfo *di)
{
clear_source_info (di);
clear_dest_info (di);
g_free (di);
}
static TreeViewDragInfo*
ensure_info (GtkTreeView *tree_view)
{
TreeViewDragInfo *di;
di = get_info (tree_view);
if (di == NULL)
{
di = g_new0 (TreeViewDragInfo, 1);
g_object_set_data_full (G_OBJECT (tree_view),
"gtk-tree-view-drag-info",
di,
(GDestroyNotify) destroy_info);
}
return di;
}
static void
remove_info (GtkTreeView *tree_view)
{
g_object_set_data (G_OBJECT (tree_view), "gtk-tree-view-drag-info", NULL);
}
#if 0
static gint
drag_scan_timeout (gpointer data)
{
GtkTreeView *tree_view;
gint x, y;
GdkModifierType state;
GtkTreePath *path = NULL;
GtkTreeViewColumn *column = NULL;
GdkRectangle visible_rect;
GDK_THREADS_ENTER ();
tree_view = GTK_TREE_VIEW (data);
gdk_window_get_pointer (tree_view->priv->bin_window,
&x, &y, &state);
gtk_tree_view_get_visible_rect (tree_view, &visible_rect);
/* See if we are near the edge. */
if ((x - visible_rect.x) < SCROLL_EDGE_SIZE ||
(visible_rect.x + visible_rect.width - x) < SCROLL_EDGE_SIZE ||
(y - visible_rect.y) < SCROLL_EDGE_SIZE ||
(visible_rect.y + visible_rect.height - y) < SCROLL_EDGE_SIZE)
{
gtk_tree_view_get_path_at_pos (tree_view,
tree_view->priv->bin_window,
x, y,
&path,
&column,
NULL,
NULL);
if (path != NULL)
{
gtk_tree_view_scroll_to_cell (tree_view,
path,
column,
TRUE,
0.5, 0.5);
gtk_tree_path_free (path);
}
}
GDK_THREADS_LEAVE ();
return TRUE;
}
#endif /* 0 */
static void
remove_scroll_timeout (GtkTreeView *tree_view)
{
if (tree_view->priv->scroll_timeout != 0)
{
g_source_remove (tree_view->priv->scroll_timeout);
tree_view->priv->scroll_timeout = 0;
}
}
static gboolean
check_model_dnd (GtkTreeModel *model,
GType required_iface,
const gchar *signal)
{
if (model == NULL || !G_TYPE_CHECK_INSTANCE_TYPE ((model), required_iface))
{
g_warning ("You must override the default '%s' handler "
"on GtkTreeView when using models that don't support "
"the %s interface and enabling drag-and-drop. The simplest way to do this "
"is to connect to '%s' and call "
"g_signal_stop_emission_by_name() in your signal handler to prevent "
"the default handler from running. Look at the source code "
"for the default handler in gtktreeview.c to get an idea what "
"your handler should do. (gtktreeview.c is in the GTK source "
"code.) If you're using GTK from a language other than C, "
"there may be a more natural way to override default handlers, e.g. via derivation.",
signal, g_type_name (required_iface), signal);
return FALSE;
}
else
return TRUE;
}
static void
remove_open_timeout (GtkTreeView *tree_view)
{
if (tree_view->priv->open_dest_timeout != 0)
{
g_source_remove (tree_view->priv->open_dest_timeout);
tree_view->priv->open_dest_timeout = 0;
}
}
static gint
open_row_timeout (gpointer data)
{
GtkTreeView *tree_view = data;
GtkTreePath *dest_path = NULL;
GtkTreeViewDropPosition pos;
gboolean result = FALSE;
GDK_THREADS_ENTER ();
gtk_tree_view_get_drag_dest_row (tree_view,
&dest_path,
&pos);
if (dest_path &&
(pos == GTK_TREE_VIEW_DROP_INTO_OR_AFTER ||
pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE))
{
gtk_tree_view_expand_row (tree_view, dest_path, FALSE);
tree_view->priv->open_dest_timeout = 0;
gtk_tree_path_free (dest_path);
}
else
{
if (dest_path)
gtk_tree_path_free (dest_path);
result = TRUE;
}
GDK_THREADS_LEAVE ();
return result;
}
static gint
scroll_row_timeout (gpointer data)
{
GtkTreeView *tree_view = data;
GDK_THREADS_ENTER ();
gtk_tree_view_vertical_autoscroll (tree_view);
GDK_THREADS_LEAVE ();
return TRUE;
}
/* Returns TRUE if event should not be propagated to parent widgets */
static gboolean
set_destination_row (GtkTreeView *tree_view,
GdkDragContext *context,
gint x,
gint y,
GdkDragAction *suggested_action,
GdkAtom *target)
{
GtkTreePath *path = NULL;
GtkTreeViewDropPosition pos;
GtkTreeViewDropPosition old_pos;
TreeViewDragInfo *di;
GtkWidget *widget;
GtkTreePath *old_dest_path = NULL;
Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore Wed Sep 10 01:06:44 2003 Kristian Rietveld <kris@gtk.org> Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore DnD work and gets rid of gtk-tree-model-drop-append. Related bugs #95362 and #113314. I don't want to touch this code ever again. * gtk/gtktreeprivate.h (GtkTreePrivate): add empty_view_drop field. * gtk/gtktreednd.c (gtk_tree_get_row_drag_data): add check for selection_data->length. * gtk/gtktreeview.c (struct DestRow), (dest_row_free), (set_dest_row), (get_dest_row): we don't store just the row ref anymore, but a struct with the row ref and additional info, (set_destination_row): handle drops on empty space and some style fixes, (get_logical_dest_row): also return path_down_mode/drop_append_mode flags, handle dropping childs on their new parents, rewrite drop append handling into something saner, (gtk_tree_view_drag_motion): show a "drop possible arrow" on empty spaces, (gtk_tree_view_drag_drop): updates for updated backend, (gtk_tree_view_drag_data_received): updates for updated backend, path down mode (treestore DnD) handling, (gtk_tree_view_set_drag_dest_row): set empty_view_drop flag, when we are trying to drop a row on an empty model, (gtk_tree_view_get_drag_dest_row): handle empty_view_drop flag. * gtk/gtkliststore.c (gtk_list_store_drag_data_received), (gtk_list_store_row_drop_possible): style and drop-append fixes. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): ditto.
2003-09-09 23:13:39 +00:00
gboolean can_drop = FALSE;
*suggested_action = 0;
*target = GDK_NONE;
widget = GTK_WIDGET (tree_view);
di = get_info (tree_view);
if (di == NULL || y - TREE_VIEW_HEADER_HEIGHT (tree_view) < 0)
{
/* someone unset us as a drag dest, note that if
* we return FALSE drag_leave isn't called
*/
gtk_tree_view_set_drag_dest_row (tree_view,
NULL,
GTK_TREE_VIEW_DROP_BEFORE);
remove_scroll_timeout (GTK_TREE_VIEW (widget));
remove_open_timeout (GTK_TREE_VIEW (widget));
return FALSE; /* no longer a drop site */
}
*target = gtk_drag_dest_find_target (widget, context, di->dest_target_list);
if (*target == GDK_NONE)
{
return FALSE;
}
if (!gtk_tree_view_get_dest_row_at_pos (tree_view,
x, y,
&path,
&pos))
{
Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore Wed Sep 10 01:06:44 2003 Kristian Rietveld <kris@gtk.org> Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore DnD work and gets rid of gtk-tree-model-drop-append. Related bugs #95362 and #113314. I don't want to touch this code ever again. * gtk/gtktreeprivate.h (GtkTreePrivate): add empty_view_drop field. * gtk/gtktreednd.c (gtk_tree_get_row_drag_data): add check for selection_data->length. * gtk/gtktreeview.c (struct DestRow), (dest_row_free), (set_dest_row), (get_dest_row): we don't store just the row ref anymore, but a struct with the row ref and additional info, (set_destination_row): handle drops on empty space and some style fixes, (get_logical_dest_row): also return path_down_mode/drop_append_mode flags, handle dropping childs on their new parents, rewrite drop append handling into something saner, (gtk_tree_view_drag_motion): show a "drop possible arrow" on empty spaces, (gtk_tree_view_drag_drop): updates for updated backend, (gtk_tree_view_drag_data_received): updates for updated backend, path down mode (treestore DnD) handling, (gtk_tree_view_set_drag_dest_row): set empty_view_drop flag, when we are trying to drop a row on an empty model, (gtk_tree_view_get_drag_dest_row): handle empty_view_drop flag. * gtk/gtkliststore.c (gtk_list_store_drag_data_received), (gtk_list_store_row_drop_possible): style and drop-append fixes. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): ditto.
2003-09-09 23:13:39 +00:00
gint n_children;
GtkTreeModel *model;
remove_open_timeout (tree_view);
Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore Wed Sep 10 01:06:44 2003 Kristian Rietveld <kris@gtk.org> Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore DnD work and gets rid of gtk-tree-model-drop-append. Related bugs #95362 and #113314. I don't want to touch this code ever again. * gtk/gtktreeprivate.h (GtkTreePrivate): add empty_view_drop field. * gtk/gtktreednd.c (gtk_tree_get_row_drag_data): add check for selection_data->length. * gtk/gtktreeview.c (struct DestRow), (dest_row_free), (set_dest_row), (get_dest_row): we don't store just the row ref anymore, but a struct with the row ref and additional info, (set_destination_row): handle drops on empty space and some style fixes, (get_logical_dest_row): also return path_down_mode/drop_append_mode flags, handle dropping childs on their new parents, rewrite drop append handling into something saner, (gtk_tree_view_drag_motion): show a "drop possible arrow" on empty spaces, (gtk_tree_view_drag_drop): updates for updated backend, (gtk_tree_view_drag_data_received): updates for updated backend, path down mode (treestore DnD) handling, (gtk_tree_view_set_drag_dest_row): set empty_view_drop flag, when we are trying to drop a row on an empty model, (gtk_tree_view_get_drag_dest_row): handle empty_view_drop flag. * gtk/gtkliststore.c (gtk_list_store_drag_data_received), (gtk_list_store_row_drop_possible): style and drop-append fixes. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): ditto.
2003-09-09 23:13:39 +00:00
/* the row got dropped on empty space, let's setup a special case
*/
if (path)
gtk_tree_path_free (path);
Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore Wed Sep 10 01:06:44 2003 Kristian Rietveld <kris@gtk.org> Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore DnD work and gets rid of gtk-tree-model-drop-append. Related bugs #95362 and #113314. I don't want to touch this code ever again. * gtk/gtktreeprivate.h (GtkTreePrivate): add empty_view_drop field. * gtk/gtktreednd.c (gtk_tree_get_row_drag_data): add check for selection_data->length. * gtk/gtktreeview.c (struct DestRow), (dest_row_free), (set_dest_row), (get_dest_row): we don't store just the row ref anymore, but a struct with the row ref and additional info, (set_destination_row): handle drops on empty space and some style fixes, (get_logical_dest_row): also return path_down_mode/drop_append_mode flags, handle dropping childs on their new parents, rewrite drop append handling into something saner, (gtk_tree_view_drag_motion): show a "drop possible arrow" on empty spaces, (gtk_tree_view_drag_drop): updates for updated backend, (gtk_tree_view_drag_data_received): updates for updated backend, path down mode (treestore DnD) handling, (gtk_tree_view_set_drag_dest_row): set empty_view_drop flag, when we are trying to drop a row on an empty model, (gtk_tree_view_get_drag_dest_row): handle empty_view_drop flag. * gtk/gtkliststore.c (gtk_list_store_drag_data_received), (gtk_list_store_row_drop_possible): style and drop-append fixes. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): ditto.
2003-09-09 23:13:39 +00:00
model = gtk_tree_view_get_model (tree_view);
n_children = gtk_tree_model_iter_n_children (model, NULL);
if (n_children)
{
pos = GTK_TREE_VIEW_DROP_AFTER;
path = gtk_tree_path_new_from_indices (n_children - 1, -1);
}
else
{
pos = GTK_TREE_VIEW_DROP_BEFORE;
path = gtk_tree_path_new_from_indices (0, -1);
}
can_drop = TRUE;
goto out;
}
g_assert (path);
/* If we left the current row's "open" zone, unset the timeout for
* opening the row
*/
gtk_tree_view_get_drag_dest_row (tree_view,
&old_dest_path,
&old_pos);
if (old_dest_path &&
(gtk_tree_path_compare (path, old_dest_path) != 0 ||
!(pos == GTK_TREE_VIEW_DROP_INTO_OR_AFTER ||
pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE)))
remove_open_timeout (tree_view);
if (old_dest_path)
gtk_tree_path_free (old_dest_path);
if (TRUE /* FIXME if the location droppable predicate */)
Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore Wed Sep 10 01:06:44 2003 Kristian Rietveld <kris@gtk.org> Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore DnD work and gets rid of gtk-tree-model-drop-append. Related bugs #95362 and #113314. I don't want to touch this code ever again. * gtk/gtktreeprivate.h (GtkTreePrivate): add empty_view_drop field. * gtk/gtktreednd.c (gtk_tree_get_row_drag_data): add check for selection_data->length. * gtk/gtktreeview.c (struct DestRow), (dest_row_free), (set_dest_row), (get_dest_row): we don't store just the row ref anymore, but a struct with the row ref and additional info, (set_destination_row): handle drops on empty space and some style fixes, (get_logical_dest_row): also return path_down_mode/drop_append_mode flags, handle dropping childs on their new parents, rewrite drop append handling into something saner, (gtk_tree_view_drag_motion): show a "drop possible arrow" on empty spaces, (gtk_tree_view_drag_drop): updates for updated backend, (gtk_tree_view_drag_data_received): updates for updated backend, path down mode (treestore DnD) handling, (gtk_tree_view_set_drag_dest_row): set empty_view_drop flag, when we are trying to drop a row on an empty model, (gtk_tree_view_get_drag_dest_row): handle empty_view_drop flag. * gtk/gtkliststore.c (gtk_list_store_drag_data_received), (gtk_list_store_row_drop_possible): style and drop-append fixes. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): ditto.
2003-09-09 23:13:39 +00:00
{
can_drop = TRUE;
}
out:
if (can_drop)
{
GtkWidget *source_widget;
*suggested_action = context->suggested_action;
source_widget = gtk_drag_get_source_widget (context);
if (source_widget == widget)
{
/* Default to MOVE, unless the user has
Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore Wed Sep 10 01:06:44 2003 Kristian Rietveld <kris@gtk.org> Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore DnD work and gets rid of gtk-tree-model-drop-append. Related bugs #95362 and #113314. I don't want to touch this code ever again. * gtk/gtktreeprivate.h (GtkTreePrivate): add empty_view_drop field. * gtk/gtktreednd.c (gtk_tree_get_row_drag_data): add check for selection_data->length. * gtk/gtktreeview.c (struct DestRow), (dest_row_free), (set_dest_row), (get_dest_row): we don't store just the row ref anymore, but a struct with the row ref and additional info, (set_destination_row): handle drops on empty space and some style fixes, (get_logical_dest_row): also return path_down_mode/drop_append_mode flags, handle dropping childs on their new parents, rewrite drop append handling into something saner, (gtk_tree_view_drag_motion): show a "drop possible arrow" on empty spaces, (gtk_tree_view_drag_drop): updates for updated backend, (gtk_tree_view_drag_data_received): updates for updated backend, path down mode (treestore DnD) handling, (gtk_tree_view_set_drag_dest_row): set empty_view_drop flag, when we are trying to drop a row on an empty model, (gtk_tree_view_get_drag_dest_row): handle empty_view_drop flag. * gtk/gtkliststore.c (gtk_list_store_drag_data_received), (gtk_list_store_row_drop_possible): style and drop-append fixes. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): ditto.
2003-09-09 23:13:39 +00:00
* pressed ctrl or shift to affect available actions
*/
if ((context->actions & GDK_ACTION_MOVE) != 0)
*suggested_action = GDK_ACTION_MOVE;
}
gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (widget),
path, pos);
}
else
{
/* can't drop here */
remove_open_timeout (tree_view);
gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (widget),
NULL,
GTK_TREE_VIEW_DROP_BEFORE);
}
if (path)
gtk_tree_path_free (path);
return TRUE;
}
Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore Wed Sep 10 01:06:44 2003 Kristian Rietveld <kris@gtk.org> Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore DnD work and gets rid of gtk-tree-model-drop-append. Related bugs #95362 and #113314. I don't want to touch this code ever again. * gtk/gtktreeprivate.h (GtkTreePrivate): add empty_view_drop field. * gtk/gtktreednd.c (gtk_tree_get_row_drag_data): add check for selection_data->length. * gtk/gtktreeview.c (struct DestRow), (dest_row_free), (set_dest_row), (get_dest_row): we don't store just the row ref anymore, but a struct with the row ref and additional info, (set_destination_row): handle drops on empty space and some style fixes, (get_logical_dest_row): also return path_down_mode/drop_append_mode flags, handle dropping childs on their new parents, rewrite drop append handling into something saner, (gtk_tree_view_drag_motion): show a "drop possible arrow" on empty spaces, (gtk_tree_view_drag_drop): updates for updated backend, (gtk_tree_view_drag_data_received): updates for updated backend, path down mode (treestore DnD) handling, (gtk_tree_view_set_drag_dest_row): set empty_view_drop flag, when we are trying to drop a row on an empty model, (gtk_tree_view_get_drag_dest_row): handle empty_view_drop flag. * gtk/gtkliststore.c (gtk_list_store_drag_data_received), (gtk_list_store_row_drop_possible): style and drop-append fixes. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): ditto.
2003-09-09 23:13:39 +00:00
static GtkTreePath*
get_logical_dest_row (GtkTreeView *tree_view,
gboolean *path_down_mode,
gboolean *drop_append_mode)
{
/* adjust path to point to the row the drop goes in front of */
GtkTreePath *path = NULL;
GtkTreeViewDropPosition pos;
Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore Wed Sep 10 01:06:44 2003 Kristian Rietveld <kris@gtk.org> Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore DnD work and gets rid of gtk-tree-model-drop-append. Related bugs #95362 and #113314. I don't want to touch this code ever again. * gtk/gtktreeprivate.h (GtkTreePrivate): add empty_view_drop field. * gtk/gtktreednd.c (gtk_tree_get_row_drag_data): add check for selection_data->length. * gtk/gtktreeview.c (struct DestRow), (dest_row_free), (set_dest_row), (get_dest_row): we don't store just the row ref anymore, but a struct with the row ref and additional info, (set_destination_row): handle drops on empty space and some style fixes, (get_logical_dest_row): also return path_down_mode/drop_append_mode flags, handle dropping childs on their new parents, rewrite drop append handling into something saner, (gtk_tree_view_drag_motion): show a "drop possible arrow" on empty spaces, (gtk_tree_view_drag_drop): updates for updated backend, (gtk_tree_view_drag_data_received): updates for updated backend, path down mode (treestore DnD) handling, (gtk_tree_view_set_drag_dest_row): set empty_view_drop flag, when we are trying to drop a row on an empty model, (gtk_tree_view_get_drag_dest_row): handle empty_view_drop flag. * gtk/gtkliststore.c (gtk_list_store_drag_data_received), (gtk_list_store_row_drop_possible): style and drop-append fixes. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): ditto.
2003-09-09 23:13:39 +00:00
g_return_val_if_fail (path_down_mode != NULL, NULL);
g_return_val_if_fail (drop_append_mode != NULL, NULL);
*path_down_mode = FALSE;
*drop_append_mode = 0;
gtk_tree_view_get_drag_dest_row (tree_view, &path, &pos);
if (path == NULL)
return NULL;
if (pos == GTK_TREE_VIEW_DROP_BEFORE)
; /* do nothing */
else if (pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE ||
pos == GTK_TREE_VIEW_DROP_INTO_OR_AFTER)
Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore Wed Sep 10 01:06:44 2003 Kristian Rietveld <kris@gtk.org> Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore DnD work and gets rid of gtk-tree-model-drop-append. Related bugs #95362 and #113314. I don't want to touch this code ever again. * gtk/gtktreeprivate.h (GtkTreePrivate): add empty_view_drop field. * gtk/gtktreednd.c (gtk_tree_get_row_drag_data): add check for selection_data->length. * gtk/gtktreeview.c (struct DestRow), (dest_row_free), (set_dest_row), (get_dest_row): we don't store just the row ref anymore, but a struct with the row ref and additional info, (set_destination_row): handle drops on empty space and some style fixes, (get_logical_dest_row): also return path_down_mode/drop_append_mode flags, handle dropping childs on their new parents, rewrite drop append handling into something saner, (gtk_tree_view_drag_motion): show a "drop possible arrow" on empty spaces, (gtk_tree_view_drag_drop): updates for updated backend, (gtk_tree_view_drag_data_received): updates for updated backend, path down mode (treestore DnD) handling, (gtk_tree_view_set_drag_dest_row): set empty_view_drop flag, when we are trying to drop a row on an empty model, (gtk_tree_view_get_drag_dest_row): handle empty_view_drop flag. * gtk/gtkliststore.c (gtk_list_store_drag_data_received), (gtk_list_store_row_drop_possible): style and drop-append fixes. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): ditto.
2003-09-09 23:13:39 +00:00
*path_down_mode = TRUE;
else
{
start implementing Thu Mar 7 02:58:16 2002 Jonathan Blandford <jrb@redhat.com> * gtk/tmpl/gtkliststore.sgml: start implementing * gtk/question_index.sgml: "I can set with the tree, but not get???!?!" Wed Mar 6 23:20:51 2002 Jonathan Blandford <jrb@redhat.com> and Kristian Rietveld <kris@gtk.org> Finishing touch for 2.0.0 release, fixes #70782, #72729, the 'stealth' bug and other last-minute minor issues. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): set dnd dest line drawing right. We can't draw the line at the position of the next row, because that one still has to be drawn. So draw everthing at a -1 offset. (validate_visible_area): add check for invalid descendants and NULL scroll_to_path path, get scrolling right. Also, fix the area_above value. Pretty amazing I got it wrong. (get_logical_dest_row): add gtk-tree-model-drop-append magic, so dragging a row to the end of the model works right. (gtk_tree_view_get_dest_row_at_pos): minor floating point fix (gtk_tree_view_start_editing): add call to validate_row (gtk_tree_view_tree_to_widget_coords): Never subtract HEADER_HEIGHT from y values anymore!!! (gtk_tree_view_widget_coords_to_tree): ditto. (gtk_tree_view_scroll_to_point): allow -1 as values for the scroll_to coords (gtk_tree_view_move_cursor_page_up_down): Don't need scroll_to_y as clamp_node_visible will make it work. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): also check path depth, as we can't get iters from empty paths * gtk/gtkliststore.c (gtk_list_store_drag_data_received): handle gtk-tree-model-drop-append * gtk/gtktreednd.c (gtk_tree_set_row_drag_data): free path_str * tests/testtreeflow.c (main): select path where we are scrolling to
2002-03-07 08:03:09 +00:00
GtkTreeIter iter;
GtkTreeModel *model = gtk_tree_view_get_model (tree_view);
g_assert (pos == GTK_TREE_VIEW_DROP_AFTER);
start implementing Thu Mar 7 02:58:16 2002 Jonathan Blandford <jrb@redhat.com> * gtk/tmpl/gtkliststore.sgml: start implementing * gtk/question_index.sgml: "I can set with the tree, but not get???!?!" Wed Mar 6 23:20:51 2002 Jonathan Blandford <jrb@redhat.com> and Kristian Rietveld <kris@gtk.org> Finishing touch for 2.0.0 release, fixes #70782, #72729, the 'stealth' bug and other last-minute minor issues. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): set dnd dest line drawing right. We can't draw the line at the position of the next row, because that one still has to be drawn. So draw everthing at a -1 offset. (validate_visible_area): add check for invalid descendants and NULL scroll_to_path path, get scrolling right. Also, fix the area_above value. Pretty amazing I got it wrong. (get_logical_dest_row): add gtk-tree-model-drop-append magic, so dragging a row to the end of the model works right. (gtk_tree_view_get_dest_row_at_pos): minor floating point fix (gtk_tree_view_start_editing): add call to validate_row (gtk_tree_view_tree_to_widget_coords): Never subtract HEADER_HEIGHT from y values anymore!!! (gtk_tree_view_widget_coords_to_tree): ditto. (gtk_tree_view_scroll_to_point): allow -1 as values for the scroll_to coords (gtk_tree_view_move_cursor_page_up_down): Don't need scroll_to_y as clamp_node_visible will make it work. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): also check path depth, as we can't get iters from empty paths * gtk/gtkliststore.c (gtk_list_store_drag_data_received): handle gtk-tree-model-drop-append * gtk/gtktreednd.c (gtk_tree_set_row_drag_data): free path_str * tests/testtreeflow.c (main): select path where we are scrolling to
2002-03-07 08:03:09 +00:00
Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore Wed Sep 10 01:06:44 2003 Kristian Rietveld <kris@gtk.org> Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore DnD work and gets rid of gtk-tree-model-drop-append. Related bugs #95362 and #113314. I don't want to touch this code ever again. * gtk/gtktreeprivate.h (GtkTreePrivate): add empty_view_drop field. * gtk/gtktreednd.c (gtk_tree_get_row_drag_data): add check for selection_data->length. * gtk/gtktreeview.c (struct DestRow), (dest_row_free), (set_dest_row), (get_dest_row): we don't store just the row ref anymore, but a struct with the row ref and additional info, (set_destination_row): handle drops on empty space and some style fixes, (get_logical_dest_row): also return path_down_mode/drop_append_mode flags, handle dropping childs on their new parents, rewrite drop append handling into something saner, (gtk_tree_view_drag_motion): show a "drop possible arrow" on empty spaces, (gtk_tree_view_drag_drop): updates for updated backend, (gtk_tree_view_drag_data_received): updates for updated backend, path down mode (treestore DnD) handling, (gtk_tree_view_set_drag_dest_row): set empty_view_drop flag, when we are trying to drop a row on an empty model, (gtk_tree_view_get_drag_dest_row): handle empty_view_drop flag. * gtk/gtkliststore.c (gtk_list_store_drag_data_received), (gtk_list_store_row_drop_possible): style and drop-append fixes. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): ditto.
2003-09-09 23:13:39 +00:00
if (!gtk_tree_model_get_iter (model, &iter, path) ||
!gtk_tree_model_iter_next (model, &iter))
*drop_append_mode = 1;
start implementing Thu Mar 7 02:58:16 2002 Jonathan Blandford <jrb@redhat.com> * gtk/tmpl/gtkliststore.sgml: start implementing * gtk/question_index.sgml: "I can set with the tree, but not get???!?!" Wed Mar 6 23:20:51 2002 Jonathan Blandford <jrb@redhat.com> and Kristian Rietveld <kris@gtk.org> Finishing touch for 2.0.0 release, fixes #70782, #72729, the 'stealth' bug and other last-minute minor issues. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): set dnd dest line drawing right. We can't draw the line at the position of the next row, because that one still has to be drawn. So draw everthing at a -1 offset. (validate_visible_area): add check for invalid descendants and NULL scroll_to_path path, get scrolling right. Also, fix the area_above value. Pretty amazing I got it wrong. (get_logical_dest_row): add gtk-tree-model-drop-append magic, so dragging a row to the end of the model works right. (gtk_tree_view_get_dest_row_at_pos): minor floating point fix (gtk_tree_view_start_editing): add call to validate_row (gtk_tree_view_tree_to_widget_coords): Never subtract HEADER_HEIGHT from y values anymore!!! (gtk_tree_view_widget_coords_to_tree): ditto. (gtk_tree_view_scroll_to_point): allow -1 as values for the scroll_to coords (gtk_tree_view_move_cursor_page_up_down): Don't need scroll_to_y as clamp_node_visible will make it work. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): also check path depth, as we can't get iters from empty paths * gtk/gtkliststore.c (gtk_list_store_drag_data_received): handle gtk-tree-model-drop-append * gtk/gtktreednd.c (gtk_tree_set_row_drag_data): free path_str * tests/testtreeflow.c (main): select path where we are scrolling to
2002-03-07 08:03:09 +00:00
else
{
Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore Wed Sep 10 01:06:44 2003 Kristian Rietveld <kris@gtk.org> Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore DnD work and gets rid of gtk-tree-model-drop-append. Related bugs #95362 and #113314. I don't want to touch this code ever again. * gtk/gtktreeprivate.h (GtkTreePrivate): add empty_view_drop field. * gtk/gtktreednd.c (gtk_tree_get_row_drag_data): add check for selection_data->length. * gtk/gtktreeview.c (struct DestRow), (dest_row_free), (set_dest_row), (get_dest_row): we don't store just the row ref anymore, but a struct with the row ref and additional info, (set_destination_row): handle drops on empty space and some style fixes, (get_logical_dest_row): also return path_down_mode/drop_append_mode flags, handle dropping childs on their new parents, rewrite drop append handling into something saner, (gtk_tree_view_drag_motion): show a "drop possible arrow" on empty spaces, (gtk_tree_view_drag_drop): updates for updated backend, (gtk_tree_view_drag_data_received): updates for updated backend, path down mode (treestore DnD) handling, (gtk_tree_view_set_drag_dest_row): set empty_view_drop flag, when we are trying to drop a row on an empty model, (gtk_tree_view_get_drag_dest_row): handle empty_view_drop flag. * gtk/gtkliststore.c (gtk_list_store_drag_data_received), (gtk_list_store_row_drop_possible): style and drop-append fixes. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): ditto.
2003-09-09 23:13:39 +00:00
*drop_append_mode = 0;
gtk_tree_path_next (path);
}
}
return path;
}
static gboolean
gtk_tree_view_maybe_begin_dragging_row (GtkTreeView *tree_view,
GdkEventMotion *event)
{
GdkDragContext *context;
TreeViewDragInfo *di;
GtkTreePath *path = NULL;
gint button;
gint cell_x, cell_y;
GtkTreeModel *model;
gboolean retval = FALSE;
di = get_info (tree_view);
if (di == NULL)
goto out;
if (tree_view->priv->pressed_button < 0)
goto out;
if (!gtk_drag_check_threshold (GTK_WIDGET (tree_view),
tree_view->priv->press_start_x,
tree_view->priv->press_start_y,
event->x, event->y))
goto out;
model = gtk_tree_view_get_model (tree_view);
if (model == NULL)
goto out;
button = tree_view->priv->pressed_button;
tree_view->priv->pressed_button = -1;
gtk_tree_view_get_path_at_pos (tree_view,
tree_view->priv->press_start_x,
tree_view->priv->press_start_y,
&path,
NULL,
&cell_x,
&cell_y);
if (path == NULL)
goto out;
if (!GTK_IS_TREE_DRAG_SOURCE (model) ||
!gtk_tree_drag_source_row_draggable (GTK_TREE_DRAG_SOURCE (model),
path))
goto out;
/* FIXME Check whether we're a start button, if not return FALSE and
* free path
*/
/* Now we can begin the drag */
retval = TRUE;
context = gtk_drag_begin (GTK_WIDGET (tree_view),
di->source_target_list,
di->source_actions,
button,
(GdkEvent*)event);
set_source_row (context, model, path);
out:
if (path)
gtk_tree_path_free (path);
return retval;
}
static void
gtk_tree_view_drag_begin (GtkWidget *widget,
GdkDragContext *context)
{
GtkTreeView *tree_view;
GtkTreePath *path = NULL;
gint cell_x, cell_y;
GdkPixmap *row_pix;
tree_view = GTK_TREE_VIEW (widget);
/* if the user uses a custom DnD impl, we don't set the icon here */
if (!get_info (tree_view))
return;
gtk_tree_view_get_path_at_pos (tree_view,
tree_view->priv->press_start_x,
tree_view->priv->press_start_y,
&path,
NULL,
&cell_x,
&cell_y);
g_return_if_fail (path != NULL);
row_pix = gtk_tree_view_create_row_drag_icon (tree_view,
path);
gtk_drag_set_icon_pixmap (context,
gdk_drawable_get_colormap (row_pix),
row_pix,
NULL,
/* the + 1 is for the black border in the icon */
tree_view->priv->press_start_x + 1,
cell_y + 1);
g_object_unref (row_pix);
gtk_tree_path_free (path);
}
static void
gtk_tree_view_drag_end (GtkWidget *widget,
GdkDragContext *context)
{
/* do nothing */
}
/* Default signal implementations for the drag signals */
static void
gtk_tree_view_drag_data_get (GtkWidget *widget,
GdkDragContext *context,
GtkSelectionData *selection_data,
guint info,
guint time)
{
GtkTreeView *tree_view;
GtkTreeModel *model;
TreeViewDragInfo *di;
GtkTreePath *source_row;
tree_view = GTK_TREE_VIEW (widget);
model = gtk_tree_view_get_model (tree_view);
if (model == NULL)
return;
di = get_info (GTK_TREE_VIEW (widget));
if (di == NULL)
return;
source_row = get_source_row (context);
if (source_row == NULL)
return;
/* We can implement the GTK_TREE_MODEL_ROW target generically for
* any model; for DragSource models there are some other targets
* we also support.
*/
if (GTK_IS_TREE_DRAG_SOURCE (model) &&
gtk_tree_drag_source_drag_data_get (GTK_TREE_DRAG_SOURCE (model),
source_row,
selection_data))
goto done;
/* If drag_data_get does nothing, try providing row data. */
if (selection_data->target == gdk_atom_intern ("GTK_TREE_MODEL_ROW", FALSE))
{
gtk_tree_set_row_drag_data (selection_data,
model,
source_row);
}
done:
gtk_tree_path_free (source_row);
}
static void
gtk_tree_view_drag_data_delete (GtkWidget *widget,
GdkDragContext *context)
{
TreeViewDragInfo *di;
GtkTreeModel *model;
GtkTreeView *tree_view;
GtkTreePath *source_row;
tree_view = GTK_TREE_VIEW (widget);
model = gtk_tree_view_get_model (tree_view);
if (!check_model_dnd (model, GTK_TYPE_TREE_DRAG_SOURCE, "drag_data_delete"))
return;
di = get_info (tree_view);
if (di == NULL)
return;
source_row = get_source_row (context);
if (source_row == NULL)
return;
gtk_tree_drag_source_drag_data_delete (GTK_TREE_DRAG_SOURCE (model),
source_row);
gtk_tree_path_free (source_row);
set_source_row (context, NULL, NULL);
}
static void
gtk_tree_view_drag_leave (GtkWidget *widget,
GdkDragContext *context,
guint time)
{
TreeViewDragInfo *di;
di = get_info (GTK_TREE_VIEW (widget));
/* unset any highlight row */
gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (widget),
NULL,
GTK_TREE_VIEW_DROP_BEFORE);
remove_scroll_timeout (GTK_TREE_VIEW (widget));
remove_open_timeout (GTK_TREE_VIEW (widget));
}
static gboolean
gtk_tree_view_drag_motion (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
guint time)
{
Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore Wed Sep 10 01:06:44 2003 Kristian Rietveld <kris@gtk.org> Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore DnD work and gets rid of gtk-tree-model-drop-append. Related bugs #95362 and #113314. I don't want to touch this code ever again. * gtk/gtktreeprivate.h (GtkTreePrivate): add empty_view_drop field. * gtk/gtktreednd.c (gtk_tree_get_row_drag_data): add check for selection_data->length. * gtk/gtktreeview.c (struct DestRow), (dest_row_free), (set_dest_row), (get_dest_row): we don't store just the row ref anymore, but a struct with the row ref and additional info, (set_destination_row): handle drops on empty space and some style fixes, (get_logical_dest_row): also return path_down_mode/drop_append_mode flags, handle dropping childs on their new parents, rewrite drop append handling into something saner, (gtk_tree_view_drag_motion): show a "drop possible arrow" on empty spaces, (gtk_tree_view_drag_drop): updates for updated backend, (gtk_tree_view_drag_data_received): updates for updated backend, path down mode (treestore DnD) handling, (gtk_tree_view_set_drag_dest_row): set empty_view_drop flag, when we are trying to drop a row on an empty model, (gtk_tree_view_get_drag_dest_row): handle empty_view_drop flag. * gtk/gtkliststore.c (gtk_list_store_drag_data_received), (gtk_list_store_row_drop_possible): style and drop-append fixes. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): ditto.
2003-09-09 23:13:39 +00:00
gboolean empty;
GtkTreePath *path = NULL;
Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore Wed Sep 10 01:06:44 2003 Kristian Rietveld <kris@gtk.org> Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore DnD work and gets rid of gtk-tree-model-drop-append. Related bugs #95362 and #113314. I don't want to touch this code ever again. * gtk/gtktreeprivate.h (GtkTreePrivate): add empty_view_drop field. * gtk/gtktreednd.c (gtk_tree_get_row_drag_data): add check for selection_data->length. * gtk/gtktreeview.c (struct DestRow), (dest_row_free), (set_dest_row), (get_dest_row): we don't store just the row ref anymore, but a struct with the row ref and additional info, (set_destination_row): handle drops on empty space and some style fixes, (get_logical_dest_row): also return path_down_mode/drop_append_mode flags, handle dropping childs on their new parents, rewrite drop append handling into something saner, (gtk_tree_view_drag_motion): show a "drop possible arrow" on empty spaces, (gtk_tree_view_drag_drop): updates for updated backend, (gtk_tree_view_drag_data_received): updates for updated backend, path down mode (treestore DnD) handling, (gtk_tree_view_set_drag_dest_row): set empty_view_drop flag, when we are trying to drop a row on an empty model, (gtk_tree_view_get_drag_dest_row): handle empty_view_drop flag. * gtk/gtkliststore.c (gtk_list_store_drag_data_received), (gtk_list_store_row_drop_possible): style and drop-append fixes. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): ditto.
2003-09-09 23:13:39 +00:00
GtkTreeModel *model;
GtkTreeViewDropPosition pos;
GtkTreeView *tree_view;
GdkDragAction suggested_action = 0;
GdkAtom target;
tree_view = GTK_TREE_VIEW (widget);
if (!set_destination_row (tree_view, context, x, y, &suggested_action, &target))
return FALSE;
gtk_tree_view_get_drag_dest_row (tree_view, &path, &pos);
Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore Wed Sep 10 01:06:44 2003 Kristian Rietveld <kris@gtk.org> Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore DnD work and gets rid of gtk-tree-model-drop-append. Related bugs #95362 and #113314. I don't want to touch this code ever again. * gtk/gtktreeprivate.h (GtkTreePrivate): add empty_view_drop field. * gtk/gtktreednd.c (gtk_tree_get_row_drag_data): add check for selection_data->length. * gtk/gtktreeview.c (struct DestRow), (dest_row_free), (set_dest_row), (get_dest_row): we don't store just the row ref anymore, but a struct with the row ref and additional info, (set_destination_row): handle drops on empty space and some style fixes, (get_logical_dest_row): also return path_down_mode/drop_append_mode flags, handle dropping childs on their new parents, rewrite drop append handling into something saner, (gtk_tree_view_drag_motion): show a "drop possible arrow" on empty spaces, (gtk_tree_view_drag_drop): updates for updated backend, (gtk_tree_view_drag_data_received): updates for updated backend, path down mode (treestore DnD) handling, (gtk_tree_view_set_drag_dest_row): set empty_view_drop flag, when we are trying to drop a row on an empty model, (gtk_tree_view_get_drag_dest_row): handle empty_view_drop flag. * gtk/gtkliststore.c (gtk_list_store_drag_data_received), (gtk_list_store_row_drop_possible): style and drop-append fixes. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): ditto.
2003-09-09 23:13:39 +00:00
/* we only know this *after* set_desination_row */
model = gtk_tree_view_get_model (tree_view);
empty = tree_view->priv->empty_view_drop;
if (path == NULL && !empty)
{
/* Can't drop here. */
gdk_drag_status (context, 0, time);
}
else
{
if (tree_view->priv->open_dest_timeout == 0 &&
(pos == GTK_TREE_VIEW_DROP_INTO_OR_AFTER ||
pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE))
{
tree_view->priv->open_dest_timeout =
g_timeout_add (AUTO_EXPAND_TIMEOUT, open_row_timeout, tree_view);
}
else if (tree_view->priv->scroll_timeout == 0)
{
tree_view->priv->scroll_timeout =
g_timeout_add (150, scroll_row_timeout, tree_view);
}
if (target == gdk_atom_intern ("GTK_TREE_MODEL_ROW", FALSE))
{
/* Request data so we can use the source row when
* determining whether to accept the drop
*/
set_status_pending (context, suggested_action);
gtk_drag_get_data (widget, context, target, time);
}
else
{
set_status_pending (context, 0);
gdk_drag_status (context, suggested_action, time);
}
}
if (path)
gtk_tree_path_free (path);
return TRUE;
}
static gboolean
gtk_tree_view_drag_drop (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
guint time)
{
GtkTreeView *tree_view;
GtkTreePath *path;
GdkDragAction suggested_action = 0;
GdkAtom target = GDK_NONE;
TreeViewDragInfo *di;
GtkTreeModel *model;
Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore Wed Sep 10 01:06:44 2003 Kristian Rietveld <kris@gtk.org> Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore DnD work and gets rid of gtk-tree-model-drop-append. Related bugs #95362 and #113314. I don't want to touch this code ever again. * gtk/gtktreeprivate.h (GtkTreePrivate): add empty_view_drop field. * gtk/gtktreednd.c (gtk_tree_get_row_drag_data): add check for selection_data->length. * gtk/gtktreeview.c (struct DestRow), (dest_row_free), (set_dest_row), (get_dest_row): we don't store just the row ref anymore, but a struct with the row ref and additional info, (set_destination_row): handle drops on empty space and some style fixes, (get_logical_dest_row): also return path_down_mode/drop_append_mode flags, handle dropping childs on their new parents, rewrite drop append handling into something saner, (gtk_tree_view_drag_motion): show a "drop possible arrow" on empty spaces, (gtk_tree_view_drag_drop): updates for updated backend, (gtk_tree_view_drag_data_received): updates for updated backend, path down mode (treestore DnD) handling, (gtk_tree_view_set_drag_dest_row): set empty_view_drop flag, when we are trying to drop a row on an empty model, (gtk_tree_view_get_drag_dest_row): handle empty_view_drop flag. * gtk/gtkliststore.c (gtk_list_store_drag_data_received), (gtk_list_store_row_drop_possible): style and drop-append fixes. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): ditto.
2003-09-09 23:13:39 +00:00
gboolean path_down_mode;
gboolean drop_append_mode;
tree_view = GTK_TREE_VIEW (widget);
model = gtk_tree_view_get_model (tree_view);
remove_scroll_timeout (GTK_TREE_VIEW (widget));
remove_open_timeout (GTK_TREE_VIEW (widget));
di = get_info (tree_view);
if (di == NULL)
return FALSE;
if (!check_model_dnd (model, GTK_TYPE_TREE_DRAG_DEST, "drag_drop"))
return FALSE;
if (!set_destination_row (tree_view, context, x, y, &suggested_action, &target))
return FALSE;
Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore Wed Sep 10 01:06:44 2003 Kristian Rietveld <kris@gtk.org> Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore DnD work and gets rid of gtk-tree-model-drop-append. Related bugs #95362 and #113314. I don't want to touch this code ever again. * gtk/gtktreeprivate.h (GtkTreePrivate): add empty_view_drop field. * gtk/gtktreednd.c (gtk_tree_get_row_drag_data): add check for selection_data->length. * gtk/gtktreeview.c (struct DestRow), (dest_row_free), (set_dest_row), (get_dest_row): we don't store just the row ref anymore, but a struct with the row ref and additional info, (set_destination_row): handle drops on empty space and some style fixes, (get_logical_dest_row): also return path_down_mode/drop_append_mode flags, handle dropping childs on their new parents, rewrite drop append handling into something saner, (gtk_tree_view_drag_motion): show a "drop possible arrow" on empty spaces, (gtk_tree_view_drag_drop): updates for updated backend, (gtk_tree_view_drag_data_received): updates for updated backend, path down mode (treestore DnD) handling, (gtk_tree_view_set_drag_dest_row): set empty_view_drop flag, when we are trying to drop a row on an empty model, (gtk_tree_view_get_drag_dest_row): handle empty_view_drop flag. * gtk/gtkliststore.c (gtk_list_store_drag_data_received), (gtk_list_store_row_drop_possible): style and drop-append fixes. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): ditto.
2003-09-09 23:13:39 +00:00
path = get_logical_dest_row (tree_view, &path_down_mode, &drop_append_mode);
if (target != GDK_NONE && path != NULL)
{
/* in case a motion had requested drag data, change things so we
* treat drag data receives as a drop.
*/
set_status_pending (context, 0);
Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore Wed Sep 10 01:06:44 2003 Kristian Rietveld <kris@gtk.org> Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore DnD work and gets rid of gtk-tree-model-drop-append. Related bugs #95362 and #113314. I don't want to touch this code ever again. * gtk/gtktreeprivate.h (GtkTreePrivate): add empty_view_drop field. * gtk/gtktreednd.c (gtk_tree_get_row_drag_data): add check for selection_data->length. * gtk/gtktreeview.c (struct DestRow), (dest_row_free), (set_dest_row), (get_dest_row): we don't store just the row ref anymore, but a struct with the row ref and additional info, (set_destination_row): handle drops on empty space and some style fixes, (get_logical_dest_row): also return path_down_mode/drop_append_mode flags, handle dropping childs on their new parents, rewrite drop append handling into something saner, (gtk_tree_view_drag_motion): show a "drop possible arrow" on empty spaces, (gtk_tree_view_drag_drop): updates for updated backend, (gtk_tree_view_drag_data_received): updates for updated backend, path down mode (treestore DnD) handling, (gtk_tree_view_set_drag_dest_row): set empty_view_drop flag, when we are trying to drop a row on an empty model, (gtk_tree_view_get_drag_dest_row): handle empty_view_drop flag. * gtk/gtkliststore.c (gtk_list_store_drag_data_received), (gtk_list_store_row_drop_possible): style and drop-append fixes. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): ditto.
2003-09-09 23:13:39 +00:00
set_dest_row (context, model, path,
path_down_mode, tree_view->priv->empty_view_drop,
drop_append_mode);
}
if (path)
gtk_tree_path_free (path);
/* Unset this thing */
gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (widget),
NULL,
GTK_TREE_VIEW_DROP_BEFORE);
if (target != GDK_NONE)
{
gtk_drag_get_data (widget, context, target, time);
return TRUE;
}
else
return FALSE;
}
static void
gtk_tree_view_drag_data_received (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
GtkSelectionData *selection_data,
guint info,
guint time)
{
GtkTreePath *path;
TreeViewDragInfo *di;
gboolean accepted = FALSE;
GtkTreeModel *model;
GtkTreeView *tree_view;
GtkTreePath *dest_row;
GdkDragAction suggested_action;
Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore Wed Sep 10 01:06:44 2003 Kristian Rietveld <kris@gtk.org> Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore DnD work and gets rid of gtk-tree-model-drop-append. Related bugs #95362 and #113314. I don't want to touch this code ever again. * gtk/gtktreeprivate.h (GtkTreePrivate): add empty_view_drop field. * gtk/gtktreednd.c (gtk_tree_get_row_drag_data): add check for selection_data->length. * gtk/gtktreeview.c (struct DestRow), (dest_row_free), (set_dest_row), (get_dest_row): we don't store just the row ref anymore, but a struct with the row ref and additional info, (set_destination_row): handle drops on empty space and some style fixes, (get_logical_dest_row): also return path_down_mode/drop_append_mode flags, handle dropping childs on their new parents, rewrite drop append handling into something saner, (gtk_tree_view_drag_motion): show a "drop possible arrow" on empty spaces, (gtk_tree_view_drag_drop): updates for updated backend, (gtk_tree_view_drag_data_received): updates for updated backend, path down mode (treestore DnD) handling, (gtk_tree_view_set_drag_dest_row): set empty_view_drop flag, when we are trying to drop a row on an empty model, (gtk_tree_view_get_drag_dest_row): handle empty_view_drop flag. * gtk/gtkliststore.c (gtk_list_store_drag_data_received), (gtk_list_store_row_drop_possible): style and drop-append fixes. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): ditto.
2003-09-09 23:13:39 +00:00
gboolean path_down_mode;
gboolean drop_append_mode;
tree_view = GTK_TREE_VIEW (widget);
model = gtk_tree_view_get_model (tree_view);
if (!check_model_dnd (model, GTK_TYPE_TREE_DRAG_DEST, "drag_data_received"))
return;
di = get_info (tree_view);
if (di == NULL)
return;
suggested_action = get_status_pending (context);
if (suggested_action)
{
/* We are getting this data due to a request in drag_motion,
* rather than due to a request in drag_drop, so we are just
* supposed to call drag_status, not actually paste in the
* data.
*/
Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore Wed Sep 10 01:06:44 2003 Kristian Rietveld <kris@gtk.org> Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore DnD work and gets rid of gtk-tree-model-drop-append. Related bugs #95362 and #113314. I don't want to touch this code ever again. * gtk/gtktreeprivate.h (GtkTreePrivate): add empty_view_drop field. * gtk/gtktreednd.c (gtk_tree_get_row_drag_data): add check for selection_data->length. * gtk/gtktreeview.c (struct DestRow), (dest_row_free), (set_dest_row), (get_dest_row): we don't store just the row ref anymore, but a struct with the row ref and additional info, (set_destination_row): handle drops on empty space and some style fixes, (get_logical_dest_row): also return path_down_mode/drop_append_mode flags, handle dropping childs on their new parents, rewrite drop append handling into something saner, (gtk_tree_view_drag_motion): show a "drop possible arrow" on empty spaces, (gtk_tree_view_drag_drop): updates for updated backend, (gtk_tree_view_drag_data_received): updates for updated backend, path down mode (treestore DnD) handling, (gtk_tree_view_set_drag_dest_row): set empty_view_drop flag, when we are trying to drop a row on an empty model, (gtk_tree_view_get_drag_dest_row): handle empty_view_drop flag. * gtk/gtkliststore.c (gtk_list_store_drag_data_received), (gtk_list_store_row_drop_possible): style and drop-append fixes. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): ditto.
2003-09-09 23:13:39 +00:00
path = get_logical_dest_row (tree_view, &path_down_mode,
&drop_append_mode);
if (path == NULL)
suggested_action = 0;
Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore Wed Sep 10 01:06:44 2003 Kristian Rietveld <kris@gtk.org> Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore DnD work and gets rid of gtk-tree-model-drop-append. Related bugs #95362 and #113314. I don't want to touch this code ever again. * gtk/gtktreeprivate.h (GtkTreePrivate): add empty_view_drop field. * gtk/gtktreednd.c (gtk_tree_get_row_drag_data): add check for selection_data->length. * gtk/gtktreeview.c (struct DestRow), (dest_row_free), (set_dest_row), (get_dest_row): we don't store just the row ref anymore, but a struct with the row ref and additional info, (set_destination_row): handle drops on empty space and some style fixes, (get_logical_dest_row): also return path_down_mode/drop_append_mode flags, handle dropping childs on their new parents, rewrite drop append handling into something saner, (gtk_tree_view_drag_motion): show a "drop possible arrow" on empty spaces, (gtk_tree_view_drag_drop): updates for updated backend, (gtk_tree_view_drag_data_received): updates for updated backend, path down mode (treestore DnD) handling, (gtk_tree_view_set_drag_dest_row): set empty_view_drop flag, when we are trying to drop a row on an empty model, (gtk_tree_view_get_drag_dest_row): handle empty_view_drop flag. * gtk/gtkliststore.c (gtk_list_store_drag_data_received), (gtk_list_store_row_drop_possible): style and drop-append fixes. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): ditto.
2003-09-09 23:13:39 +00:00
else if (path_down_mode)
gtk_tree_path_down (path);
if (suggested_action)
{
if (!gtk_tree_drag_dest_row_drop_possible (GTK_TREE_DRAG_DEST (model),
path,
selection_data))
Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore Wed Sep 10 01:06:44 2003 Kristian Rietveld <kris@gtk.org> Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore DnD work and gets rid of gtk-tree-model-drop-append. Related bugs #95362 and #113314. I don't want to touch this code ever again. * gtk/gtktreeprivate.h (GtkTreePrivate): add empty_view_drop field. * gtk/gtktreednd.c (gtk_tree_get_row_drag_data): add check for selection_data->length. * gtk/gtktreeview.c (struct DestRow), (dest_row_free), (set_dest_row), (get_dest_row): we don't store just the row ref anymore, but a struct with the row ref and additional info, (set_destination_row): handle drops on empty space and some style fixes, (get_logical_dest_row): also return path_down_mode/drop_append_mode flags, handle dropping childs on their new parents, rewrite drop append handling into something saner, (gtk_tree_view_drag_motion): show a "drop possible arrow" on empty spaces, (gtk_tree_view_drag_drop): updates for updated backend, (gtk_tree_view_drag_data_received): updates for updated backend, path down mode (treestore DnD) handling, (gtk_tree_view_set_drag_dest_row): set empty_view_drop flag, when we are trying to drop a row on an empty model, (gtk_tree_view_get_drag_dest_row): handle empty_view_drop flag. * gtk/gtkliststore.c (gtk_list_store_drag_data_received), (gtk_list_store_row_drop_possible): style and drop-append fixes. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): ditto.
2003-09-09 23:13:39 +00:00
{
if (path_down_mode)
{
path_down_mode = FALSE;
gtk_tree_path_up (path);
if (!gtk_tree_drag_dest_row_drop_possible (GTK_TREE_DRAG_DEST (model),
path,
selection_data))
suggested_action = 0;
}
else
suggested_action = 0;
}
}
gdk_drag_status (context, suggested_action, time);
if (path)
gtk_tree_path_free (path);
/* If you can't drop, remove user drop indicator until the next motion */
if (suggested_action == 0)
gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (widget),
NULL,
GTK_TREE_VIEW_DROP_BEFORE);
return;
}
Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore Wed Sep 10 01:06:44 2003 Kristian Rietveld <kris@gtk.org> Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore DnD work and gets rid of gtk-tree-model-drop-append. Related bugs #95362 and #113314. I don't want to touch this code ever again. * gtk/gtktreeprivate.h (GtkTreePrivate): add empty_view_drop field. * gtk/gtktreednd.c (gtk_tree_get_row_drag_data): add check for selection_data->length. * gtk/gtktreeview.c (struct DestRow), (dest_row_free), (set_dest_row), (get_dest_row): we don't store just the row ref anymore, but a struct with the row ref and additional info, (set_destination_row): handle drops on empty space and some style fixes, (get_logical_dest_row): also return path_down_mode/drop_append_mode flags, handle dropping childs on their new parents, rewrite drop append handling into something saner, (gtk_tree_view_drag_motion): show a "drop possible arrow" on empty spaces, (gtk_tree_view_drag_drop): updates for updated backend, (gtk_tree_view_drag_data_received): updates for updated backend, path down mode (treestore DnD) handling, (gtk_tree_view_set_drag_dest_row): set empty_view_drop flag, when we are trying to drop a row on an empty model, (gtk_tree_view_get_drag_dest_row): handle empty_view_drop flag. * gtk/gtkliststore.c (gtk_list_store_drag_data_received), (gtk_list_store_row_drop_possible): style and drop-append fixes. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): ditto.
2003-09-09 23:13:39 +00:00
dest_row = get_dest_row (context, &path_down_mode);
if (dest_row == NULL)
return;
Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore Wed Sep 10 01:06:44 2003 Kristian Rietveld <kris@gtk.org> Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore DnD work and gets rid of gtk-tree-model-drop-append. Related bugs #95362 and #113314. I don't want to touch this code ever again. * gtk/gtktreeprivate.h (GtkTreePrivate): add empty_view_drop field. * gtk/gtktreednd.c (gtk_tree_get_row_drag_data): add check for selection_data->length. * gtk/gtktreeview.c (struct DestRow), (dest_row_free), (set_dest_row), (get_dest_row): we don't store just the row ref anymore, but a struct with the row ref and additional info, (set_destination_row): handle drops on empty space and some style fixes, (get_logical_dest_row): also return path_down_mode/drop_append_mode flags, handle dropping childs on their new parents, rewrite drop append handling into something saner, (gtk_tree_view_drag_motion): show a "drop possible arrow" on empty spaces, (gtk_tree_view_drag_drop): updates for updated backend, (gtk_tree_view_drag_data_received): updates for updated backend, path down mode (treestore DnD) handling, (gtk_tree_view_set_drag_dest_row): set empty_view_drop flag, when we are trying to drop a row on an empty model, (gtk_tree_view_get_drag_dest_row): handle empty_view_drop flag. * gtk/gtkliststore.c (gtk_list_store_drag_data_received), (gtk_list_store_row_drop_possible): style and drop-append fixes. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): ditto.
2003-09-09 23:13:39 +00:00
if (selection_data->length >= 0)
{
if (path_down_mode)
{
gtk_tree_path_down (dest_row);
if (!gtk_tree_drag_dest_row_drop_possible (GTK_TREE_DRAG_DEST (model),
dest_row, selection_data))
gtk_tree_path_up (dest_row);
}
}
if (selection_data->length >= 0)
{
if (gtk_tree_drag_dest_drag_data_received (GTK_TREE_DRAG_DEST (model),
dest_row,
selection_data))
accepted = TRUE;
}
gtk_drag_finish (context,
accepted,
(context->action == GDK_ACTION_MOVE),
time);
if (gtk_tree_path_get_depth (dest_row) == 1
&& gtk_tree_path_get_indices (dest_row)[0] == 0)
{
/* special special case drag to "0", scroll to first item */
if (!tree_view->priv->scroll_to_path)
gtk_tree_view_scroll_to_cell (tree_view, dest_row, NULL, FALSE, 0.0, 0.0);
}
gtk_tree_path_free (dest_row);
/* drop dest_row */
Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore Wed Sep 10 01:06:44 2003 Kristian Rietveld <kris@gtk.org> Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore DnD work and gets rid of gtk-tree-model-drop-append. Related bugs #95362 and #113314. I don't want to touch this code ever again. * gtk/gtktreeprivate.h (GtkTreePrivate): add empty_view_drop field. * gtk/gtktreednd.c (gtk_tree_get_row_drag_data): add check for selection_data->length. * gtk/gtktreeview.c (struct DestRow), (dest_row_free), (set_dest_row), (get_dest_row): we don't store just the row ref anymore, but a struct with the row ref and additional info, (set_destination_row): handle drops on empty space and some style fixes, (get_logical_dest_row): also return path_down_mode/drop_append_mode flags, handle dropping childs on their new parents, rewrite drop append handling into something saner, (gtk_tree_view_drag_motion): show a "drop possible arrow" on empty spaces, (gtk_tree_view_drag_drop): updates for updated backend, (gtk_tree_view_drag_data_received): updates for updated backend, path down mode (treestore DnD) handling, (gtk_tree_view_set_drag_dest_row): set empty_view_drop flag, when we are trying to drop a row on an empty model, (gtk_tree_view_get_drag_dest_row): handle empty_view_drop flag. * gtk/gtkliststore.c (gtk_list_store_drag_data_received), (gtk_list_store_row_drop_possible): style and drop-append fixes. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): ditto.
2003-09-09 23:13:39 +00:00
set_dest_row (context, NULL, NULL, FALSE, FALSE, FALSE);
}
/* GtkContainer Methods
*/
static void
gtk_tree_view_remove (GtkContainer *container,
GtkWidget *widget)
{
GtkTreeView *tree_view;
GtkTreeViewChild *child = NULL;
GList *tmp_list;
g_return_if_fail (GTK_IS_TREE_VIEW (container));
tree_view = GTK_TREE_VIEW (container);
tmp_list = tree_view->priv->children;
while (tmp_list)
{
child = tmp_list->data;
if (child->widget == widget)
{
gtk_widget_unparent (widget);
tree_view->priv->children = g_list_remove_link (tree_view->priv->children, tmp_list);
g_list_free_1 (tmp_list);
g_free (child);
return;
}
tmp_list = tmp_list->next;
}
tmp_list = tree_view->priv->columns;
while (tmp_list)
{
GtkTreeViewColumn *column;
column = tmp_list->data;
if (column->button == widget)
{
gtk_widget_unparent (widget);
return;
}
tmp_list = tmp_list->next;
}
}
static void
gtk_tree_view_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data)
{
GtkTreeView *tree_view;
GtkTreeViewChild *child = NULL;
GtkTreeViewColumn *column;
GList *tmp_list;
g_return_if_fail (GTK_IS_TREE_VIEW (container));
g_return_if_fail (callback != NULL);
tree_view = GTK_TREE_VIEW (container);
tmp_list = tree_view->priv->children;
while (tmp_list)
{
child = tmp_list->data;
tmp_list = tmp_list->next;
(* callback) (child->widget, callback_data);
}
if (include_internals == FALSE)
return;
Port to GObject, can go back in gdk-pixbuf after setting up a 2000-12-16 Havoc Pennington <hp@pobox.com> * gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c: Port to GObject, can go back in gdk-pixbuf after setting up a gdk-pixbuf-marshal.h header over there. * gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g; (gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal args (gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be set (gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons here, do it when we create the buttons later (gtk_tree_view_realize_buttons): add some g_return_if_fail (gtk_tree_view_map): paranoia checks that column->button is shown and unmapped (gtk_tree_view_size_request): only request visible children. Move header size calculation in here, for cleanliness, and to maintain invariants for child widgets if we eventually let users set different children inside the buttons (gtk_tree_view_map_buttons): factor out code to map buttons, since it was being called several times (gtk_tree_view_size_allocate_buttons): move_resize the drag windows instead of just moving them; their height may change if we allow random widgets in there, or the theme changes. (gtk_tree_view_size_allocate): move button size allocation above emitting the scroll signals, to ensure a sane state when we hit user code (gtk_tree_view_button_release): remove queue_resize after tree_view_set_size(), set_size() will handle any resize queuing that's needed (gtk_tree_view_focus_in): just queue a draw, don't fool with draw_focus goo (gtk_tree_view_focus): use gtk_get_current_event() and gdk_event_get_state() (gtk_tree_view_deleted): don't queue_resize() after calling set_size() (gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove semicolon (gtk_tree_view_create_button): show the button here (gtk_tree_view_button_clicked): actually emit the clicked signal on the column (_gtk_tree_view_set_size): return right away if the size is unchanged, as a cheesy optimization (gtk_tree_view_setup_model): rename set_model_realized to setup_model to match the flag that indicates whether we've called it (gtk_tree_view_get_hadjustment): create adjustment if it doesn't exist, because set_scroll_adjustment does that and it shouldn't matter what order you call these in (gtk_tree_view_get_vadjustment): ditto (gtk_tree_view_set_headers_visible): canonicalize the bool, for paranoia (gtk_tree_view_set_headers_visible): call gtk_tree_view_map_buttons() instead of using cut-and-paste code (gtk_tree_view_append_column): clarify whether the return value is the count of columns before or after, and do the increment separately from the return statement so you can tell from the code. (gtk_tree_view_remove_column): ditto (gtk_tree_view_insert_column): ditto (gtk_tree_view_get_column): remove g_return_if_fail for columns outside the existing range, the docs say that outside-range columns are allowed, so we handle them as documented. (Presumably this allows a nice loop with column != NULL as test.) (gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments mean (left/right/center etc.). (gtk_tree_view_collapse_all): only queue a draw if we're mapped (gtk_tree_view_expand_row): add docs (gtk_tree_view_collapse_row): add docs * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new function to emit the clicked signal on a column * gdk/gdkevents.c (gdk_event_get_state): new function, to get the state of an event (gdk_event_get_time): don't treat GDK_SCROLL as a button event, remove default case from switch so gcc will whine if we don't explicitly handle all event types * gtk/gtktreeselection.h: added some FIXME * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename "columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
for (tmp_list = tree_view->priv->columns; tmp_list; tmp_list = tmp_list->next)
{
column = tmp_list->data;
if (column->button)
(* callback) (column->button, callback_data);
}
}
The "big treeview focus patch". Fixes several issues and adds some Sun May 5 16:42:32 2002 Kristian Rietveld <kris@gtk.org> The "big treeview focus patch". Fixes several issues and adds some goodies. Related bugs: #73676, #73734, #78660. * gtk/gtktreeview.h: add gtk_tree_view_set_cursor_on_cell * gtk/gtktreeview.c (gtk_tree_view_button_press): focus on a cell if applicable, (gtk_tree_view_bin_expose): set_cell_data before iterating columns, add support for row-spanning focus rectangles, (gtk_tree_view_has_special_cell): new function, (gtk_tree_view_move_cursor_left_right): add support for multiple focusable cells in one column, (gtk_tree_view_set_cursor): call _set_cursor_on_cell now, (gtk_tree_view_set_cursor_on_cell): copy of _set_cursor, extended with focus_cell parameter, (gtk_tree_view_search_iter): removed unused column variable, (gtk_tree_view_start_editing): add neighbor size code to allow for multiple editable cells in one column. * gtk/gtktreeviewcolumn.c (_GtkTreeViewColumnCellInfo): add in_editing_mode field, (gtk_tree_view_column_get_edited_cell): new function, removed _get_editable_cell, (_gtk_tree_view_column_get_cell_at_pos): new function, (gtk_tree_view_column_pack_end): s/g_new/g_new0/ ..., (gtk_tree_view_column_cell_process_action): loads of changes to get it right and to allow for multiple special cells, etc, (gtk_tree_view_column_cell_first): new function, (gtk_tree_view_column_cell_last): ditto, (gtk_tree_view_column_cell_next): ditto, (gtk_tree_view_column_cell_prev): ditto, (gtk_tree_view_column_cell_focus): add left and right parameters, allow for multiple special cells, (gtk_tree_view_column_cell_is_visible): add assertion, (gtk_tree_view_column_focus_cell): new function, (gtk_tree_view_column_stop_editing): unset in_editing_mode flag, (_gtk_tree_view_column_get_neighbor_sizes): iterate through cells correctly * gtk/gtktreeviewcolumn.h: add gtk_tree_view_column_focus_cell * gtk/gtktreeprivate.h: s/_get_editable_cell/_get_edited_cell/, add _gtk_tree_view_column_get_cell_at_pos, add new parameters to _gtk_tree_view_column_cell_focus. * tests/testtreeedit.c: add some cells in order to test new code.
2002-05-05 14:54:00 +00:00
/* Returns TRUE if the treeview contains no "special" (editable or activatable)
* cells. If so we draw one big row-spanning focus rectangle.
*/
static gboolean
gtk_tree_view_has_special_cell (GtkTreeView *tree_view)
{
GList *list;
for (list = tree_view->priv->columns; list; list = list->next)
{
if (!((GtkTreeViewColumn *)list->data)->visible)
continue;
if (_gtk_tree_view_column_count_special_cells (list->data))
return TRUE;
}
return FALSE;
}
static void
column_sizing_notify (GObject *object,
GParamSpec *pspec,
gpointer data)
{
GtkTreeViewColumn *c = GTK_TREE_VIEW_COLUMN (object);
if (gtk_tree_view_column_get_sizing (c) != GTK_TREE_VIEW_COLUMN_FIXED)
/* disable fixed height mode */
g_object_set (data, "fixed_height_mode", FALSE, NULL);
}
/**
* gtk_tree_view_set_fixed_height_mode:
* @tree_view: a #GtkTreeView
* @enable: %TRUE to enable fixed height mode
*
* Enables or disables the fixed height mode of @tree_view.
* Fixed height mode speeds up #GtkTreeView by assuming that all
* rows have the same height.
* Only enable this option if all rows are the same height and all
* columns are of type %GTK_TREE_VIEW_COLUMN_FIXED.
*
* Since: 2.6
**/
void
gtk_tree_view_set_fixed_height_mode (GtkTreeView *tree_view,
gboolean enable)
{
GList *l;
enable = enable != FALSE;
if (enable == tree_view->priv->fixed_height_mode)
return;
if (!enable)
{
tree_view->priv->fixed_height_mode = 0;
tree_view->priv->fixed_height = -1;
/* force a revalidation */
install_presize_handler (tree_view);
}
else
{
/* make sure all columns are of type FIXED */
for (l = tree_view->priv->columns; l; l = l->next)
{
GtkTreeViewColumn *c = l->data;
g_return_if_fail (gtk_tree_view_column_get_sizing (c) == GTK_TREE_VIEW_COLUMN_FIXED);
}
/* yes, we really have to do this is in a separate loop */
for (l = tree_view->priv->columns; l; l = l->next)
g_signal_connect (l->data, "notify::sizing",
G_CALLBACK (column_sizing_notify), tree_view);
tree_view->priv->fixed_height_mode = 1;
tree_view->priv->fixed_height = -1;
if (tree_view->priv->tree)
initialize_fixed_height_mode (tree_view);
}
g_object_notify (G_OBJECT (tree_view), "fixed-height-mode");
}
/**
* gtk_tree_view_get_fixed_height_mode:
* @tree_view: a #GtkTreeView
*
* Returns whether fixed height mode is turned on for @tree_view.
*
* Return value: %TRUE if @tree_view is in fixed height mode
*
* Since: 2.6
**/
gboolean
gtk_tree_view_get_fixed_height_mode (GtkTreeView *tree_view)
{
return tree_view->priv->fixed_height_mode;
}
/* Returns TRUE if the focus is within the headers, after the focus operation is
* done
*/
static gboolean
gtk_tree_view_header_focus (GtkTreeView *tree_view,
GtkDirectionType dir)
{
GtkWidget *focus_child;
GtkContainer *container;
GList *last_column, *first_column;
GList *tmp_list;
gboolean rtl;
if (! GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_HEADERS_VISIBLE))
return FALSE;
focus_child = GTK_CONTAINER (tree_view)->focus_child;
container = GTK_CONTAINER (tree_view);
first_column = tree_view->priv->columns;
while (first_column)
{
if (GTK_WIDGET_CAN_FOCUS (GTK_TREE_VIEW_COLUMN (first_column->data)->button) &&
GTK_TREE_VIEW_COLUMN (first_column->data)->visible &&
(GTK_TREE_VIEW_COLUMN (first_column->data)->clickable ||
GTK_TREE_VIEW_COLUMN (first_column->data)->reorderable))
break;
first_column = first_column->next;
}
/* No headers are visible, or are focusable. We can't focus in or out.
*/
if (first_column == NULL)
return FALSE;
last_column = g_list_last (tree_view->priv->columns);
while (last_column)
{
if (GTK_WIDGET_CAN_FOCUS (GTK_TREE_VIEW_COLUMN (last_column->data)->button) &&
GTK_TREE_VIEW_COLUMN (last_column->data)->visible &&
(GTK_TREE_VIEW_COLUMN (last_column->data)->clickable ||
GTK_TREE_VIEW_COLUMN (last_column->data)->reorderable))
break;
last_column = last_column->prev;
}
rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
if (rtl) {
GList *temp = first_column;
first_column = last_column;
last_column = temp;
}
switch (dir)
{
case GTK_DIR_TAB_BACKWARD:
case GTK_DIR_TAB_FORWARD:
case GTK_DIR_UP:
case GTK_DIR_DOWN:
if (focus_child == NULL)
{
if (tree_view->priv->focus_column != NULL)
focus_child = tree_view->priv->focus_column->button;
else
focus_child = GTK_TREE_VIEW_COLUMN (first_column->data)->button;
gtk_widget_grab_focus (focus_child);
break;
}
return FALSE;
case GTK_DIR_LEFT:
case GTK_DIR_RIGHT:
if (focus_child == NULL)
{
if (tree_view->priv->focus_column != NULL)
focus_child = tree_view->priv->focus_column->button;
else if (dir == GTK_DIR_LEFT)
focus_child = GTK_TREE_VIEW_COLUMN (last_column->data)->button;
else
focus_child = GTK_TREE_VIEW_COLUMN (first_column->data)->button;
gtk_widget_grab_focus (focus_child);
break;
}
fix bug where it always set the foreground, even if we were only using a 2001-02-12 Havoc Pennington <hp@pobox.com> * gdk/gdkpango.c (gdk_pango_get_gc): fix bug where it always set the foreground, even if we were only using a stipple. (gdk_draw_layout_line_with_colors): new function, allow override colors (gdk_draw_layout_with_colors): new function, allow override colors (gdk_pango_layout_line_get_clip_region): function to get the clip region for a logical text range (gdk_pango_layout_get_clip_region): get the clip region for a logical text range * gdk/x11/gdkcolor-x11.c: forward declare gdk_colormap_sync(), (gdk_colormap_new): fix call to gdk_colormap_sync() so it has the right number of arguments. * gtk/gtktextbtree.c (gtk_text_btree_node_check_consistency): enhance the function to check that node data corresponds to a view still belonging to the tree. * gtk/gtktreeview.c (gtk_tree_view_changed): we were leaking the GtkTreePath (gtk_tree_view_inserted): ditto (gtk_tree_view_child_toggled): ditto * gtk/gtktreemodel.c (gtk_tree_path_append_index): use realloc to simplify this code. * gtk/gtkcellrenderertext.c (get_layout): fix leak of a PangoAttrList * demos/gtk-demo/main.c (load_file): Fix leak of a GString * gtk/gtkentry.c (gtk_entry_realize): Fix leak of a GdkCursor * gtk/gtkmenubar.c (gtk_menu_bar_size_request): consider toggle size in the size request (gtk_menu_bar_size_allocate): consider toggle size here * gtk/gtkimagemenuitem.h, gtkimagemenuitem.c: Menu item that displays a widget in the toggle slot * gtk/testgtk.c: test GtkImageMenuItem * gtk/Makefile.am, gtk/gtk.h: Add GtkImageMenuItem * gtk/gtkmenuitem.h: Use "gint" not "guint16" for toggle size request and allocation * gtk/gtkmenu.c (gtk_menu_size_request): use gint not guint16 * gtk/gtkcheckmenuitem.c (gtk_check_menu_item_toggle_size_request): ditto
2001-02-13 05:44:47 +00:00
if (gtk_widget_child_focus (focus_child, dir))
{
/* The focus moves inside the button. */
/* This is probably a great example of bad UI */
break;
}
/* We need to move the focus among the row of buttons. */
for (tmp_list = tree_view->priv->columns; tmp_list; tmp_list = tmp_list->next)
if (GTK_TREE_VIEW_COLUMN (tmp_list->data)->button == focus_child)
break;
if (tmp_list == first_column && dir == GTK_DIR_LEFT)
{
focus_child = GTK_TREE_VIEW_COLUMN (last_column->data)->button;
gtk_widget_grab_focus (focus_child);
break;
}
else if (tmp_list == last_column && dir == GTK_DIR_RIGHT)
{
focus_child = GTK_TREE_VIEW_COLUMN (first_column->data)->button;
gtk_widget_grab_focus (focus_child);
break;
}
while (tmp_list)
{
GtkTreeViewColumn *column;
if (dir == GTK_DIR_RIGHT)
tmp_list = tmp_list->next;
else
tmp_list = tmp_list->prev;
if (tmp_list == NULL)
{
g_warning ("Internal button not found");
break;
}
column = tmp_list->data;
if (column->button &&
column->visible &&
GTK_WIDGET_CAN_FOCUS (column->button))
{
focus_child = column->button;
gtk_widget_grab_focus (column->button);
break;
}
}
break;
default:
g_assert_not_reached ();
break;
}
/* if focus child is non-null, we assume it's been set to the current focus child
*/
if (focus_child)
{
for (tmp_list = tree_view->priv->columns; tmp_list; tmp_list = tmp_list->next)
if (GTK_TREE_VIEW_COLUMN (tmp_list->data)->button == focus_child)
break;
tree_view->priv->focus_column = GTK_TREE_VIEW_COLUMN (tmp_list->data);
/* If the following isn't true, then the view is smaller then the scrollpane.
*/
if ((focus_child->allocation.x + focus_child->allocation.width) <=
(tree_view->priv->hadjustment->upper))
{
/* Scroll to the button, if needed */
if ((tree_view->priv->hadjustment->value + tree_view->priv->hadjustment->page_size) <
(focus_child->allocation.x + focus_child->allocation.width))
gtk_adjustment_set_value (tree_view->priv->hadjustment,
focus_child->allocation.x + focus_child->allocation.width -
tree_view->priv->hadjustment->page_size);
else if (tree_view->priv->hadjustment->value > focus_child->allocation.x)
gtk_adjustment_set_value (tree_view->priv->hadjustment,
focus_child->allocation.x);
}
}
return (focus_child != NULL);
}
static gint
gtk_tree_view_focus (GtkWidget *widget,
GtkDirectionType direction)
{
GtkTreeView *tree_view;
GtkWidget *focus_child;
GtkContainer *container;
g_return_val_if_fail (GTK_IS_TREE_VIEW (widget), FALSE);
g_return_val_if_fail (GTK_WIDGET_VISIBLE (widget), FALSE);
container = GTK_CONTAINER (widget);
tree_view = GTK_TREE_VIEW (widget);
if (!GTK_WIDGET_IS_SENSITIVE (container))
return FALSE;
focus_child = container->focus_child;
gtk_tree_view_stop_editing (GTK_TREE_VIEW (widget), FALSE);
/* Case 1. Headers currently have focus. */
if (focus_child)
{
switch (direction)
{
case GTK_DIR_LEFT:
case GTK_DIR_RIGHT:
gtk_tree_view_header_focus (tree_view, direction);
return TRUE;
case GTK_DIR_TAB_BACKWARD:
case GTK_DIR_UP:
return FALSE;
case GTK_DIR_TAB_FORWARD:
case GTK_DIR_DOWN:
gtk_widget_grab_focus (widget);
return TRUE;
default:
g_assert_not_reached ();
return FALSE;
}
}
/* Case 2. We don't have focus at all. */
if (!GTK_WIDGET_HAS_FOCUS (container))
{
if (!gtk_tree_view_header_focus (tree_view, direction))
gtk_widget_grab_focus (widget);
return TRUE;
}
/* Case 3. We have focus already. */
if (direction == GTK_DIR_TAB_BACKWARD)
return (gtk_tree_view_header_focus (tree_view, direction));
else if (direction == GTK_DIR_TAB_FORWARD)
return FALSE;
/* Other directions caught by the keybindings */
gtk_widget_grab_focus (widget);
return TRUE;
}
static void
gtk_tree_view_grab_focus (GtkWidget *widget)
{
(* GTK_WIDGET_CLASS (parent_class)->grab_focus) (widget);
gtk_tree_view_focus_to_cursor (GTK_TREE_VIEW (widget));
}
static void
gtk_tree_view_style_set (GtkWidget *widget,
GtkStyle *previous_style)
{
GtkTreeView *tree_view;
GList *list;
GtkTreeViewColumn *column;
g_return_if_fail (GTK_IS_TREE_VIEW (widget));
tree_view = GTK_TREE_VIEW (widget);
if (GTK_WIDGET_REALIZED (widget))
{
gdk_window_set_background (widget->window, &widget->style->base[widget->state]);
gdk_window_set_background (tree_view->priv->bin_window, &widget->style->base[widget->state]);
}
gtk_widget_style_get (widget,
"expander_size", &tree_view->priv->expander_size,
NULL);
tree_view->priv->expander_size += EXPANDER_EXTRA_PADDING;
for (list = tree_view->priv->columns; list; list = list->next)
{
column = list->data;
_gtk_tree_view_column_cell_set_dirty (column, TRUE);
}
tree_view->priv->fixed_height = -1;
_gtk_rbtree_mark_invalid (tree_view->priv->tree);
gtk_widget_queue_resize (widget);
}
static void
gtk_tree_view_set_focus_child (GtkContainer *container,
GtkWidget *child)
{
GtkTreeView *tree_view = GTK_TREE_VIEW (container);
GList *list;
for (list = tree_view->priv->columns; list; list = list->next)
{
if (GTK_TREE_VIEW_COLUMN (list->data)->button == child)
{
tree_view->priv->focus_column = GTK_TREE_VIEW_COLUMN (list->data);
break;
}
}
(* 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 (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 (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 (tree_view->priv->hadjustment);
gtk_object_sink (GTK_OBJECT (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 (tree_view->priv->vadjustment);
gtk_object_sink (GTK_OBJECT (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,
gint count)
{
GdkModifierType state;
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), FALSE);
g_return_val_if_fail (step == GTK_MOVEMENT_LOGICAL_POSITIONS ||
step == GTK_MOVEMENT_VISUAL_POSITIONS ||
step == GTK_MOVEMENT_DISPLAY_LINES ||
step == GTK_MOVEMENT_PAGES ||
step == GTK_MOVEMENT_BUFFER_ENDS, FALSE);
if (tree_view->priv->tree == NULL)
return FALSE;
if (!GTK_WIDGET_HAS_FOCUS (GTK_WIDGET (tree_view)))
return FALSE;
gtk_tree_view_stop_editing (tree_view, FALSE);
GTK_TREE_VIEW_SET_FLAG (tree_view, GTK_TREE_VIEW_DRAW_KEYFOCUS);
gtk_widget_grab_focus (GTK_WIDGET (tree_view));
if (gtk_get_current_event_state (&state))
{
if ((state & GDK_CONTROL_MASK) == GDK_CONTROL_MASK)
tree_view->priv->ctrl_pressed = TRUE;
if ((state & GDK_SHIFT_MASK) == GDK_SHIFT_MASK)
tree_view->priv->shift_pressed = TRUE;
}
/* else we assume not pressed */
switch (step)
{
/* currently we make no distinction. When we go bi-di, we need to */
case GTK_MOVEMENT_LOGICAL_POSITIONS:
case GTK_MOVEMENT_VISUAL_POSITIONS:
gtk_tree_view_move_cursor_left_right (tree_view, count);
break;
case GTK_MOVEMENT_DISPLAY_LINES:
gtk_tree_view_move_cursor_up_down (tree_view, count);
break;
case GTK_MOVEMENT_PAGES:
gtk_tree_view_move_cursor_page_up_down (tree_view, count);
break;
case GTK_MOVEMENT_BUFFER_ENDS:
gtk_tree_view_move_cursor_start_end (tree_view, count);
break;
default:
g_assert_not_reached ();
}
tree_view->priv->ctrl_pressed = FALSE;
tree_view->priv->shift_pressed = FALSE;
return TRUE;
}
static void
gtk_tree_view_put (GtkTreeView *tree_view,
GtkWidget *child_widget,
gint x,
gint y,
gint width,
gint height)
{
GtkTreeViewChild *child;
2004-07-16 20:27:40 +00:00
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
g_return_if_fail (GTK_IS_WIDGET (child_widget));
child = g_new (GtkTreeViewChild, 1);
child->widget = child_widget;
child->x = x;
child->y = y;
child->width = width;
child->height = height;
tree_view->priv->children = g_list_append (tree_view->priv->children, child);
if (GTK_WIDGET_REALIZED (tree_view))
gtk_widget_set_parent_window (child->widget, tree_view->priv->bin_window);
2004-07-16 20:27:40 +00:00
gtk_widget_set_parent (child_widget, GTK_WIDGET (tree_view));
}
void
_gtk_tree_view_child_move_resize (GtkTreeView *tree_view,
GtkWidget *widget,
gint x,
gint y,
gint width,
gint height)
{
GtkTreeViewChild *child = NULL;
GList *list;
GdkRectangle allocation;
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
g_return_if_fail (GTK_IS_WIDGET (widget));
for (list = tree_view->priv->children; list; list = list->next)
{
if (((GtkTreeViewChild *)list->data)->widget == widget)
{
child = list->data;
break;
}
}
if (child == NULL)
return;
allocation.x = child->x = x;
allocation.y = child->y = y;
allocation.width = child->width = width;
allocation.height = child->height = height;
if (GTK_WIDGET_REALIZED (widget))
gtk_widget_size_allocate (widget, &allocation);
}
/* TreeModel Callbacks
*/
static void
gtk_tree_view_row_changed (GtkTreeModel *model,
GtkTreePath *path,
GtkTreeIter *iter,
gpointer data)
{
GtkTreeView *tree_view = (GtkTreeView *)data;
GtkRBTree *tree;
GtkRBNode *node;
gboolean free_path = FALSE;
gint vertical_separator;
GList *list;
g_return_if_fail (path != NULL || iter != NULL);
if (!GTK_WIDGET_REALIZED (tree_view))
/* We can just ignore ::changed signals if we aren't realized, as we don't care about sizes
*/
return;
if (tree_view->priv->edited_column)
gtk_tree_view_stop_editing (tree_view, TRUE);
gtk_widget_style_get (GTK_WIDGET (data), "vertical_separator", &vertical_separator, NULL);
if (path == NULL)
{
path = gtk_tree_model_get_path (model, iter);
free_path = TRUE;
}
else if (iter == NULL)
gtk_tree_model_get_iter (model, iter, path);
if (_gtk_tree_view_find_node (tree_view,
path,
&tree,
&node))
/* We aren't actually showing the node */
goto done;
if (tree == NULL)
goto done;
if (tree_view->priv->fixed_height_mode
&& tree_view->priv->fixed_height >= 0)
{
_gtk_rbtree_node_set_height (tree, node, tree_view->priv->fixed_height);
gtk_tree_view_node_queue_redraw (tree_view, tree, node);
}
else
{
_gtk_rbtree_node_mark_invalid (tree, node);
for (list = tree_view->priv->columns; list; list = list->next)
{
GtkTreeViewColumn *column;
column = list->data;
if (! column->visible)
continue;
if (column->column_type == GTK_TREE_VIEW_COLUMN_AUTOSIZE)
{
_gtk_tree_view_column_cell_set_dirty (column, TRUE);
}
}
}
done:
if (!tree_view->priv->fixed_height_mode)
install_presize_handler (tree_view);
if (free_path)
gtk_tree_path_free (path);
}
static void
gtk_tree_view_row_inserted (GtkTreeModel *model,
GtkTreePath *path,
GtkTreeIter *iter,
gpointer data)
{
GtkTreeView *tree_view = (GtkTreeView *) data;
gint *indices;
GtkRBTree *tmptree, *tree;
GtkRBNode *tmpnode = NULL;
gint depth;
gint i = 0;
gint height;
gboolean free_path = FALSE;
g_return_if_fail (path != NULL || iter != NULL);
if (path == NULL)
{
path = gtk_tree_model_get_path (model, iter);
free_path = TRUE;
}
else if (iter == NULL)
gtk_tree_model_get_iter (model, iter, path);
if (tree_view->priv->tree == NULL)
tree_view->priv->tree = _gtk_rbtree_new ();
tmptree = tree = tree_view->priv->tree;
/* Update all row-references */
gtk_tree_row_reference_inserted (G_OBJECT (data), path);
depth = gtk_tree_path_get_depth (path);
indices = gtk_tree_path_get_indices (path);
/* First, find the parent tree */
while (i < depth - 1)
{
if (tmptree == NULL)
{
/* We aren't showing the node */
goto done;
}
tmpnode = _gtk_rbtree_find_count (tmptree, indices[i] + 1);
if (tmpnode == NULL)
{
g_warning ("A node was inserted with a parent that's not in the tree.\n" \
"This possibly means that a GtkTreeModel inserted a child node\n" \
"before the parent was inserted.");
goto done;
}
else if (!GTK_RBNODE_FLAG_SET (tmpnode, GTK_RBNODE_IS_PARENT))
{
/* FIXME enforce correct behavior on model, probably */
/* In theory, the model should have emitted has_child_toggled here. We
* try to catch it anyway, just to be safe, in case the model hasn't.
*/
GtkTreePath *tmppath = _gtk_tree_view_find_path (tree_view,
tree,
tmpnode);
gtk_tree_view_row_has_child_toggled (model, tmppath, NULL, data);
gtk_tree_path_free (tmppath);
goto done;
}
tmptree = tmpnode->children;
tree = tmptree;
i++;
}
if (tree == NULL)
goto done;
if (tree_view->priv->fixed_height_mode
&& tree_view->priv->fixed_height >= 0)
height = tree_view->priv->fixed_height;
else
height = 0;
/* ref the node */
gtk_tree_model_ref_node (tree_view->priv->model, iter);
if (indices[depth - 1] == 0)
{
tmpnode = _gtk_rbtree_find_count (tree, 1);
_gtk_rbtree_insert_before (tree, tmpnode, height, FALSE);
}
else
{
tmpnode = _gtk_rbtree_find_count (tree, indices[depth - 1]);
_gtk_rbtree_insert_after (tree, tmpnode, height, FALSE);
}
done:
install_presize_handler (tree_view);
if (free_path)
gtk_tree_path_free (path);
}
static void
gtk_tree_view_row_has_child_toggled (GtkTreeModel *model,
GtkTreePath *path,
GtkTreeIter *iter,
gpointer data)
{
GtkTreeView *tree_view = (GtkTreeView *)data;
GtkTreeIter real_iter;
gboolean has_child;
GtkRBTree *tree;
GtkRBNode *node;
gboolean free_path = FALSE;
g_return_if_fail (path != NULL || iter != NULL);
if (iter)
real_iter = *iter;
if (path == NULL)
{
path = gtk_tree_model_get_path (model, iter);
free_path = TRUE;
}
else if (iter == NULL)
gtk_tree_model_get_iter (model, &real_iter, path);
if (_gtk_tree_view_find_node (tree_view,
path,
&tree,
&node))
/* We aren't actually showing the node */
goto done;
if (tree == NULL)
goto done;
has_child = gtk_tree_model_iter_has_child (model, &real_iter);
/* Sanity check.
*/
if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_PARENT) == has_child)
goto done;
if (has_child)
GTK_RBNODE_SET_FLAG (node, GTK_RBNODE_IS_PARENT);
else
GTK_RBNODE_UNSET_FLAG (node, GTK_RBNODE_IS_PARENT);
if (has_child && GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_IS_LIST))
{
GTK_TREE_VIEW_UNSET_FLAG (tree_view, GTK_TREE_VIEW_IS_LIST);
if (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_SHOW_EXPANDERS))
{
GList *list;
for (list = tree_view->priv->columns; list; list = list->next)
if (GTK_TREE_VIEW_COLUMN (list->data)->visible)
{
GTK_TREE_VIEW_COLUMN (list->data)->dirty = TRUE;
_gtk_tree_view_column_cell_set_dirty (GTK_TREE_VIEW_COLUMN (list->data), TRUE);
break;
}
}
gtk_widget_queue_resize (GTK_WIDGET (tree_view));
}
else
{
_gtk_tree_view_queue_draw_node (tree_view, tree, node, NULL);
}
done:
if (free_path)
gtk_tree_path_free (path);
}
static void
count_children_helper (GtkRBTree *tree,
GtkRBNode *node,
gpointer data)
{
if (node->children)
_gtk_rbtree_traverse (node->children, node->children->root, G_POST_ORDER, count_children_helper, data);
(*((gint *)data))++;
}
static void
check_selection_helper (GtkRBTree *tree,
GtkRBNode *node,
gpointer data)
{
gint *value = (gint *)data;
*value = GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_SELECTED);
if (node->children && !*value)
_gtk_rbtree_traverse (node->children, node->children->root, G_POST_ORDER, check_selection_helper, data);
}
static void
gtk_tree_view_row_deleted (GtkTreeModel *model,
GtkTreePath *path,
gpointer data)
{
GtkTreeView *tree_view = (GtkTreeView *)data;
GtkRBTree *tree;
GtkRBNode *node;
GList *list;
gint selection_changed = FALSE;
g_return_if_fail (path != NULL);
gtk_tree_row_reference_deleted (G_OBJECT (data), path);
if (_gtk_tree_view_find_node (tree_view, path, &tree, &node))
return;
if (tree == NULL)
return;
/* check if the selection has been changed */
_gtk_rbtree_traverse (tree, node, G_POST_ORDER,
check_selection_helper, &selection_changed);
for (list = tree_view->priv->columns; list; list = list->next)
if (((GtkTreeViewColumn *)list->data)->visible &&
((GtkTreeViewColumn *)list->data)->column_type == GTK_TREE_VIEW_COLUMN_AUTOSIZE)
_gtk_tree_view_column_cell_set_dirty ((GtkTreeViewColumn *)list->data, TRUE);
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
/* Ensure we don't have a dangling pointer to a dead node */
ensure_unprelighted (tree_view);
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
/* Cancel editting if we've started */
gtk_tree_view_stop_editing (tree_view, TRUE);
Add support for animating expanders. 2001-07-22 Anders Carlsson <andersca@gnome.org> * gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the expander_height and expander_width properties with a single property, expander_size. (gtk_tree_view_init): Set the tab_offset to expander_size plus some padding. (gtk_tree_view_unrealize): Remove the expand/collapse timeout if it exists. (coords_are_over_arrow): Fix a small bug. (gtk_tree_view_motion_draw_column_motion_arrow): Use expander_size. (gtk_tree_view_draw_focus): Use "treeview" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_bin_expose): Use "treeview-drop-indicator" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_deleted): If we have a node currently being expanded or collapsed, remove the timeout and set the node to NULL. (gtk_tree_view_queue_draw_arrow): New function that just redraws the arrow of a node. (gtk_tree_view_draw_arrow): Use expander_size instead of expander_width/expander_height, also pass a different expander_style to gtk_paint_expander depending on the state of the node being drawn. (expand_collapse_timeout): New function for expanding or collapsing a node depending on the previous state. (gtk_tree_view_real_expand_row): Add timeout and set correct state for node being expanded. (gtk_tree_view_real_collapse_row): Add timeout and set correct state for node being collapsed. * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add information about the node currently being expanded or collapsed, and also a timeout id. * gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open with expander_style for draw_expander. * gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with expander_style. (create_expander_affine): New function for creating an expander affine. (apply_affine_on_point): New function for applying an affine to a point. (gtk_default_draw_expander): Modified to take expander_style instead of is_open, and to draw the rectangle rotated differently depending on the expander style. (gtk_paint_expander): Replace is_open with expander_style. * gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor. * gtk/gtkenums.h: Add expander style enum.
2001-07-22 20:09:00 +00:00
/* If we have a node expanded/collapsed timeout, remove it */
if (tree_view->priv->expand_collapse_timeout != 0)
{
g_source_remove (tree_view->priv->expand_collapse_timeout);
Add support for animating expanders. 2001-07-22 Anders Carlsson <andersca@gnome.org> * gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the expander_height and expander_width properties with a single property, expander_size. (gtk_tree_view_init): Set the tab_offset to expander_size plus some padding. (gtk_tree_view_unrealize): Remove the expand/collapse timeout if it exists. (coords_are_over_arrow): Fix a small bug. (gtk_tree_view_motion_draw_column_motion_arrow): Use expander_size. (gtk_tree_view_draw_focus): Use "treeview" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_bin_expose): Use "treeview-drop-indicator" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_deleted): If we have a node currently being expanded or collapsed, remove the timeout and set the node to NULL. (gtk_tree_view_queue_draw_arrow): New function that just redraws the arrow of a node. (gtk_tree_view_draw_arrow): Use expander_size instead of expander_width/expander_height, also pass a different expander_style to gtk_paint_expander depending on the state of the node being drawn. (expand_collapse_timeout): New function for expanding or collapsing a node depending on the previous state. (gtk_tree_view_real_expand_row): Add timeout and set correct state for node being expanded. (gtk_tree_view_real_collapse_row): Add timeout and set correct state for node being collapsed. * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add information about the node currently being expanded or collapsed, and also a timeout id. * gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open with expander_style for draw_expander. * gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with expander_style. (create_expander_affine): New function for creating an expander affine. (apply_affine_on_point): New function for applying an affine to a point. (gtk_default_draw_expander): Modified to take expander_style instead of is_open, and to draw the rectangle rotated differently depending on the expander style. (gtk_paint_expander): Replace is_open with expander_style. * gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor. * gtk/gtkenums.h: Add expander style enum.
2001-07-22 20:09:00 +00:00
tree_view->priv->expand_collapse_timeout = 0;
/* Reset node */
GTK_RBNODE_UNSET_FLAG (tree_view->priv->expanded_collapsed_node, GTK_RBNODE_IS_SEMI_COLLAPSED);
GTK_RBNODE_UNSET_FLAG (tree_view->priv->expanded_collapsed_node, GTK_RBNODE_IS_SEMI_EXPANDED);
tree_view->priv->expanded_collapsed_node = NULL;
}
if (tree_view->priv->destroy_count_func)
{
gint child_count = 0;
if (node->children)
_gtk_rbtree_traverse (node->children, node->children->root, G_POST_ORDER, count_children_helper, &child_count);
(* tree_view->priv->destroy_count_func) (tree_view, path, child_count, tree_view->priv->destroy_count_data);
}
if (tree->root->count == 1)
{
if (tree_view->priv->tree == tree)
tree_view->priv->tree = NULL;
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
_gtk_rbtree_remove (tree);
}
else
{
_gtk_rbtree_remove_node (tree, node);
}
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
if (! gtk_tree_row_reference_valid (tree_view->priv->top_row))
{
gtk_tree_row_reference_free (tree_view->priv->top_row);
tree_view->priv->top_row = NULL;
}
install_scroll_sync_handler (tree_view);
gtk_widget_queue_resize (GTK_WIDGET (tree_view));
if (selection_changed)
g_signal_emit_by_name (tree_view->priv->selection, "changed");
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
}
static void
cancel_arrow_animation (GtkTreeView *tree_view)
{
if (tree_view->priv->expand_collapse_timeout)
{
while (do_expand_collapse (tree_view));
g_source_remove (tree_view->priv->expand_collapse_timeout);
tree_view->priv->expand_collapse_timeout = 0;
}
}
static void
gtk_tree_view_rows_reordered (GtkTreeModel *model,
GtkTreePath *parent,
GtkTreeIter *iter,
gint *new_order,
gpointer data)
{
GtkTreeView *tree_view = GTK_TREE_VIEW (data);
GtkRBTree *tree;
GtkRBNode *node;
gint len;
len = gtk_tree_model_iter_n_children (model, iter);
if (len < 2)
return;
gtk_tree_row_reference_reordered (G_OBJECT (data),
parent,
iter,
new_order);
if (_gtk_tree_view_find_node (tree_view,
parent,
&tree,
&node))
return;
/* We need to special case the parent path */
if (tree == NULL)
tree = tree_view->priv->tree;
else
tree = node->children;
if (tree == NULL)
return;
if (tree_view->priv->edited_column)
gtk_tree_view_stop_editing (tree_view, TRUE);
/* we need to be unprelighted */
ensure_unprelighted (tree_view);
/* clear the timeout */
cancel_arrow_animation (tree_view);
_gtk_rbtree_reorder (tree, new_order, len);
gtk_widget_queue_draw (GTK_WIDGET (tree_view));
gtk_tree_view_dy_to_top_row (tree_view);
}
/* Internal tree functions
*/
static void
gtk_tree_view_get_background_xrange (GtkTreeView *tree_view,
GtkRBTree *tree,
GtkTreeViewColumn *column,
gint *x1,
gint *x2)
{
GtkTreeViewColumn *tmp_column = NULL;
gint total_width;
GList *list;
gboolean rtl;
if (x1)
*x1 = 0;
if (x2)
*x2 = 0;
rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
total_width = 0;
for (list = (rtl ? g_list_last (tree_view->priv->columns) : g_list_first (tree_view->priv->columns));
list;
list = (rtl ? list->prev : list->next))
{
tmp_column = list->data;
remove validation idle 2001-02-08 Havoc Pennington <hp@redhat.com> * gtk/gtktextview.c (gtk_text_view_destroy_layout): remove validation idle * demos/gtk-demo/main.c (create_tree): adjust to changes in text cell renderer * demos/pixbuf-demo.c (timeout): remove deprecated gtk_widget_draw * demos/testpixbuf-save.c (main): remove deprecated gtk_drawing_area_size * gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate buttons even if the model isn't setup. gtk_tree_view_check_dirty() at the start of the allocation. (gtk_tree_view_check_dirty): handle column->button == NULL, handle unsetup or NULL model. * gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the even/odd/sorted cells in the tree view. * gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all): bugfixes * gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row backgrounds with draw_flat_box using different detail for even/odd rows. * gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each row, so we can draw the alternating colors thing * gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a property from a synonym property, notify for the synonym. Also, nuke the background_gdk_set and foreground_gdk_set synonyms (gtk_text_tag_get_property): Always return the font, even if all its fields aren't set * gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't store the attr list; it leaves us with no way to change attributes in _render according to the render flags, and no way to implement get_property. Instead store all the specific text attributes. Separate whether an attribute is enabled from its value. Sync all properties with GtkTextTag, make them all consistent, etc. * gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so renderers can highlight the sort row/column * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use accessor functions to get values; this has the side effect of showing up which accessor functions were missing. Added those. * gtk/gtktreeviewcolumn.h: Replace set_justification with set_alignment, to be consistent with GtkLabel, GtkMisc * gtk/gtktreeviewcolumn.c: Added code to display sort indicator arrow. * gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h * gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
if (tmp_column == column)
break;
if (tmp_column->visible)
total_width += tmp_column->width;
}
if (tmp_column != column)
{
g_warning (G_STRLOC": passed-in column isn't in the tree");
return;
}
if (x1)
*x1 = total_width;
if (x2)
{
if (column->visible)
*x2 = total_width + column->width;
else
*x2 = total_width; /* width of 0 */
}
}
static void
gtk_tree_view_get_arrow_xrange (GtkTreeView *tree_view,
GtkRBTree *tree,
gint *x1,
gint *x2)
{
gint x_offset = 0;
GList *list;
GtkTreeViewColumn *tmp_column = NULL;
gint total_width;
gboolean indent_expanders;
gboolean rtl;
rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
total_width = 0;
for (list = (rtl ? g_list_last (tree_view->priv->columns) : g_list_first (tree_view->priv->columns));
list;
list = (rtl ? list->prev : list->next))
{
tmp_column = list->data;
if (gtk_tree_view_is_expander_column (tree_view, tmp_column))
{
if (rtl)
x_offset = total_width + tmp_column->width - tree_view->priv->expander_size;
else
x_offset = total_width;
break;
}
if (tmp_column->visible)
total_width += tmp_column->width;
}
gtk_widget_style_get (GTK_WIDGET (tree_view),
"indent_expanders", &indent_expanders,
NULL);
if (indent_expanders)
{
if (rtl)
x_offset -= tree_view->priv->expander_size * _gtk_rbtree_get_depth (tree);
else
x_offset += tree_view->priv->expander_size * _gtk_rbtree_get_depth (tree);
}
if (x1)
{
*x1 = x_offset;
}
if (tmp_column && tmp_column->visible)
{
/* +1 because x2 isn't included in the range. */
if (x2)
*x2 = *x1 + tree_view->priv->expander_size + 1;
}
else
{
/* return an empty range, the expander column is hidden */
if (x2)
*x2 = *x1;
}
}
static void
gtk_tree_view_build_tree (GtkTreeView *tree_view,
GtkRBTree *tree,
GtkTreeIter *iter,
gint depth,
gboolean recurse)
{
GtkRBNode *temp = NULL;
gboolean is_list = GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_IS_LIST);
do
{
gtk_tree_model_ref_node (tree_view->priv->model, iter);
temp = _gtk_rbtree_insert_after (tree, temp, 0, FALSE);
if (is_list)
continue;
if (recurse)
{
GtkTreeIter child;
if (gtk_tree_model_iter_children (tree_view->priv->model, &child, iter))
{
temp->children = _gtk_rbtree_new ();
temp->children->parent_tree = tree;
temp->children->parent_node = temp;
gtk_tree_view_build_tree (tree_view, temp->children, &child, depth + 1, recurse);
}
}
if (gtk_tree_model_iter_has_child (tree_view->priv->model, iter))
{
if ((temp->flags&GTK_RBNODE_IS_PARENT) != GTK_RBNODE_IS_PARENT)
temp->flags ^= GTK_RBNODE_IS_PARENT;
}
}
while (gtk_tree_model_iter_next (tree_view->priv->model, iter));
}
/* If height is non-NULL, then we set it to be the new height. if it's all
* dirty, then height is -1. We know we'll remeasure dirty rows, anyways.
*/
static gboolean
gtk_tree_view_discover_dirty_iter (GtkTreeView *tree_view,
GtkTreeIter *iter,
gint depth,
gint *height,
GtkRBNode *node)
{
GtkTreeViewColumn *column;
GList *list;
gboolean retval = FALSE;
gint tmpheight;
gint horizontal_separator;
gtk_widget_style_get (GTK_WIDGET (tree_view),
"horizontal_separator", &horizontal_separator,
NULL);
if (height)
*height = -1;
for (list = tree_view->priv->columns; list; list = list->next)
{
gint width;
column = list->data;
if (column->dirty == TRUE)
continue;
if (height == NULL && column->column_type == GTK_TREE_VIEW_COLUMN_FIXED)
continue;
if (!column->visible)
continue;
gtk_tree_view_column_cell_set_cell_data (column, tree_view->priv->model, iter,
GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_PARENT),
node->children?TRUE:FALSE);
if (height)
{
gtk_tree_view_column_cell_get_size (column,
NULL, NULL, NULL,
&width, &tmpheight);
*height = MAX (*height, tmpheight);
}
else
{
gtk_tree_view_column_cell_get_size (column,
NULL, NULL, NULL,
&width, NULL);
}
if (gtk_tree_view_is_expander_column (tree_view, column) &&
TREE_VIEW_DRAW_EXPANDERS (tree_view))
{
if (depth * tree_view->priv->expander_size + horizontal_separator + width > column->requested_width)
{
_gtk_tree_view_column_cell_set_dirty (column, TRUE);
retval = TRUE;
}
}
else
{
if (horizontal_separator + width > column->requested_width)
{
_gtk_tree_view_column_cell_set_dirty (column, TRUE);
retval = TRUE;
}
}
}
return retval;
}
static void
gtk_tree_view_discover_dirty (GtkTreeView *tree_view,
GtkRBTree *tree,
GtkTreeIter *iter,
gint depth)
{
GtkRBNode *temp = tree->root;
GtkTreeViewColumn *column;
GList *list;
GtkTreeIter child;
gboolean is_all_dirty;
TREE_VIEW_INTERNAL_ASSERT_VOID (tree != NULL);
while (temp->left != tree->nil)
temp = temp->left;
do
{
TREE_VIEW_INTERNAL_ASSERT_VOID (temp != NULL);
is_all_dirty = TRUE;
for (list = tree_view->priv->columns; list; list = list->next)
{
column = list->data;
if (column->dirty == FALSE)
{
is_all_dirty = FALSE;
break;
}
}
if (is_all_dirty)
return;
gtk_tree_view_discover_dirty_iter (tree_view,
iter,
depth,
NULL,
temp);
if (gtk_tree_model_iter_children (tree_view->priv->model, &child, iter) &&
temp->children != NULL)
gtk_tree_view_discover_dirty (tree_view, temp->children, &child, depth + 1);
temp = _gtk_rbtree_next (tree, temp);
}
while (gtk_tree_model_iter_next (tree_view->priv->model, iter));
}
/* Make sure the node is visible vertically */
static void
gtk_tree_view_clamp_node_visible (GtkTreeView *tree_view,
GtkRBTree *tree,
GtkRBNode *node)
{
GtkTreePath *path = NULL;
if (!GTK_WIDGET_REALIZED (tree_view))
return;
path = _gtk_tree_view_find_path (tree_view, tree, node);
if (path)
{
/* We process updates because we want to clear old selected items when we scroll.
* if this is removed, we get a "selection streak" at the bottom. */
gdk_window_process_updates (tree_view->priv->bin_window, TRUE);
gtk_tree_view_scroll_to_cell (tree_view, path, NULL, FALSE, 0.0, 0.0);
gtk_tree_path_free (path);
}
}
static void
gtk_tree_view_clamp_column_visible (GtkTreeView *tree_view,
GtkTreeViewColumn *column)
{
if (column == NULL)
return;
if ((tree_view->priv->hadjustment->value + tree_view->priv->hadjustment->page_size) <
(column->button->allocation.x + column->button->allocation.width))
gtk_adjustment_set_value (tree_view->priv->hadjustment,
column->button->allocation.x + column->button->allocation.width -
tree_view->priv->hadjustment->page_size);
else if (tree_view->priv->hadjustment->value > column->button->allocation.x)
gtk_adjustment_set_value (tree_view->priv->hadjustment,
column->button->allocation.x);
}
/* This function could be more efficient. I'll optimize it if profiling seems
* to imply that it is important */
GtkTreePath *
_gtk_tree_view_find_path (GtkTreeView *tree_view,
GtkRBTree *tree,
GtkRBNode *node)
{
GtkTreePath *path;
GtkRBTree *tmp_tree;
GtkRBNode *tmp_node, *last;
gint count;
path = gtk_tree_path_new ();
g_return_val_if_fail (node != NULL, path);
g_return_val_if_fail (node != tree->nil, path);
count = 1 + node->left->count;
last = node;
tmp_node = node->parent;
tmp_tree = tree;
while (tmp_tree)
{
while (tmp_node != tmp_tree->nil)
{
if (tmp_node->right == last)
count += 1 + tmp_node->left->count;
last = tmp_node;
tmp_node = tmp_node->parent;
}
gtk_tree_path_prepend_index (path, count - 1);
last = tmp_tree->parent_node;
tmp_tree = tmp_tree->parent_tree;
if (last)
{
count = 1 + last->left->count;
tmp_node = last->parent;
}
}
return path;
Port to GObject, can go back in gdk-pixbuf after setting up a 2000-12-16 Havoc Pennington <hp@pobox.com> * gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c: Port to GObject, can go back in gdk-pixbuf after setting up a gdk-pixbuf-marshal.h header over there. * gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g; (gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal args (gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be set (gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons here, do it when we create the buttons later (gtk_tree_view_realize_buttons): add some g_return_if_fail (gtk_tree_view_map): paranoia checks that column->button is shown and unmapped (gtk_tree_view_size_request): only request visible children. Move header size calculation in here, for cleanliness, and to maintain invariants for child widgets if we eventually let users set different children inside the buttons (gtk_tree_view_map_buttons): factor out code to map buttons, since it was being called several times (gtk_tree_view_size_allocate_buttons): move_resize the drag windows instead of just moving them; their height may change if we allow random widgets in there, or the theme changes. (gtk_tree_view_size_allocate): move button size allocation above emitting the scroll signals, to ensure a sane state when we hit user code (gtk_tree_view_button_release): remove queue_resize after tree_view_set_size(), set_size() will handle any resize queuing that's needed (gtk_tree_view_focus_in): just queue a draw, don't fool with draw_focus goo (gtk_tree_view_focus): use gtk_get_current_event() and gdk_event_get_state() (gtk_tree_view_deleted): don't queue_resize() after calling set_size() (gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove semicolon (gtk_tree_view_create_button): show the button here (gtk_tree_view_button_clicked): actually emit the clicked signal on the column (_gtk_tree_view_set_size): return right away if the size is unchanged, as a cheesy optimization (gtk_tree_view_setup_model): rename set_model_realized to setup_model to match the flag that indicates whether we've called it (gtk_tree_view_get_hadjustment): create adjustment if it doesn't exist, because set_scroll_adjustment does that and it shouldn't matter what order you call these in (gtk_tree_view_get_vadjustment): ditto (gtk_tree_view_set_headers_visible): canonicalize the bool, for paranoia (gtk_tree_view_set_headers_visible): call gtk_tree_view_map_buttons() instead of using cut-and-paste code (gtk_tree_view_append_column): clarify whether the return value is the count of columns before or after, and do the increment separately from the return statement so you can tell from the code. (gtk_tree_view_remove_column): ditto (gtk_tree_view_insert_column): ditto (gtk_tree_view_get_column): remove g_return_if_fail for columns outside the existing range, the docs say that outside-range columns are allowed, so we handle them as documented. (Presumably this allows a nice loop with column != NULL as test.) (gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments mean (left/right/center etc.). (gtk_tree_view_collapse_all): only queue a draw if we're mapped (gtk_tree_view_expand_row): add docs (gtk_tree_view_collapse_row): add docs * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new function to emit the clicked signal on a column * gdk/gdkevents.c (gdk_event_get_state): new function, to get the state of an event (gdk_event_get_time): don't treat GDK_SCROLL as a button event, remove default case from switch so gcc will whine if we don't explicitly handle all event types * gtk/gtktreeselection.h: added some FIXME * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename "columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
}
/* Returns TRUE if we ran out of tree before finding the path. If the path is
* invalid (ie. points to a node that's not in the tree), *tree and *node are
* both set to NULL.
*/
gboolean
_gtk_tree_view_find_node (GtkTreeView *tree_view,
GtkTreePath *path,
GtkRBTree **tree,
GtkRBNode **node)
{
GtkRBNode *tmpnode = NULL;
GtkRBTree *tmptree = tree_view->priv->tree;
gint *indices = gtk_tree_path_get_indices (path);
gint depth = gtk_tree_path_get_depth (path);
gint i = 0;
Port to GObject, can go back in gdk-pixbuf after setting up a 2000-12-16 Havoc Pennington <hp@pobox.com> * gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c: Port to GObject, can go back in gdk-pixbuf after setting up a gdk-pixbuf-marshal.h header over there. * gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g; (gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal args (gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be set (gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons here, do it when we create the buttons later (gtk_tree_view_realize_buttons): add some g_return_if_fail (gtk_tree_view_map): paranoia checks that column->button is shown and unmapped (gtk_tree_view_size_request): only request visible children. Move header size calculation in here, for cleanliness, and to maintain invariants for child widgets if we eventually let users set different children inside the buttons (gtk_tree_view_map_buttons): factor out code to map buttons, since it was being called several times (gtk_tree_view_size_allocate_buttons): move_resize the drag windows instead of just moving them; their height may change if we allow random widgets in there, or the theme changes. (gtk_tree_view_size_allocate): move button size allocation above emitting the scroll signals, to ensure a sane state when we hit user code (gtk_tree_view_button_release): remove queue_resize after tree_view_set_size(), set_size() will handle any resize queuing that's needed (gtk_tree_view_focus_in): just queue a draw, don't fool with draw_focus goo (gtk_tree_view_focus): use gtk_get_current_event() and gdk_event_get_state() (gtk_tree_view_deleted): don't queue_resize() after calling set_size() (gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove semicolon (gtk_tree_view_create_button): show the button here (gtk_tree_view_button_clicked): actually emit the clicked signal on the column (_gtk_tree_view_set_size): return right away if the size is unchanged, as a cheesy optimization (gtk_tree_view_setup_model): rename set_model_realized to setup_model to match the flag that indicates whether we've called it (gtk_tree_view_get_hadjustment): create adjustment if it doesn't exist, because set_scroll_adjustment does that and it shouldn't matter what order you call these in (gtk_tree_view_get_vadjustment): ditto (gtk_tree_view_set_headers_visible): canonicalize the bool, for paranoia (gtk_tree_view_set_headers_visible): call gtk_tree_view_map_buttons() instead of using cut-and-paste code (gtk_tree_view_append_column): clarify whether the return value is the count of columns before or after, and do the increment separately from the return statement so you can tell from the code. (gtk_tree_view_remove_column): ditto (gtk_tree_view_insert_column): ditto (gtk_tree_view_get_column): remove g_return_if_fail for columns outside the existing range, the docs say that outside-range columns are allowed, so we handle them as documented. (Presumably this allows a nice loop with column != NULL as test.) (gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments mean (left/right/center etc.). (gtk_tree_view_collapse_all): only queue a draw if we're mapped (gtk_tree_view_expand_row): add docs (gtk_tree_view_collapse_row): add docs * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new function to emit the clicked signal on a column * gdk/gdkevents.c (gdk_event_get_state): new function, to get the state of an event (gdk_event_get_time): don't treat GDK_SCROLL as a button event, remove default case from switch so gcc will whine if we don't explicitly handle all event types * gtk/gtktreeselection.h: added some FIXME * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename "columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
*node = NULL;
*tree = NULL;
if (depth == 0 || tmptree == NULL)
return FALSE;
do
{
tmpnode = _gtk_rbtree_find_count (tmptree, indices[i] + 1);
++i;
if (tmpnode == NULL)
{
*tree = NULL;
*node = NULL;
return FALSE;
}
if (i >= depth)
{
*tree = tmptree;
*node = tmpnode;
return FALSE;
}
*tree = tmptree;
*node = tmpnode;
tmptree = tmpnode->children;
if (tmptree == NULL)
return TRUE;
}
while (1);
}
static gboolean
gtk_tree_view_is_expander_column (GtkTreeView *tree_view,
GtkTreeViewColumn *column)
{
GList *list;
if (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_IS_LIST))
return FALSE;
if (tree_view->priv->expander_column != NULL)
{
if (tree_view->priv->expander_column == column)
return TRUE;
return FALSE;
}
else
{
for (list = tree_view->priv->columns;
list;
list = list->next)
if (((GtkTreeViewColumn *)list->data)->visible)
break;
if (list && list->data == column)
return TRUE;
}
return FALSE;
}
static void
gtk_tree_view_add_move_binding (GtkBindingSet *binding_set,
guint keyval,
guint modmask,
GtkMovementStep step,
gint count)
{
gtk_binding_entry_add_signal (binding_set, keyval, modmask,
"move_cursor", 2,
G_TYPE_ENUM, step,
G_TYPE_INT, count);
gtk_binding_entry_add_signal (binding_set, keyval, GDK_SHIFT_MASK,
"move_cursor", 2,
G_TYPE_ENUM, step,
G_TYPE_INT, count);
if ((modmask & GDK_CONTROL_MASK) == GDK_CONTROL_MASK)
return;
gtk_binding_entry_add_signal (binding_set, keyval, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
"move_cursor", 2,
G_TYPE_ENUM, step,
G_TYPE_INT, count);
gtk_binding_entry_add_signal (binding_set, keyval, GDK_CONTROL_MASK,
"move_cursor", 2,
G_TYPE_ENUM, step,
G_TYPE_INT, count);
}
static gint
gtk_tree_view_unref_tree_helper (GtkTreeModel *model,
GtkTreeIter *iter,
GtkRBTree *tree,
GtkRBNode *node)
{
gint retval = FALSE;
do
{
g_return_val_if_fail (node != NULL, FALSE);
if (node->children)
{
GtkTreeIter child;
GtkRBTree *new_tree;
GtkRBNode *new_node;
new_tree = node->children;
new_node = new_tree->root;
while (new_node && new_node->left != new_tree->nil)
new_node = new_node->left;
API additions: _move, _reorder and _swap for stores, path constructor. Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org> API additions: _move, _reorder and _swap for stores, path constructor. * gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function. * gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private), gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move. * gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private), gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move. Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org> Merge from stable: * gtk/gtktreestore.c (node_free): return FALSE, (gtk_tree_store_finalize): use g_node_traverse instead of g_node_children_foreach, so the whole tree will be freed (#88854, patch from Emmanuel Briot). Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org> Merge from stable: * gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks, (#84426, patch from Matthias Clasen). Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org> Merge from stable: * gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children check shouldn't be in g_return_return_val_if_fail (pointed out by Josh Green, #88997), (gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model for each column when we unset the model (part of #82484), (gtk_tree_view_get_cell_area): return if we ran out of tree or if we got an invalid path (#82376). * gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model. * gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model which disconnects the sort_column_changed_signal (part of #82484). * gtk/gtkliststore.c (gtk_list_store_insert): append row if the given postion is off the end of the tree (#85813). * gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use 2-space indent, commit changes if up/down keys has been pressed, this overrides the focus key foo so the user won't be surprised (#84665).
2002-07-26 20:51:13 +00:00
if (!gtk_tree_model_iter_children (model, &child, iter))
return FALSE;
retval = retval || gtk_tree_view_unref_tree_helper (model, &child, new_tree, new_node);
}
if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_SELECTED))
retval = TRUE;
gtk_tree_model_unref_node (model, iter);
node = _gtk_rbtree_next (tree, node);
}
while (gtk_tree_model_iter_next (model, iter));
return retval;
}
static gint
gtk_tree_view_unref_and_check_selection_tree (GtkTreeView *tree_view,
GtkRBTree *tree)
{
GtkTreeIter iter;
GtkTreePath *path;
GtkRBNode *node;
gint retval;
2001-09-11 04:27:53 +00:00
if (!tree)
return FALSE;
node = tree->root;
while (node && node->left != tree->nil)
node = node->left;
g_return_val_if_fail (node != NULL, FALSE);
path = _gtk_tree_view_find_path (tree_view, tree, node);
gtk_tree_model_get_iter (GTK_TREE_MODEL (tree_view->priv->model),
&iter, path);
retval = gtk_tree_view_unref_tree_helper (GTK_TREE_MODEL (tree_view->priv->model), &iter, tree, node);
gtk_tree_path_free (path);
return retval;
}
static void
gtk_tree_view_set_column_drag_info (GtkTreeView *tree_view,
GtkTreeViewColumn *column)
{
GtkTreeViewColumn *left_column;
GtkTreeViewColumn *cur_column = NULL;
GtkTreeViewColumnReorder *reorder;
gboolean rtl;
GList *tmp_list;
gint left;
/* We want to precalculate the motion list such that we know what column slots
* are available.
*/
left_column = NULL;
rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
/* First, identify all possible drop spots */
if (rtl)
tmp_list = g_list_last (tree_view->priv->columns);
else
tmp_list = g_list_first (tree_view->priv->columns);
while (tmp_list)
{
cur_column = GTK_TREE_VIEW_COLUMN (tmp_list->data);
tmp_list = rtl?g_list_previous (tmp_list):g_list_next (tmp_list);
if (cur_column->visible == FALSE)
continue;
/* If it's not the column moving and func tells us to skip over the column, we continue. */
if (left_column != column && cur_column != column &&
tree_view->priv->column_drop_func &&
! (* tree_view->priv->column_drop_func) (tree_view, column, left_column, cur_column, tree_view->priv->column_drop_func_data))
{
left_column = cur_column;
continue;
}
reorder = g_new (GtkTreeViewColumnReorder, 1);
reorder->left_column = left_column;
left_column = reorder->right_column = cur_column;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
tree_view->priv->column_drag_info = g_list_append (tree_view->priv->column_drag_info, reorder);
}
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
/* Add the last one */
if (tree_view->priv->column_drop_func == NULL ||
((left_column != column) &&
(* tree_view->priv->column_drop_func) (tree_view, column, left_column, cur_column, tree_view->priv->column_drop_func_data)))
{
reorder = g_new (GtkTreeViewColumnReorder, 1);
reorder->left_column = left_column;
reorder->right_column = NULL;
tree_view->priv->column_drag_info = g_list_append (tree_view->priv->column_drag_info, reorder);
}
/* We quickly check to see if it even makes sense to reorder columns. */
/* If there is nothing that can be moved, then we return */
if (tree_view->priv->column_drag_info == NULL)
return;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
/* We know there are always 2 slots possbile, as you can always return column. */
/* If that's all there is, return */
if (tree_view->priv->column_drag_info->next->next == NULL &&
((GtkTreeViewColumnReorder *)tree_view->priv->column_drag_info->data)->right_column == column &&
((GtkTreeViewColumnReorder *)tree_view->priv->column_drag_info->next->data)->left_column == column)
{
for (tmp_list = tree_view->priv->column_drag_info; tmp_list; tmp_list = tmp_list->next)
g_free (tmp_list->data);
g_list_free (tree_view->priv->column_drag_info);
tree_view->priv->column_drag_info = NULL;
return;
}
/* We fill in the ranges for the columns, now that we've isolated them */
left = - TREE_VIEW_COLUMN_DRAG_DEAD_MULTIPLIER (tree_view);
for (tmp_list = tree_view->priv->column_drag_info; tmp_list; tmp_list = tmp_list->next)
{
reorder = (GtkTreeViewColumnReorder *) tmp_list->data;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
reorder->left_align = left;
if (tmp_list->next != NULL)
{
g_assert (tmp_list->next->data);
left = reorder->right_align = (reorder->right_column->button->allocation.x +
reorder->right_column->button->allocation.width +
((GtkTreeViewColumnReorder *)tmp_list->next->data)->left_column->button->allocation.x)/2;
}
else
{
gint width;
gdk_drawable_get_size (tree_view->priv->header_window, &width, NULL);
reorder->right_align = width + TREE_VIEW_COLUMN_DRAG_DEAD_MULTIPLIER (tree_view);
}
}
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
}
void
_gtk_tree_view_column_start_drag (GtkTreeView *tree_view,
GtkTreeViewColumn *column)
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
{
GdkEvent *send_event;
GtkAllocation allocation;
gint x, y, width, height;
Integrate Erwann Chenede's multihead changes for the gtk/ directory. Mon Apr 29 18:28:00 2002 Owen Taylor <otaylor@redhat.com> Integrate Erwann Chenede's multihead changes for the gtk/ directory. * gtk/gtkclipboard.[ch]: Add gtk_clipboard_get_for_display(), make internals multihead aware. * gtk/gtkcolorsel.[ch]: Add gtk_color_selection_set_change_palette_with_screen_hook () [ugh!] make up for non-multihead safety of gtk_color_selection_set_change_palette_hook() * gtk/gtkinvisible.[ch] gtk/gtkmenu.[ch] gtkwindow.[ch]: Add gtk_{invisible,menu,window}_set_screen(); add "screen" properties for GtkWindow and GtkMenu. * gtk/gtkplug.[ch]: Add gtk_plug_construct_for_display(), gtk_plug_new_for_display(). Multihead fixes. * gtk/gtkselection.[ch]: Add gtk_selection_owner_set_for_display(), make internals multihead aware. * gtk/gtksettings.[ch]: Add gtk_settings_get_for_screen(), get rid of now-useless gtk_settings_constructor(). * gtk/gtkstyle.[ch]: Add gtk_style_get_font_for_display(), fix check/radio button indicators bitmap handling to be multihead safe. * gtk/gtkwidget.[ch]: Add gtk_widget_get_screen(), gtk_widget_has_screen(), gtk_widget_get_display(), gtk_widget_get_clipboard(), gtk_widget_get_root_window(). * gtk/gtkbindings.c gtk/gtkbutton.c gtk/gtkclist.c gtk/gtkcombo.c gtk/gtkctree.c gtk/gtkdnd.c gtk/gtkfilesel.c gtk/gtkgamma.c gtk/gtkhandlebox.c gtk/gtkhsv.c gtk/gtkimcontext.c gtk/gtklabel.c gtk/gtklist.c gtk/gtkmain.c gtk/gtkmenuitem.c gtk/gtkmenushell.c gtk/gtknotebook.c gtk/gtkoldeditable.c gtk/gtkoptionmenu.c gtk/gtkpaned.c gtk/gtkpreview.c gtk/gtksocket.c gtk/gtktext.c gtk/gtktextbuffer.c gtk/gtktextview.c gtk/gtktipsquery.c gtk/gtktooltips.c gtk/gtktreeview.c gtk/gtktreeviewcolumn.c: misc mechanical multihead-safety fixes. * gtk/gtkclipboard.c: Use a GtkImage rather than a pixmap for the dropper, look up the color palette only at realization time, other multihead fixes. * gtk/gtkcombo.c (gtk_combo_unrealize): Popdown the list when unrealizing. * gtk/gtkentry.c: Only claim ownership of the primary selection when realized, misc multihead fixes. * gtk/gtkfontsel.c: Only fill in fonts when attached to a screen, fix gtk_font_selection_get_font() for multihead. * gtk/gtkgc.c: make the depth => drawable hash per-screen. * gtk/gtkinvisible.c: Add a constructor that realizes the widget, so we get a realized widget with g_object_new() as well gtk_invisible_new() as before. * gtk/gtkmain.c: Get rid of unused gtk_visual/gtk_colormap variables. * gtk/gtktextdisplay.c: Add warnings if stipple bitmaps are used on the wrong screen. * gtk/gtktoolbar.c: Make handling of GtkSettings-based layout read properties and connect to settings when the screen is changed, rather than on init/finalize. * gtk/gtkwindow.c: Fix icon handing to be multihead safe ... default icon pixmaps/mask are only shared between windows on the same screen. Misc multihead fixes. Sat Apr 27 13:49:53 2002 Owen Taylor <otaylor@redhat.com> * gtk/gtkclipboard.c (gtk_clipboard_get_for_display): Update docs to reference GDK_SELECTION_CLIPBOARD rather GDK_NONE. 2002-04-29 Alex Larsson <alexl@redhat.com> * gdk/linux-fb/gdkproperty-fb.c (gdk_property_get): Fix silly bug, noticed by Sven Neumann. Sun Apr 28 22:43:55 2002 Jonathan Blandford <jrb@gnome.org> * gtk/gtktreemodelsort.c (gtk_tree_model_sort_set_sort_func): Fix so that you can set a new sort func.
2002-04-29 22:53:45 +00:00
GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (tree_view));
GdkDisplay *display = gdk_screen_get_display (screen);
g_return_if_fail (tree_view->priv->column_drag_info == NULL);
g_return_if_fail (tree_view->priv->cur_reorder == NULL);
gtk_tree_view_set_column_drag_info (tree_view, column);
if (tree_view->priv->column_drag_info == NULL)
return;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
if (tree_view->priv->drag_window == NULL)
{
GdkWindowAttr attributes;
guint attributes_mask;
attributes.window_type = GDK_WINDOW_CHILD;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = gtk_widget_get_visual (GTK_WIDGET (tree_view));
attributes.colormap = gtk_widget_get_colormap (GTK_WIDGET (tree_view));
attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK | GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK;
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
tree_view->priv->drag_window = gdk_window_new (tree_view->priv->bin_window,
&attributes,
attributes_mask);
gdk_window_set_user_data (tree_view->priv->drag_window, GTK_WIDGET (tree_view));
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
}
gdk_display_pointer_ungrab (display, GDK_CURRENT_TIME);
gdk_display_keyboard_ungrab (display, GDK_CURRENT_TIME);
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
gtk_grab_remove (column->button);
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
send_event = gdk_event_new (GDK_LEAVE_NOTIFY);
send_event->crossing.send_event = TRUE;
send_event->crossing.window = g_object_ref (column->button->window);
send_event->crossing.subwindow = NULL;
send_event->crossing.detail = GDK_NOTIFY_ANCESTOR;
send_event->crossing.time = GDK_CURRENT_TIME;
gtk_propagate_event (column->button, send_event);
gdk_event_free (send_event);
send_event = gdk_event_new (GDK_BUTTON_RELEASE);
send_event->button.window = g_object_ref (gdk_screen_get_root_window (screen));
send_event->button.send_event = TRUE;
send_event->button.time = GDK_CURRENT_TIME;
send_event->button.x = -1;
send_event->button.y = -1;
send_event->button.axes = NULL;
send_event->button.state = 0;
send_event->button.button = 1;
send_event->button.device = gdk_display_get_core_pointer (display);
send_event->button.x_root = 0;
send_event->button.y_root = 0;
gtk_propagate_event (column->button, send_event);
gdk_event_free (send_event);
gdk_window_move_resize (tree_view->priv->drag_window,
column->button->allocation.x,
0,
column->button->allocation.width,
column->button->allocation.height);
/* Kids, don't try this at home */
g_object_ref (column->button);
gtk_container_remove (GTK_CONTAINER (tree_view), column->button);
gtk_widget_set_parent_window (column->button, tree_view->priv->drag_window);
gtk_widget_set_parent (column->button, GTK_WIDGET (tree_view));
g_object_unref (column->button);
tree_view->priv->drag_column_x = column->button->allocation.x;
allocation = column->button->allocation;
allocation.x = 0;
gtk_widget_size_allocate (column->button, &allocation);
gtk_widget_set_parent_window (column->button, tree_view->priv->drag_window);
tree_view->priv->drag_column = column;
gdk_window_show (tree_view->priv->drag_window);
gdk_window_get_origin (tree_view->priv->header_window, &x, &y);
gdk_drawable_get_size (tree_view->priv->header_window, &width, &height);
gtk_widget_grab_focus (GTK_WIDGET (tree_view));
while (gtk_events_pending ())
gtk_main_iteration ();
GTK_TREE_VIEW_SET_FLAG (tree_view, GTK_TREE_VIEW_IN_COLUMN_DRAG);
gdk_pointer_grab (tree_view->priv->drag_window,
FALSE,
GDK_POINTER_MOTION_MASK|GDK_BUTTON_RELEASE_MASK,
NULL, NULL, GDK_CURRENT_TIME);
gdk_keyboard_grab (tree_view->priv->drag_window,
FALSE,
GDK_CURRENT_TIME);
}
Add support for animating expanders. 2001-07-22 Anders Carlsson <andersca@gnome.org> * gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the expander_height and expander_width properties with a single property, expander_size. (gtk_tree_view_init): Set the tab_offset to expander_size plus some padding. (gtk_tree_view_unrealize): Remove the expand/collapse timeout if it exists. (coords_are_over_arrow): Fix a small bug. (gtk_tree_view_motion_draw_column_motion_arrow): Use expander_size. (gtk_tree_view_draw_focus): Use "treeview" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_bin_expose): Use "treeview-drop-indicator" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_deleted): If we have a node currently being expanded or collapsed, remove the timeout and set the node to NULL. (gtk_tree_view_queue_draw_arrow): New function that just redraws the arrow of a node. (gtk_tree_view_draw_arrow): Use expander_size instead of expander_width/expander_height, also pass a different expander_style to gtk_paint_expander depending on the state of the node being drawn. (expand_collapse_timeout): New function for expanding or collapsing a node depending on the previous state. (gtk_tree_view_real_expand_row): Add timeout and set correct state for node being expanded. (gtk_tree_view_real_collapse_row): Add timeout and set correct state for node being collapsed. * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add information about the node currently being expanded or collapsed, and also a timeout id. * gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open with expander_style for draw_expander. * gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with expander_style. (create_expander_affine): New function for creating an expander affine. (apply_affine_on_point): New function for applying an affine to a point. (gtk_default_draw_expander): Modified to take expander_style instead of is_open, and to draw the rectangle rotated differently depending on the expander style. (gtk_paint_expander): Replace is_open with expander_style. * gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor. * gtk/gtkenums.h: Add expander style enum.
2001-07-22 20:09:00 +00:00
static void
gtk_tree_view_queue_draw_arrow (GtkTreeView *tree_view,
GtkRBTree *tree,
GtkRBNode *node,
GdkRectangle *clip_rect)
{
GdkRectangle rect;
if (!GTK_WIDGET_REALIZED (tree_view))
return;
rect.x = 0;
rect.width = MAX (tree_view->priv->expander_size, GTK_WIDGET (tree_view)->allocation.width);
Add support for animating expanders. 2001-07-22 Anders Carlsson <andersca@gnome.org> * gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the expander_height and expander_width properties with a single property, expander_size. (gtk_tree_view_init): Set the tab_offset to expander_size plus some padding. (gtk_tree_view_unrealize): Remove the expand/collapse timeout if it exists. (coords_are_over_arrow): Fix a small bug. (gtk_tree_view_motion_draw_column_motion_arrow): Use expander_size. (gtk_tree_view_draw_focus): Use "treeview" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_bin_expose): Use "treeview-drop-indicator" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_deleted): If we have a node currently being expanded or collapsed, remove the timeout and set the node to NULL. (gtk_tree_view_queue_draw_arrow): New function that just redraws the arrow of a node. (gtk_tree_view_draw_arrow): Use expander_size instead of expander_width/expander_height, also pass a different expander_style to gtk_paint_expander depending on the state of the node being drawn. (expand_collapse_timeout): New function for expanding or collapsing a node depending on the previous state. (gtk_tree_view_real_expand_row): Add timeout and set correct state for node being expanded. (gtk_tree_view_real_collapse_row): Add timeout and set correct state for node being collapsed. * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add information about the node currently being expanded or collapsed, and also a timeout id. * gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open with expander_style for draw_expander. * gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with expander_style. (create_expander_affine): New function for creating an expander affine. (apply_affine_on_point): New function for applying an affine to a point. (gtk_default_draw_expander): Modified to take expander_style instead of is_open, and to draw the rectangle rotated differently depending on the expander style. (gtk_paint_expander): Replace is_open with expander_style. * gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor. * gtk/gtkenums.h: Add expander style enum.
2001-07-22 20:09:00 +00:00
rect.y = BACKGROUND_FIRST_PIXEL (tree_view, tree, node);
rect.height = ROW_HEIGHT (tree_view, BACKGROUND_HEIGHT (node));
Add support for animating expanders. 2001-07-22 Anders Carlsson <andersca@gnome.org> * gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the expander_height and expander_width properties with a single property, expander_size. (gtk_tree_view_init): Set the tab_offset to expander_size plus some padding. (gtk_tree_view_unrealize): Remove the expand/collapse timeout if it exists. (coords_are_over_arrow): Fix a small bug. (gtk_tree_view_motion_draw_column_motion_arrow): Use expander_size. (gtk_tree_view_draw_focus): Use "treeview" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_bin_expose): Use "treeview-drop-indicator" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_deleted): If we have a node currently being expanded or collapsed, remove the timeout and set the node to NULL. (gtk_tree_view_queue_draw_arrow): New function that just redraws the arrow of a node. (gtk_tree_view_draw_arrow): Use expander_size instead of expander_width/expander_height, also pass a different expander_style to gtk_paint_expander depending on the state of the node being drawn. (expand_collapse_timeout): New function for expanding or collapsing a node depending on the previous state. (gtk_tree_view_real_expand_row): Add timeout and set correct state for node being expanded. (gtk_tree_view_real_collapse_row): Add timeout and set correct state for node being collapsed. * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add information about the node currently being expanded or collapsed, and also a timeout id. * gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open with expander_style for draw_expander. * gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with expander_style. (create_expander_affine): New function for creating an expander affine. (apply_affine_on_point): New function for applying an affine to a point. (gtk_default_draw_expander): Modified to take expander_style instead of is_open, and to draw the rectangle rotated differently depending on the expander style. (gtk_paint_expander): Replace is_open with expander_style. * gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor. * gtk/gtkenums.h: Add expander style enum.
2001-07-22 20:09:00 +00:00
if (clip_rect)
{
GdkRectangle new_rect;
Add support for animating expanders. 2001-07-22 Anders Carlsson <andersca@gnome.org> * gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the expander_height and expander_width properties with a single property, expander_size. (gtk_tree_view_init): Set the tab_offset to expander_size plus some padding. (gtk_tree_view_unrealize): Remove the expand/collapse timeout if it exists. (coords_are_over_arrow): Fix a small bug. (gtk_tree_view_motion_draw_column_motion_arrow): Use expander_size. (gtk_tree_view_draw_focus): Use "treeview" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_bin_expose): Use "treeview-drop-indicator" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_deleted): If we have a node currently being expanded or collapsed, remove the timeout and set the node to NULL. (gtk_tree_view_queue_draw_arrow): New function that just redraws the arrow of a node. (gtk_tree_view_draw_arrow): Use expander_size instead of expander_width/expander_height, also pass a different expander_style to gtk_paint_expander depending on the state of the node being drawn. (expand_collapse_timeout): New function for expanding or collapsing a node depending on the previous state. (gtk_tree_view_real_expand_row): Add timeout and set correct state for node being expanded. (gtk_tree_view_real_collapse_row): Add timeout and set correct state for node being collapsed. * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add information about the node currently being expanded or collapsed, and also a timeout id. * gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open with expander_style for draw_expander. * gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with expander_style. (create_expander_affine): New function for creating an expander affine. (apply_affine_on_point): New function for applying an affine to a point. (gtk_default_draw_expander): Modified to take expander_style instead of is_open, and to draw the rectangle rotated differently depending on the expander style. (gtk_paint_expander): Replace is_open with expander_style. * gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor. * gtk/gtkenums.h: Add expander style enum.
2001-07-22 20:09:00 +00:00
gdk_rectangle_intersect (clip_rect, &rect, &new_rect);
Add support for animating expanders. 2001-07-22 Anders Carlsson <andersca@gnome.org> * gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the expander_height and expander_width properties with a single property, expander_size. (gtk_tree_view_init): Set the tab_offset to expander_size plus some padding. (gtk_tree_view_unrealize): Remove the expand/collapse timeout if it exists. (coords_are_over_arrow): Fix a small bug. (gtk_tree_view_motion_draw_column_motion_arrow): Use expander_size. (gtk_tree_view_draw_focus): Use "treeview" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_bin_expose): Use "treeview-drop-indicator" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_deleted): If we have a node currently being expanded or collapsed, remove the timeout and set the node to NULL. (gtk_tree_view_queue_draw_arrow): New function that just redraws the arrow of a node. (gtk_tree_view_draw_arrow): Use expander_size instead of expander_width/expander_height, also pass a different expander_style to gtk_paint_expander depending on the state of the node being drawn. (expand_collapse_timeout): New function for expanding or collapsing a node depending on the previous state. (gtk_tree_view_real_expand_row): Add timeout and set correct state for node being expanded. (gtk_tree_view_real_collapse_row): Add timeout and set correct state for node being collapsed. * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add information about the node currently being expanded or collapsed, and also a timeout id. * gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open with expander_style for draw_expander. * gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with expander_style. (create_expander_affine): New function for creating an expander affine. (apply_affine_on_point): New function for applying an affine to a point. (gtk_default_draw_expander): Modified to take expander_style instead of is_open, and to draw the rectangle rotated differently depending on the expander style. (gtk_paint_expander): Replace is_open with expander_style. * gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor. * gtk/gtkenums.h: Add expander style enum.
2001-07-22 20:09:00 +00:00
gdk_window_invalidate_rect (tree_view->priv->bin_window, &new_rect, TRUE);
}
else
{
gdk_window_invalidate_rect (tree_view->priv->bin_window, &rect, TRUE);
}
}
void
_gtk_tree_view_queue_draw_node (GtkTreeView *tree_view,
GtkRBTree *tree,
GtkRBNode *node,
GdkRectangle *clip_rect)
{
GdkRectangle rect;
if (!GTK_WIDGET_REALIZED (tree_view))
return;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
rect.x = 0;
rect.width = MAX (tree_view->priv->width, GTK_WIDGET (tree_view)->allocation.width);
rect.y = BACKGROUND_FIRST_PIXEL (tree_view, tree, node);
rect.height = ROW_HEIGHT (tree_view, BACKGROUND_HEIGHT (node));
if (clip_rect)
{
GdkRectangle new_rect;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
gdk_rectangle_intersect (clip_rect, &rect, &new_rect);
gdk_window_invalidate_rect (tree_view->priv->bin_window, &new_rect, TRUE);
}
else
{
gdk_window_invalidate_rect (tree_view->priv->bin_window, &rect, TRUE);
}
}
static void
gtk_tree_view_queue_draw_path (GtkTreeView *tree_view,
GtkTreePath *path,
GdkRectangle *clip_rect)
{
GtkRBTree *tree = NULL;
GtkRBNode *node = NULL;
_gtk_tree_view_find_node (tree_view, path, &tree, &node);
if (tree)
_gtk_tree_view_queue_draw_node (tree_view, tree, node, clip_rect);
}
/* x and y are the mouse position
*/
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
static void
gtk_tree_view_draw_arrow (GtkTreeView *tree_view,
GtkRBTree *tree,
GtkRBNode *node,
gint x,
gint y)
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
{
GdkRectangle area;
GtkStateType state;
GtkWidget *widget;
gint x_offset = 0;
gint vertical_separator;
Add support for animating expanders. 2001-07-22 Anders Carlsson <andersca@gnome.org> * gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the expander_height and expander_width properties with a single property, expander_size. (gtk_tree_view_init): Set the tab_offset to expander_size plus some padding. (gtk_tree_view_unrealize): Remove the expand/collapse timeout if it exists. (coords_are_over_arrow): Fix a small bug. (gtk_tree_view_motion_draw_column_motion_arrow): Use expander_size. (gtk_tree_view_draw_focus): Use "treeview" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_bin_expose): Use "treeview-drop-indicator" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_deleted): If we have a node currently being expanded or collapsed, remove the timeout and set the node to NULL. (gtk_tree_view_queue_draw_arrow): New function that just redraws the arrow of a node. (gtk_tree_view_draw_arrow): Use expander_size instead of expander_width/expander_height, also pass a different expander_style to gtk_paint_expander depending on the state of the node being drawn. (expand_collapse_timeout): New function for expanding or collapsing a node depending on the previous state. (gtk_tree_view_real_expand_row): Add timeout and set correct state for node being expanded. (gtk_tree_view_real_collapse_row): Add timeout and set correct state for node being collapsed. * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add information about the node currently being expanded or collapsed, and also a timeout id. * gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open with expander_style for draw_expander. * gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with expander_style. (create_expander_affine): New function for creating an expander affine. (apply_affine_on_point): New function for applying an affine to a point. (gtk_default_draw_expander): Modified to take expander_style instead of is_open, and to draw the rectangle rotated differently depending on the expander style. (gtk_paint_expander): Replace is_open with expander_style. * gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor. * gtk/gtkenums.h: Add expander style enum.
2001-07-22 20:09:00 +00:00
gint expander_size;
GtkExpanderStyle expander_style;
gtk_widget_style_get (GTK_WIDGET (tree_view),
"vertical_separator", &vertical_separator,
NULL);
expander_size = tree_view->priv->expander_size - EXPANDER_EXTRA_PADDING;
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
if (! GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_PARENT))
return;
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
widget = GTK_WIDGET (tree_view);
gtk_tree_view_get_arrow_xrange (tree_view, tree, &x_offset, NULL);
area.x = x_offset;
area.y = CELL_FIRST_PIXEL (tree_view, tree, node, vertical_separator);
Add support for animating expanders. 2001-07-22 Anders Carlsson <andersca@gnome.org> * gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the expander_height and expander_width properties with a single property, expander_size. (gtk_tree_view_init): Set the tab_offset to expander_size plus some padding. (gtk_tree_view_unrealize): Remove the expand/collapse timeout if it exists. (coords_are_over_arrow): Fix a small bug. (gtk_tree_view_motion_draw_column_motion_arrow): Use expander_size. (gtk_tree_view_draw_focus): Use "treeview" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_bin_expose): Use "treeview-drop-indicator" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_deleted): If we have a node currently being expanded or collapsed, remove the timeout and set the node to NULL. (gtk_tree_view_queue_draw_arrow): New function that just redraws the arrow of a node. (gtk_tree_view_draw_arrow): Use expander_size instead of expander_width/expander_height, also pass a different expander_style to gtk_paint_expander depending on the state of the node being drawn. (expand_collapse_timeout): New function for expanding or collapsing a node depending on the previous state. (gtk_tree_view_real_expand_row): Add timeout and set correct state for node being expanded. (gtk_tree_view_real_collapse_row): Add timeout and set correct state for node being collapsed. * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add information about the node currently being expanded or collapsed, and also a timeout id. * gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open with expander_style for draw_expander. * gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with expander_style. (create_expander_affine): New function for creating an expander affine. (apply_affine_on_point): New function for applying an affine to a point. (gtk_default_draw_expander): Modified to take expander_style instead of is_open, and to draw the rectangle rotated differently depending on the expander style. (gtk_paint_expander): Replace is_open with expander_style. * gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor. * gtk/gtkenums.h: Add expander style enum.
2001-07-22 20:09:00 +00:00
area.width = expander_size + 2;
area.height = MAX (CELL_HEIGHT (node, vertical_separator), (expander_size - vertical_separator));
if (node == tree_view->priv->button_pressed_node)
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
{
if (x >= area.x && x <= (area.x + area.width) &&
y >= area.y && y <= (area.y + area.height))
state = GTK_STATE_ACTIVE;
else
state = GTK_STATE_NORMAL;
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
}
else
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
{
if (node == tree_view->priv->prelight_node &&
GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_ARROW_PRELIT))
state = GTK_STATE_PRELIGHT;
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
else
state = GTK_STATE_NORMAL;
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
}
Add support for animating expanders. 2001-07-22 Anders Carlsson <andersca@gnome.org> * gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the expander_height and expander_width properties with a single property, expander_size. (gtk_tree_view_init): Set the tab_offset to expander_size plus some padding. (gtk_tree_view_unrealize): Remove the expand/collapse timeout if it exists. (coords_are_over_arrow): Fix a small bug. (gtk_tree_view_motion_draw_column_motion_arrow): Use expander_size. (gtk_tree_view_draw_focus): Use "treeview" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_bin_expose): Use "treeview-drop-indicator" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_deleted): If we have a node currently being expanded or collapsed, remove the timeout and set the node to NULL. (gtk_tree_view_queue_draw_arrow): New function that just redraws the arrow of a node. (gtk_tree_view_draw_arrow): Use expander_size instead of expander_width/expander_height, also pass a different expander_style to gtk_paint_expander depending on the state of the node being drawn. (expand_collapse_timeout): New function for expanding or collapsing a node depending on the previous state. (gtk_tree_view_real_expand_row): Add timeout and set correct state for node being expanded. (gtk_tree_view_real_collapse_row): Add timeout and set correct state for node being collapsed. * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add information about the node currently being expanded or collapsed, and also a timeout id. * gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open with expander_style for draw_expander. * gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with expander_style. (create_expander_affine): New function for creating an expander affine. (apply_affine_on_point): New function for applying an affine to a point. (gtk_default_draw_expander): Modified to take expander_style instead of is_open, and to draw the rectangle rotated differently depending on the expander style. (gtk_paint_expander): Replace is_open with expander_style. * gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor. * gtk/gtkenums.h: Add expander style enum.
2001-07-22 20:09:00 +00:00
if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_SEMI_EXPANDED))
expander_style = GTK_EXPANDER_SEMI_EXPANDED;
else if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_SEMI_COLLAPSED))
expander_style = GTK_EXPANDER_SEMI_COLLAPSED;
else if (node->children != NULL)
expander_style = GTK_EXPANDER_EXPANDED;
else
expander_style = GTK_EXPANDER_COLLAPSED;
gtk_paint_expander (widget->style,
tree_view->priv->bin_window,
state,
&area,
widget,
"treeview",
Add support for animating expanders. 2001-07-22 Anders Carlsson <andersca@gnome.org> * gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the expander_height and expander_width properties with a single property, expander_size. (gtk_tree_view_init): Set the tab_offset to expander_size plus some padding. (gtk_tree_view_unrealize): Remove the expand/collapse timeout if it exists. (coords_are_over_arrow): Fix a small bug. (gtk_tree_view_motion_draw_column_motion_arrow): Use expander_size. (gtk_tree_view_draw_focus): Use "treeview" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_bin_expose): Use "treeview-drop-indicator" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_deleted): If we have a node currently being expanded or collapsed, remove the timeout and set the node to NULL. (gtk_tree_view_queue_draw_arrow): New function that just redraws the arrow of a node. (gtk_tree_view_draw_arrow): Use expander_size instead of expander_width/expander_height, also pass a different expander_style to gtk_paint_expander depending on the state of the node being drawn. (expand_collapse_timeout): New function for expanding or collapsing a node depending on the previous state. (gtk_tree_view_real_expand_row): Add timeout and set correct state for node being expanded. (gtk_tree_view_real_collapse_row): Add timeout and set correct state for node being collapsed. * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add information about the node currently being expanded or collapsed, and also a timeout id. * gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open with expander_style for draw_expander. * gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with expander_style. (create_expander_affine): New function for creating an expander affine. (apply_affine_on_point): New function for applying an affine to a point. (gtk_default_draw_expander): Modified to take expander_style instead of is_open, and to draw the rectangle rotated differently depending on the expander style. (gtk_paint_expander): Replace is_open with expander_style. * gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor. * gtk/gtkenums.h: Add expander style enum.
2001-07-22 20:09:00 +00:00
area.x + area.width / 2,
area.y + area.height / 2,
expander_style);
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
}
static void
gtk_tree_view_focus_to_cursor (GtkTreeView *tree_view)
{
GtkTreePath *cursor_path;
if ((tree_view->priv->tree == NULL) ||
(! GTK_WIDGET_REALIZED (tree_view)))
return;
GTK_TREE_VIEW_SET_FLAG (tree_view, GTK_TREE_VIEW_DRAW_KEYFOCUS);
cursor_path = NULL;
if (tree_view->priv->cursor)
cursor_path = gtk_tree_row_reference_get_path (tree_view->priv->cursor);
if (cursor_path == NULL)
{
cursor_path = gtk_tree_path_new_first ();
gtk_tree_row_reference_free (tree_view->priv->cursor);
tree_view->priv->cursor = NULL;
if (tree_view->priv->selection->type == GTK_SELECTION_MULTIPLE)
gtk_tree_view_real_set_cursor (tree_view, cursor_path, FALSE, FALSE);
else
gtk_tree_view_real_set_cursor (tree_view, cursor_path, TRUE, FALSE);
}
gtk_tree_view_queue_draw_path (tree_view, cursor_path, NULL);
gtk_tree_path_free (cursor_path);
if (tree_view->priv->focus_column == NULL)
{
GList *list;
for (list = tree_view->priv->columns; list; list = list->next)
{
if (GTK_TREE_VIEW_COLUMN (list->data)->visible)
{
tree_view->priv->focus_column = GTK_TREE_VIEW_COLUMN (list->data);
break;
}
}
}
}
static void
gtk_tree_view_move_cursor_up_down (GtkTreeView *tree_view,
gint count)
{
GtkRBTree *cursor_tree = NULL;
GtkRBNode *cursor_node = NULL;
GtkRBTree *new_cursor_tree = NULL;
GtkRBNode *new_cursor_node = NULL;
GtkTreePath *cursor_path = NULL;
if (! GTK_WIDGET_HAS_FOCUS (tree_view))
return;
cursor_path = NULL;
if (!gtk_tree_row_reference_valid (tree_view->priv->cursor))
/* FIXME: we lost the cursor; should we get the first? */
return;
cursor_path = gtk_tree_row_reference_get_path (tree_view->priv->cursor);
_gtk_tree_view_find_node (tree_view, cursor_path,
&cursor_tree, &cursor_node);
gtk_tree_path_free (cursor_path);
if (cursor_tree == NULL)
/* FIXME: we lost the cursor; should we get the first? */
return;
if (count == -1)
_gtk_rbtree_prev_full (cursor_tree, cursor_node,
&new_cursor_tree, &new_cursor_node);
else
_gtk_rbtree_next_full (cursor_tree, cursor_node,
&new_cursor_tree, &new_cursor_node);
if (new_cursor_node)
{
cursor_path = _gtk_tree_view_find_path (tree_view, new_cursor_tree, new_cursor_node);
gtk_tree_view_real_set_cursor (tree_view, cursor_path, TRUE, TRUE);
gtk_tree_path_free (cursor_path);
}
else
{
gtk_tree_view_clamp_node_visible (tree_view, cursor_tree, cursor_node);
}
gtk_widget_grab_focus (GTK_WIDGET (tree_view));
}
static void
gtk_tree_view_move_cursor_page_up_down (GtkTreeView *tree_view,
gint count)
{
GtkRBTree *cursor_tree = NULL;
GtkRBNode *cursor_node = NULL;
GtkTreePath *cursor_path = NULL;
gint y;
gint vertical_separator;
if (! GTK_WIDGET_HAS_FOCUS (tree_view))
return;
if (gtk_tree_row_reference_valid (tree_view->priv->cursor))
cursor_path = gtk_tree_row_reference_get_path (tree_view->priv->cursor);
else
/* This is sorta weird. Focus in should give us a cursor */
return;
gtk_widget_style_get (GTK_WIDGET (tree_view), "vertical_separator", &vertical_separator, NULL);
_gtk_tree_view_find_node (tree_view, cursor_path,
&cursor_tree, &cursor_node);
gtk_tree_path_free (cursor_path);
if (cursor_tree == NULL)
/* FIXME: we lost the cursor. Should we try to get one? */
return;
g_return_if_fail (cursor_node != NULL);
y = _gtk_rbtree_node_find_offset (cursor_tree, cursor_node);
y += count * tree_view->priv->vadjustment->page_size;
if (count > 0)
y -= ROW_HEIGHT (tree_view, GTK_RBNODE_GET_HEIGHT (cursor_node));
else if (count < 0)
y += ROW_HEIGHT (tree_view, GTK_RBNODE_GET_HEIGHT (cursor_node));
y = CLAMP (y, (gint)tree_view->priv->vadjustment->lower, (gint)tree_view->priv->vadjustment->upper - vertical_separator);
if (y >= tree_view->priv->height)
y = tree_view->priv->height - 1;
_gtk_rbtree_find_offset (tree_view->priv->tree, y, &cursor_tree, &cursor_node);
cursor_path = _gtk_tree_view_find_path (tree_view, cursor_tree, cursor_node);
g_return_if_fail (cursor_path != NULL);
gtk_tree_view_real_set_cursor (tree_view, cursor_path, TRUE, TRUE);
gtk_tree_view_clamp_node_visible (tree_view, cursor_tree, cursor_node);
gtk_tree_path_free (cursor_path);
}
static void
gtk_tree_view_move_cursor_left_right (GtkTreeView *tree_view,
gint count)
{
GtkRBTree *cursor_tree = NULL;
GtkRBNode *cursor_node = NULL;
GtkTreePath *cursor_path = NULL;
GtkTreeViewColumn *column;
GtkTreeIter iter;
GList *list;
gboolean found_column = FALSE;
gboolean rtl;
rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
if (! GTK_WIDGET_HAS_FOCUS (tree_view))
return;
if (gtk_tree_row_reference_valid (tree_view->priv->cursor))
cursor_path = gtk_tree_row_reference_get_path (tree_view->priv->cursor);
else
return;
_gtk_tree_view_find_node (tree_view, cursor_path, &cursor_tree, &cursor_node);
if (cursor_tree == NULL)
return;
if (gtk_tree_model_get_iter (tree_view->priv->model, &iter, cursor_path) == FALSE)
{
gtk_tree_path_free (cursor_path);
return;
}
gtk_tree_path_free (cursor_path);
list = tree_view->priv->columns;
if (tree_view->priv->focus_column)
{
for (list = tree_view->priv->columns; list; list = list->next)
{
if (list->data == tree_view->priv->focus_column)
break;
}
}
while (list)
{
column = list->data;
if (column->visible == FALSE)
goto loop_end;
gtk_tree_view_column_cell_set_cell_data (column,
tree_view->priv->model,
&iter,
GTK_RBNODE_FLAG_SET (cursor_node, GTK_RBNODE_IS_PARENT),
cursor_node->children?TRUE:FALSE);
The "big treeview focus patch". Fixes several issues and adds some Sun May 5 16:42:32 2002 Kristian Rietveld <kris@gtk.org> The "big treeview focus patch". Fixes several issues and adds some goodies. Related bugs: #73676, #73734, #78660. * gtk/gtktreeview.h: add gtk_tree_view_set_cursor_on_cell * gtk/gtktreeview.c (gtk_tree_view_button_press): focus on a cell if applicable, (gtk_tree_view_bin_expose): set_cell_data before iterating columns, add support for row-spanning focus rectangles, (gtk_tree_view_has_special_cell): new function, (gtk_tree_view_move_cursor_left_right): add support for multiple focusable cells in one column, (gtk_tree_view_set_cursor): call _set_cursor_on_cell now, (gtk_tree_view_set_cursor_on_cell): copy of _set_cursor, extended with focus_cell parameter, (gtk_tree_view_search_iter): removed unused column variable, (gtk_tree_view_start_editing): add neighbor size code to allow for multiple editable cells in one column. * gtk/gtktreeviewcolumn.c (_GtkTreeViewColumnCellInfo): add in_editing_mode field, (gtk_tree_view_column_get_edited_cell): new function, removed _get_editable_cell, (_gtk_tree_view_column_get_cell_at_pos): new function, (gtk_tree_view_column_pack_end): s/g_new/g_new0/ ..., (gtk_tree_view_column_cell_process_action): loads of changes to get it right and to allow for multiple special cells, etc, (gtk_tree_view_column_cell_first): new function, (gtk_tree_view_column_cell_last): ditto, (gtk_tree_view_column_cell_next): ditto, (gtk_tree_view_column_cell_prev): ditto, (gtk_tree_view_column_cell_focus): add left and right parameters, allow for multiple special cells, (gtk_tree_view_column_cell_is_visible): add assertion, (gtk_tree_view_column_focus_cell): new function, (gtk_tree_view_column_stop_editing): unset in_editing_mode flag, (_gtk_tree_view_column_get_neighbor_sizes): iterate through cells correctly * gtk/gtktreeviewcolumn.h: add gtk_tree_view_column_focus_cell * gtk/gtktreeprivate.h: s/_get_editable_cell/_get_edited_cell/, add _gtk_tree_view_column_get_cell_at_pos, add new parameters to _gtk_tree_view_column_cell_focus. * tests/testtreeedit.c: add some cells in order to test new code.
2002-05-05 14:54:00 +00:00
if (_gtk_tree_view_column_cell_focus (column, count,
list->prev?TRUE:FALSE,
list->next?TRUE:FALSE))
{
tree_view->priv->focus_column = column;
found_column = TRUE;
break;
}
loop_end:
if (count == 1)
list = rtl ? list->prev : list->next;
else
list = rtl ? list->next : list->prev;
}
if (found_column)
{
The "big treeview focus patch". Fixes several issues and adds some Sun May 5 16:42:32 2002 Kristian Rietveld <kris@gtk.org> The "big treeview focus patch". Fixes several issues and adds some goodies. Related bugs: #73676, #73734, #78660. * gtk/gtktreeview.h: add gtk_tree_view_set_cursor_on_cell * gtk/gtktreeview.c (gtk_tree_view_button_press): focus on a cell if applicable, (gtk_tree_view_bin_expose): set_cell_data before iterating columns, add support for row-spanning focus rectangles, (gtk_tree_view_has_special_cell): new function, (gtk_tree_view_move_cursor_left_right): add support for multiple focusable cells in one column, (gtk_tree_view_set_cursor): call _set_cursor_on_cell now, (gtk_tree_view_set_cursor_on_cell): copy of _set_cursor, extended with focus_cell parameter, (gtk_tree_view_search_iter): removed unused column variable, (gtk_tree_view_start_editing): add neighbor size code to allow for multiple editable cells in one column. * gtk/gtktreeviewcolumn.c (_GtkTreeViewColumnCellInfo): add in_editing_mode field, (gtk_tree_view_column_get_edited_cell): new function, removed _get_editable_cell, (_gtk_tree_view_column_get_cell_at_pos): new function, (gtk_tree_view_column_pack_end): s/g_new/g_new0/ ..., (gtk_tree_view_column_cell_process_action): loads of changes to get it right and to allow for multiple special cells, etc, (gtk_tree_view_column_cell_first): new function, (gtk_tree_view_column_cell_last): ditto, (gtk_tree_view_column_cell_next): ditto, (gtk_tree_view_column_cell_prev): ditto, (gtk_tree_view_column_cell_focus): add left and right parameters, allow for multiple special cells, (gtk_tree_view_column_cell_is_visible): add assertion, (gtk_tree_view_column_focus_cell): new function, (gtk_tree_view_column_stop_editing): unset in_editing_mode flag, (_gtk_tree_view_column_get_neighbor_sizes): iterate through cells correctly * gtk/gtktreeviewcolumn.h: add gtk_tree_view_column_focus_cell * gtk/gtktreeprivate.h: s/_get_editable_cell/_get_edited_cell/, add _gtk_tree_view_column_get_cell_at_pos, add new parameters to _gtk_tree_view_column_cell_focus. * tests/testtreeedit.c: add some cells in order to test new code.
2002-05-05 14:54:00 +00:00
if (!gtk_tree_view_has_special_cell (tree_view))
_gtk_tree_view_queue_draw_node (tree_view,
cursor_tree,
cursor_node,
NULL);
g_signal_emit (tree_view, tree_view_signals[CURSOR_CHANGED], 0);
}
gtk_tree_view_clamp_column_visible (tree_view, tree_view->priv->focus_column);
}
static void
gtk_tree_view_move_cursor_start_end (GtkTreeView *tree_view,
gint count)
{
GtkRBTree *cursor_tree;
GtkRBNode *cursor_node;
GtkTreePath *path;
if (! GTK_WIDGET_HAS_FOCUS (tree_view))
return;
g_return_if_fail (tree_view->priv->tree != NULL);
if (count == -1)
{
cursor_tree = tree_view->priv->tree;
cursor_node = cursor_tree->root;
while (cursor_node && cursor_node->left != cursor_tree->nil)
cursor_node = cursor_node->left;
}
else
{
cursor_tree = tree_view->priv->tree;
cursor_node = cursor_tree->root;
do
{
while (cursor_node && cursor_node->right != cursor_tree->nil)
cursor_node = cursor_node->right;
if (cursor_node->children == NULL)
break;
cursor_tree = cursor_node->children;
cursor_node = cursor_tree->root;
}
while (1);
}
path = _gtk_tree_view_find_path (tree_view, cursor_tree, cursor_node);
gtk_tree_view_real_set_cursor (tree_view, path, TRUE, TRUE);
gtk_tree_path_free (path);
}
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
static gboolean
gtk_tree_view_real_select_all (GtkTreeView *tree_view)
{
if (! GTK_WIDGET_HAS_FOCUS (tree_view))
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
return FALSE;
if (tree_view->priv->selection->type != GTK_SELECTION_MULTIPLE)
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
return FALSE;
gtk_tree_selection_select_all (tree_view->priv->selection);
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
return TRUE;
}
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
static gboolean
gtk_tree_view_real_unselect_all (GtkTreeView *tree_view)
{
if (! GTK_WIDGET_HAS_FOCUS (tree_view))
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
return FALSE;
if (tree_view->priv->selection->type != GTK_SELECTION_MULTIPLE)
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
return FALSE;
gtk_tree_selection_unselect_all (tree_view->priv->selection);
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
return TRUE;
}
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
static gboolean
gtk_tree_view_real_select_cursor_row (GtkTreeView *tree_view,
gboolean start_editing)
{
GtkRBTree *cursor_tree = NULL;
GtkRBNode *cursor_node = NULL;
GtkTreePath *cursor_path = NULL;
GtkTreeSelectMode mode = 0;
if (! GTK_WIDGET_HAS_FOCUS (tree_view))
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
return FALSE;
if (tree_view->priv->cursor)
cursor_path = gtk_tree_row_reference_get_path (tree_view->priv->cursor);
if (cursor_path == NULL)
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
return FALSE;
_gtk_tree_view_find_node (tree_view, cursor_path,
&cursor_tree, &cursor_node);
if (cursor_tree == NULL)
{
gtk_tree_path_free (cursor_path);
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
return FALSE;
}
if (!tree_view->priv->shift_pressed && start_editing &&
tree_view->priv->focus_column)
{
if (gtk_tree_view_start_editing (tree_view, cursor_path))
{
gtk_tree_path_free (cursor_path);
return TRUE;
}
}
if (tree_view->priv->ctrl_pressed)
mode |= GTK_TREE_SELECT_MODE_TOGGLE;
if (tree_view->priv->shift_pressed)
mode |= GTK_TREE_SELECT_MODE_EXTEND;
_gtk_tree_selection_internal_select_node (tree_view->priv->selection,
cursor_node,
cursor_tree,
cursor_path,
mode,
FALSE);
gtk_tree_view_clamp_node_visible (tree_view, cursor_tree, cursor_node);
gtk_widget_grab_focus (GTK_WIDGET (tree_view));
_gtk_tree_view_queue_draw_node (tree_view, cursor_tree, cursor_node, NULL);
if (!tree_view->priv->shift_pressed)
gtk_tree_view_row_activated (tree_view, cursor_path,
tree_view->priv->focus_column);
gtk_tree_path_free (cursor_path);
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
return TRUE;
}
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
static gboolean
gtk_tree_view_real_toggle_cursor_row (GtkTreeView *tree_view)
{
GtkRBTree *cursor_tree = NULL;
GtkRBNode *cursor_node = NULL;
GtkTreePath *cursor_path = NULL;
if (! GTK_WIDGET_HAS_FOCUS (tree_view))
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
return FALSE;
cursor_path = NULL;
if (tree_view->priv->cursor)
cursor_path = gtk_tree_row_reference_get_path (tree_view->priv->cursor);
if (cursor_path == NULL)
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
return FALSE;
_gtk_tree_view_find_node (tree_view, cursor_path,
&cursor_tree, &cursor_node);
if (cursor_tree == NULL)
{
gtk_tree_path_free (cursor_path);
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
return FALSE;
}
_gtk_tree_selection_internal_select_node (tree_view->priv->selection,
cursor_node,
cursor_tree,
cursor_path,
GTK_TREE_SELECT_MODE_TOGGLE,
FALSE);
gtk_tree_view_clamp_node_visible (tree_view, cursor_tree, cursor_node);
gtk_widget_grab_focus (GTK_WIDGET (tree_view));
gtk_tree_view_queue_draw_path (tree_view, cursor_path, NULL);
gtk_tree_path_free (cursor_path);
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
return TRUE;
}
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
static gboolean
gtk_tree_view_real_expand_collapse_cursor_row (GtkTreeView *tree_view,
gboolean logical,
gboolean expand,
gboolean open_all)
{
GtkTreePath *cursor_path = NULL;
GtkRBTree *tree;
GtkRBNode *node;
if (! GTK_WIDGET_HAS_FOCUS (tree_view))
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
return FALSE;
cursor_path = NULL;
if (tree_view->priv->cursor)
cursor_path = gtk_tree_row_reference_get_path (tree_view->priv->cursor);
if (cursor_path == NULL)
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
return FALSE;
if (_gtk_tree_view_find_node (tree_view, cursor_path, &tree, &node))
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
return FALSE;
gtk_widget_grab_focus (GTK_WIDGET (tree_view));
gtk_tree_view_queue_draw_path (tree_view, cursor_path, NULL);
if (!logical
&& gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL)
expand = !expand;
if (expand)
gtk_tree_view_real_expand_row (tree_view, cursor_path, tree, node, open_all, TRUE);
else
gtk_tree_view_real_collapse_row (tree_view, cursor_path, tree, node, TRUE);
gtk_tree_path_free (cursor_path);
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
return TRUE;
}
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
static gboolean
gtk_tree_view_real_select_cursor_parent (GtkTreeView *tree_view)
{
GtkRBTree *cursor_tree = NULL;
GtkRBNode *cursor_node = NULL;
GtkTreePath *cursor_path = NULL;
if (! GTK_WIDGET_HAS_FOCUS (tree_view))
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
return FALSE;
cursor_path = NULL;
if (tree_view->priv->cursor)
cursor_path = gtk_tree_row_reference_get_path (tree_view->priv->cursor);
if (cursor_path == NULL)
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
return FALSE;
_gtk_tree_view_find_node (tree_view, cursor_path,
&cursor_tree, &cursor_node);
if (cursor_tree == NULL)
{
gtk_tree_path_free (cursor_path);
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
return FALSE;
}
if (cursor_tree->parent_node)
{
gtk_tree_view_queue_draw_path (tree_view, cursor_path, NULL);
cursor_node = cursor_tree->parent_node;
cursor_tree = cursor_tree->parent_tree;
gtk_tree_path_up (cursor_path);
gtk_tree_row_reference_free (tree_view->priv->cursor);
tree_view->priv->cursor = gtk_tree_row_reference_new_proxy (G_OBJECT (tree_view), tree_view->priv->model, cursor_path);
_gtk_tree_selection_internal_select_node (tree_view->priv->selection,
cursor_node,
cursor_tree,
cursor_path,
0,
FALSE);
}
gtk_tree_view_clamp_node_visible (tree_view, cursor_tree, cursor_node);
gtk_widget_grab_focus (GTK_WIDGET (tree_view));
gtk_tree_view_queue_draw_path (tree_view, cursor_path, NULL);
gtk_tree_path_free (cursor_path);
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
return TRUE;
}
static gboolean
gtk_tree_view_search_entry_flush_timeout (GtkTreeView *tree_view)
{
gtk_tree_view_search_dialog_hide (tree_view->priv->search_window, tree_view);
tree_view->priv->typeselect_flush_timeout = 0;
return TRUE;
}
/* Cut and paste from gtkwindow.c */
static void
send_focus_change (GtkWidget *widget,
gboolean in)
{
GdkEvent *fevent = gdk_event_new (GDK_FOCUS_CHANGE);
g_object_ref (widget);
if (in)
GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
else
GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
fevent->focus_change.type = GDK_FOCUS_CHANGE;
fevent->focus_change.window = g_object_ref (widget->window);
fevent->focus_change.in = in;
gtk_widget_event (widget, fevent);
g_object_notify (G_OBJECT (widget), "has_focus");
g_object_unref (widget);
gdk_event_free (fevent);
}
static void
gtk_tree_view_ensure_interactive_directory (GtkTreeView *tree_view)
{
GtkWidget *frame, *vbox;
if (tree_view->priv->search_window != NULL)
return;
tree_view->priv->search_window = gtk_window_new (GTK_WINDOW_POPUP);
gtk_window_set_modal (GTK_WINDOW (tree_view->priv->search_window), TRUE);
g_signal_connect (tree_view->priv->search_window, "delete_event",
G_CALLBACK (gtk_tree_view_search_delete_event),
tree_view);
g_signal_connect (tree_view->priv->search_window, "key_press_event",
G_CALLBACK (gtk_tree_view_search_key_press_event),
tree_view);
g_signal_connect (tree_view->priv->search_window, "button_press_event",
G_CALLBACK (gtk_tree_view_search_button_press_event),
tree_view);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
gtk_widget_show (frame);
gtk_container_add (GTK_CONTAINER (tree_view->priv->search_window), frame);
vbox = gtk_vbox_new (FALSE, 0);
gtk_widget_show (vbox);
gtk_container_add (GTK_CONTAINER (frame), vbox);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 3);
/* add entry */
tree_view->priv->search_entry = gtk_entry_new ();
gtk_widget_show (tree_view->priv->search_entry);
g_signal_connect (tree_view->priv->search_entry, "populate_popup",
G_CALLBACK (gtk_tree_view_search_disable_popdown),
tree_view);
g_signal_connect (GTK_ENTRY (tree_view->priv->search_entry)->im_context,
"preedit-changed",
G_CALLBACK (gtk_tree_view_search_preedit_changed),
tree_view);
gtk_container_add (GTK_CONTAINER (vbox),
tree_view->priv->search_entry);
gtk_widget_realize (tree_view->priv->search_entry);
}
/* Pops up the interactive search entry. If keybinding is TRUE then the user
* started this by typing the start_interactive_search keybinding. Otherwise, it came from
*/
static gboolean
gtk_tree_view_real_start_interactive_search (GtkTreeView *tree_view,
gboolean keybinding)
{
/* We only start interactive search if we have focus or the columns
* have focus. If one of our children have focus, we don't want to
* start the search.
*/
GList *list;
gboolean found_focus = FALSE;
GtkWidgetClass *entry_parent_class;
if (GTK_WIDGET_VISIBLE (tree_view->priv->search_window))
return TRUE;
for (list = tree_view->priv->columns; list; list = list->next)
{
GtkTreeViewColumn *column;
column = list->data;
if (! column->visible)
continue;
if (GTK_WIDGET_HAS_FOCUS (column->button))
{
found_focus = TRUE;
break;
}
}
if (GTK_WIDGET_HAS_FOCUS (tree_view))
found_focus = TRUE;
if (! found_focus)
return FALSE;
if (tree_view->priv->enable_search == FALSE ||
tree_view->priv->search_column < 0)
return FALSE;
gtk_tree_view_ensure_interactive_directory (tree_view);
if (keybinding)
{
gtk_entry_set_text (GTK_ENTRY (tree_view->priv->search_entry), "");
}
/* done, show it */
tree_view->priv->search_dialog_position_func (tree_view, tree_view->priv->search_window);
gtk_widget_show (tree_view->priv->search_window);
if (tree_view->priv->search_entry_changed_id == 0)
{
tree_view->priv->search_entry_changed_id =
g_signal_connect (tree_view->priv->search_entry, "changed",
G_CALLBACK (gtk_tree_view_search_init),
tree_view);
}
if (! keybinding)
{
tree_view->priv->typeselect_flush_timeout =
g_timeout_add (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
(GSourceFunc) gtk_tree_view_search_entry_flush_timeout,
tree_view);
}
/* Grab focus will select all the text. We don't want that to happen, so we
* call the parent instance and bypass the selection change. This is probably
* really non-kosher. */
entry_parent_class = g_type_class_peek_parent (GTK_ENTRY_GET_CLASS (tree_view->priv->search_entry));
(entry_parent_class->grab_focus) (tree_view->priv->search_entry);
/* send focus-in event */
send_focus_change (tree_view->priv->search_entry, TRUE);
/* search first matching iter */
gtk_tree_view_search_init (tree_view->priv->search_entry, tree_view);
add a gtk_list_store_sort_iter_changed line for some special case ... Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value): add a gtk_list_store_sort_iter_changed line for some special case ... (#96647 (issue 1), testcases from Soeren Sandmann and Daniel Elstner). Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org> Inconsistent state for toggle renderers, requested by Paolo Bacchilega in #88130. * gtk/gtktreeprivate.h: move GtkCellRendererInfo here. * gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away, fix some indentation issues. * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init), (gtk_cell_renderer_toggle_set_property), (gtk_cell_renderer_toggle_get_property), (gtk_cell_renderer_toggle_render): add an inconsistent property. * gtk/gtkstyle.c (gtk_default_draw_check), (gtk_default_draw_option): support drawing inconsistent options/checks for cells. Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done), (gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid calling _editing_done twice (which has nasty side-effects). (#96647, (issue 2) testcase from Soeren Sandmann). Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org> #82739, patch from Padraig O'Briain. * gtk/gtktreeviewcolumn.[ch]: add gtk_tree_view_column_cell_get_position() Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org> Yes, this chunk breaks ABI compatibility. Owen knows about it and agreed with it. It doesn't break ABI that bad though, things will still work. Please keep it silent :P. This patch fixes some keynav issues reported by Narayana Pattipati in #81633. (Also mentioned in #92037 (Sun tracking bug)). * gtk/gtkmarshalers.list: add two silly marshalers * gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all), (gtk_tree_view_real_unselect_all), (gtk_tree_view_real_select_cursor_row), (gtk_tree_view_real_toggle_cursor_row), (gtk_tree_view_real_expand_collapse_cursor_row), (gtk_tree_view_real_start_interactive_search): change the return type from void to gboolean, update prototypes, functions, signals and entries in GtkTreeViewClass, (gtk_tree_view_class_init): add select_cursor_row binding for enter key, (gtk_tree_view_key_press): only navigate the header button if the header is also visible ... Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org> API bit of #75745, reported by Richard Hult. * gtk/gtkcellrenderer.h (GtkCellRendererState): add GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
return TRUE;
}
static gboolean
gtk_tree_view_start_interactive_search (GtkTreeView *tree_view)
{
return gtk_tree_view_real_start_interactive_search (tree_view, FALSE);
}
/* this function returns the new width of the column being resized given
* the column and x position of the cursor; the x cursor position is passed
* in as a pointer and automagicly corrected if it's beyond min/max limits
*/
static gint
gtk_tree_view_new_column_width (GtkTreeView *tree_view,
gint i,
gint *x)
{
GtkTreeViewColumn *column;
gint width;
gboolean rtl;
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
/* first translate the x position from widget->window
* to clist->clist_window
*/
rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
column = g_list_nth (tree_view->priv->columns, i)->data;
width = rtl ? (column->button->allocation.x + column->button->allocation.width - *x) : (*x - column->button->allocation.x);
/* Clamp down the value */
if (column->min_width == -1)
width = MAX (column->button->requisition.width,
width);
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
else
width = MAX (column->min_width,
width);
if (column->max_width != -1)
width = MIN (width, column->max_width != -1);
*x = rtl ? (column->button->allocation.x + column->button->allocation.width - width) : (column->button->allocation.x + width);
return width;
}
/* FIXME this adjust_allocation is a big cut-and-paste from
* GtkCList, needs to be some "official" way to do this
* factored out.
*/
typedef struct
{
GdkWindow *window;
int dx;
int dy;
} ScrollData;
/* The window to which widget->window is relative */
#define ALLOCATION_WINDOW(widget) \
(GTK_WIDGET_NO_WINDOW (widget) ? \
(widget)->window : \
gdk_window_get_parent ((widget)->window))
static void
adjust_allocation_recurse (GtkWidget *widget,
gpointer data)
{
ScrollData *scroll_data = data;
/* Need to really size allocate instead of just poking
* into widget->allocation if the widget is not realized.
* FIXME someone figure out why this was.
*/
if (!GTK_WIDGET_REALIZED (widget))
{
if (GTK_WIDGET_VISIBLE (widget))
{
GdkRectangle tmp_rectangle = widget->allocation;
tmp_rectangle.x += scroll_data->dx;
tmp_rectangle.y += scroll_data->dy;
gtk_widget_size_allocate (widget, &tmp_rectangle);
}
}
else
{
if (ALLOCATION_WINDOW (widget) == scroll_data->window)
{
widget->allocation.x += scroll_data->dx;
widget->allocation.y += scroll_data->dy;
if (GTK_IS_CONTAINER (widget))
gtk_container_forall (GTK_CONTAINER (widget),
adjust_allocation_recurse,
data);
}
}
}
static void
adjust_allocation (GtkWidget *widget,
int dx,
int dy)
{
ScrollData scroll_data;
if (GTK_WIDGET_REALIZED (widget))
scroll_data.window = ALLOCATION_WINDOW (widget);
else
scroll_data.window = NULL;
scroll_data.dx = dx;
scroll_data.dy = dy;
adjust_allocation_recurse (widget, &scroll_data);
}
/* Callbacks */
static void
gtk_tree_view_adjustment_changed (GtkAdjustment *adjustment,
GtkTreeView *tree_view)
{
if (GTK_WIDGET_REALIZED (tree_view))
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
{
gint dy;
gdk_window_move (tree_view->priv->bin_window,
- tree_view->priv->hadjustment->value,
TREE_VIEW_HEADER_HEIGHT (tree_view));
gdk_window_move (tree_view->priv->header_window,
- tree_view->priv->hadjustment->value,
0);
dy = tree_view->priv->dy - (int) tree_view->priv->vadjustment->value;
if (dy && tree_view->priv->edited_column)
{
if (GTK_IS_WIDGET (tree_view->priv->edited_column->editable_widget))
{
GList *list;
GtkWidget *widget;
GtkTreeViewChild *child = NULL;
widget = GTK_WIDGET (tree_view->priv->edited_column->editable_widget);
adjust_allocation (widget, 0, dy);
for (list = tree_view->priv->children; list; list = list->next)
{
child = (GtkTreeViewChild *)list->data;
if (child->widget == widget)
{
child->y += dy;
break;
}
}
}
}
gdk_window_scroll (tree_view->priv->bin_window, 0, dy);
/* update our dy and top_row */
tree_view->priv->dy = (int) tree_view->priv->vadjustment->value;
gtk_tree_view_dy_to_top_row (tree_view);
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
}
}
/* Public methods
*/
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
/**
* gtk_tree_view_new:
*
* Creates a new #GtkTreeView widget.
*
* Return value: A newly created #GtkTreeView widget.
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
**/
GtkWidget *
gtk_tree_view_new (void)
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
{
return g_object_new (GTK_TYPE_TREE_VIEW, NULL);
}
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
/**
* gtk_tree_view_new_with_model:
* @model: the model.
*
* Creates a new #GtkTreeView widget with the model initialized to @model.
*
* Return value: A newly created #GtkTreeView widget.
**/
GtkWidget *
gtk_tree_view_new_with_model (GtkTreeModel *model)
{
return g_object_new (GTK_TYPE_TREE_VIEW, "model", model, NULL);
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
}
/* Public Accessors
*/
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
/**
* gtk_tree_view_get_model:
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
* @tree_view: a #GtkTreeView
*
* Returns the model the the #GtkTreeView is based on. Returns %NULL if the
* model is unset.
*
* Return value: A #GtkTreeModel, or %NULL if none is currently being used.
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
**/
GtkTreeModel *
gtk_tree_view_get_model (GtkTreeView *tree_view)
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
{
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), NULL);
return tree_view->priv->model;
}
/**
* gtk_tree_view_set_model:
* @tree_view: A #GtkTreeNode.
* @model: The model.
*
* Sets the model for a #GtkTreeView. If the @tree_view already has a model
* set, it will remove it before setting the new model. If @model is %NULL,
* then it will unset the old model.
**/
void
gtk_tree_view_set_model (GtkTreeView *tree_view,
GtkTreeModel *model)
{
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
if (model != NULL)
g_return_if_fail (GTK_IS_TREE_MODEL (model));
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
if (model == tree_view->priv->model)
return;
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
if (tree_view->priv->model)
{
API additions: _move, _reorder and _swap for stores, path constructor. Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org> API additions: _move, _reorder and _swap for stores, path constructor. * gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function. * gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private), gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move. * gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private), gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move. Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org> Merge from stable: * gtk/gtktreestore.c (node_free): return FALSE, (gtk_tree_store_finalize): use g_node_traverse instead of g_node_children_foreach, so the whole tree will be freed (#88854, patch from Emmanuel Briot). Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org> Merge from stable: * gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks, (#84426, patch from Matthias Clasen). Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org> Merge from stable: * gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children check shouldn't be in g_return_return_val_if_fail (pointed out by Josh Green, #88997), (gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model for each column when we unset the model (part of #82484), (gtk_tree_view_get_cell_area): return if we ran out of tree or if we got an invalid path (#82376). * gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model. * gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model which disconnects the sort_column_changed_signal (part of #82484). * gtk/gtkliststore.c (gtk_list_store_insert): append row if the given postion is off the end of the tree (#85813). * gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use 2-space indent, commit changes if up/down keys has been pressed, this overrides the focus key foo so the user won't be surprised (#84665).
2002-07-26 20:51:13 +00:00
GList *tmplist = tree_view->priv->columns;
gtk_tree_view_unref_and_check_selection_tree (tree_view, tree_view->priv->tree);
gtk_tree_view_stop_editing (tree_view, TRUE);
g_signal_handlers_disconnect_by_func (tree_view->priv->model,
gtk_tree_view_row_changed,
tree_view);
g_signal_handlers_disconnect_by_func (tree_view->priv->model,
gtk_tree_view_row_inserted,
tree_view);
g_signal_handlers_disconnect_by_func (tree_view->priv->model,
gtk_tree_view_row_has_child_toggled,
tree_view);
g_signal_handlers_disconnect_by_func (tree_view->priv->model,
gtk_tree_view_row_deleted,
tree_view);
g_signal_handlers_disconnect_by_func (tree_view->priv->model,
gtk_tree_view_rows_reordered,
tree_view);
API additions: _move, _reorder and _swap for stores, path constructor. Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org> API additions: _move, _reorder and _swap for stores, path constructor. * gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function. * gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private), gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move. * gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private), gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move. Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org> Merge from stable: * gtk/gtktreestore.c (node_free): return FALSE, (gtk_tree_store_finalize): use g_node_traverse instead of g_node_children_foreach, so the whole tree will be freed (#88854, patch from Emmanuel Briot). Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org> Merge from stable: * gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks, (#84426, patch from Matthias Clasen). Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org> Merge from stable: * gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children check shouldn't be in g_return_return_val_if_fail (pointed out by Josh Green, #88997), (gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model for each column when we unset the model (part of #82484), (gtk_tree_view_get_cell_area): return if we ran out of tree or if we got an invalid path (#82376). * gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model. * gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model which disconnects the sort_column_changed_signal (part of #82484). * gtk/gtkliststore.c (gtk_list_store_insert): append row if the given postion is off the end of the tree (#85813). * gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use 2-space indent, commit changes if up/down keys has been pressed, this overrides the focus key foo so the user won't be surprised (#84665).
2002-07-26 20:51:13 +00:00
for (; tmplist; tmplist = tmplist->next)
_gtk_tree_view_column_unset_model (tmplist->data,
tree_view->priv->model);
if (tree_view->priv->tree)
{
_gtk_rbtree_free (tree_view->priv->tree);
tree_view->priv->tree = NULL;
}
tree_view->priv->prelight_node = NULL;
tree_view->priv->prelight_tree = NULL;
tree_view->priv->button_pressed_node = NULL;
tree_view->priv->button_pressed_tree = NULL;
gtk_tree_row_reference_free (tree_view->priv->drag_dest_row);
tree_view->priv->drag_dest_row = NULL;
gtk_tree_row_reference_free (tree_view->priv->cursor);
tree_view->priv->cursor = NULL;
gtk_tree_row_reference_free (tree_view->priv->anchor);
tree_view->priv->anchor = NULL;
gtk_tree_row_reference_free (tree_view->priv->top_row);
tree_view->priv->top_row = NULL;
gtk_tree_row_reference_free (tree_view->priv->last_button_press);
tree_view->priv->last_button_press = NULL;
gtk_tree_row_reference_free (tree_view->priv->last_button_press_2);
tree_view->priv->last_button_press_2 = NULL;
gtk_tree_row_reference_free (tree_view->priv->scroll_to_path);
tree_view->priv->scroll_to_path = NULL;
tree_view->priv->scroll_to_column = NULL;
g_object_unref (tree_view->priv->model);
tree_view->priv->search_column = -1;
tree_view->priv->fixed_height_check = 0;
tree_view->priv->fixed_height = -1;
tree_view->priv->dy = tree_view->priv->top_row_dy = 0;
}
tree_view->priv->model = model;
if (tree_view->priv->model)
{
gint i;
GtkTreePath *path;
GtkTreeIter iter;
GtkTreeModelFlags flags;
if (tree_view->priv->search_column == -1)
{
for (i = 0; i < gtk_tree_model_get_n_columns (model); i++)
{
GType type = gtk_tree_model_get_column_type (model, i);
if (g_value_type_transformable (type, G_TYPE_STRING))
{
tree_view->priv->search_column = i;
break;
}
}
}
g_object_ref (tree_view->priv->model);
g_signal_connect (tree_view->priv->model,
"row_changed",
G_CALLBACK (gtk_tree_view_row_changed),
tree_view);
g_signal_connect (tree_view->priv->model,
"row_inserted",
G_CALLBACK (gtk_tree_view_row_inserted),
tree_view);
g_signal_connect (tree_view->priv->model,
"row_has_child_toggled",
G_CALLBACK (gtk_tree_view_row_has_child_toggled),
tree_view);
g_signal_connect (tree_view->priv->model,
"row_deleted",
G_CALLBACK (gtk_tree_view_row_deleted),
tree_view);
g_signal_connect (tree_view->priv->model,
"rows_reordered",
G_CALLBACK (gtk_tree_view_rows_reordered),
tree_view);
flags = gtk_tree_model_get_flags (tree_view->priv->model);
if ((flags & GTK_TREE_MODEL_LIST_ONLY) == GTK_TREE_MODEL_LIST_ONLY)
GTK_TREE_VIEW_SET_FLAG (tree_view, GTK_TREE_VIEW_IS_LIST);
else
GTK_TREE_VIEW_UNSET_FLAG (tree_view, GTK_TREE_VIEW_IS_LIST);
path = gtk_tree_path_new_first ();
if (gtk_tree_model_get_iter (tree_view->priv->model, &iter, path))
{
tree_view->priv->tree = _gtk_rbtree_new ();
gtk_tree_view_build_tree (tree_view, tree_view->priv->tree, &iter, 1, FALSE);
}
gtk_tree_path_free (path);
/* FIXME: do I need to do this? gtk_tree_view_create_buttons (tree_view); */
install_presize_handler (tree_view);
}
g_object_notify (G_OBJECT (tree_view), "model");
if (GTK_WIDGET_REALIZED (tree_view))
gtk_widget_queue_resize (GTK_WIDGET (tree_view));
}
/**
* gtk_tree_view_get_selection:
* @tree_view: A #GtkTreeView.
*
* Gets the #GtkTreeSelection associated with @tree_view.
*
* Return value: A #GtkTreeSelection object.
**/
GtkTreeSelection *
gtk_tree_view_get_selection (GtkTreeView *tree_view)
{
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), NULL);
return tree_view->priv->selection;
}
/**
* gtk_tree_view_get_hadjustment:
* @tree_view: A #GtkTreeView
*
* Gets the #GtkAdjustment currently being used for the horizontal aspect.
*
* Return value: A #GtkAdjustment object, or %NULL if none is currently being
* used.
**/
GtkAdjustment *
gtk_tree_view_get_hadjustment (GtkTreeView *tree_view)
{
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), NULL);
remove validation idle 2001-02-08 Havoc Pennington <hp@redhat.com> * gtk/gtktextview.c (gtk_text_view_destroy_layout): remove validation idle * demos/gtk-demo/main.c (create_tree): adjust to changes in text cell renderer * demos/pixbuf-demo.c (timeout): remove deprecated gtk_widget_draw * demos/testpixbuf-save.c (main): remove deprecated gtk_drawing_area_size * gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate buttons even if the model isn't setup. gtk_tree_view_check_dirty() at the start of the allocation. (gtk_tree_view_check_dirty): handle column->button == NULL, handle unsetup or NULL model. * gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the even/odd/sorted cells in the tree view. * gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all): bugfixes * gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row backgrounds with draw_flat_box using different detail for even/odd rows. * gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each row, so we can draw the alternating colors thing * gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a property from a synonym property, notify for the synonym. Also, nuke the background_gdk_set and foreground_gdk_set synonyms (gtk_text_tag_get_property): Always return the font, even if all its fields aren't set * gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't store the attr list; it leaves us with no way to change attributes in _render according to the render flags, and no way to implement get_property. Instead store all the specific text attributes. Separate whether an attribute is enabled from its value. Sync all properties with GtkTextTag, make them all consistent, etc. * gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so renderers can highlight the sort row/column * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use accessor functions to get values; this has the side effect of showing up which accessor functions were missing. Added those. * gtk/gtktreeviewcolumn.h: Replace set_justification with set_alignment, to be consistent with GtkLabel, GtkMisc * gtk/gtktreeviewcolumn.c: Added code to display sort indicator arrow. * gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h * gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
if (tree_view->priv->hadjustment == NULL)
gtk_tree_view_set_hadjustment (tree_view, NULL);
return tree_view->priv->hadjustment;
}
/**
* gtk_tree_view_set_hadjustment:
* @tree_view: A #GtkTreeView
* @adjustment: The #GtkAdjustment to set, or %NULL
*
* Sets the #GtkAdjustment for the current horizontal aspect.
**/
void
gtk_tree_view_set_hadjustment (GtkTreeView *tree_view,
GtkAdjustment *adjustment)
{
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
gtk_tree_view_set_adjustments (tree_view,
adjustment,
tree_view->priv->vadjustment);
g_object_notify (G_OBJECT (tree_view), "hadjustment");
}
Port to GObject, can go back in gdk-pixbuf after setting up a 2000-12-16 Havoc Pennington <hp@pobox.com> * gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c: Port to GObject, can go back in gdk-pixbuf after setting up a gdk-pixbuf-marshal.h header over there. * gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g; (gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal args (gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be set (gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons here, do it when we create the buttons later (gtk_tree_view_realize_buttons): add some g_return_if_fail (gtk_tree_view_map): paranoia checks that column->button is shown and unmapped (gtk_tree_view_size_request): only request visible children. Move header size calculation in here, for cleanliness, and to maintain invariants for child widgets if we eventually let users set different children inside the buttons (gtk_tree_view_map_buttons): factor out code to map buttons, since it was being called several times (gtk_tree_view_size_allocate_buttons): move_resize the drag windows instead of just moving them; their height may change if we allow random widgets in there, or the theme changes. (gtk_tree_view_size_allocate): move button size allocation above emitting the scroll signals, to ensure a sane state when we hit user code (gtk_tree_view_button_release): remove queue_resize after tree_view_set_size(), set_size() will handle any resize queuing that's needed (gtk_tree_view_focus_in): just queue a draw, don't fool with draw_focus goo (gtk_tree_view_focus): use gtk_get_current_event() and gdk_event_get_state() (gtk_tree_view_deleted): don't queue_resize() after calling set_size() (gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove semicolon (gtk_tree_view_create_button): show the button here (gtk_tree_view_button_clicked): actually emit the clicked signal on the column (_gtk_tree_view_set_size): return right away if the size is unchanged, as a cheesy optimization (gtk_tree_view_setup_model): rename set_model_realized to setup_model to match the flag that indicates whether we've called it (gtk_tree_view_get_hadjustment): create adjustment if it doesn't exist, because set_scroll_adjustment does that and it shouldn't matter what order you call these in (gtk_tree_view_get_vadjustment): ditto (gtk_tree_view_set_headers_visible): canonicalize the bool, for paranoia (gtk_tree_view_set_headers_visible): call gtk_tree_view_map_buttons() instead of using cut-and-paste code (gtk_tree_view_append_column): clarify whether the return value is the count of columns before or after, and do the increment separately from the return statement so you can tell from the code. (gtk_tree_view_remove_column): ditto (gtk_tree_view_insert_column): ditto (gtk_tree_view_get_column): remove g_return_if_fail for columns outside the existing range, the docs say that outside-range columns are allowed, so we handle them as documented. (Presumably this allows a nice loop with column != NULL as test.) (gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments mean (left/right/center etc.). (gtk_tree_view_collapse_all): only queue a draw if we're mapped (gtk_tree_view_expand_row): add docs (gtk_tree_view_collapse_row): add docs * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new function to emit the clicked signal on a column * gdk/gdkevents.c (gdk_event_get_state): new function, to get the state of an event (gdk_event_get_time): don't treat GDK_SCROLL as a button event, remove default case from switch so gcc will whine if we don't explicitly handle all event types * gtk/gtktreeselection.h: added some FIXME * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename "columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
/**
* gtk_tree_view_get_vadjustment:
* @tree_view: A #GtkTreeView
*
* Gets the #GtkAdjustment currently being used for the vertical aspect.
*
* Return value: A #GtkAdjustment object, or %NULL if none is currently being
* used.
Port to GObject, can go back in gdk-pixbuf after setting up a 2000-12-16 Havoc Pennington <hp@pobox.com> * gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c: Port to GObject, can go back in gdk-pixbuf after setting up a gdk-pixbuf-marshal.h header over there. * gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g; (gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal args (gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be set (gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons here, do it when we create the buttons later (gtk_tree_view_realize_buttons): add some g_return_if_fail (gtk_tree_view_map): paranoia checks that column->button is shown and unmapped (gtk_tree_view_size_request): only request visible children. Move header size calculation in here, for cleanliness, and to maintain invariants for child widgets if we eventually let users set different children inside the buttons (gtk_tree_view_map_buttons): factor out code to map buttons, since it was being called several times (gtk_tree_view_size_allocate_buttons): move_resize the drag windows instead of just moving them; their height may change if we allow random widgets in there, or the theme changes. (gtk_tree_view_size_allocate): move button size allocation above emitting the scroll signals, to ensure a sane state when we hit user code (gtk_tree_view_button_release): remove queue_resize after tree_view_set_size(), set_size() will handle any resize queuing that's needed (gtk_tree_view_focus_in): just queue a draw, don't fool with draw_focus goo (gtk_tree_view_focus): use gtk_get_current_event() and gdk_event_get_state() (gtk_tree_view_deleted): don't queue_resize() after calling set_size() (gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove semicolon (gtk_tree_view_create_button): show the button here (gtk_tree_view_button_clicked): actually emit the clicked signal on the column (_gtk_tree_view_set_size): return right away if the size is unchanged, as a cheesy optimization (gtk_tree_view_setup_model): rename set_model_realized to setup_model to match the flag that indicates whether we've called it (gtk_tree_view_get_hadjustment): create adjustment if it doesn't exist, because set_scroll_adjustment does that and it shouldn't matter what order you call these in (gtk_tree_view_get_vadjustment): ditto (gtk_tree_view_set_headers_visible): canonicalize the bool, for paranoia (gtk_tree_view_set_headers_visible): call gtk_tree_view_map_buttons() instead of using cut-and-paste code (gtk_tree_view_append_column): clarify whether the return value is the count of columns before or after, and do the increment separately from the return statement so you can tell from the code. (gtk_tree_view_remove_column): ditto (gtk_tree_view_insert_column): ditto (gtk_tree_view_get_column): remove g_return_if_fail for columns outside the existing range, the docs say that outside-range columns are allowed, so we handle them as documented. (Presumably this allows a nice loop with column != NULL as test.) (gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments mean (left/right/center etc.). (gtk_tree_view_collapse_all): only queue a draw if we're mapped (gtk_tree_view_expand_row): add docs (gtk_tree_view_collapse_row): add docs * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new function to emit the clicked signal on a column * gdk/gdkevents.c (gdk_event_get_state): new function, to get the state of an event (gdk_event_get_time): don't treat GDK_SCROLL as a button event, remove default case from switch so gcc will whine if we don't explicitly handle all event types * gtk/gtktreeselection.h: added some FIXME * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename "columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
**/
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;
}
Port to GObject, can go back in gdk-pixbuf after setting up a 2000-12-16 Havoc Pennington <hp@pobox.com> * gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c: Port to GObject, can go back in gdk-pixbuf after setting up a gdk-pixbuf-marshal.h header over there. * gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g; (gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal args (gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be set (gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons here, do it when we create the buttons later (gtk_tree_view_realize_buttons): add some g_return_if_fail (gtk_tree_view_map): paranoia checks that column->button is shown and unmapped (gtk_tree_view_size_request): only request visible children. Move header size calculation in here, for cleanliness, and to maintain invariants for child widgets if we eventually let users set different children inside the buttons (gtk_tree_view_map_buttons): factor out code to map buttons, since it was being called several times (gtk_tree_view_size_allocate_buttons): move_resize the drag windows instead of just moving them; their height may change if we allow random widgets in there, or the theme changes. (gtk_tree_view_size_allocate): move button size allocation above emitting the scroll signals, to ensure a sane state when we hit user code (gtk_tree_view_button_release): remove queue_resize after tree_view_set_size(), set_size() will handle any resize queuing that's needed (gtk_tree_view_focus_in): just queue a draw, don't fool with draw_focus goo (gtk_tree_view_focus): use gtk_get_current_event() and gdk_event_get_state() (gtk_tree_view_deleted): don't queue_resize() after calling set_size() (gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove semicolon (gtk_tree_view_create_button): show the button here (gtk_tree_view_button_clicked): actually emit the clicked signal on the column (_gtk_tree_view_set_size): return right away if the size is unchanged, as a cheesy optimization (gtk_tree_view_setup_model): rename set_model_realized to setup_model to match the flag that indicates whether we've called it (gtk_tree_view_get_hadjustment): create adjustment if it doesn't exist, because set_scroll_adjustment does that and it shouldn't matter what order you call these in (gtk_tree_view_get_vadjustment): ditto (gtk_tree_view_set_headers_visible): canonicalize the bool, for paranoia (gtk_tree_view_set_headers_visible): call gtk_tree_view_map_buttons() instead of using cut-and-paste code (gtk_tree_view_append_column): clarify whether the return value is the count of columns before or after, and do the increment separately from the return statement so you can tell from the code. (gtk_tree_view_remove_column): ditto (gtk_tree_view_insert_column): ditto (gtk_tree_view_get_column): remove g_return_if_fail for columns outside the existing range, the docs say that outside-range columns are allowed, so we handle them as documented. (Presumably this allows a nice loop with column != NULL as test.) (gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments mean (left/right/center etc.). (gtk_tree_view_collapse_all): only queue a draw if we're mapped (gtk_tree_view_expand_row): add docs (gtk_tree_view_collapse_row): add docs * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new function to emit the clicked signal on a column * gdk/gdkevents.c (gdk_event_get_state): new function, to get the state of an event (gdk_event_get_time): don't treat GDK_SCROLL as a button event, remove default case from switch so gcc will whine if we don't explicitly handle all event types * gtk/gtktreeselection.h: added some FIXME * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename "columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
/**
* gtk_tree_view_set_vadjustment:
* @tree_view: A #GtkTreeView
* @adjustment: The #GtkAdjustment to set, or %NULL
*
* Sets the #GtkAdjustment for the current vertical aspect.
Port to GObject, can go back in gdk-pixbuf after setting up a 2000-12-16 Havoc Pennington <hp@pobox.com> * gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c: Port to GObject, can go back in gdk-pixbuf after setting up a gdk-pixbuf-marshal.h header over there. * gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g; (gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal args (gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be set (gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons here, do it when we create the buttons later (gtk_tree_view_realize_buttons): add some g_return_if_fail (gtk_tree_view_map): paranoia checks that column->button is shown and unmapped (gtk_tree_view_size_request): only request visible children. Move header size calculation in here, for cleanliness, and to maintain invariants for child widgets if we eventually let users set different children inside the buttons (gtk_tree_view_map_buttons): factor out code to map buttons, since it was being called several times (gtk_tree_view_size_allocate_buttons): move_resize the drag windows instead of just moving them; their height may change if we allow random widgets in there, or the theme changes. (gtk_tree_view_size_allocate): move button size allocation above emitting the scroll signals, to ensure a sane state when we hit user code (gtk_tree_view_button_release): remove queue_resize after tree_view_set_size(), set_size() will handle any resize queuing that's needed (gtk_tree_view_focus_in): just queue a draw, don't fool with draw_focus goo (gtk_tree_view_focus): use gtk_get_current_event() and gdk_event_get_state() (gtk_tree_view_deleted): don't queue_resize() after calling set_size() (gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove semicolon (gtk_tree_view_create_button): show the button here (gtk_tree_view_button_clicked): actually emit the clicked signal on the column (_gtk_tree_view_set_size): return right away if the size is unchanged, as a cheesy optimization (gtk_tree_view_setup_model): rename set_model_realized to setup_model to match the flag that indicates whether we've called it (gtk_tree_view_get_hadjustment): create adjustment if it doesn't exist, because set_scroll_adjustment does that and it shouldn't matter what order you call these in (gtk_tree_view_get_vadjustment): ditto (gtk_tree_view_set_headers_visible): canonicalize the bool, for paranoia (gtk_tree_view_set_headers_visible): call gtk_tree_view_map_buttons() instead of using cut-and-paste code (gtk_tree_view_append_column): clarify whether the return value is the count of columns before or after, and do the increment separately from the return statement so you can tell from the code. (gtk_tree_view_remove_column): ditto (gtk_tree_view_insert_column): ditto (gtk_tree_view_get_column): remove g_return_if_fail for columns outside the existing range, the docs say that outside-range columns are allowed, so we handle them as documented. (Presumably this allows a nice loop with column != NULL as test.) (gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments mean (left/right/center etc.). (gtk_tree_view_collapse_all): only queue a draw if we're mapped (gtk_tree_view_expand_row): add docs (gtk_tree_view_collapse_row): add docs * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new function to emit the clicked signal on a column * gdk/gdkevents.c (gdk_event_get_state): new function, to get the state of an event (gdk_event_get_time): don't treat GDK_SCROLL as a button event, remove default case from switch so gcc will whine if we don't explicitly handle all event types * gtk/gtktreeselection.h: added some FIXME * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename "columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
**/
void
gtk_tree_view_set_vadjustment (GtkTreeView *tree_view,
GtkAdjustment *adjustment)
{
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
remove validation idle 2001-02-08 Havoc Pennington <hp@redhat.com> * gtk/gtktextview.c (gtk_text_view_destroy_layout): remove validation idle * demos/gtk-demo/main.c (create_tree): adjust to changes in text cell renderer * demos/pixbuf-demo.c (timeout): remove deprecated gtk_widget_draw * demos/testpixbuf-save.c (main): remove deprecated gtk_drawing_area_size * gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate buttons even if the model isn't setup. gtk_tree_view_check_dirty() at the start of the allocation. (gtk_tree_view_check_dirty): handle column->button == NULL, handle unsetup or NULL model. * gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the even/odd/sorted cells in the tree view. * gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all): bugfixes * gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row backgrounds with draw_flat_box using different detail for even/odd rows. * gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each row, so we can draw the alternating colors thing * gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a property from a synonym property, notify for the synonym. Also, nuke the background_gdk_set and foreground_gdk_set synonyms (gtk_text_tag_get_property): Always return the font, even if all its fields aren't set * gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't store the attr list; it leaves us with no way to change attributes in _render according to the render flags, and no way to implement get_property. Instead store all the specific text attributes. Separate whether an attribute is enabled from its value. Sync all properties with GtkTextTag, make them all consistent, etc. * gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so renderers can highlight the sort row/column * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use accessor functions to get values; this has the side effect of showing up which accessor functions were missing. Added those. * gtk/gtktreeviewcolumn.h: Replace set_justification with set_alignment, to be consistent with GtkLabel, GtkMisc * gtk/gtktreeviewcolumn.c: Added code to display sort indicator arrow. * gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h * gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
gtk_tree_view_set_adjustments (tree_view,
tree_view->priv->hadjustment,
adjustment);
g_object_notify (G_OBJECT (tree_view), "vadjustment");
}
/* Column and header operations */
/**
* gtk_tree_view_get_headers_visible:
* @tree_view: A #GtkTreeView.
*
* Returns %TRUE if the headers on the @tree_view are visible.
*
* Return value: Whether the headers are visible or not.
**/
gboolean
gtk_tree_view_get_headers_visible (GtkTreeView *tree_view)
{
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), FALSE);
return GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_HEADERS_VISIBLE);
}
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
/**
* gtk_tree_view_set_headers_visible:
* @tree_view: A #GtkTreeView.
* @headers_visible: %TRUE if the headers are visible
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
*
* Sets the the visibility state of the headers.
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
**/
void
gtk_tree_view_set_headers_visible (GtkTreeView *tree_view,
gboolean headers_visible)
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
{
gint x, y;
GList *list;
GtkTreeViewColumn *column;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
headers_visible = !! headers_visible;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
if (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_HEADERS_VISIBLE) == headers_visible)
return;
if (headers_visible)
GTK_TREE_VIEW_SET_FLAG (tree_view, GTK_TREE_VIEW_HEADERS_VISIBLE);
else
GTK_TREE_VIEW_UNSET_FLAG (tree_view, GTK_TREE_VIEW_HEADERS_VISIBLE);
if (GTK_WIDGET_REALIZED (tree_view))
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
{
gdk_window_get_position (tree_view->priv->bin_window, &x, &y);
if (headers_visible)
{
start implementing Thu Mar 7 02:58:16 2002 Jonathan Blandford <jrb@redhat.com> * gtk/tmpl/gtkliststore.sgml: start implementing * gtk/question_index.sgml: "I can set with the tree, but not get???!?!" Wed Mar 6 23:20:51 2002 Jonathan Blandford <jrb@redhat.com> and Kristian Rietveld <kris@gtk.org> Finishing touch for 2.0.0 release, fixes #70782, #72729, the 'stealth' bug and other last-minute minor issues. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): set dnd dest line drawing right. We can't draw the line at the position of the next row, because that one still has to be drawn. So draw everthing at a -1 offset. (validate_visible_area): add check for invalid descendants and NULL scroll_to_path path, get scrolling right. Also, fix the area_above value. Pretty amazing I got it wrong. (get_logical_dest_row): add gtk-tree-model-drop-append magic, so dragging a row to the end of the model works right. (gtk_tree_view_get_dest_row_at_pos): minor floating point fix (gtk_tree_view_start_editing): add call to validate_row (gtk_tree_view_tree_to_widget_coords): Never subtract HEADER_HEIGHT from y values anymore!!! (gtk_tree_view_widget_coords_to_tree): ditto. (gtk_tree_view_scroll_to_point): allow -1 as values for the scroll_to coords (gtk_tree_view_move_cursor_page_up_down): Don't need scroll_to_y as clamp_node_visible will make it work. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): also check path depth, as we can't get iters from empty paths * gtk/gtkliststore.c (gtk_list_store_drag_data_received): handle gtk-tree-model-drop-append * gtk/gtktreednd.c (gtk_tree_set_row_drag_data): free path_str * tests/testtreeflow.c (main): select path where we are scrolling to
2002-03-07 08:03:09 +00:00
gdk_window_move_resize (tree_view->priv->bin_window, x, y + TREE_VIEW_HEADER_HEIGHT (tree_view), tree_view->priv->width, GTK_WIDGET (tree_view)->allocation.height - + TREE_VIEW_HEADER_HEIGHT (tree_view));
if (GTK_WIDGET_MAPPED (tree_view))
gtk_tree_view_map_buttons (tree_view);
}
else
{
gdk_window_move_resize (tree_view->priv->bin_window, x, y, tree_view->priv->width, tree_view->priv->height);
for (list = tree_view->priv->columns; list; list = list->next)
{
column = list->data;
gtk_widget_unmap (column->button);
}
gdk_window_hide (tree_view->priv->header_window);
}
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
}
tree_view->priv->vadjustment->page_size = GTK_WIDGET (tree_view)->allocation.height - TREE_VIEW_HEADER_HEIGHT (tree_view);
tree_view->priv->vadjustment->page_increment = (GTK_WIDGET (tree_view)->allocation.height - TREE_VIEW_HEADER_HEIGHT (tree_view)) / 2;
tree_view->priv->vadjustment->lower = 0;
tree_view->priv->vadjustment->upper = tree_view->priv->height;
gtk_adjustment_changed (tree_view->priv->vadjustment);
gtk_widget_queue_resize (GTK_WIDGET (tree_view));
g_object_notify (G_OBJECT (tree_view), "headers_visible");
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
}
/**
* gtk_tree_view_columns_autosize:
* @tree_view: A #GtkTreeView.
*
* Resizes all columns to their optimal width. Only works after the
* treeview has been realized.
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
**/
void
gtk_tree_view_columns_autosize (GtkTreeView *tree_view)
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
{
gboolean dirty = FALSE;
GList *list;
GtkTreeViewColumn *column;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
for (list = tree_view->priv->columns; list; list = list->next)
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
{
column = list->data;
if (column->column_type == GTK_TREE_VIEW_COLUMN_AUTOSIZE)
continue;
_gtk_tree_view_column_cell_set_dirty (column, TRUE);
dirty = TRUE;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
}
if (dirty)
gtk_widget_queue_resize (GTK_WIDGET (tree_view));
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
}
/**
* gtk_tree_view_set_headers_clickable:
* @tree_view: A #GtkTreeView.
* @setting: %TRUE if the columns are clickable.
*
* Allow the column title buttons to be clicked.
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
**/
void
gtk_tree_view_set_headers_clickable (GtkTreeView *tree_view,
gboolean setting)
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
{
GList *list;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
g_return_if_fail (tree_view->priv->model != NULL);
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
for (list = tree_view->priv->columns; list; list = list->next)
gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (list->data), setting);
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
g_object_notify (G_OBJECT (tree_view), "headers_clickable");
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
}
remove validation idle 2001-02-08 Havoc Pennington <hp@redhat.com> * gtk/gtktextview.c (gtk_text_view_destroy_layout): remove validation idle * demos/gtk-demo/main.c (create_tree): adjust to changes in text cell renderer * demos/pixbuf-demo.c (timeout): remove deprecated gtk_widget_draw * demos/testpixbuf-save.c (main): remove deprecated gtk_drawing_area_size * gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate buttons even if the model isn't setup. gtk_tree_view_check_dirty() at the start of the allocation. (gtk_tree_view_check_dirty): handle column->button == NULL, handle unsetup or NULL model. * gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the even/odd/sorted cells in the tree view. * gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all): bugfixes * gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row backgrounds with draw_flat_box using different detail for even/odd rows. * gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each row, so we can draw the alternating colors thing * gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a property from a synonym property, notify for the synonym. Also, nuke the background_gdk_set and foreground_gdk_set synonyms (gtk_text_tag_get_property): Always return the font, even if all its fields aren't set * gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't store the attr list; it leaves us with no way to change attributes in _render according to the render flags, and no way to implement get_property. Instead store all the specific text attributes. Separate whether an attribute is enabled from its value. Sync all properties with GtkTextTag, make them all consistent, etc. * gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so renderers can highlight the sort row/column * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use accessor functions to get values; this has the side effect of showing up which accessor functions were missing. Added those. * gtk/gtktreeviewcolumn.h: Replace set_justification with set_alignment, to be consistent with GtkLabel, GtkMisc * gtk/gtktreeviewcolumn.c: Added code to display sort indicator arrow. * gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h * gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
/**
* gtk_tree_view_set_rules_hint
* @tree_view: a #GtkTreeView
* @setting: %TRUE if the tree requires reading across rows
*
remove validation idle 2001-02-08 Havoc Pennington <hp@redhat.com> * gtk/gtktextview.c (gtk_text_view_destroy_layout): remove validation idle * demos/gtk-demo/main.c (create_tree): adjust to changes in text cell renderer * demos/pixbuf-demo.c (timeout): remove deprecated gtk_widget_draw * demos/testpixbuf-save.c (main): remove deprecated gtk_drawing_area_size * gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate buttons even if the model isn't setup. gtk_tree_view_check_dirty() at the start of the allocation. (gtk_tree_view_check_dirty): handle column->button == NULL, handle unsetup or NULL model. * gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the even/odd/sorted cells in the tree view. * gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all): bugfixes * gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row backgrounds with draw_flat_box using different detail for even/odd rows. * gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each row, so we can draw the alternating colors thing * gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a property from a synonym property, notify for the synonym. Also, nuke the background_gdk_set and foreground_gdk_set synonyms (gtk_text_tag_get_property): Always return the font, even if all its fields aren't set * gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't store the attr list; it leaves us with no way to change attributes in _render according to the render flags, and no way to implement get_property. Instead store all the specific text attributes. Separate whether an attribute is enabled from its value. Sync all properties with GtkTextTag, make them all consistent, etc. * gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so renderers can highlight the sort row/column * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use accessor functions to get values; this has the side effect of showing up which accessor functions were missing. Added those. * gtk/gtktreeviewcolumn.h: Replace set_justification with set_alignment, to be consistent with GtkLabel, GtkMisc * gtk/gtktreeviewcolumn.c: Added code to display sort indicator arrow. * gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h * gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
* This function tells GTK+ that the user interface for your
* application requires users to read across tree rows and associate
* cells with one another. By default, GTK+ will then render the tree
* with alternating row colors. Do <emphasis>not</emphasis> use it
remove validation idle 2001-02-08 Havoc Pennington <hp@redhat.com> * gtk/gtktextview.c (gtk_text_view_destroy_layout): remove validation idle * demos/gtk-demo/main.c (create_tree): adjust to changes in text cell renderer * demos/pixbuf-demo.c (timeout): remove deprecated gtk_widget_draw * demos/testpixbuf-save.c (main): remove deprecated gtk_drawing_area_size * gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate buttons even if the model isn't setup. gtk_tree_view_check_dirty() at the start of the allocation. (gtk_tree_view_check_dirty): handle column->button == NULL, handle unsetup or NULL model. * gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the even/odd/sorted cells in the tree view. * gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all): bugfixes * gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row backgrounds with draw_flat_box using different detail for even/odd rows. * gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each row, so we can draw the alternating colors thing * gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a property from a synonym property, notify for the synonym. Also, nuke the background_gdk_set and foreground_gdk_set synonyms (gtk_text_tag_get_property): Always return the font, even if all its fields aren't set * gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't store the attr list; it leaves us with no way to change attributes in _render according to the render flags, and no way to implement get_property. Instead store all the specific text attributes. Separate whether an attribute is enabled from its value. Sync all properties with GtkTextTag, make them all consistent, etc. * gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so renderers can highlight the sort row/column * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use accessor functions to get values; this has the side effect of showing up which accessor functions were missing. Added those. * gtk/gtktreeviewcolumn.h: Replace set_justification with set_alignment, to be consistent with GtkLabel, GtkMisc * gtk/gtktreeviewcolumn.c: Added code to display sort indicator arrow. * gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h * gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
* just because you prefer the appearance of the ruled tree; that's a
* question for the theme. Some themes will draw tree rows in
* alternating colors even when rules are turned off, and users who
* prefer that appearance all the time can choose those themes. You
* should call this function only as a <emphasis>semantic</emphasis>
* hint to the theme engine that your tree makes alternating colors
* useful from a functional standpoint (since it has lots of columns,
* generally).
*
remove validation idle 2001-02-08 Havoc Pennington <hp@redhat.com> * gtk/gtktextview.c (gtk_text_view_destroy_layout): remove validation idle * demos/gtk-demo/main.c (create_tree): adjust to changes in text cell renderer * demos/pixbuf-demo.c (timeout): remove deprecated gtk_widget_draw * demos/testpixbuf-save.c (main): remove deprecated gtk_drawing_area_size * gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate buttons even if the model isn't setup. gtk_tree_view_check_dirty() at the start of the allocation. (gtk_tree_view_check_dirty): handle column->button == NULL, handle unsetup or NULL model. * gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the even/odd/sorted cells in the tree view. * gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all): bugfixes * gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row backgrounds with draw_flat_box using different detail for even/odd rows. * gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each row, so we can draw the alternating colors thing * gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a property from a synonym property, notify for the synonym. Also, nuke the background_gdk_set and foreground_gdk_set synonyms (gtk_text_tag_get_property): Always return the font, even if all its fields aren't set * gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't store the attr list; it leaves us with no way to change attributes in _render according to the render flags, and no way to implement get_property. Instead store all the specific text attributes. Separate whether an attribute is enabled from its value. Sync all properties with GtkTextTag, make them all consistent, etc. * gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so renderers can highlight the sort row/column * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use accessor functions to get values; this has the side effect of showing up which accessor functions were missing. Added those. * gtk/gtktreeviewcolumn.h: Replace set_justification with set_alignment, to be consistent with GtkLabel, GtkMisc * gtk/gtktreeviewcolumn.c: Added code to display sort indicator arrow. * gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h * gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
**/
void
gtk_tree_view_set_rules_hint (GtkTreeView *tree_view,
gboolean setting)
{
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
setting = setting != FALSE;
if (tree_view->priv->has_rules != setting)
{
tree_view->priv->has_rules = setting;
gtk_widget_queue_draw (GTK_WIDGET (tree_view));
}
g_object_notify (G_OBJECT (tree_view), "rules_hint");
}
/**
* gtk_tree_view_get_rules_hint
* @tree_view: a #GtkTreeView
*
* Gets the setting set by gtk_tree_view_set_rules_hint().
*
* Return value: %TRUE if rules are useful for the user of this tree
**/
gboolean
gtk_tree_view_get_rules_hint (GtkTreeView *tree_view)
{
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), FALSE);
return tree_view->priv->has_rules;
}
/* Public Column functions
*/
/**
* gtk_tree_view_append_column:
* @tree_view: A #GtkTreeView.
* @column: The #GtkTreeViewColumn to add.
*
* Appends @column to the list of columns. If @tree_view has "fixed_height"
* mode enbabled, then @column must have its "sizing" property set to be
* GTK_TREE_VIEW_COLUMN_FIXED.
*
* Return value: The number of columns in @tree_view after appending.
**/
gint
gtk_tree_view_append_column (GtkTreeView *tree_view,
GtkTreeViewColumn *column)
{
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), -1);
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (column), -1);
g_return_val_if_fail (column->tree_view == NULL, -1);
return gtk_tree_view_insert_column (tree_view, column, -1);
}
/**
* gtk_tree_view_remove_column:
* @tree_view: A #GtkTreeView.
* @column: The #GtkTreeViewColumn to remove.
*
* Removes @column from @tree_view.
*
* Return value: The number of columns in @tree_view after removing.
**/
gint
gtk_tree_view_remove_column (GtkTreeView *tree_view,
GtkTreeViewColumn *column)
{
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), -1);
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (column), -1);
g_return_val_if_fail (column->tree_view == GTK_WIDGET (tree_view), -1);
if (tree_view->priv->focus_column == column)
tree_view->priv->focus_column = NULL;
if (tree_view->priv->edited_column == column)
{
gtk_tree_view_stop_editing (tree_view, TRUE);
/* no need to, but just to be sure ... */
tree_view->priv->edited_column = NULL;
}
g_signal_handlers_disconnect_by_func (column,
G_CALLBACK (column_sizing_notify),
tree_view);
_gtk_tree_view_column_unset_tree_view (column);
tree_view->priv->columns = g_list_remove (tree_view->priv->columns, column);
tree_view->priv->n_columns--;
if (GTK_WIDGET_REALIZED (tree_view))
{
GList *list;
_gtk_tree_view_column_unrealize_button (column);
for (list = tree_view->priv->columns; list; list = list->next)
{
GtkTreeViewColumn *tmp_column;
tmp_column = GTK_TREE_VIEW_COLUMN (list->data);
if (tmp_column->visible)
_gtk_tree_view_column_cell_set_dirty (tmp_column, TRUE);
}
if (tree_view->priv->n_columns == 0 &&
gtk_tree_view_get_headers_visible (tree_view))
gdk_window_hide (tree_view->priv->header_window);
gtk_widget_queue_resize (GTK_WIDGET (tree_view));
}
g_object_unref (column);
g_signal_emit (tree_view, tree_view_signals[COLUMNS_CHANGED], 0);
return tree_view->priv->n_columns;
}
/**
* gtk_tree_view_insert_column:
* @tree_view: A #GtkTreeView.
* @column: The #GtkTreeViewColumn to be inserted.
* @position: The position to insert @column in.
*
* This inserts the @column into the @tree_view at @position. If @position is
* -1, then the column is inserted at the end. If @tree_view has
* "fixed_height" mode enabled, then @column must have its "sizing" property
* set to be GTK_TREE_VIEW_COLUMN_FIXED.
*
* Return value: The number of columns in @tree_view after insertion.
**/
gint
gtk_tree_view_insert_column (GtkTreeView *tree_view,
GtkTreeViewColumn *column,
gint position)
{
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), -1);
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (column), -1);
g_return_val_if_fail (column->tree_view == NULL, -1);
if (tree_view->priv->fixed_height_mode)
g_return_val_if_fail (gtk_tree_view_column_get_sizing (column)
== GTK_TREE_VIEW_COLUMN_FIXED, -1);
g_object_ref (column);
gtk_object_sink (GTK_OBJECT (column));
remove validation idle 2001-02-08 Havoc Pennington <hp@redhat.com> * gtk/gtktextview.c (gtk_text_view_destroy_layout): remove validation idle * demos/gtk-demo/main.c (create_tree): adjust to changes in text cell renderer * demos/pixbuf-demo.c (timeout): remove deprecated gtk_widget_draw * demos/testpixbuf-save.c (main): remove deprecated gtk_drawing_area_size * gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate buttons even if the model isn't setup. gtk_tree_view_check_dirty() at the start of the allocation. (gtk_tree_view_check_dirty): handle column->button == NULL, handle unsetup or NULL model. * gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the even/odd/sorted cells in the tree view. * gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all): bugfixes * gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row backgrounds with draw_flat_box using different detail for even/odd rows. * gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each row, so we can draw the alternating colors thing * gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a property from a synonym property, notify for the synonym. Also, nuke the background_gdk_set and foreground_gdk_set synonyms (gtk_text_tag_get_property): Always return the font, even if all its fields aren't set * gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't store the attr list; it leaves us with no way to change attributes in _render according to the render flags, and no way to implement get_property. Instead store all the specific text attributes. Separate whether an attribute is enabled from its value. Sync all properties with GtkTextTag, make them all consistent, etc. * gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so renderers can highlight the sort row/column * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use accessor functions to get values; this has the side effect of showing up which accessor functions were missing. Added those. * gtk/gtktreeviewcolumn.h: Replace set_justification with set_alignment, to be consistent with GtkLabel, GtkMisc * gtk/gtktreeviewcolumn.c: Added code to display sort indicator arrow. * gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h * gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
if (tree_view->priv->n_columns == 0 &&
GTK_WIDGET_REALIZED (tree_view) &&
gtk_tree_view_get_headers_visible (tree_view))
remove validation idle 2001-02-08 Havoc Pennington <hp@redhat.com> * gtk/gtktextview.c (gtk_text_view_destroy_layout): remove validation idle * demos/gtk-demo/main.c (create_tree): adjust to changes in text cell renderer * demos/pixbuf-demo.c (timeout): remove deprecated gtk_widget_draw * demos/testpixbuf-save.c (main): remove deprecated gtk_drawing_area_size * gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate buttons even if the model isn't setup. gtk_tree_view_check_dirty() at the start of the allocation. (gtk_tree_view_check_dirty): handle column->button == NULL, handle unsetup or NULL model. * gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the even/odd/sorted cells in the tree view. * gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all): bugfixes * gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row backgrounds with draw_flat_box using different detail for even/odd rows. * gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each row, so we can draw the alternating colors thing * gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a property from a synonym property, notify for the synonym. Also, nuke the background_gdk_set and foreground_gdk_set synonyms (gtk_text_tag_get_property): Always return the font, even if all its fields aren't set * gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't store the attr list; it leaves us with no way to change attributes in _render according to the render flags, and no way to implement get_property. Instead store all the specific text attributes. Separate whether an attribute is enabled from its value. Sync all properties with GtkTextTag, make them all consistent, etc. * gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so renderers can highlight the sort row/column * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use accessor functions to get values; this has the side effect of showing up which accessor functions were missing. Added those. * gtk/gtktreeviewcolumn.h: Replace set_justification with set_alignment, to be consistent with GtkLabel, GtkMisc * gtk/gtktreeviewcolumn.c: Added code to display sort indicator arrow. * gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h * gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
{
gdk_window_show (tree_view->priv->header_window);
remove validation idle 2001-02-08 Havoc Pennington <hp@redhat.com> * gtk/gtktextview.c (gtk_text_view_destroy_layout): remove validation idle * demos/gtk-demo/main.c (create_tree): adjust to changes in text cell renderer * demos/pixbuf-demo.c (timeout): remove deprecated gtk_widget_draw * demos/testpixbuf-save.c (main): remove deprecated gtk_drawing_area_size * gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate buttons even if the model isn't setup. gtk_tree_view_check_dirty() at the start of the allocation. (gtk_tree_view_check_dirty): handle column->button == NULL, handle unsetup or NULL model. * gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the even/odd/sorted cells in the tree view. * gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all): bugfixes * gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row backgrounds with draw_flat_box using different detail for even/odd rows. * gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each row, so we can draw the alternating colors thing * gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a property from a synonym property, notify for the synonym. Also, nuke the background_gdk_set and foreground_gdk_set synonyms (gtk_text_tag_get_property): Always return the font, even if all its fields aren't set * gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't store the attr list; it leaves us with no way to change attributes in _render according to the render flags, and no way to implement get_property. Instead store all the specific text attributes. Separate whether an attribute is enabled from its value. Sync all properties with GtkTextTag, make them all consistent, etc. * gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so renderers can highlight the sort row/column * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use accessor functions to get values; this has the side effect of showing up which accessor functions were missing. Added those. * gtk/gtktreeviewcolumn.h: Replace set_justification with set_alignment, to be consistent with GtkLabel, GtkMisc * gtk/gtktreeviewcolumn.c: Added code to display sort indicator arrow. * gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h * gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
}
g_signal_connect (column, "notify::sizing",
G_CALLBACK (column_sizing_notify), tree_view);
tree_view->priv->columns = g_list_insert (tree_view->priv->columns,
column, position);
tree_view->priv->n_columns++;
_gtk_tree_view_column_set_tree_view (column, tree_view);
if (GTK_WIDGET_REALIZED (tree_view))
{
GList *list;
_gtk_tree_view_column_realize_button (column);
for (list = tree_view->priv->columns; list; list = list->next)
{
column = GTK_TREE_VIEW_COLUMN (list->data);
if (column->visible)
_gtk_tree_view_column_cell_set_dirty (column, TRUE);
}
gtk_widget_queue_resize (GTK_WIDGET (tree_view));
}
g_signal_emit (tree_view, tree_view_signals[COLUMNS_CHANGED], 0);
return tree_view->priv->n_columns;
remove validation idle 2001-02-08 Havoc Pennington <hp@redhat.com> * gtk/gtktextview.c (gtk_text_view_destroy_layout): remove validation idle * demos/gtk-demo/main.c (create_tree): adjust to changes in text cell renderer * demos/pixbuf-demo.c (timeout): remove deprecated gtk_widget_draw * demos/testpixbuf-save.c (main): remove deprecated gtk_drawing_area_size * gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate buttons even if the model isn't setup. gtk_tree_view_check_dirty() at the start of the allocation. (gtk_tree_view_check_dirty): handle column->button == NULL, handle unsetup or NULL model. * gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the even/odd/sorted cells in the tree view. * gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all): bugfixes * gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row backgrounds with draw_flat_box using different detail for even/odd rows. * gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each row, so we can draw the alternating colors thing * gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a property from a synonym property, notify for the synonym. Also, nuke the background_gdk_set and foreground_gdk_set synonyms (gtk_text_tag_get_property): Always return the font, even if all its fields aren't set * gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't store the attr list; it leaves us with no way to change attributes in _render according to the render flags, and no way to implement get_property. Instead store all the specific text attributes. Separate whether an attribute is enabled from its value. Sync all properties with GtkTextTag, make them all consistent, etc. * gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so renderers can highlight the sort row/column * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use accessor functions to get values; this has the side effect of showing up which accessor functions were missing. Added those. * gtk/gtktreeviewcolumn.h: Replace set_justification with set_alignment, to be consistent with GtkLabel, GtkMisc * gtk/gtktreeviewcolumn.c: Added code to display sort indicator arrow. * gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h * gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
}
/**
* gtk_tree_view_insert_column_with_attributes:
* @tree_view: A #GtkTreeView
* @position: The position to insert the new column in.
* @title: The title to set the header to.
* @cell: The #GtkCellRenderer.
* @Varargs: A %NULL-terminated list of attributes.
*
* Creates a new #GtkTreeViewColumn and inserts it into the @tree_view at
* @position. If @position is -1, then the newly created column is inserted at
* the end. The column is initialized with the attributes given. If @tree_view
* has "fixed_height" mode enabled, then @column must have its sizing
* property set to be GTK_TREE_VIEW_COLUMN_FIXED.
*
* Return value: The number of columns in @tree_view after insertion.
remove validation idle 2001-02-08 Havoc Pennington <hp@redhat.com> * gtk/gtktextview.c (gtk_text_view_destroy_layout): remove validation idle * demos/gtk-demo/main.c (create_tree): adjust to changes in text cell renderer * demos/pixbuf-demo.c (timeout): remove deprecated gtk_widget_draw * demos/testpixbuf-save.c (main): remove deprecated gtk_drawing_area_size * gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate buttons even if the model isn't setup. gtk_tree_view_check_dirty() at the start of the allocation. (gtk_tree_view_check_dirty): handle column->button == NULL, handle unsetup or NULL model. * gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the even/odd/sorted cells in the tree view. * gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all): bugfixes * gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row backgrounds with draw_flat_box using different detail for even/odd rows. * gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each row, so we can draw the alternating colors thing * gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a property from a synonym property, notify for the synonym. Also, nuke the background_gdk_set and foreground_gdk_set synonyms (gtk_text_tag_get_property): Always return the font, even if all its fields aren't set * gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't store the attr list; it leaves us with no way to change attributes in _render according to the render flags, and no way to implement get_property. Instead store all the specific text attributes. Separate whether an attribute is enabled from its value. Sync all properties with GtkTextTag, make them all consistent, etc. * gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so renderers can highlight the sort row/column * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use accessor functions to get values; this has the side effect of showing up which accessor functions were missing. Added those. * gtk/gtktreeviewcolumn.h: Replace set_justification with set_alignment, to be consistent with GtkLabel, GtkMisc * gtk/gtktreeviewcolumn.c: Added code to display sort indicator arrow. * gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h * gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
**/
gint
gtk_tree_view_insert_column_with_attributes (GtkTreeView *tree_view,
gint position,
const gchar *title,
GtkCellRenderer *cell,
...)
remove validation idle 2001-02-08 Havoc Pennington <hp@redhat.com> * gtk/gtktextview.c (gtk_text_view_destroy_layout): remove validation idle * demos/gtk-demo/main.c (create_tree): adjust to changes in text cell renderer * demos/pixbuf-demo.c (timeout): remove deprecated gtk_widget_draw * demos/testpixbuf-save.c (main): remove deprecated gtk_drawing_area_size * gtk/gtktreeview.c (gtk_tree_view_size_allocate): allocate buttons even if the model isn't setup. gtk_tree_view_check_dirty() at the start of the allocation. (gtk_tree_view_check_dirty): handle column->button == NULL, handle unsetup or NULL model. * gtk/gtkstyle.c (gtk_default_draw_flat_box): drawing for the even/odd/sorted cells in the tree view. * gtk/gtktreeselection.c (gtk_tree_selection_real_unselect_all): bugfixes * gtk/gtktreeview.c: assorted bugfixy stuff. Draw the row backgrounds with draw_flat_box using different detail for even/odd rows. * gtk/gtkrbtree.c, gtkrbtree.h: Keep track of the parity of each row, so we can draw the alternating colors thing * gtk/gtktexttag.c (gtk_text_tag_set_property): if we change a property from a synonym property, notify for the synonym. Also, nuke the background_gdk_set and foreground_gdk_set synonyms (gtk_text_tag_get_property): Always return the font, even if all its fields aren't set * gtk/gtkcellrenderertext.h (struct _GtkCellRendererText): don't store the attr list; it leaves us with no way to change attributes in _render according to the render flags, and no way to implement get_property. Instead store all the specific text attributes. Separate whether an attribute is enabled from its value. Sync all properties with GtkTextTag, make them all consistent, etc. * gtk/gtkcellrenderer.h: Add a flag GTK_CELL_RENDERER_SORTED so renderers can highlight the sort row/column * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_get_property): use accessor functions to get values; this has the side effect of showing up which accessor functions were missing. Added those. * gtk/gtktreeviewcolumn.h: Replace set_justification with set_alignment, to be consistent with GtkLabel, GtkMisc * gtk/gtktreeviewcolumn.c: Added code to display sort indicator arrow. * gtk/Makefile.am (gtk_public_h_sources): add gtktreesortable.h * gtk/gtktreesortable.h: updates in here
2001-02-08 23:36:53 +00:00
{
GtkTreeViewColumn *column;
gchar *attribute;
va_list args;
gint column_id;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), -1);
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
column = gtk_tree_view_column_new ();
fix bug in here where prev pointer was set to the wrong thing 2001-01-30 Havoc Pennington <hp@redhat.com> * gtk/gtkliststore.c (gtk_list_store_insert_before): fix bug in here where prev pointer was set to the wrong thing * gtk/gtktreemodel.c (gtk_tree_path_is_ancestor): new function (gtk_tree_path_is_descendant): new function * gtk/gtkliststore.c (gtk_list_store_iter_n_children): return cached length (gtk_list_store_get_iter): don't modify iter if we can't get the path. * gtk/gtkliststore.h (struct _GtkListStore): cache the length * gtk/gtktreednd.h: add virtual function row_drop_possible() to GtkTreeDragDest * gtk/gtktreestore.c (copy_node_data): fix varargs type error that was causing segfault * gtk/gtktreedatalist.c (_gtk_tree_data_list_node_copy): set next pointer to NULL * gtk/gtktreestore.c (gtk_tree_store_append): fix memleak * gtk/gtkliststore.c (gtk_list_store_iter_next): don't modify iter on returning FALSE (gtk_list_store_iter_children): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_parent): ditto * gtk/gtktreestore.c (gtk_tree_store_get_path): g_return_if_fail on iter->user_data != NULL instead of silently accepting it. (gtk_tree_store_iter_next): ditto. Also, don't modify iter unless we are returning TRUE. (gtk_tree_store_iter_children): ditto (gtk_tree_store_iter_nth_child): ditto (gtk_tree_store_iter_parent): ditto (gtk_tree_store_insert): remove handling of parent->user_data == NULL, replace with parent == NULL * gtk/gtktreemodel.c (inserted_callback): put some fixes in here, and a comment explaining things * gtk/gtktreestore.c: add GtkTreeDragSource/GtkTreeDragDest interface support to GtkTreeStore. * gtk/gtktreemodel.c (gtk_tree_path_prev): didn't properly return FALSE if no prev, fix * gtk/gtktreeview.c (set_source_row): use a row reference (set_dest_row): use a row reference
2001-01-31 00:57:49 +00:00
gtk_tree_view_column_set_title (column, title);
gtk_tree_view_column_pack_start (column, cell, TRUE);
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
va_start (args, cell);
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
attribute = va_arg (args, gchar *);
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
while (attribute != NULL)
{
column_id = va_arg (args, gint);
gtk_tree_view_column_add_attribute (column, cell, attribute, column_id);
attribute = va_arg (args, gchar *);
}
fix bug in here where prev pointer was set to the wrong thing 2001-01-30 Havoc Pennington <hp@redhat.com> * gtk/gtkliststore.c (gtk_list_store_insert_before): fix bug in here where prev pointer was set to the wrong thing * gtk/gtktreemodel.c (gtk_tree_path_is_ancestor): new function (gtk_tree_path_is_descendant): new function * gtk/gtkliststore.c (gtk_list_store_iter_n_children): return cached length (gtk_list_store_get_iter): don't modify iter if we can't get the path. * gtk/gtkliststore.h (struct _GtkListStore): cache the length * gtk/gtktreednd.h: add virtual function row_drop_possible() to GtkTreeDragDest * gtk/gtktreestore.c (copy_node_data): fix varargs type error that was causing segfault * gtk/gtktreedatalist.c (_gtk_tree_data_list_node_copy): set next pointer to NULL * gtk/gtktreestore.c (gtk_tree_store_append): fix memleak * gtk/gtkliststore.c (gtk_list_store_iter_next): don't modify iter on returning FALSE (gtk_list_store_iter_children): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_parent): ditto * gtk/gtktreestore.c (gtk_tree_store_get_path): g_return_if_fail on iter->user_data != NULL instead of silently accepting it. (gtk_tree_store_iter_next): ditto. Also, don't modify iter unless we are returning TRUE. (gtk_tree_store_iter_children): ditto (gtk_tree_store_iter_nth_child): ditto (gtk_tree_store_iter_parent): ditto (gtk_tree_store_insert): remove handling of parent->user_data == NULL, replace with parent == NULL * gtk/gtktreemodel.c (inserted_callback): put some fixes in here, and a comment explaining things * gtk/gtktreestore.c: add GtkTreeDragSource/GtkTreeDragDest interface support to GtkTreeStore. * gtk/gtktreemodel.c (gtk_tree_path_prev): didn't properly return FALSE if no prev, fix * gtk/gtktreeview.c (set_source_row): use a row reference (set_dest_row): use a row reference
2001-01-31 00:57:49 +00:00
va_end (args);
fix bug in here where prev pointer was set to the wrong thing 2001-01-30 Havoc Pennington <hp@redhat.com> * gtk/gtkliststore.c (gtk_list_store_insert_before): fix bug in here where prev pointer was set to the wrong thing * gtk/gtktreemodel.c (gtk_tree_path_is_ancestor): new function (gtk_tree_path_is_descendant): new function * gtk/gtkliststore.c (gtk_list_store_iter_n_children): return cached length (gtk_list_store_get_iter): don't modify iter if we can't get the path. * gtk/gtkliststore.h (struct _GtkListStore): cache the length * gtk/gtktreednd.h: add virtual function row_drop_possible() to GtkTreeDragDest * gtk/gtktreestore.c (copy_node_data): fix varargs type error that was causing segfault * gtk/gtktreedatalist.c (_gtk_tree_data_list_node_copy): set next pointer to NULL * gtk/gtktreestore.c (gtk_tree_store_append): fix memleak * gtk/gtkliststore.c (gtk_list_store_iter_next): don't modify iter on returning FALSE (gtk_list_store_iter_children): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_parent): ditto * gtk/gtktreestore.c (gtk_tree_store_get_path): g_return_if_fail on iter->user_data != NULL instead of silently accepting it. (gtk_tree_store_iter_next): ditto. Also, don't modify iter unless we are returning TRUE. (gtk_tree_store_iter_children): ditto (gtk_tree_store_iter_nth_child): ditto (gtk_tree_store_iter_parent): ditto (gtk_tree_store_insert): remove handling of parent->user_data == NULL, replace with parent == NULL * gtk/gtktreemodel.c (inserted_callback): put some fixes in here, and a comment explaining things * gtk/gtktreestore.c: add GtkTreeDragSource/GtkTreeDragDest interface support to GtkTreeStore. * gtk/gtktreemodel.c (gtk_tree_path_prev): didn't properly return FALSE if no prev, fix * gtk/gtktreeview.c (set_source_row): use a row reference (set_dest_row): use a row reference
2001-01-31 00:57:49 +00:00
gtk_tree_view_insert_column (tree_view, column, position);
fix bug in here where prev pointer was set to the wrong thing 2001-01-30 Havoc Pennington <hp@redhat.com> * gtk/gtkliststore.c (gtk_list_store_insert_before): fix bug in here where prev pointer was set to the wrong thing * gtk/gtktreemodel.c (gtk_tree_path_is_ancestor): new function (gtk_tree_path_is_descendant): new function * gtk/gtkliststore.c (gtk_list_store_iter_n_children): return cached length (gtk_list_store_get_iter): don't modify iter if we can't get the path. * gtk/gtkliststore.h (struct _GtkListStore): cache the length * gtk/gtktreednd.h: add virtual function row_drop_possible() to GtkTreeDragDest * gtk/gtktreestore.c (copy_node_data): fix varargs type error that was causing segfault * gtk/gtktreedatalist.c (_gtk_tree_data_list_node_copy): set next pointer to NULL * gtk/gtktreestore.c (gtk_tree_store_append): fix memleak * gtk/gtkliststore.c (gtk_list_store_iter_next): don't modify iter on returning FALSE (gtk_list_store_iter_children): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_parent): ditto * gtk/gtktreestore.c (gtk_tree_store_get_path): g_return_if_fail on iter->user_data != NULL instead of silently accepting it. (gtk_tree_store_iter_next): ditto. Also, don't modify iter unless we are returning TRUE. (gtk_tree_store_iter_children): ditto (gtk_tree_store_iter_nth_child): ditto (gtk_tree_store_iter_parent): ditto (gtk_tree_store_insert): remove handling of parent->user_data == NULL, replace with parent == NULL * gtk/gtktreemodel.c (inserted_callback): put some fixes in here, and a comment explaining things * gtk/gtktreestore.c: add GtkTreeDragSource/GtkTreeDragDest interface support to GtkTreeStore. * gtk/gtktreemodel.c (gtk_tree_path_prev): didn't properly return FALSE if no prev, fix * gtk/gtktreeview.c (set_source_row): use a row reference (set_dest_row): use a row reference
2001-01-31 00:57:49 +00:00
return tree_view->priv->n_columns;
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
}
/**
* gtk_tree_view_insert_column_with_data_func:
* @tree_view: a #GtkTreeView
* @position: Position to insert, -1 for append
* @title: column title
* @cell: cell renderer for column
* @func: function to set attributes of cell renderer
* @data: data for @func
* @dnotify: destroy notifier for @data
*
* Convenience function that inserts a new column into the #GtkTreeView
* with the given cell renderer and a #GtkCellDataFunc to set cell renderer
* attributes (normally using data from the model). See also
* gtk_tree_view_column_set_cell_data_func(), gtk_tree_view_column_pack_start().
* If @tree_view has "fixed_height" mode enabled, then @column must have its
* "sizing" property set to be GTK_TREE_VIEW_COLUMN_FIXED.
*
* Return value: number of columns in the tree view post-insert
**/
gint
gtk_tree_view_insert_column_with_data_func (GtkTreeView *tree_view,
gint position,
const gchar *title,
GtkCellRenderer *cell,
GtkTreeCellDataFunc func,
gpointer data,
GDestroyNotify dnotify)
{
GtkTreeViewColumn *column;
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), -1);
column = gtk_tree_view_column_new ();
gtk_tree_view_column_set_title (column, title);
gtk_tree_view_column_pack_start (column, cell, TRUE);
gtk_tree_view_column_set_cell_data_func (column, cell, func, data, dnotify);
gtk_tree_view_insert_column (tree_view, column, position);
return tree_view->priv->n_columns;
}
/**
* gtk_tree_view_get_column:
* @tree_view: A #GtkTreeView.
* @n: The position of the column, counting from 0.
*
* Gets the #GtkTreeViewColumn at the given position in the #tree_view.
*
* Return value: The #GtkTreeViewColumn, or %NULL if the position is outside the
* range of columns.
**/
GtkTreeViewColumn *
gtk_tree_view_get_column (GtkTreeView *tree_view,
gint n)
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
{
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), NULL);
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
if (n < 0 || n >= tree_view->priv->n_columns)
return NULL;
if (tree_view->priv->columns == NULL)
return NULL;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
return GTK_TREE_VIEW_COLUMN (g_list_nth (tree_view->priv->columns, n)->data);
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
}
/**
* gtk_tree_view_get_columns:
* @tree_view: A #GtkTreeView
*
* Returns a #GList of all the #GtkTreeViewColumn s currently in @tree_view.
* The returned list must be freed with g_list_free ().
*
* Return value: A list of #GtkTreeViewColumn s
**/
GList *
gtk_tree_view_get_columns (GtkTreeView *tree_view)
{
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), NULL);
return g_list_copy (tree_view->priv->columns);
}
/**
* gtk_tree_view_move_column_after:
* @tree_view: A #GtkTreeView
* @column: The #GtkTreeViewColumn to be moved.
* @base_column: The #GtkTreeViewColumn to be moved relative to, or %NULL.
*
* Moves @column to be after to @base_column. If @base_column is %NULL, then
* @column is placed in the first position.
**/
void
gtk_tree_view_move_column_after (GtkTreeView *tree_view,
GtkTreeViewColumn *column,
GtkTreeViewColumn *base_column)
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
{
GList *column_list_el, *base_el = NULL;
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
column_list_el = g_list_find (tree_view->priv->columns, column);
g_return_if_fail (column_list_el != NULL);
if (base_column)
{
base_el = g_list_find (tree_view->priv->columns, base_column);
g_return_if_fail (base_el != NULL);
}
if (column_list_el->prev == base_el)
return;
tree_view->priv->columns = g_list_remove_link (tree_view->priv->columns, column_list_el);
if (base_el == NULL)
{
column_list_el->prev = NULL;
column_list_el->next = tree_view->priv->columns;
if (column_list_el->next)
column_list_el->next->prev = column_list_el;
tree_view->priv->columns = column_list_el;
}
else
{
column_list_el->prev = base_el;
column_list_el->next = base_el->next;
if (column_list_el->next)
column_list_el->next->prev = column_list_el;
base_el->next = column_list_el;
}
if (GTK_WIDGET_REALIZED (tree_view))
{
gtk_widget_queue_resize (GTK_WIDGET (tree_view));
gtk_tree_view_size_allocate_columns (GTK_WIDGET (tree_view));
}
g_signal_emit (tree_view, tree_view_signals[COLUMNS_CHANGED], 0);
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
}
/**
* gtk_tree_view_set_expander_column:
* @tree_view: A #GtkTreeView
* @column: %NULL, or the column to draw the expander arrow at.
*
* Sets the column to draw the expander arrow at. It must be in @tree_view. If
* @column is %NULL, then the expander arrow is always at the first visible
* column.
**/
void
gtk_tree_view_set_expander_column (GtkTreeView *tree_view,
GtkTreeViewColumn *column)
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
{
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
if (column != NULL)
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (column));
if (tree_view->priv->expander_column != column)
{
GList *list;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
if (column)
{
/* Confirm that column is in tree_view */
for (list = tree_view->priv->columns; list; list = list->next)
if (list->data == column)
break;
g_return_if_fail (list != NULL);
}
tree_view->priv->expander_column = column;
g_object_notify (G_OBJECT (tree_view), "expander_column");
}
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
}
/**
* gtk_tree_view_get_expander_column:
* @tree_view: A #GtkTreeView
*
* Returns the column that is the current expander column. This
* column has the expander arrow drawn next to it.
*
* Return value: The expander column.
**/
GtkTreeViewColumn *
gtk_tree_view_get_expander_column (GtkTreeView *tree_view)
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
{
GList *list;
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), NULL);
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
for (list = tree_view->priv->columns; list; list = list->next)
if (gtk_tree_view_is_expander_column (tree_view, GTK_TREE_VIEW_COLUMN (list->data)))
return (GtkTreeViewColumn *) list->data;
return NULL;
}
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
/**
* gtk_tree_view_set_column_drag_function:
* @tree_view: A #GtkTreeView.
* @func: A function to determine which columns are reorderable, or %NULL.
* @user_data: User data to be passed to @func, or %NULL
* @destroy: Destroy notifier for @user_data, or %NULL
*
* Sets a user function for determining where a column may be dropped when
* dragged. This function is called on every column pair in turn at the
* beginning of a column drag to determine where a drop can take place. The
* arguments passed to @func are: the @tree_view, the #GtkTreeViewColumn being
* dragged, the two #GtkTreeViewColumn s determining the drop spot, and
* @user_data. If either of the #GtkTreeViewColumn arguments for the drop spot
* are %NULL, then they indicate an edge. If @func is set to be %NULL, then
* @tree_view reverts to the default behavior of allowing all columns to be
* dropped everywhere.
**/
void
gtk_tree_view_set_column_drag_function (GtkTreeView *tree_view,
GtkTreeViewColumnDropFunc func,
gpointer user_data,
GtkDestroyNotify destroy)
{
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
if (tree_view->priv->column_drop_func_data_destroy)
(* tree_view->priv->column_drop_func_data_destroy) (tree_view->priv->column_drop_func_data);
tree_view->priv->column_drop_func = func;
tree_view->priv->column_drop_func_data = user_data;
tree_view->priv->column_drop_func_data_destroy = destroy;
}
/**
* gtk_tree_view_scroll_to_point:
* @tree_view: a #GtkTreeView
start implementing Thu Mar 7 02:58:16 2002 Jonathan Blandford <jrb@redhat.com> * gtk/tmpl/gtkliststore.sgml: start implementing * gtk/question_index.sgml: "I can set with the tree, but not get???!?!" Wed Mar 6 23:20:51 2002 Jonathan Blandford <jrb@redhat.com> and Kristian Rietveld <kris@gtk.org> Finishing touch for 2.0.0 release, fixes #70782, #72729, the 'stealth' bug and other last-minute minor issues. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): set dnd dest line drawing right. We can't draw the line at the position of the next row, because that one still has to be drawn. So draw everthing at a -1 offset. (validate_visible_area): add check for invalid descendants and NULL scroll_to_path path, get scrolling right. Also, fix the area_above value. Pretty amazing I got it wrong. (get_logical_dest_row): add gtk-tree-model-drop-append magic, so dragging a row to the end of the model works right. (gtk_tree_view_get_dest_row_at_pos): minor floating point fix (gtk_tree_view_start_editing): add call to validate_row (gtk_tree_view_tree_to_widget_coords): Never subtract HEADER_HEIGHT from y values anymore!!! (gtk_tree_view_widget_coords_to_tree): ditto. (gtk_tree_view_scroll_to_point): allow -1 as values for the scroll_to coords (gtk_tree_view_move_cursor_page_up_down): Don't need scroll_to_y as clamp_node_visible will make it work. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): also check path depth, as we can't get iters from empty paths * gtk/gtkliststore.c (gtk_list_store_drag_data_received): handle gtk-tree-model-drop-append * gtk/gtktreednd.c (gtk_tree_set_row_drag_data): free path_str * tests/testtreeflow.c (main): select path where we are scrolling to
2002-03-07 08:03:09 +00:00
* @tree_x: X coordinate of new top-left pixel of visible area, or -1
* @tree_y: Y coordinate of new top-left pixel of visible area, or -1
*
* Scrolls the tree view such that the top-left corner of the visible
* area is @tree_x, @tree_y, where @tree_x and @tree_y are specified
* in tree window coordinates. The @tree_view must be realized before
* this function is called. If it isn't, you probably want to be
* using gtk_tree_view_scroll_to_cell().
start implementing Thu Mar 7 02:58:16 2002 Jonathan Blandford <jrb@redhat.com> * gtk/tmpl/gtkliststore.sgml: start implementing * gtk/question_index.sgml: "I can set with the tree, but not get???!?!" Wed Mar 6 23:20:51 2002 Jonathan Blandford <jrb@redhat.com> and Kristian Rietveld <kris@gtk.org> Finishing touch for 2.0.0 release, fixes #70782, #72729, the 'stealth' bug and other last-minute minor issues. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): set dnd dest line drawing right. We can't draw the line at the position of the next row, because that one still has to be drawn. So draw everthing at a -1 offset. (validate_visible_area): add check for invalid descendants and NULL scroll_to_path path, get scrolling right. Also, fix the area_above value. Pretty amazing I got it wrong. (get_logical_dest_row): add gtk-tree-model-drop-append magic, so dragging a row to the end of the model works right. (gtk_tree_view_get_dest_row_at_pos): minor floating point fix (gtk_tree_view_start_editing): add call to validate_row (gtk_tree_view_tree_to_widget_coords): Never subtract HEADER_HEIGHT from y values anymore!!! (gtk_tree_view_widget_coords_to_tree): ditto. (gtk_tree_view_scroll_to_point): allow -1 as values for the scroll_to coords (gtk_tree_view_move_cursor_page_up_down): Don't need scroll_to_y as clamp_node_visible will make it work. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): also check path depth, as we can't get iters from empty paths * gtk/gtkliststore.c (gtk_list_store_drag_data_received): handle gtk-tree-model-drop-append * gtk/gtktreednd.c (gtk_tree_set_row_drag_data): free path_str * tests/testtreeflow.c (main): select path where we are scrolling to
2002-03-07 08:03:09 +00:00
*
* If either @tree_x or @tree_y are -1, then that direction isn't scrolled.
**/
void
gtk_tree_view_scroll_to_point (GtkTreeView *tree_view,
gint tree_x,
gint tree_y)
{
GtkAdjustment *hadj;
GtkAdjustment *vadj;
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
g_return_if_fail (GTK_WIDGET_REALIZED (tree_view));
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
hadj = tree_view->priv->hadjustment;
vadj = tree_view->priv->vadjustment;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
start implementing Thu Mar 7 02:58:16 2002 Jonathan Blandford <jrb@redhat.com> * gtk/tmpl/gtkliststore.sgml: start implementing * gtk/question_index.sgml: "I can set with the tree, but not get???!?!" Wed Mar 6 23:20:51 2002 Jonathan Blandford <jrb@redhat.com> and Kristian Rietveld <kris@gtk.org> Finishing touch for 2.0.0 release, fixes #70782, #72729, the 'stealth' bug and other last-minute minor issues. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): set dnd dest line drawing right. We can't draw the line at the position of the next row, because that one still has to be drawn. So draw everthing at a -1 offset. (validate_visible_area): add check for invalid descendants and NULL scroll_to_path path, get scrolling right. Also, fix the area_above value. Pretty amazing I got it wrong. (get_logical_dest_row): add gtk-tree-model-drop-append magic, so dragging a row to the end of the model works right. (gtk_tree_view_get_dest_row_at_pos): minor floating point fix (gtk_tree_view_start_editing): add call to validate_row (gtk_tree_view_tree_to_widget_coords): Never subtract HEADER_HEIGHT from y values anymore!!! (gtk_tree_view_widget_coords_to_tree): ditto. (gtk_tree_view_scroll_to_point): allow -1 as values for the scroll_to coords (gtk_tree_view_move_cursor_page_up_down): Don't need scroll_to_y as clamp_node_visible will make it work. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): also check path depth, as we can't get iters from empty paths * gtk/gtkliststore.c (gtk_list_store_drag_data_received): handle gtk-tree-model-drop-append * gtk/gtktreednd.c (gtk_tree_set_row_drag_data): free path_str * tests/testtreeflow.c (main): select path where we are scrolling to
2002-03-07 08:03:09 +00:00
if (tree_x != -1)
gtk_adjustment_set_value (hadj, CLAMP (tree_x, hadj->lower, hadj->upper - hadj->page_size));
if (tree_y != -1)
gtk_adjustment_set_value (vadj, CLAMP (tree_y, vadj->lower, vadj->upper - vadj->page_size));
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
}
/**
* gtk_tree_view_scroll_to_cell:
* @tree_view: A #GtkTreeView.
* @path: The path of the row to move to, or %NULL.
* @column: The #GtkTreeViewColumn to move horizontally to, or %NULL.
* @use_align: whether to use alignment arguments, or %FALSE.
* @row_align: The vertical alignment of the row specified by @path.
* @col_align: The horizontal alignment of the column specified by @column.
*
* Moves the alignments of @tree_view to the position specified by @column and
* @path. If @column is %NULL, then no horizontal scrolling occurs. Likewise,
* if @path is %NULL no vertical scrolling occurs. At a minimum, one of @column
* or @path need to be non-%NULL. @row_align determines where the row is
* placed, and @col_align determines where @column is placed. Both are expected
* to be between 0.0 and 1.0. 0.0 means left/top alignment, 1.0 means
* right/bottom alignment, 0.5 means center.
*
* If @use_align is %FALSE, then the alignment arguments are ignored, and the
* tree does the minimum amount of work to scroll the cell onto the screen.
* This means that the cell will be scrolled to the edge closest to its current
* position. If the cell is currently visible on the screen, nothing is done.
start implementing Thu Mar 7 02:58:16 2002 Jonathan Blandford <jrb@redhat.com> * gtk/tmpl/gtkliststore.sgml: start implementing * gtk/question_index.sgml: "I can set with the tree, but not get???!?!" Wed Mar 6 23:20:51 2002 Jonathan Blandford <jrb@redhat.com> and Kristian Rietveld <kris@gtk.org> Finishing touch for 2.0.0 release, fixes #70782, #72729, the 'stealth' bug and other last-minute minor issues. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): set dnd dest line drawing right. We can't draw the line at the position of the next row, because that one still has to be drawn. So draw everthing at a -1 offset. (validate_visible_area): add check for invalid descendants and NULL scroll_to_path path, get scrolling right. Also, fix the area_above value. Pretty amazing I got it wrong. (get_logical_dest_row): add gtk-tree-model-drop-append magic, so dragging a row to the end of the model works right. (gtk_tree_view_get_dest_row_at_pos): minor floating point fix (gtk_tree_view_start_editing): add call to validate_row (gtk_tree_view_tree_to_widget_coords): Never subtract HEADER_HEIGHT from y values anymore!!! (gtk_tree_view_widget_coords_to_tree): ditto. (gtk_tree_view_scroll_to_point): allow -1 as values for the scroll_to coords (gtk_tree_view_move_cursor_page_up_down): Don't need scroll_to_y as clamp_node_visible will make it work. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): also check path depth, as we can't get iters from empty paths * gtk/gtkliststore.c (gtk_list_store_drag_data_received): handle gtk-tree-model-drop-append * gtk/gtktreednd.c (gtk_tree_set_row_drag_data): free path_str * tests/testtreeflow.c (main): select path where we are scrolling to
2002-03-07 08:03:09 +00:00
*
* This function only works if the model is set, and @path is a valid row on the
* model. If the model changes before the @tree_view is realized, the centered
* path will be modified to reflect this change.
**/
void
gtk_tree_view_scroll_to_cell (GtkTreeView *tree_view,
GtkTreePath *path,
GtkTreeViewColumn *column,
gboolean use_align,
gfloat row_align,
gfloat col_align)
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
{
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
start implementing Thu Mar 7 02:58:16 2002 Jonathan Blandford <jrb@redhat.com> * gtk/tmpl/gtkliststore.sgml: start implementing * gtk/question_index.sgml: "I can set with the tree, but not get???!?!" Wed Mar 6 23:20:51 2002 Jonathan Blandford <jrb@redhat.com> and Kristian Rietveld <kris@gtk.org> Finishing touch for 2.0.0 release, fixes #70782, #72729, the 'stealth' bug and other last-minute minor issues. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): set dnd dest line drawing right. We can't draw the line at the position of the next row, because that one still has to be drawn. So draw everthing at a -1 offset. (validate_visible_area): add check for invalid descendants and NULL scroll_to_path path, get scrolling right. Also, fix the area_above value. Pretty amazing I got it wrong. (get_logical_dest_row): add gtk-tree-model-drop-append magic, so dragging a row to the end of the model works right. (gtk_tree_view_get_dest_row_at_pos): minor floating point fix (gtk_tree_view_start_editing): add call to validate_row (gtk_tree_view_tree_to_widget_coords): Never subtract HEADER_HEIGHT from y values anymore!!! (gtk_tree_view_widget_coords_to_tree): ditto. (gtk_tree_view_scroll_to_point): allow -1 as values for the scroll_to coords (gtk_tree_view_move_cursor_page_up_down): Don't need scroll_to_y as clamp_node_visible will make it work. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): also check path depth, as we can't get iters from empty paths * gtk/gtkliststore.c (gtk_list_store_drag_data_received): handle gtk-tree-model-drop-append * gtk/gtktreednd.c (gtk_tree_set_row_drag_data): free path_str * tests/testtreeflow.c (main): select path where we are scrolling to
2002-03-07 08:03:09 +00:00
g_return_if_fail (tree_view->priv->model != NULL);
g_return_if_fail (tree_view->priv->tree != NULL);
g_return_if_fail (row_align >= 0.0 && row_align <= 1.0);
g_return_if_fail (col_align >= 0.0 && col_align <= 1.0);
g_return_if_fail (path != NULL || column != NULL);
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
start implementing Thu Mar 7 02:58:16 2002 Jonathan Blandford <jrb@redhat.com> * gtk/tmpl/gtkliststore.sgml: start implementing * gtk/question_index.sgml: "I can set with the tree, but not get???!?!" Wed Mar 6 23:20:51 2002 Jonathan Blandford <jrb@redhat.com> and Kristian Rietveld <kris@gtk.org> Finishing touch for 2.0.0 release, fixes #70782, #72729, the 'stealth' bug and other last-minute minor issues. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): set dnd dest line drawing right. We can't draw the line at the position of the next row, because that one still has to be drawn. So draw everthing at a -1 offset. (validate_visible_area): add check for invalid descendants and NULL scroll_to_path path, get scrolling right. Also, fix the area_above value. Pretty amazing I got it wrong. (get_logical_dest_row): add gtk-tree-model-drop-append magic, so dragging a row to the end of the model works right. (gtk_tree_view_get_dest_row_at_pos): minor floating point fix (gtk_tree_view_start_editing): add call to validate_row (gtk_tree_view_tree_to_widget_coords): Never subtract HEADER_HEIGHT from y values anymore!!! (gtk_tree_view_widget_coords_to_tree): ditto. (gtk_tree_view_scroll_to_point): allow -1 as values for the scroll_to coords (gtk_tree_view_move_cursor_page_up_down): Don't need scroll_to_y as clamp_node_visible will make it work. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): also check path depth, as we can't get iters from empty paths * gtk/gtkliststore.c (gtk_list_store_drag_data_received): handle gtk-tree-model-drop-append * gtk/gtktreednd.c (gtk_tree_set_row_drag_data): free path_str * tests/testtreeflow.c (main): select path where we are scrolling to
2002-03-07 08:03:09 +00:00
#if 0
g_print ("gtk_tree_view_scroll_to_cell:\npath: %s\ncolumn: %s\nuse_align: %d\nrow_align: %f\ncol_align: %f\n",
gtk_tree_path_to_string (path), column?"non-null":"null", use_align, row_align, col_align);
#endif
row_align = CLAMP (row_align, 0.0, 1.0);
col_align = CLAMP (col_align, 0.0, 1.0);
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
start implementing Thu Mar 7 02:58:16 2002 Jonathan Blandford <jrb@redhat.com> * gtk/tmpl/gtkliststore.sgml: start implementing * gtk/question_index.sgml: "I can set with the tree, but not get???!?!" Wed Mar 6 23:20:51 2002 Jonathan Blandford <jrb@redhat.com> and Kristian Rietveld <kris@gtk.org> Finishing touch for 2.0.0 release, fixes #70782, #72729, the 'stealth' bug and other last-minute minor issues. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): set dnd dest line drawing right. We can't draw the line at the position of the next row, because that one still has to be drawn. So draw everthing at a -1 offset. (validate_visible_area): add check for invalid descendants and NULL scroll_to_path path, get scrolling right. Also, fix the area_above value. Pretty amazing I got it wrong. (get_logical_dest_row): add gtk-tree-model-drop-append magic, so dragging a row to the end of the model works right. (gtk_tree_view_get_dest_row_at_pos): minor floating point fix (gtk_tree_view_start_editing): add call to validate_row (gtk_tree_view_tree_to_widget_coords): Never subtract HEADER_HEIGHT from y values anymore!!! (gtk_tree_view_widget_coords_to_tree): ditto. (gtk_tree_view_scroll_to_point): allow -1 as values for the scroll_to coords (gtk_tree_view_move_cursor_page_up_down): Don't need scroll_to_y as clamp_node_visible will make it work. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): also check path depth, as we can't get iters from empty paths * gtk/gtkliststore.c (gtk_list_store_drag_data_received): handle gtk-tree-model-drop-append * gtk/gtktreednd.c (gtk_tree_set_row_drag_data): free path_str * tests/testtreeflow.c (main): select path where we are scrolling to
2002-03-07 08:03:09 +00:00
/* Note: Despite the benefits that come from having one code path for the
* scrolling code, we short-circuit validate_visible_area's immplementation as
* it is much slower than just going to the point.
*/
if (! GTK_WIDGET_REALIZED (tree_view) ||
GTK_RBNODE_FLAG_SET (tree_view->priv->tree->root, GTK_RBNODE_DESCENDANTS_INVALID))
{
if (tree_view->priv->scroll_to_path)
gtk_tree_row_reference_free (tree_view->priv->scroll_to_path);
start implementing Thu Mar 7 02:58:16 2002 Jonathan Blandford <jrb@redhat.com> * gtk/tmpl/gtkliststore.sgml: start implementing * gtk/question_index.sgml: "I can set with the tree, but not get???!?!" Wed Mar 6 23:20:51 2002 Jonathan Blandford <jrb@redhat.com> and Kristian Rietveld <kris@gtk.org> Finishing touch for 2.0.0 release, fixes #70782, #72729, the 'stealth' bug and other last-minute minor issues. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): set dnd dest line drawing right. We can't draw the line at the position of the next row, because that one still has to be drawn. So draw everthing at a -1 offset. (validate_visible_area): add check for invalid descendants and NULL scroll_to_path path, get scrolling right. Also, fix the area_above value. Pretty amazing I got it wrong. (get_logical_dest_row): add gtk-tree-model-drop-append magic, so dragging a row to the end of the model works right. (gtk_tree_view_get_dest_row_at_pos): minor floating point fix (gtk_tree_view_start_editing): add call to validate_row (gtk_tree_view_tree_to_widget_coords): Never subtract HEADER_HEIGHT from y values anymore!!! (gtk_tree_view_widget_coords_to_tree): ditto. (gtk_tree_view_scroll_to_point): allow -1 as values for the scroll_to coords (gtk_tree_view_move_cursor_page_up_down): Don't need scroll_to_y as clamp_node_visible will make it work. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): also check path depth, as we can't get iters from empty paths * gtk/gtkliststore.c (gtk_list_store_drag_data_received): handle gtk-tree-model-drop-append * gtk/gtktreednd.c (gtk_tree_set_row_drag_data): free path_str * tests/testtreeflow.c (main): select path where we are scrolling to
2002-03-07 08:03:09 +00:00
tree_view->priv->scroll_to_path = NULL;
tree_view->priv->scroll_to_column = NULL;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
start implementing Thu Mar 7 02:58:16 2002 Jonathan Blandford <jrb@redhat.com> * gtk/tmpl/gtkliststore.sgml: start implementing * gtk/question_index.sgml: "I can set with the tree, but not get???!?!" Wed Mar 6 23:20:51 2002 Jonathan Blandford <jrb@redhat.com> and Kristian Rietveld <kris@gtk.org> Finishing touch for 2.0.0 release, fixes #70782, #72729, the 'stealth' bug and other last-minute minor issues. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): set dnd dest line drawing right. We can't draw the line at the position of the next row, because that one still has to be drawn. So draw everthing at a -1 offset. (validate_visible_area): add check for invalid descendants and NULL scroll_to_path path, get scrolling right. Also, fix the area_above value. Pretty amazing I got it wrong. (get_logical_dest_row): add gtk-tree-model-drop-append magic, so dragging a row to the end of the model works right. (gtk_tree_view_get_dest_row_at_pos): minor floating point fix (gtk_tree_view_start_editing): add call to validate_row (gtk_tree_view_tree_to_widget_coords): Never subtract HEADER_HEIGHT from y values anymore!!! (gtk_tree_view_widget_coords_to_tree): ditto. (gtk_tree_view_scroll_to_point): allow -1 as values for the scroll_to coords (gtk_tree_view_move_cursor_page_up_down): Don't need scroll_to_y as clamp_node_visible will make it work. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): also check path depth, as we can't get iters from empty paths * gtk/gtkliststore.c (gtk_list_store_drag_data_received): handle gtk-tree-model-drop-append * gtk/gtktreednd.c (gtk_tree_set_row_drag_data): free path_str * tests/testtreeflow.c (main): select path where we are scrolling to
2002-03-07 08:03:09 +00:00
if (path)
tree_view->priv->scroll_to_path = gtk_tree_row_reference_new_proxy (G_OBJECT (tree_view), tree_view->priv->model, path);
if (column)
tree_view->priv->scroll_to_column = column;
tree_view->priv->scroll_to_use_align = use_align;
tree_view->priv->scroll_to_row_align = row_align;
tree_view->priv->scroll_to_col_align = col_align;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
start implementing Thu Mar 7 02:58:16 2002 Jonathan Blandford <jrb@redhat.com> * gtk/tmpl/gtkliststore.sgml: start implementing * gtk/question_index.sgml: "I can set with the tree, but not get???!?!" Wed Mar 6 23:20:51 2002 Jonathan Blandford <jrb@redhat.com> and Kristian Rietveld <kris@gtk.org> Finishing touch for 2.0.0 release, fixes #70782, #72729, the 'stealth' bug and other last-minute minor issues. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): set dnd dest line drawing right. We can't draw the line at the position of the next row, because that one still has to be drawn. So draw everthing at a -1 offset. (validate_visible_area): add check for invalid descendants and NULL scroll_to_path path, get scrolling right. Also, fix the area_above value. Pretty amazing I got it wrong. (get_logical_dest_row): add gtk-tree-model-drop-append magic, so dragging a row to the end of the model works right. (gtk_tree_view_get_dest_row_at_pos): minor floating point fix (gtk_tree_view_start_editing): add call to validate_row (gtk_tree_view_tree_to_widget_coords): Never subtract HEADER_HEIGHT from y values anymore!!! (gtk_tree_view_widget_coords_to_tree): ditto. (gtk_tree_view_scroll_to_point): allow -1 as values for the scroll_to coords (gtk_tree_view_move_cursor_page_up_down): Don't need scroll_to_y as clamp_node_visible will make it work. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): also check path depth, as we can't get iters from empty paths * gtk/gtkliststore.c (gtk_list_store_drag_data_received): handle gtk-tree-model-drop-append * gtk/gtktreednd.c (gtk_tree_set_row_drag_data): free path_str * tests/testtreeflow.c (main): select path where we are scrolling to
2002-03-07 08:03:09 +00:00
install_presize_handler (tree_view);
}
start implementing Thu Mar 7 02:58:16 2002 Jonathan Blandford <jrb@redhat.com> * gtk/tmpl/gtkliststore.sgml: start implementing * gtk/question_index.sgml: "I can set with the tree, but not get???!?!" Wed Mar 6 23:20:51 2002 Jonathan Blandford <jrb@redhat.com> and Kristian Rietveld <kris@gtk.org> Finishing touch for 2.0.0 release, fixes #70782, #72729, the 'stealth' bug and other last-minute minor issues. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): set dnd dest line drawing right. We can't draw the line at the position of the next row, because that one still has to be drawn. So draw everthing at a -1 offset. (validate_visible_area): add check for invalid descendants and NULL scroll_to_path path, get scrolling right. Also, fix the area_above value. Pretty amazing I got it wrong. (get_logical_dest_row): add gtk-tree-model-drop-append magic, so dragging a row to the end of the model works right. (gtk_tree_view_get_dest_row_at_pos): minor floating point fix (gtk_tree_view_start_editing): add call to validate_row (gtk_tree_view_tree_to_widget_coords): Never subtract HEADER_HEIGHT from y values anymore!!! (gtk_tree_view_widget_coords_to_tree): ditto. (gtk_tree_view_scroll_to_point): allow -1 as values for the scroll_to coords (gtk_tree_view_move_cursor_page_up_down): Don't need scroll_to_y as clamp_node_visible will make it work. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): also check path depth, as we can't get iters from empty paths * gtk/gtkliststore.c (gtk_list_store_drag_data_received): handle gtk-tree-model-drop-append * gtk/gtktreednd.c (gtk_tree_set_row_drag_data): free path_str * tests/testtreeflow.c (main): select path where we are scrolling to
2002-03-07 08:03:09 +00:00
else
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
{
start implementing Thu Mar 7 02:58:16 2002 Jonathan Blandford <jrb@redhat.com> * gtk/tmpl/gtkliststore.sgml: start implementing * gtk/question_index.sgml: "I can set with the tree, but not get???!?!" Wed Mar 6 23:20:51 2002 Jonathan Blandford <jrb@redhat.com> and Kristian Rietveld <kris@gtk.org> Finishing touch for 2.0.0 release, fixes #70782, #72729, the 'stealth' bug and other last-minute minor issues. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): set dnd dest line drawing right. We can't draw the line at the position of the next row, because that one still has to be drawn. So draw everthing at a -1 offset. (validate_visible_area): add check for invalid descendants and NULL scroll_to_path path, get scrolling right. Also, fix the area_above value. Pretty amazing I got it wrong. (get_logical_dest_row): add gtk-tree-model-drop-append magic, so dragging a row to the end of the model works right. (gtk_tree_view_get_dest_row_at_pos): minor floating point fix (gtk_tree_view_start_editing): add call to validate_row (gtk_tree_view_tree_to_widget_coords): Never subtract HEADER_HEIGHT from y values anymore!!! (gtk_tree_view_widget_coords_to_tree): ditto. (gtk_tree_view_scroll_to_point): allow -1 as values for the scroll_to coords (gtk_tree_view_move_cursor_page_up_down): Don't need scroll_to_y as clamp_node_visible will make it work. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): also check path depth, as we can't get iters from empty paths * gtk/gtkliststore.c (gtk_list_store_drag_data_received): handle gtk-tree-model-drop-append * gtk/gtktreednd.c (gtk_tree_set_row_drag_data): free path_str * tests/testtreeflow.c (main): select path where we are scrolling to
2002-03-07 08:03:09 +00:00
GdkRectangle cell_rect;
GdkRectangle vis_rect;
gint dest_x, dest_y;
gtk_tree_view_get_cell_area (tree_view, path, column, &cell_rect);
gtk_tree_view_tree_window_to_tree_coords (tree_view, cell_rect.x, cell_rect.y, &(cell_rect.x), &(cell_rect.y));
start implementing Thu Mar 7 02:58:16 2002 Jonathan Blandford <jrb@redhat.com> * gtk/tmpl/gtkliststore.sgml: start implementing * gtk/question_index.sgml: "I can set with the tree, but not get???!?!" Wed Mar 6 23:20:51 2002 Jonathan Blandford <jrb@redhat.com> and Kristian Rietveld <kris@gtk.org> Finishing touch for 2.0.0 release, fixes #70782, #72729, the 'stealth' bug and other last-minute minor issues. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): set dnd dest line drawing right. We can't draw the line at the position of the next row, because that one still has to be drawn. So draw everthing at a -1 offset. (validate_visible_area): add check for invalid descendants and NULL scroll_to_path path, get scrolling right. Also, fix the area_above value. Pretty amazing I got it wrong. (get_logical_dest_row): add gtk-tree-model-drop-append magic, so dragging a row to the end of the model works right. (gtk_tree_view_get_dest_row_at_pos): minor floating point fix (gtk_tree_view_start_editing): add call to validate_row (gtk_tree_view_tree_to_widget_coords): Never subtract HEADER_HEIGHT from y values anymore!!! (gtk_tree_view_widget_coords_to_tree): ditto. (gtk_tree_view_scroll_to_point): allow -1 as values for the scroll_to coords (gtk_tree_view_move_cursor_page_up_down): Don't need scroll_to_y as clamp_node_visible will make it work. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): also check path depth, as we can't get iters from empty paths * gtk/gtkliststore.c (gtk_list_store_drag_data_received): handle gtk-tree-model-drop-append * gtk/gtktreednd.c (gtk_tree_set_row_drag_data): free path_str * tests/testtreeflow.c (main): select path where we are scrolling to
2002-03-07 08:03:09 +00:00
gtk_tree_view_get_visible_rect (tree_view, &vis_rect);
dest_x = vis_rect.x;
dest_y = vis_rect.y;
if (column)
{
start implementing Thu Mar 7 02:58:16 2002 Jonathan Blandford <jrb@redhat.com> * gtk/tmpl/gtkliststore.sgml: start implementing * gtk/question_index.sgml: "I can set with the tree, but not get???!?!" Wed Mar 6 23:20:51 2002 Jonathan Blandford <jrb@redhat.com> and Kristian Rietveld <kris@gtk.org> Finishing touch for 2.0.0 release, fixes #70782, #72729, the 'stealth' bug and other last-minute minor issues. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): set dnd dest line drawing right. We can't draw the line at the position of the next row, because that one still has to be drawn. So draw everthing at a -1 offset. (validate_visible_area): add check for invalid descendants and NULL scroll_to_path path, get scrolling right. Also, fix the area_above value. Pretty amazing I got it wrong. (get_logical_dest_row): add gtk-tree-model-drop-append magic, so dragging a row to the end of the model works right. (gtk_tree_view_get_dest_row_at_pos): minor floating point fix (gtk_tree_view_start_editing): add call to validate_row (gtk_tree_view_tree_to_widget_coords): Never subtract HEADER_HEIGHT from y values anymore!!! (gtk_tree_view_widget_coords_to_tree): ditto. (gtk_tree_view_scroll_to_point): allow -1 as values for the scroll_to coords (gtk_tree_view_move_cursor_page_up_down): Don't need scroll_to_y as clamp_node_visible will make it work. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): also check path depth, as we can't get iters from empty paths * gtk/gtkliststore.c (gtk_list_store_drag_data_received): handle gtk-tree-model-drop-append * gtk/gtktreednd.c (gtk_tree_set_row_drag_data): free path_str * tests/testtreeflow.c (main): select path where we are scrolling to
2002-03-07 08:03:09 +00:00
if (use_align)
{
dest_x = cell_rect.x - ((vis_rect.width - cell_rect.width) * col_align);
}
else
{
if (cell_rect.x < vis_rect.x)
dest_x = cell_rect.x;
if (cell_rect.x + cell_rect.width > vis_rect.x + vis_rect.width)
dest_x = cell_rect.x + cell_rect.width - vis_rect.width;
}
}
start implementing Thu Mar 7 02:58:16 2002 Jonathan Blandford <jrb@redhat.com> * gtk/tmpl/gtkliststore.sgml: start implementing * gtk/question_index.sgml: "I can set with the tree, but not get???!?!" Wed Mar 6 23:20:51 2002 Jonathan Blandford <jrb@redhat.com> and Kristian Rietveld <kris@gtk.org> Finishing touch for 2.0.0 release, fixes #70782, #72729, the 'stealth' bug and other last-minute minor issues. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): set dnd dest line drawing right. We can't draw the line at the position of the next row, because that one still has to be drawn. So draw everthing at a -1 offset. (validate_visible_area): add check for invalid descendants and NULL scroll_to_path path, get scrolling right. Also, fix the area_above value. Pretty amazing I got it wrong. (get_logical_dest_row): add gtk-tree-model-drop-append magic, so dragging a row to the end of the model works right. (gtk_tree_view_get_dest_row_at_pos): minor floating point fix (gtk_tree_view_start_editing): add call to validate_row (gtk_tree_view_tree_to_widget_coords): Never subtract HEADER_HEIGHT from y values anymore!!! (gtk_tree_view_widget_coords_to_tree): ditto. (gtk_tree_view_scroll_to_point): allow -1 as values for the scroll_to coords (gtk_tree_view_move_cursor_page_up_down): Don't need scroll_to_y as clamp_node_visible will make it work. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): also check path depth, as we can't get iters from empty paths * gtk/gtkliststore.c (gtk_list_store_drag_data_received): handle gtk-tree-model-drop-append * gtk/gtktreednd.c (gtk_tree_set_row_drag_data): free path_str * tests/testtreeflow.c (main): select path where we are scrolling to
2002-03-07 08:03:09 +00:00
if (path)
{
start implementing Thu Mar 7 02:58:16 2002 Jonathan Blandford <jrb@redhat.com> * gtk/tmpl/gtkliststore.sgml: start implementing * gtk/question_index.sgml: "I can set with the tree, but not get???!?!" Wed Mar 6 23:20:51 2002 Jonathan Blandford <jrb@redhat.com> and Kristian Rietveld <kris@gtk.org> Finishing touch for 2.0.0 release, fixes #70782, #72729, the 'stealth' bug and other last-minute minor issues. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): set dnd dest line drawing right. We can't draw the line at the position of the next row, because that one still has to be drawn. So draw everthing at a -1 offset. (validate_visible_area): add check for invalid descendants and NULL scroll_to_path path, get scrolling right. Also, fix the area_above value. Pretty amazing I got it wrong. (get_logical_dest_row): add gtk-tree-model-drop-append magic, so dragging a row to the end of the model works right. (gtk_tree_view_get_dest_row_at_pos): minor floating point fix (gtk_tree_view_start_editing): add call to validate_row (gtk_tree_view_tree_to_widget_coords): Never subtract HEADER_HEIGHT from y values anymore!!! (gtk_tree_view_widget_coords_to_tree): ditto. (gtk_tree_view_scroll_to_point): allow -1 as values for the scroll_to coords (gtk_tree_view_move_cursor_page_up_down): Don't need scroll_to_y as clamp_node_visible will make it work. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): also check path depth, as we can't get iters from empty paths * gtk/gtkliststore.c (gtk_list_store_drag_data_received): handle gtk-tree-model-drop-append * gtk/gtktreednd.c (gtk_tree_set_row_drag_data): free path_str * tests/testtreeflow.c (main): select path where we are scrolling to
2002-03-07 08:03:09 +00:00
if (use_align)
{
dest_y = cell_rect.y - ((vis_rect.height - cell_rect.height) * row_align);
dest_y = MAX (dest_y, 0);
}
else
{
if (cell_rect.y < vis_rect.y)
dest_y = cell_rect.y;
if (cell_rect.y + cell_rect.height > vis_rect.y + vis_rect.height)
dest_y = cell_rect.y + cell_rect.height - vis_rect.height;
}
}
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
start implementing Thu Mar 7 02:58:16 2002 Jonathan Blandford <jrb@redhat.com> * gtk/tmpl/gtkliststore.sgml: start implementing * gtk/question_index.sgml: "I can set with the tree, but not get???!?!" Wed Mar 6 23:20:51 2002 Jonathan Blandford <jrb@redhat.com> and Kristian Rietveld <kris@gtk.org> Finishing touch for 2.0.0 release, fixes #70782, #72729, the 'stealth' bug and other last-minute minor issues. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): set dnd dest line drawing right. We can't draw the line at the position of the next row, because that one still has to be drawn. So draw everthing at a -1 offset. (validate_visible_area): add check for invalid descendants and NULL scroll_to_path path, get scrolling right. Also, fix the area_above value. Pretty amazing I got it wrong. (get_logical_dest_row): add gtk-tree-model-drop-append magic, so dragging a row to the end of the model works right. (gtk_tree_view_get_dest_row_at_pos): minor floating point fix (gtk_tree_view_start_editing): add call to validate_row (gtk_tree_view_tree_to_widget_coords): Never subtract HEADER_HEIGHT from y values anymore!!! (gtk_tree_view_widget_coords_to_tree): ditto. (gtk_tree_view_scroll_to_point): allow -1 as values for the scroll_to coords (gtk_tree_view_move_cursor_page_up_down): Don't need scroll_to_y as clamp_node_visible will make it work. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): also check path depth, as we can't get iters from empty paths * gtk/gtkliststore.c (gtk_list_store_drag_data_received): handle gtk-tree-model-drop-append * gtk/gtktreednd.c (gtk_tree_set_row_drag_data): free path_str * tests/testtreeflow.c (main): select path where we are scrolling to
2002-03-07 08:03:09 +00:00
gtk_tree_view_scroll_to_point (tree_view, dest_x, dest_y);
}
}
/**
* gtk_tree_view_row_activated:
* @tree_view: A #GtkTreeView
* @path: The #GtkTreePath to be activated.
* @column: The #GtkTreeViewColumn to be activated.
*
* Activates the cell determined by @path and @column.
**/
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
void
gtk_tree_view_row_activated (GtkTreeView *tree_view,
GtkTreePath *path,
GtkTreeViewColumn *column)
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
{
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
g_signal_emit (tree_view, tree_view_signals[ROW_ACTIVATED], 0, path, column);
}
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
static void
gtk_tree_view_expand_all_emission_helper (GtkRBTree *tree,
GtkRBNode *node,
gpointer data)
{
GtkTreeView *tree_view = data;
if ((node->flags & GTK_RBNODE_IS_PARENT) == GTK_RBNODE_IS_PARENT &&
node->children)
{
GtkTreePath *path;
GtkTreeIter iter;
path = _gtk_tree_view_find_path (tree_view, tree, node);
gtk_tree_model_get_iter (tree_view->priv->model, &iter, path);
g_signal_emit (tree_view, tree_view_signals[ROW_EXPANDED], 0, &iter, path);
gtk_tree_path_free (path);
}
if (node->children)
_gtk_rbtree_traverse (node->children,
node->children->root,
G_PRE_ORDER,
gtk_tree_view_expand_all_emission_helper,
tree_view);
}
static void
gtk_tree_view_expand_all_helper (GtkRBTree *tree,
GtkRBNode *node,
gpointer data)
{
GtkTreeView *tree_view = data;
if (node->children)
_gtk_rbtree_traverse (node->children,
node->children->root,
G_PRE_ORDER,
gtk_tree_view_expand_all_helper,
data);
else if ((node->flags & GTK_RBNODE_IS_PARENT) == GTK_RBNODE_IS_PARENT && node->children == NULL)
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
{
GtkTreePath *path;
GtkTreeIter iter;
GtkTreeIter child;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
node->children = _gtk_rbtree_new ();
node->children->parent_tree = tree;
node->children->parent_node = node;
path = _gtk_tree_view_find_path (tree_view, tree, node);
gtk_tree_model_get_iter (tree_view->priv->model, &iter, path);
gtk_tree_model_iter_children (tree_view->priv->model, &child, &iter);
gtk_tree_view_build_tree (tree_view,
node->children,
&child,
gtk_tree_path_get_depth (path) + 1,
TRUE);
g_signal_emit (tree_view, tree_view_signals[ROW_EXPANDED], 0, &iter, path);
_gtk_rbtree_traverse (node->children,
node->children->root,
G_PRE_ORDER,
gtk_tree_view_expand_all_emission_helper,
tree_view);
gtk_tree_path_free (path);
}
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
}
/**
* gtk_tree_view_expand_all:
* @tree_view: A #GtkTreeView.
*
* Recursively expands all nodes in the @tree_view.
**/
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
void
gtk_tree_view_expand_all (GtkTreeView *tree_view)
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
{
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
if (tree_view->priv->tree == NULL)
return;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
_gtk_rbtree_traverse (tree_view->priv->tree,
tree_view->priv->tree->root,
G_PRE_ORDER,
gtk_tree_view_expand_all_helper,
tree_view);
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
}
Add support for animating expanders. 2001-07-22 Anders Carlsson <andersca@gnome.org> * gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the expander_height and expander_width properties with a single property, expander_size. (gtk_tree_view_init): Set the tab_offset to expander_size plus some padding. (gtk_tree_view_unrealize): Remove the expand/collapse timeout if it exists. (coords_are_over_arrow): Fix a small bug. (gtk_tree_view_motion_draw_column_motion_arrow): Use expander_size. (gtk_tree_view_draw_focus): Use "treeview" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_bin_expose): Use "treeview-drop-indicator" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_deleted): If we have a node currently being expanded or collapsed, remove the timeout and set the node to NULL. (gtk_tree_view_queue_draw_arrow): New function that just redraws the arrow of a node. (gtk_tree_view_draw_arrow): Use expander_size instead of expander_width/expander_height, also pass a different expander_style to gtk_paint_expander depending on the state of the node being drawn. (expand_collapse_timeout): New function for expanding or collapsing a node depending on the previous state. (gtk_tree_view_real_expand_row): Add timeout and set correct state for node being expanded. (gtk_tree_view_real_collapse_row): Add timeout and set correct state for node being collapsed. * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add information about the node currently being expanded or collapsed, and also a timeout id. * gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open with expander_style for draw_expander. * gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with expander_style. (create_expander_affine): New function for creating an expander affine. (apply_affine_on_point): New function for applying an affine to a point. (gtk_default_draw_expander): Modified to take expander_style instead of is_open, and to draw the rectangle rotated differently depending on the expander style. (gtk_paint_expander): Replace is_open with expander_style. * gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor. * gtk/gtkenums.h: Add expander style enum.
2001-07-22 20:09:00 +00:00
/* Timeout to animate the expander during expands and collapses */
static gboolean
expand_collapse_timeout (gpointer data)
{
gboolean retval;
GDK_THREADS_ENTER ();
retval = do_expand_collapse (data);
GDK_THREADS_LEAVE ();
return retval;
}
static gboolean
do_expand_collapse (GtkTreeView *tree_view)
{
Add support for animating expanders. 2001-07-22 Anders Carlsson <andersca@gnome.org> * gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the expander_height and expander_width properties with a single property, expander_size. (gtk_tree_view_init): Set the tab_offset to expander_size plus some padding. (gtk_tree_view_unrealize): Remove the expand/collapse timeout if it exists. (coords_are_over_arrow): Fix a small bug. (gtk_tree_view_motion_draw_column_motion_arrow): Use expander_size. (gtk_tree_view_draw_focus): Use "treeview" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_bin_expose): Use "treeview-drop-indicator" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_deleted): If we have a node currently being expanded or collapsed, remove the timeout and set the node to NULL. (gtk_tree_view_queue_draw_arrow): New function that just redraws the arrow of a node. (gtk_tree_view_draw_arrow): Use expander_size instead of expander_width/expander_height, also pass a different expander_style to gtk_paint_expander depending on the state of the node being drawn. (expand_collapse_timeout): New function for expanding or collapsing a node depending on the previous state. (gtk_tree_view_real_expand_row): Add timeout and set correct state for node being expanded. (gtk_tree_view_real_collapse_row): Add timeout and set correct state for node being collapsed. * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add information about the node currently being expanded or collapsed, and also a timeout id. * gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open with expander_style for draw_expander. * gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with expander_style. (create_expander_affine): New function for creating an expander affine. (apply_affine_on_point): New function for applying an affine to a point. (gtk_default_draw_expander): Modified to take expander_style instead of is_open, and to draw the rectangle rotated differently depending on the expander style. (gtk_paint_expander): Replace is_open with expander_style. * gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor. * gtk/gtkenums.h: Add expander style enum.
2001-07-22 20:09:00 +00:00
GtkRBNode *node;
GtkRBTree *tree;
gboolean expanding;
gboolean redraw;
redraw = FALSE;
expanding = TRUE;
node = tree_view->priv->expanded_collapsed_node;
tree = tree_view->priv->expanded_collapsed_tree;
Add support for animating expanders. 2001-07-22 Anders Carlsson <andersca@gnome.org> * gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the expander_height and expander_width properties with a single property, expander_size. (gtk_tree_view_init): Set the tab_offset to expander_size plus some padding. (gtk_tree_view_unrealize): Remove the expand/collapse timeout if it exists. (coords_are_over_arrow): Fix a small bug. (gtk_tree_view_motion_draw_column_motion_arrow): Use expander_size. (gtk_tree_view_draw_focus): Use "treeview" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_bin_expose): Use "treeview-drop-indicator" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_deleted): If we have a node currently being expanded or collapsed, remove the timeout and set the node to NULL. (gtk_tree_view_queue_draw_arrow): New function that just redraws the arrow of a node. (gtk_tree_view_draw_arrow): Use expander_size instead of expander_width/expander_height, also pass a different expander_style to gtk_paint_expander depending on the state of the node being drawn. (expand_collapse_timeout): New function for expanding or collapsing a node depending on the previous state. (gtk_tree_view_real_expand_row): Add timeout and set correct state for node being expanded. (gtk_tree_view_real_collapse_row): Add timeout and set correct state for node being collapsed. * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add information about the node currently being expanded or collapsed, and also a timeout id. * gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open with expander_style for draw_expander. * gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with expander_style. (create_expander_affine): New function for creating an expander affine. (apply_affine_on_point): New function for applying an affine to a point. (gtk_default_draw_expander): Modified to take expander_style instead of is_open, and to draw the rectangle rotated differently depending on the expander style. (gtk_paint_expander): Replace is_open with expander_style. * gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor. * gtk/gtkenums.h: Add expander style enum.
2001-07-22 20:09:00 +00:00
if (node->children == NULL)
expanding = FALSE;
if (expanding)
{
if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_SEMI_COLLAPSED))
{
GTK_RBNODE_UNSET_FLAG (node, GTK_RBNODE_IS_SEMI_COLLAPSED);
GTK_RBNODE_SET_FLAG (node, GTK_RBNODE_IS_SEMI_EXPANDED);
redraw = TRUE;
Add support for animating expanders. 2001-07-22 Anders Carlsson <andersca@gnome.org> * gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the expander_height and expander_width properties with a single property, expander_size. (gtk_tree_view_init): Set the tab_offset to expander_size plus some padding. (gtk_tree_view_unrealize): Remove the expand/collapse timeout if it exists. (coords_are_over_arrow): Fix a small bug. (gtk_tree_view_motion_draw_column_motion_arrow): Use expander_size. (gtk_tree_view_draw_focus): Use "treeview" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_bin_expose): Use "treeview-drop-indicator" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_deleted): If we have a node currently being expanded or collapsed, remove the timeout and set the node to NULL. (gtk_tree_view_queue_draw_arrow): New function that just redraws the arrow of a node. (gtk_tree_view_draw_arrow): Use expander_size instead of expander_width/expander_height, also pass a different expander_style to gtk_paint_expander depending on the state of the node being drawn. (expand_collapse_timeout): New function for expanding or collapsing a node depending on the previous state. (gtk_tree_view_real_expand_row): Add timeout and set correct state for node being expanded. (gtk_tree_view_real_collapse_row): Add timeout and set correct state for node being collapsed. * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add information about the node currently being expanded or collapsed, and also a timeout id. * gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open with expander_style for draw_expander. * gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with expander_style. (create_expander_affine): New function for creating an expander affine. (apply_affine_on_point): New function for applying an affine to a point. (gtk_default_draw_expander): Modified to take expander_style instead of is_open, and to draw the rectangle rotated differently depending on the expander style. (gtk_paint_expander): Replace is_open with expander_style. * gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor. * gtk/gtkenums.h: Add expander style enum.
2001-07-22 20:09:00 +00:00
}
else if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_SEMI_EXPANDED))
{
GTK_RBNODE_UNSET_FLAG (node, GTK_RBNODE_IS_SEMI_EXPANDED);
redraw = TRUE;
}
}
else
{
if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_SEMI_EXPANDED))
{
GTK_RBNODE_UNSET_FLAG (node, GTK_RBNODE_IS_SEMI_EXPANDED);
GTK_RBNODE_SET_FLAG (node, GTK_RBNODE_IS_SEMI_COLLAPSED);
redraw = TRUE;
}
else if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_SEMI_COLLAPSED))
{
GTK_RBNODE_UNSET_FLAG (node, GTK_RBNODE_IS_SEMI_COLLAPSED);
redraw = TRUE;
}
}
if (redraw)
{
gtk_tree_view_queue_draw_arrow (tree_view, tree, node, NULL);
return TRUE;
}
return FALSE;
}
/**
* gtk_tree_view_collapse_all:
* @tree_view: A #GtkTreeView.
*
* Recursively collapses all visible, expanded nodes in @tree_view.
**/
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
void
gtk_tree_view_collapse_all (GtkTreeView *tree_view)
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
{
GtkRBTree *tree;
GtkRBNode *node;
GtkTreePath *path;
gint *indices;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
if (tree_view->priv->tree == NULL)
return;
path = gtk_tree_path_new ();
gtk_tree_path_down (path);
indices = gtk_tree_path_get_indices (path);
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
tree = tree_view->priv->tree;
node = tree->root;
while (node && node->left != tree->nil)
node = node->left;
while (node)
{
if (node->children)
gtk_tree_view_real_collapse_row (tree_view, path, tree, node, FALSE);
indices[0]++;
node = _gtk_rbtree_next (tree, node);
}
gtk_tree_path_free (path);
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
}
/**
* gtk_tree_view_expand_to_path:
* @tree_view: A #GtkTreeView.
* @path: path to a row.
*
* Expands the row at @path. This will also expand all parent rows of
* @path as necessary.
2002-11-28 00:33:17 +00:00
*
* Since: 2.2
**/
void
gtk_tree_view_expand_to_path (GtkTreeView *tree_view,
GtkTreePath *path)
{
gint i, depth;
gint *indices;
GtkTreePath *tmp;
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
g_return_if_fail (path != NULL);
depth = gtk_tree_path_get_depth (path);
indices = gtk_tree_path_get_indices (path);
tmp = gtk_tree_path_new ();
g_return_if_fail (tmp != NULL);
for (i = 0; i < depth; i++)
{
gtk_tree_path_append_index (tmp, indices[i]);
gtk_tree_view_expand_row (tree_view, tmp, FALSE);
}
gtk_tree_path_free (tmp);
}
/* FIXME the bool return values for expand_row and collapse_row are
* not analagous; they should be TRUE if the row had children and
* was not already in the requested state.
*/
static gboolean
gtk_tree_view_real_expand_row (GtkTreeView *tree_view,
GtkTreePath *path,
GtkRBTree *tree,
GtkRBNode *node,
gboolean open_all,
gboolean animate)
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
{
GtkTreeIter iter;
GtkTreeIter temp;
gboolean expand;
remove_auto_expand_timeout (tree_view);
if (node->children && !open_all)
return FALSE;
if (! GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_PARENT))
return FALSE;
gtk_tree_model_get_iter (tree_view->priv->model, &iter, path);
if (! gtk_tree_model_iter_has_child (tree_view->priv->model, &iter))
return FALSE;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
if (node->children && open_all)
{
gboolean retval = FALSE;
GtkTreePath *tmp_path = gtk_tree_path_copy (path);
gtk_tree_path_append_index (tmp_path, 0);
tree = node->children;
node = tree->root;
while (node->left != tree->nil)
node = node->left;
/* try to expand the children */
do
{
gboolean t;
t = gtk_tree_view_real_expand_row (tree_view, tmp_path, tree, node,
TRUE, animate);
if (t)
retval = TRUE;
gtk_tree_path_next (tmp_path);
node = _gtk_rbtree_next (tree, node);
}
while (node != NULL);
gtk_tree_path_free (tmp_path);
return retval;
}
g_signal_emit (tree_view, tree_view_signals[TEST_EXPAND_ROW], 0, &iter, path, &expand);
if (expand)
return FALSE;
node->children = _gtk_rbtree_new ();
node->children->parent_tree = tree;
node->children->parent_node = node;
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
gtk_tree_model_iter_children (tree_view->priv->model, &temp, &iter);
gtk_tree_view_build_tree (tree_view,
node->children,
&temp,
gtk_tree_path_get_depth (path) + 1,
open_all);
Add support for animating expanders. 2001-07-22 Anders Carlsson <andersca@gnome.org> * gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the expander_height and expander_width properties with a single property, expander_size. (gtk_tree_view_init): Set the tab_offset to expander_size plus some padding. (gtk_tree_view_unrealize): Remove the expand/collapse timeout if it exists. (coords_are_over_arrow): Fix a small bug. (gtk_tree_view_motion_draw_column_motion_arrow): Use expander_size. (gtk_tree_view_draw_focus): Use "treeview" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_bin_expose): Use "treeview-drop-indicator" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_deleted): If we have a node currently being expanded or collapsed, remove the timeout and set the node to NULL. (gtk_tree_view_queue_draw_arrow): New function that just redraws the arrow of a node. (gtk_tree_view_draw_arrow): Use expander_size instead of expander_width/expander_height, also pass a different expander_style to gtk_paint_expander depending on the state of the node being drawn. (expand_collapse_timeout): New function for expanding or collapsing a node depending on the previous state. (gtk_tree_view_real_expand_row): Add timeout and set correct state for node being expanded. (gtk_tree_view_real_collapse_row): Add timeout and set correct state for node being collapsed. * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add information about the node currently being expanded or collapsed, and also a timeout id. * gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open with expander_style for draw_expander. * gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with expander_style. (create_expander_affine): New function for creating an expander affine. (apply_affine_on_point): New function for applying an affine to a point. (gtk_default_draw_expander): Modified to take expander_style instead of is_open, and to draw the rectangle rotated differently depending on the expander style. (gtk_paint_expander): Replace is_open with expander_style. * gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor. * gtk/gtkenums.h: Add expander style enum.
2001-07-22 20:09:00 +00:00
if (tree_view->priv->expand_collapse_timeout)
{
g_source_remove (tree_view->priv->expand_collapse_timeout);
tree_view->priv->expand_collapse_timeout = 0;
}
Add support for animating expanders. 2001-07-22 Anders Carlsson <andersca@gnome.org> * gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the expander_height and expander_width properties with a single property, expander_size. (gtk_tree_view_init): Set the tab_offset to expander_size plus some padding. (gtk_tree_view_unrealize): Remove the expand/collapse timeout if it exists. (coords_are_over_arrow): Fix a small bug. (gtk_tree_view_motion_draw_column_motion_arrow): Use expander_size. (gtk_tree_view_draw_focus): Use "treeview" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_bin_expose): Use "treeview-drop-indicator" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_deleted): If we have a node currently being expanded or collapsed, remove the timeout and set the node to NULL. (gtk_tree_view_queue_draw_arrow): New function that just redraws the arrow of a node. (gtk_tree_view_draw_arrow): Use expander_size instead of expander_width/expander_height, also pass a different expander_style to gtk_paint_expander depending on the state of the node being drawn. (expand_collapse_timeout): New function for expanding or collapsing a node depending on the previous state. (gtk_tree_view_real_expand_row): Add timeout and set correct state for node being expanded. (gtk_tree_view_real_collapse_row): Add timeout and set correct state for node being collapsed. * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add information about the node currently being expanded or collapsed, and also a timeout id. * gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open with expander_style for draw_expander. * gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with expander_style. (create_expander_affine): New function for creating an expander affine. (apply_affine_on_point): New function for applying an affine to a point. (gtk_default_draw_expander): Modified to take expander_style instead of is_open, and to draw the rectangle rotated differently depending on the expander style. (gtk_paint_expander): Replace is_open with expander_style. * gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor. * gtk/gtkenums.h: Add expander style enum.
2001-07-22 20:09:00 +00:00
if (tree_view->priv->expanded_collapsed_node != NULL)
{
GTK_RBNODE_UNSET_FLAG (tree_view->priv->expanded_collapsed_node, GTK_RBNODE_IS_SEMI_EXPANDED);
GTK_RBNODE_UNSET_FLAG (tree_view->priv->expanded_collapsed_node, GTK_RBNODE_IS_SEMI_COLLAPSED);
tree_view->priv->expanded_collapsed_node = NULL;
Add support for animating expanders. 2001-07-22 Anders Carlsson <andersca@gnome.org> * gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the expander_height and expander_width properties with a single property, expander_size. (gtk_tree_view_init): Set the tab_offset to expander_size plus some padding. (gtk_tree_view_unrealize): Remove the expand/collapse timeout if it exists. (coords_are_over_arrow): Fix a small bug. (gtk_tree_view_motion_draw_column_motion_arrow): Use expander_size. (gtk_tree_view_draw_focus): Use "treeview" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_bin_expose): Use "treeview-drop-indicator" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_deleted): If we have a node currently being expanded or collapsed, remove the timeout and set the node to NULL. (gtk_tree_view_queue_draw_arrow): New function that just redraws the arrow of a node. (gtk_tree_view_draw_arrow): Use expander_size instead of expander_width/expander_height, also pass a different expander_style to gtk_paint_expander depending on the state of the node being drawn. (expand_collapse_timeout): New function for expanding or collapsing a node depending on the previous state. (gtk_tree_view_real_expand_row): Add timeout and set correct state for node being expanded. (gtk_tree_view_real_collapse_row): Add timeout and set correct state for node being collapsed. * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add information about the node currently being expanded or collapsed, and also a timeout id. * gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open with expander_style for draw_expander. * gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with expander_style. (create_expander_affine): New function for creating an expander affine. (apply_affine_on_point): New function for applying an affine to a point. (gtk_default_draw_expander): Modified to take expander_style instead of is_open, and to draw the rectangle rotated differently depending on the expander style. (gtk_paint_expander): Replace is_open with expander_style. * gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor. * gtk/gtkenums.h: Add expander style enum.
2001-07-22 20:09:00 +00:00
}
if (animate)
{
tree_view->priv->expand_collapse_timeout = g_timeout_add (50, expand_collapse_timeout, tree_view);
tree_view->priv->expanded_collapsed_node = node;
tree_view->priv->expanded_collapsed_tree = tree;
GTK_RBNODE_SET_FLAG (node, GTK_RBNODE_IS_SEMI_COLLAPSED);
}
Add support for animating expanders. 2001-07-22 Anders Carlsson <andersca@gnome.org> * gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the expander_height and expander_width properties with a single property, expander_size. (gtk_tree_view_init): Set the tab_offset to expander_size plus some padding. (gtk_tree_view_unrealize): Remove the expand/collapse timeout if it exists. (coords_are_over_arrow): Fix a small bug. (gtk_tree_view_motion_draw_column_motion_arrow): Use expander_size. (gtk_tree_view_draw_focus): Use "treeview" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_bin_expose): Use "treeview-drop-indicator" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_deleted): If we have a node currently being expanded or collapsed, remove the timeout and set the node to NULL. (gtk_tree_view_queue_draw_arrow): New function that just redraws the arrow of a node. (gtk_tree_view_draw_arrow): Use expander_size instead of expander_width/expander_height, also pass a different expander_style to gtk_paint_expander depending on the state of the node being drawn. (expand_collapse_timeout): New function for expanding or collapsing a node depending on the previous state. (gtk_tree_view_real_expand_row): Add timeout and set correct state for node being expanded. (gtk_tree_view_real_collapse_row): Add timeout and set correct state for node being collapsed. * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add information about the node currently being expanded or collapsed, and also a timeout id. * gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open with expander_style for draw_expander. * gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with expander_style. (create_expander_affine): New function for creating an expander affine. (apply_affine_on_point): New function for applying an affine to a point. (gtk_default_draw_expander): Modified to take expander_style instead of is_open, and to draw the rectangle rotated differently depending on the expander style. (gtk_paint_expander): Replace is_open with expander_style. * gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor. * gtk/gtkenums.h: Add expander style enum.
2001-07-22 20:09:00 +00:00
install_presize_handler (tree_view);
g_signal_emit (tree_view, tree_view_signals[ROW_EXPANDED], 0, &iter, path);
return TRUE;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
}
/**
* gtk_tree_view_expand_row:
* @tree_view: a #GtkTreeView
* @path: path to a row
* @open_all: whether to recursively expand, or just expand immediate children
*
* Opens the row so its children are visible.
*
* Return value: %TRUE if the row existed and had children
**/
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
gboolean
gtk_tree_view_expand_row (GtkTreeView *tree_view,
GtkTreePath *path,
gboolean open_all)
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
{
GtkRBTree *tree;
GtkRBNode *node;
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), FALSE);
g_return_val_if_fail (tree_view->priv->model != NULL, FALSE);
g_return_val_if_fail (path != NULL, FALSE);
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
if (_gtk_tree_view_find_node (tree_view,
path,
&tree,
&node))
return FALSE;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
if (tree != NULL)
return gtk_tree_view_real_expand_row (tree_view, path, tree, node, open_all, FALSE);
else
return FALSE;
}
static gboolean
gtk_tree_view_real_collapse_row (GtkTreeView *tree_view,
GtkTreePath *path,
GtkRBTree *tree,
GtkRBNode *node,
gboolean animate)
{
GtkTreeIter iter;
GtkTreeIter children;
gboolean collapse;
gint x, y;
GList *list;
GdkDisplay *display;
GdkWindow *child, *parent;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
remove_auto_expand_timeout (tree_view);
if (node->children == NULL)
return FALSE;
gtk_tree_model_get_iter (tree_view->priv->model, &iter, path);
g_signal_emit (tree_view, tree_view_signals[TEST_COLLAPSE_ROW], 0, &iter, path, &collapse);
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
if (collapse)
return FALSE;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
/* if the prelighted node is a child of us, we want to unprelight it. We have
* a chance to prelight the correct node below */
if (tree_view->priv->prelight_tree)
{
GtkRBTree *parent_tree;
GtkRBNode *parent_node;
parent_tree = tree_view->priv->prelight_tree->parent_tree;
parent_node = tree_view->priv->prelight_tree->parent_node;
while (parent_tree)
{
if (parent_tree == tree && parent_node == node)
{
ensure_unprelighted (tree_view);
break;
}
parent_node = parent_tree->parent_node;
parent_tree = parent_tree->parent_tree;
}
}
TREE_VIEW_INTERNAL_ASSERT (gtk_tree_model_iter_children (tree_view->priv->model, &children, &iter), FALSE);
for (list = tree_view->priv->columns; list; list = list->next)
{
GtkTreeViewColumn *column = list->data;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
if (column->visible == FALSE)
continue;
if (gtk_tree_view_column_get_sizing (column) == GTK_TREE_VIEW_COLUMN_AUTOSIZE)
_gtk_tree_view_column_cell_set_dirty (column, TRUE);
}
if (tree_view->priv->destroy_count_func)
{
GtkTreePath *child_path;
gint child_count = 0;
child_path = gtk_tree_path_copy (path);
gtk_tree_path_down (child_path);
if (node->children)
_gtk_rbtree_traverse (node->children, node->children->root, G_POST_ORDER, count_children_helper, &child_count);
(* tree_view->priv->destroy_count_func) (tree_view, child_path, child_count, tree_view->priv->destroy_count_data);
gtk_tree_path_free (child_path);
}
if (gtk_tree_row_reference_valid (tree_view->priv->cursor))
{
GtkTreePath *cursor_path = gtk_tree_row_reference_get_path (tree_view->priv->cursor);
if (gtk_tree_path_is_ancestor (path, cursor_path))
{
gtk_tree_row_reference_free (tree_view->priv->cursor);
tree_view->priv->cursor = gtk_tree_row_reference_new_proxy (G_OBJECT (tree_view),
tree_view->priv->model,
path);
}
gtk_tree_path_free (cursor_path);
}
if (gtk_tree_row_reference_valid (tree_view->priv->anchor))
{
GtkTreePath *anchor_path = gtk_tree_row_reference_get_path (tree_view->priv->anchor);
if (gtk_tree_path_is_ancestor (path, anchor_path))
{
gtk_tree_row_reference_free (tree_view->priv->anchor);
tree_view->priv->anchor = NULL;
}
gtk_tree_path_free (anchor_path);
}
if (gtk_tree_row_reference_valid (tree_view->priv->last_button_press))
{
GtkTreePath *lsc = gtk_tree_row_reference_get_path (tree_view->priv->last_button_press);
if (gtk_tree_path_is_ancestor (path, lsc))
{
gtk_tree_row_reference_free (tree_view->priv->last_button_press);
tree_view->priv->last_button_press = NULL;
}
gtk_tree_path_free (lsc);
}
if (gtk_tree_row_reference_valid (tree_view->priv->last_button_press_2))
{
GtkTreePath *lsc = gtk_tree_row_reference_get_path (tree_view->priv->last_button_press_2);
if (gtk_tree_path_is_ancestor (path, lsc))
{
gtk_tree_row_reference_free (tree_view->priv->last_button_press_2);
tree_view->priv->last_button_press_2 = NULL;
}
gtk_tree_path_free (lsc);
}
if (gtk_tree_view_unref_and_check_selection_tree (tree_view, node->children))
{
_gtk_rbtree_remove (node->children);
g_signal_emit_by_name (tree_view->priv->selection, "changed");
}
else
_gtk_rbtree_remove (node->children);
Add support for animating expanders. 2001-07-22 Anders Carlsson <andersca@gnome.org> * gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the expander_height and expander_width properties with a single property, expander_size. (gtk_tree_view_init): Set the tab_offset to expander_size plus some padding. (gtk_tree_view_unrealize): Remove the expand/collapse timeout if it exists. (coords_are_over_arrow): Fix a small bug. (gtk_tree_view_motion_draw_column_motion_arrow): Use expander_size. (gtk_tree_view_draw_focus): Use "treeview" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_bin_expose): Use "treeview-drop-indicator" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_deleted): If we have a node currently being expanded or collapsed, remove the timeout and set the node to NULL. (gtk_tree_view_queue_draw_arrow): New function that just redraws the arrow of a node. (gtk_tree_view_draw_arrow): Use expander_size instead of expander_width/expander_height, also pass a different expander_style to gtk_paint_expander depending on the state of the node being drawn. (expand_collapse_timeout): New function for expanding or collapsing a node depending on the previous state. (gtk_tree_view_real_expand_row): Add timeout and set correct state for node being expanded. (gtk_tree_view_real_collapse_row): Add timeout and set correct state for node being collapsed. * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add information about the node currently being expanded or collapsed, and also a timeout id. * gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open with expander_style for draw_expander. * gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with expander_style. (create_expander_affine): New function for creating an expander affine. (apply_affine_on_point): New function for applying an affine to a point. (gtk_default_draw_expander): Modified to take expander_style instead of is_open, and to draw the rectangle rotated differently depending on the expander style. (gtk_paint_expander): Replace is_open with expander_style. * gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor. * gtk/gtkenums.h: Add expander style enum.
2001-07-22 20:09:00 +00:00
if (tree_view->priv->expand_collapse_timeout)
{
g_source_remove (tree_view->priv->expand_collapse_timeout);
tree_view->priv->expand_collapse_timeout = 0;
}
Add support for animating expanders. 2001-07-22 Anders Carlsson <andersca@gnome.org> * gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the expander_height and expander_width properties with a single property, expander_size. (gtk_tree_view_init): Set the tab_offset to expander_size plus some padding. (gtk_tree_view_unrealize): Remove the expand/collapse timeout if it exists. (coords_are_over_arrow): Fix a small bug. (gtk_tree_view_motion_draw_column_motion_arrow): Use expander_size. (gtk_tree_view_draw_focus): Use "treeview" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_bin_expose): Use "treeview-drop-indicator" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_deleted): If we have a node currently being expanded or collapsed, remove the timeout and set the node to NULL. (gtk_tree_view_queue_draw_arrow): New function that just redraws the arrow of a node. (gtk_tree_view_draw_arrow): Use expander_size instead of expander_width/expander_height, also pass a different expander_style to gtk_paint_expander depending on the state of the node being drawn. (expand_collapse_timeout): New function for expanding or collapsing a node depending on the previous state. (gtk_tree_view_real_expand_row): Add timeout and set correct state for node being expanded. (gtk_tree_view_real_collapse_row): Add timeout and set correct state for node being collapsed. * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add information about the node currently being expanded or collapsed, and also a timeout id. * gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open with expander_style for draw_expander. * gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with expander_style. (create_expander_affine): New function for creating an expander affine. (apply_affine_on_point): New function for applying an affine to a point. (gtk_default_draw_expander): Modified to take expander_style instead of is_open, and to draw the rectangle rotated differently depending on the expander style. (gtk_paint_expander): Replace is_open with expander_style. * gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor. * gtk/gtkenums.h: Add expander style enum.
2001-07-22 20:09:00 +00:00
if (tree_view->priv->expanded_collapsed_node != NULL)
{
GTK_RBNODE_UNSET_FLAG (tree_view->priv->expanded_collapsed_node, GTK_RBNODE_IS_SEMI_EXPANDED);
GTK_RBNODE_UNSET_FLAG (tree_view->priv->expanded_collapsed_node, GTK_RBNODE_IS_SEMI_COLLAPSED);
tree_view->priv->expanded_collapsed_node = NULL;
Add support for animating expanders. 2001-07-22 Anders Carlsson <andersca@gnome.org> * gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the expander_height and expander_width properties with a single property, expander_size. (gtk_tree_view_init): Set the tab_offset to expander_size plus some padding. (gtk_tree_view_unrealize): Remove the expand/collapse timeout if it exists. (coords_are_over_arrow): Fix a small bug. (gtk_tree_view_motion_draw_column_motion_arrow): Use expander_size. (gtk_tree_view_draw_focus): Use "treeview" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_bin_expose): Use "treeview-drop-indicator" instead of "add-mode" as detail when drawing the focus. (gtk_tree_view_deleted): If we have a node currently being expanded or collapsed, remove the timeout and set the node to NULL. (gtk_tree_view_queue_draw_arrow): New function that just redraws the arrow of a node. (gtk_tree_view_draw_arrow): Use expander_size instead of expander_width/expander_height, also pass a different expander_style to gtk_paint_expander depending on the state of the node being drawn. (expand_collapse_timeout): New function for expanding or collapsing a node depending on the previous state. (gtk_tree_view_real_expand_row): Add timeout and set correct state for node being expanded. (gtk_tree_view_real_collapse_row): Add timeout and set correct state for node being collapsed. * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add information about the node currently being expanded or collapsed, and also a timeout id. * gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open with expander_style for draw_expander. * gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with expander_style. (create_expander_affine): New function for creating an expander affine. (apply_affine_on_point): New function for applying an affine to a point. (gtk_default_draw_expander): Modified to take expander_style instead of is_open, and to draw the rectangle rotated differently depending on the expander style. (gtk_paint_expander): Replace is_open with expander_style. * gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor. * gtk/gtkenums.h: Add expander style enum.
2001-07-22 20:09:00 +00:00
}
if (animate)
{
tree_view->priv->expand_collapse_timeout = g_timeout_add (50, expand_collapse_timeout, tree_view);
tree_view->priv->expanded_collapsed_node = node;
tree_view->priv->expanded_collapsed_tree = tree;
GTK_RBNODE_SET_FLAG (node, GTK_RBNODE_IS_SEMI_EXPANDED);
}
if (GTK_WIDGET_MAPPED (tree_view))
{
gtk_widget_queue_resize (GTK_WIDGET (tree_view));
}
g_signal_emit (tree_view, tree_view_signals[ROW_COLLAPSED], 0, &iter, path);
if (GTK_WIDGET_MAPPED (tree_view))
{
/* now that we've collapsed all rows, we want to try to set the prelight
* again. To do this, we fake a motion event and send it to ourselves. */
display = gdk_drawable_get_display (tree_view->priv->bin_window);
child = tree_view->priv->bin_window;
parent = gdk_window_get_parent (child);
if (gdk_window_get_pointer (parent, &x, &y, NULL) == child)
{
GdkEventMotion event;
gint child_x, child_y;
gdk_window_get_position (child, &child_x, &child_y);
event.window = tree_view->priv->bin_window;
event.x = x - child_x;
event.y = y - child_y;
/* despite the fact this isn't a real event, I'm almost positive it will
* never trigger a drag event. maybe_drag is the only function that uses
* more than just event.x and event.y. */
gtk_tree_view_motion_bin_window (GTK_WIDGET (tree_view), &event);
}
}
return TRUE;
}
/**
* gtk_tree_view_collapse_row:
* @tree_view: a #GtkTreeView
* @path: path to a row in the @tree_view
*
* Collapses a row (hides its child rows, if they exist).
*
* Return value: %TRUE if the row was collapsed.
**/
gboolean
gtk_tree_view_collapse_row (GtkTreeView *tree_view,
GtkTreePath *path)
{
GtkRBTree *tree;
GtkRBNode *node;
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), FALSE);
g_return_val_if_fail (tree_view->priv->tree != NULL, FALSE);
g_return_val_if_fail (path != NULL, FALSE);
if (_gtk_tree_view_find_node (tree_view,
path,
&tree,
&node))
return FALSE;
if (tree == NULL || node->children == NULL)
return FALSE;
return gtk_tree_view_real_collapse_row (tree_view, path, tree, node, FALSE);
}
static void
gtk_tree_view_map_expanded_rows_helper (GtkTreeView *tree_view,
GtkRBTree *tree,
GtkTreePath *path,
GtkTreeViewMappingFunc func,
gpointer user_data)
{
GtkRBNode *node;
if (tree == NULL || tree->root == NULL)
return;
node = tree->root;
while (node && node->left != tree->nil)
node = node->left;
while (node)
{
if (node->children)
{
(* func) (tree_view, path, user_data);
gtk_tree_path_down (path);
gtk_tree_view_map_expanded_rows_helper (tree_view, node->children, path, func, user_data);
gtk_tree_path_up (path);
}
gtk_tree_path_next (path);
node = _gtk_rbtree_next (tree, node);
}
}
/**
* gtk_tree_view_map_expanded_rows:
* @tree_view: A #GtkTreeView
* @func: A function to be called
* @data: User data to be passed to the function.
*
* Calls @func on all expanded rows.
**/
void
gtk_tree_view_map_expanded_rows (GtkTreeView *tree_view,
GtkTreeViewMappingFunc func,
gpointer user_data)
{
GtkTreePath *path;
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
g_return_if_fail (func != NULL);
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
path = gtk_tree_path_new_first ();
gtk_tree_view_map_expanded_rows_helper (tree_view,
tree_view->priv->tree,
path, func, user_data);
gtk_tree_path_free (path);
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
}
/**
* gtk_tree_view_row_expanded:
* @tree_view: A #GtkTreeView.
* @path: A #GtkTreePath to test expansion state.
*
* Returns %TRUE if the node pointed to by @path is expanded in @tree_view.
*
* Return value: %TRUE if #path is expanded.
**/
gboolean
gtk_tree_view_row_expanded (GtkTreeView *tree_view,
GtkTreePath *path)
{
GtkRBTree *tree;
GtkRBNode *node;
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), FALSE);
g_return_val_if_fail (path != NULL, FALSE);
_gtk_tree_view_find_node (tree_view, path, &tree, &node);
if (node == NULL)
return FALSE;
return (node->children != NULL);
}
static const GtkTargetEntry row_targets[] = {
{ "GTK_TREE_MODEL_ROW", GTK_TARGET_SAME_WIDGET, 0 }
};
/**
* gtk_tree_view_get_reorderable:
* @tree_view: a #GtkTreeView
*
* Retrieves whether the user can reorder the tree via drag-and-drop. See
* gtk_tree_view_set_reorderable().
*
* Return value: %TRUE if the tree can be reordered.
**/
gboolean
gtk_tree_view_get_reorderable (GtkTreeView *tree_view)
{
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), FALSE);
return tree_view->priv->reorderable;
}
/**
* gtk_tree_view_set_reorderable:
* @tree_view: A #GtkTreeView.
* @reorderable: %TRUE, if the tree can be reordered.
*
* This function is a convenience function to allow you to reorder models that
* support the #GtkDragSourceIface and the #GtkDragDestIface. Both
* #GtkTreeStore and #GtkListStore support these. If @reorderable is %TRUE, then
* the user can reorder the model by dragging and dropping rows. The
* developer can listen to these changes by connecting to the model's
* row_inserted and row_deleted signals.
*
* This function does not give you any degree of control over the order -- any
* reordering is allowed. If more control is needed, you should probably
* handle drag and drop manually.
**/
void
gtk_tree_view_set_reorderable (GtkTreeView *tree_view,
gboolean reorderable)
{
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
reorderable = reorderable != FALSE;
if (tree_view->priv->reorderable == reorderable)
return;
if (reorderable)
{
gtk_tree_view_enable_model_drag_source (tree_view,
GDK_BUTTON1_MASK,
row_targets,
G_N_ELEMENTS (row_targets),
GDK_ACTION_MOVE);
gtk_tree_view_enable_model_drag_dest (tree_view,
row_targets,
G_N_ELEMENTS (row_targets),
GDK_ACTION_MOVE);
}
else
{
gtk_tree_view_unset_rows_drag_source (tree_view);
gtk_tree_view_unset_rows_drag_dest (tree_view);
}
tree_view->priv->reorderable = reorderable;
g_object_notify (G_OBJECT (tree_view), "reorderable");
}
static void
gtk_tree_view_real_set_cursor (GtkTreeView *tree_view,
GtkTreePath *path,
gboolean clear_and_select,
gboolean clamp_node)
{
GtkRBTree *tree = NULL;
GtkRBNode *node = NULL;
if (gtk_tree_row_reference_valid (tree_view->priv->cursor))
{
GtkTreePath *cursor_path;
cursor_path = gtk_tree_row_reference_get_path (tree_view->priv->cursor);
gtk_tree_view_queue_draw_path (tree_view, cursor_path, NULL);
gtk_tree_path_free (cursor_path);
}
gtk_tree_row_reference_free (tree_view->priv->cursor);
tree_view->priv->cursor = gtk_tree_row_reference_new_proxy (G_OBJECT (tree_view),
tree_view->priv->model,
path);
_gtk_tree_view_find_node (tree_view, path, &tree, &node);
if (tree != NULL)
{
GtkRBTree *new_tree = NULL;
GtkRBNode *new_node = NULL;
if (clear_and_select && !tree_view->priv->ctrl_pressed)
{
GtkTreeSelectMode mode = 0;
if (tree_view->priv->ctrl_pressed)
mode |= GTK_TREE_SELECT_MODE_TOGGLE;
if (tree_view->priv->shift_pressed)
mode |= GTK_TREE_SELECT_MODE_EXTEND;
_gtk_tree_selection_internal_select_node (tree_view->priv->selection,
node, tree, path, mode,
FALSE);
}
/* We have to re-find tree and node here again, somebody might have
* cleared the node or the whole tree in the GtkTreeSelection::changed
* callback. If the nodes differ we bail out here.
*/
_gtk_tree_view_find_node (tree_view, path, &new_tree, &new_node);
if (tree != new_tree || node != new_node)
return;
if (clamp_node)
{
gtk_tree_view_clamp_node_visible (tree_view, tree, node);
_gtk_tree_view_queue_draw_node (tree_view, tree, node, NULL);
}
}
g_signal_emit (tree_view, tree_view_signals[CURSOR_CHANGED], 0);
}
/**
* gtk_tree_view_get_cursor:
* @tree_view: A #GtkTreeView
* @path: A pointer to be filled with the current cursor path, or %NULL
* @focus_column: A pointer to be filled with the current focus column, or %NULL
*
* Fills in @path and @focus_column with the current path and focus column. If
* the cursor isn't currently set, then *@path will be %NULL. If no column
* currently has focus, then *@focus_column will be %NULL.
*
* The returned #GtkTreePath must be freed with gtk_tree_path_free() when
* you are done with it.
**/
void
gtk_tree_view_get_cursor (GtkTreeView *tree_view,
GtkTreePath **path,
GtkTreeViewColumn **focus_column)
{
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
if (path)
{
if (gtk_tree_row_reference_valid (tree_view->priv->cursor))
*path = gtk_tree_row_reference_get_path (tree_view->priv->cursor);
else
*path = NULL;
}
if (focus_column)
{
*focus_column = tree_view->priv->focus_column;
}
}
/**
* gtk_tree_view_set_cursor:
* @tree_view: A #GtkTreeView
* @path: A #GtkTreePath
* @focus_column: A #GtkTreeViewColumn, or %NULL
* @start_editing: %TRUE if the specified cell should start being edited.
*
* Sets the current keyboard focus to be at @path, and selects it. This is
* useful when you want to focus the user's attention on a particular row. If
* @focus_column is not %NULL, then focus is given to the column specified by
* it. Additionally, if @focus_column is specified, and @start_editing is
* %TRUE, then editing should be started in the specified cell.
* This function is often followed by @gtk_widget_grab_focus (@tree_view)
* in order to give keyboard focus to the widget. Please note that editing
* can only happen when the widget is realized.
**/
void
gtk_tree_view_set_cursor (GtkTreeView *tree_view,
GtkTreePath *path,
GtkTreeViewColumn *focus_column,
gboolean start_editing)
The "big treeview focus patch". Fixes several issues and adds some Sun May 5 16:42:32 2002 Kristian Rietveld <kris@gtk.org> The "big treeview focus patch". Fixes several issues and adds some goodies. Related bugs: #73676, #73734, #78660. * gtk/gtktreeview.h: add gtk_tree_view_set_cursor_on_cell * gtk/gtktreeview.c (gtk_tree_view_button_press): focus on a cell if applicable, (gtk_tree_view_bin_expose): set_cell_data before iterating columns, add support for row-spanning focus rectangles, (gtk_tree_view_has_special_cell): new function, (gtk_tree_view_move_cursor_left_right): add support for multiple focusable cells in one column, (gtk_tree_view_set_cursor): call _set_cursor_on_cell now, (gtk_tree_view_set_cursor_on_cell): copy of _set_cursor, extended with focus_cell parameter, (gtk_tree_view_search_iter): removed unused column variable, (gtk_tree_view_start_editing): add neighbor size code to allow for multiple editable cells in one column. * gtk/gtktreeviewcolumn.c (_GtkTreeViewColumnCellInfo): add in_editing_mode field, (gtk_tree_view_column_get_edited_cell): new function, removed _get_editable_cell, (_gtk_tree_view_column_get_cell_at_pos): new function, (gtk_tree_view_column_pack_end): s/g_new/g_new0/ ..., (gtk_tree_view_column_cell_process_action): loads of changes to get it right and to allow for multiple special cells, etc, (gtk_tree_view_column_cell_first): new function, (gtk_tree_view_column_cell_last): ditto, (gtk_tree_view_column_cell_next): ditto, (gtk_tree_view_column_cell_prev): ditto, (gtk_tree_view_column_cell_focus): add left and right parameters, allow for multiple special cells, (gtk_tree_view_column_cell_is_visible): add assertion, (gtk_tree_view_column_focus_cell): new function, (gtk_tree_view_column_stop_editing): unset in_editing_mode flag, (_gtk_tree_view_column_get_neighbor_sizes): iterate through cells correctly * gtk/gtktreeviewcolumn.h: add gtk_tree_view_column_focus_cell * gtk/gtktreeprivate.h: s/_get_editable_cell/_get_edited_cell/, add _gtk_tree_view_column_get_cell_at_pos, add new parameters to _gtk_tree_view_column_cell_focus. * tests/testtreeedit.c: add some cells in order to test new code.
2002-05-05 14:54:00 +00:00
{
gtk_tree_view_set_cursor_on_cell (tree_view, path, focus_column,
NULL, start_editing);
}
/**
* gtk_tree_view_set_cursor_on_cell:
* @tree_view: A #GtkTreeView
* @path: A #GtkTreePath
* @focus_column: A #GtkTreeViewColumn, or %NULL
* @focus_cell: A #GtkCellRenderer, or %NULL
* @start_editing: %TRUE if the specified cell should start being edited.
*
* Sets the current keyboard focus to be at @path, and selects it. This is
* useful when you want to focus the user's attention on a particular row. If
* @focus_column is not %NULL, then focus is given to the column specified by
* it. If @focus_column and @focus_cell are not %NULL, and @focus_column
* contains 2 or more editable or activatable cells, then focus is given to
* the cell specified by @focus_cell. Additionally, if @focus_column is
* specified, and @start_editing is %TRUE, then editing should be started in
* the specified cell. This function is often followed by
* @gtk_widget_grab_focus (@tree_view) in order to give keyboard focus to the
* widget. Please note that editing can only happen when the widget is
* realized.
2002-11-28 00:33:17 +00:00
*
* Since: 2.2
The "big treeview focus patch". Fixes several issues and adds some Sun May 5 16:42:32 2002 Kristian Rietveld <kris@gtk.org> The "big treeview focus patch". Fixes several issues and adds some goodies. Related bugs: #73676, #73734, #78660. * gtk/gtktreeview.h: add gtk_tree_view_set_cursor_on_cell * gtk/gtktreeview.c (gtk_tree_view_button_press): focus on a cell if applicable, (gtk_tree_view_bin_expose): set_cell_data before iterating columns, add support for row-spanning focus rectangles, (gtk_tree_view_has_special_cell): new function, (gtk_tree_view_move_cursor_left_right): add support for multiple focusable cells in one column, (gtk_tree_view_set_cursor): call _set_cursor_on_cell now, (gtk_tree_view_set_cursor_on_cell): copy of _set_cursor, extended with focus_cell parameter, (gtk_tree_view_search_iter): removed unused column variable, (gtk_tree_view_start_editing): add neighbor size code to allow for multiple editable cells in one column. * gtk/gtktreeviewcolumn.c (_GtkTreeViewColumnCellInfo): add in_editing_mode field, (gtk_tree_view_column_get_edited_cell): new function, removed _get_editable_cell, (_gtk_tree_view_column_get_cell_at_pos): new function, (gtk_tree_view_column_pack_end): s/g_new/g_new0/ ..., (gtk_tree_view_column_cell_process_action): loads of changes to get it right and to allow for multiple special cells, etc, (gtk_tree_view_column_cell_first): new function, (gtk_tree_view_column_cell_last): ditto, (gtk_tree_view_column_cell_next): ditto, (gtk_tree_view_column_cell_prev): ditto, (gtk_tree_view_column_cell_focus): add left and right parameters, allow for multiple special cells, (gtk_tree_view_column_cell_is_visible): add assertion, (gtk_tree_view_column_focus_cell): new function, (gtk_tree_view_column_stop_editing): unset in_editing_mode flag, (_gtk_tree_view_column_get_neighbor_sizes): iterate through cells correctly * gtk/gtktreeviewcolumn.h: add gtk_tree_view_column_focus_cell * gtk/gtktreeprivate.h: s/_get_editable_cell/_get_edited_cell/, add _gtk_tree_view_column_get_cell_at_pos, add new parameters to _gtk_tree_view_column_cell_focus. * tests/testtreeedit.c: add some cells in order to test new code.
2002-05-05 14:54:00 +00:00
**/
void
gtk_tree_view_set_cursor_on_cell (GtkTreeView *tree_view,
GtkTreePath *path,
GtkTreeViewColumn *focus_column,
GtkCellRenderer *focus_cell,
gboolean start_editing)
{
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
g_return_if_fail (path != NULL);
if (focus_column)
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (focus_column));
The "big treeview focus patch". Fixes several issues and adds some Sun May 5 16:42:32 2002 Kristian Rietveld <kris@gtk.org> The "big treeview focus patch". Fixes several issues and adds some goodies. Related bugs: #73676, #73734, #78660. * gtk/gtktreeview.h: add gtk_tree_view_set_cursor_on_cell * gtk/gtktreeview.c (gtk_tree_view_button_press): focus on a cell if applicable, (gtk_tree_view_bin_expose): set_cell_data before iterating columns, add support for row-spanning focus rectangles, (gtk_tree_view_has_special_cell): new function, (gtk_tree_view_move_cursor_left_right): add support for multiple focusable cells in one column, (gtk_tree_view_set_cursor): call _set_cursor_on_cell now, (gtk_tree_view_set_cursor_on_cell): copy of _set_cursor, extended with focus_cell parameter, (gtk_tree_view_search_iter): removed unused column variable, (gtk_tree_view_start_editing): add neighbor size code to allow for multiple editable cells in one column. * gtk/gtktreeviewcolumn.c (_GtkTreeViewColumnCellInfo): add in_editing_mode field, (gtk_tree_view_column_get_edited_cell): new function, removed _get_editable_cell, (_gtk_tree_view_column_get_cell_at_pos): new function, (gtk_tree_view_column_pack_end): s/g_new/g_new0/ ..., (gtk_tree_view_column_cell_process_action): loads of changes to get it right and to allow for multiple special cells, etc, (gtk_tree_view_column_cell_first): new function, (gtk_tree_view_column_cell_last): ditto, (gtk_tree_view_column_cell_next): ditto, (gtk_tree_view_column_cell_prev): ditto, (gtk_tree_view_column_cell_focus): add left and right parameters, allow for multiple special cells, (gtk_tree_view_column_cell_is_visible): add assertion, (gtk_tree_view_column_focus_cell): new function, (gtk_tree_view_column_stop_editing): unset in_editing_mode flag, (_gtk_tree_view_column_get_neighbor_sizes): iterate through cells correctly * gtk/gtktreeviewcolumn.h: add gtk_tree_view_column_focus_cell * gtk/gtktreeprivate.h: s/_get_editable_cell/_get_edited_cell/, add _gtk_tree_view_column_get_cell_at_pos, add new parameters to _gtk_tree_view_column_cell_focus. * tests/testtreeedit.c: add some cells in order to test new code.
2002-05-05 14:54:00 +00:00
if (focus_cell)
{
g_return_if_fail (focus_column);
g_return_if_fail (GTK_IS_CELL_RENDERER (focus_cell));
}
/* cancel the current editing, if it exists */
if (tree_view->priv->edited_column &&
tree_view->priv->edited_column->editable_widget)
gtk_tree_view_stop_editing (tree_view, TRUE);
gtk_tree_view_real_set_cursor (tree_view, path, TRUE, TRUE);
if (focus_column && focus_column->visible)
{
GList *list;
gboolean column_in_tree = FALSE;
for (list = tree_view->priv->columns; list; list = list->next)
if (list->data == focus_column)
{
column_in_tree = TRUE;
break;
}
g_return_if_fail (column_in_tree);
tree_view->priv->focus_column = focus_column;
The "big treeview focus patch". Fixes several issues and adds some Sun May 5 16:42:32 2002 Kristian Rietveld <kris@gtk.org> The "big treeview focus patch". Fixes several issues and adds some goodies. Related bugs: #73676, #73734, #78660. * gtk/gtktreeview.h: add gtk_tree_view_set_cursor_on_cell * gtk/gtktreeview.c (gtk_tree_view_button_press): focus on a cell if applicable, (gtk_tree_view_bin_expose): set_cell_data before iterating columns, add support for row-spanning focus rectangles, (gtk_tree_view_has_special_cell): new function, (gtk_tree_view_move_cursor_left_right): add support for multiple focusable cells in one column, (gtk_tree_view_set_cursor): call _set_cursor_on_cell now, (gtk_tree_view_set_cursor_on_cell): copy of _set_cursor, extended with focus_cell parameter, (gtk_tree_view_search_iter): removed unused column variable, (gtk_tree_view_start_editing): add neighbor size code to allow for multiple editable cells in one column. * gtk/gtktreeviewcolumn.c (_GtkTreeViewColumnCellInfo): add in_editing_mode field, (gtk_tree_view_column_get_edited_cell): new function, removed _get_editable_cell, (_gtk_tree_view_column_get_cell_at_pos): new function, (gtk_tree_view_column_pack_end): s/g_new/g_new0/ ..., (gtk_tree_view_column_cell_process_action): loads of changes to get it right and to allow for multiple special cells, etc, (gtk_tree_view_column_cell_first): new function, (gtk_tree_view_column_cell_last): ditto, (gtk_tree_view_column_cell_next): ditto, (gtk_tree_view_column_cell_prev): ditto, (gtk_tree_view_column_cell_focus): add left and right parameters, allow for multiple special cells, (gtk_tree_view_column_cell_is_visible): add assertion, (gtk_tree_view_column_focus_cell): new function, (gtk_tree_view_column_stop_editing): unset in_editing_mode flag, (_gtk_tree_view_column_get_neighbor_sizes): iterate through cells correctly * gtk/gtktreeviewcolumn.h: add gtk_tree_view_column_focus_cell * gtk/gtktreeprivate.h: s/_get_editable_cell/_get_edited_cell/, add _gtk_tree_view_column_get_cell_at_pos, add new parameters to _gtk_tree_view_column_cell_focus. * tests/testtreeedit.c: add some cells in order to test new code.
2002-05-05 14:54:00 +00:00
if (focus_cell)
gtk_tree_view_column_focus_cell (focus_column, focus_cell);
if (start_editing)
gtk_tree_view_start_editing (tree_view, path);
}
}
/**
* gtk_tree_view_get_bin_window:
* @tree_view: A #GtkTreeView
*
* Returns the window that @tree_view renders to. This is used primarily to
* compare to <literal>event->window</literal> to confirm that the event on
* @tree_view is on the right window.
*
* Return value: A #GdkWindow, or %NULL when @tree_view hasn't been realized yet
**/
GdkWindow *
gtk_tree_view_get_bin_window (GtkTreeView *tree_view)
{
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), NULL);
return tree_view->priv->bin_window;
}
/**
* gtk_tree_view_get_path_at_pos:
* @tree_view: A #GtkTreeView.
* @x: The x position to be identified.
* @y: The y position to be identified.
* @path: A pointer to a #GtkTreePath pointer to be filled in, or %NULL
* @column: A pointer to a #GtkTreeViewColumn pointer to be filled in, or %NULL
* @cell_x: A pointer where the X coordinate relative to the cell can be placed, or %NULL
* @cell_y: A pointer where the Y coordinate relative to the cell can be placed, or %NULL
*
* Finds the path at the point (@x, @y), relative to widget coordinates. That
* is, @x and @y are relative to an events coordinates. @x and @y must come
* from an event on the @tree_view only where <literal>event->window ==
* gtk_tree_view_get_bin (<!-- -->)</literal>. It is primarily for things
* like popup menus. If @path is non-%NULL, then it will be filled with the
* #GtkTreePath at that point. This path should be freed with gtk_tree_path_free().
* If @column is non-%NULL, then it will be filled with the column at that point.
* @cell_x and @cell_y return the coordinates relative to the cell background
* (i.e. the @background_area passed to gtk_cell_renderer_render()). This
* function is only meaningful if @tree_view is realized.
*
* Return value: %TRUE if a row exists at that coordinate.
**/
gboolean
gtk_tree_view_get_path_at_pos (GtkTreeView *tree_view,
gint x,
gint y,
GtkTreePath **path,
GtkTreeViewColumn **column,
gint *cell_x,
gint *cell_y)
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
{
GtkRBTree *tree;
GtkRBNode *node;
gint y_offset;
g_return_val_if_fail (tree_view != NULL, FALSE);
g_return_val_if_fail (tree_view->priv->bin_window != NULL, FALSE);
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
if (path)
*path = NULL;
if (column)
*column = NULL;
if (tree_view->priv->tree == NULL)
return FALSE;
if (x > tree_view->priv->hadjustment->upper)
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
return FALSE;
fix bug in here where prev pointer was set to the wrong thing 2001-01-30 Havoc Pennington <hp@redhat.com> * gtk/gtkliststore.c (gtk_list_store_insert_before): fix bug in here where prev pointer was set to the wrong thing * gtk/gtktreemodel.c (gtk_tree_path_is_ancestor): new function (gtk_tree_path_is_descendant): new function * gtk/gtkliststore.c (gtk_list_store_iter_n_children): return cached length (gtk_list_store_get_iter): don't modify iter if we can't get the path. * gtk/gtkliststore.h (struct _GtkListStore): cache the length * gtk/gtktreednd.h: add virtual function row_drop_possible() to GtkTreeDragDest * gtk/gtktreestore.c (copy_node_data): fix varargs type error that was causing segfault * gtk/gtktreedatalist.c (_gtk_tree_data_list_node_copy): set next pointer to NULL * gtk/gtktreestore.c (gtk_tree_store_append): fix memleak * gtk/gtkliststore.c (gtk_list_store_iter_next): don't modify iter on returning FALSE (gtk_list_store_iter_children): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_parent): ditto * gtk/gtktreestore.c (gtk_tree_store_get_path): g_return_if_fail on iter->user_data != NULL instead of silently accepting it. (gtk_tree_store_iter_next): ditto. Also, don't modify iter unless we are returning TRUE. (gtk_tree_store_iter_children): ditto (gtk_tree_store_iter_nth_child): ditto (gtk_tree_store_iter_parent): ditto (gtk_tree_store_insert): remove handling of parent->user_data == NULL, replace with parent == NULL * gtk/gtktreemodel.c (inserted_callback): put some fixes in here, and a comment explaining things * gtk/gtktreestore.c: add GtkTreeDragSource/GtkTreeDragDest interface support to GtkTreeStore. * gtk/gtktreemodel.c (gtk_tree_path_prev): didn't properly return FALSE if no prev, fix * gtk/gtktreeview.c (set_source_row): use a row reference (set_dest_row): use a row reference
2001-01-31 00:57:49 +00:00
if (x < 0 || y < 0)
fix bug in here where prev pointer was set to the wrong thing 2001-01-30 Havoc Pennington <hp@redhat.com> * gtk/gtkliststore.c (gtk_list_store_insert_before): fix bug in here where prev pointer was set to the wrong thing * gtk/gtktreemodel.c (gtk_tree_path_is_ancestor): new function (gtk_tree_path_is_descendant): new function * gtk/gtkliststore.c (gtk_list_store_iter_n_children): return cached length (gtk_list_store_get_iter): don't modify iter if we can't get the path. * gtk/gtkliststore.h (struct _GtkListStore): cache the length * gtk/gtktreednd.h: add virtual function row_drop_possible() to GtkTreeDragDest * gtk/gtktreestore.c (copy_node_data): fix varargs type error that was causing segfault * gtk/gtktreedatalist.c (_gtk_tree_data_list_node_copy): set next pointer to NULL * gtk/gtktreestore.c (gtk_tree_store_append): fix memleak * gtk/gtkliststore.c (gtk_list_store_iter_next): don't modify iter on returning FALSE (gtk_list_store_iter_children): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_parent): ditto * gtk/gtktreestore.c (gtk_tree_store_get_path): g_return_if_fail on iter->user_data != NULL instead of silently accepting it. (gtk_tree_store_iter_next): ditto. Also, don't modify iter unless we are returning TRUE. (gtk_tree_store_iter_children): ditto (gtk_tree_store_iter_nth_child): ditto (gtk_tree_store_iter_parent): ditto (gtk_tree_store_insert): remove handling of parent->user_data == NULL, replace with parent == NULL * gtk/gtktreemodel.c (inserted_callback): put some fixes in here, and a comment explaining things * gtk/gtktreestore.c: add GtkTreeDragSource/GtkTreeDragDest interface support to GtkTreeStore. * gtk/gtktreemodel.c (gtk_tree_path_prev): didn't properly return FALSE if no prev, fix * gtk/gtktreeview.c (set_source_row): use a row reference (set_dest_row): use a row reference
2001-01-31 00:57:49 +00:00
return FALSE;
if (column || cell_x)
{
GtkTreeViewColumn *tmp_column;
GtkTreeViewColumn *last_column = NULL;
GList *list;
gint remaining_x = x;
gboolean found = FALSE;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
for (list = tree_view->priv->columns; list; list = list->next)
{
tmp_column = list->data;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
if (tmp_column->visible == FALSE)
continue;
last_column = tmp_column;
if (remaining_x <= tmp_column->width)
{
found = TRUE;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
if (column)
*column = tmp_column;
if (cell_x)
*cell_x = remaining_x;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
break;
}
remaining_x -= tmp_column->width;
}
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
/* If found is FALSE and there is a last_column, then it the remainder
* space is in that area
*/
if (!found)
{
if (last_column)
{
if (column)
*column = last_column;
if (cell_x)
*cell_x = last_column->width + remaining_x;
}
else
{
return FALSE;
}
}
}
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
y_offset = _gtk_rbtree_find_offset (tree_view->priv->tree,
TREE_WINDOW_Y_TO_RBTREE_Y (tree_view, y),
&tree, &node);
if (tree == NULL)
return FALSE;
if (cell_y)
*cell_y = y_offset;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
if (path)
*path = _gtk_tree_view_find_path (tree_view, tree, node);
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
return TRUE;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
}
/**
* gtk_tree_view_get_cell_area:
* @tree_view: a #GtkTreeView
* @path: a #GtkTreePath for the row, or %NULL to get only horizontal coordinates
* @column: a #GtkTreeViewColumn for the column, or %NULL to get only vertical coordinates
* @rect: rectangle to fill with cell rect
*
* Fills the bounding rectangle in tree window coordinates for the cell at the
* row specified by @path and the column specified by @column. If @path is
* %NULL, or points to a path not currently displayed, the @y and @height fields
* of the rectangle will be filled with 0. If @column is %NULL, the @x and @width
* fields will be filled with 0. The sum of all cell rects does not cover the
* entire tree; there are extra pixels in between rows, for example. The
* returned rectangle is equivalent to the @cell_area passed to
* gtk_cell_renderer_render(). This function is only valid if @tree_view is
* realized.
**/
void
gtk_tree_view_get_cell_area (GtkTreeView *tree_view,
GtkTreePath *path,
GtkTreeViewColumn *column,
GdkRectangle *rect)
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
{
GtkRBTree *tree = NULL;
GtkRBNode *node = NULL;
gint vertical_separator;
gint horizontal_separator;
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
g_return_if_fail (column == NULL || GTK_IS_TREE_VIEW_COLUMN (column));
g_return_if_fail (rect != NULL);
g_return_if_fail (!column || column->tree_view == (GtkWidget *) tree_view);
2001-08-21 03:53:13 +00:00
g_return_if_fail (GTK_WIDGET_REALIZED (tree_view));
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
gtk_widget_style_get (GTK_WIDGET (tree_view),
"vertical_separator", &vertical_separator,
"horizontal_separator", &horizontal_separator,
NULL);
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
rect->x = 0;
rect->y = 0;
rect->width = 0;
rect->height = 0;
if (column)
{
rect->x = column->button->allocation.x + horizontal_separator/2;
rect->width = column->button->allocation.width - horizontal_separator;
}
if (path)
{
API additions: _move, _reorder and _swap for stores, path constructor. Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org> API additions: _move, _reorder and _swap for stores, path constructor. * gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function. * gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private), gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move. * gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private), gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move. Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org> Merge from stable: * gtk/gtktreestore.c (node_free): return FALSE, (gtk_tree_store_finalize): use g_node_traverse instead of g_node_children_foreach, so the whole tree will be freed (#88854, patch from Emmanuel Briot). Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org> Merge from stable: * gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks, (#84426, patch from Matthias Clasen). Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org> Merge from stable: * gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children check shouldn't be in g_return_return_val_if_fail (pointed out by Josh Green, #88997), (gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model for each column when we unset the model (part of #82484), (gtk_tree_view_get_cell_area): return if we ran out of tree or if we got an invalid path (#82376). * gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model. * gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model which disconnects the sort_column_changed_signal (part of #82484). * gtk/gtkliststore.c (gtk_list_store_insert): append row if the given postion is off the end of the tree (#85813). * gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use 2-space indent, commit changes if up/down keys has been pressed, this overrides the focus key foo so the user won't be surprised (#84665).
2002-07-26 20:51:13 +00:00
gboolean ret = _gtk_tree_view_find_node (tree_view, path, &tree, &node);
/* Get vertical coords */
API additions: _move, _reorder and _swap for stores, path constructor. Fri Jul 26 22:53:37 2002 Kristian Rietveld <kris@gtk.org> API additions: _move, _reorder and _swap for stores, path constructor. * gtk/gtktreemodel.[ch] (gtk_tree_path_new_from_indices): new function. * gtk/gtkliststore.[ch]: added gtk_list_store_reorder_func (private), gtk_list_store_reorder, gtk_list_store_swap, gtk_list_store_move. * gtk/gtktreestore.[ch]: added gtk_tree_store_reorder_func (private), gtk_tree_store_reorder, gtk_tree_store_swap, gtk_tree_store_move. Fri Jul 26 22:32:57 2002 Kristian Rietveld <kris@gtk.org> Merge from stable: * gtk/gtktreestore.c (node_free): return FALSE, (gtk_tree_store_finalize): use g_node_traverse instead of g_node_children_foreach, so the whole tree will be freed (#88854, patch from Emmanuel Briot). Fri Jul 26 22:32:24 2002 Kristian Rietveld <kris@gtk.org> Merge from stable: * gtk/gtktreeview.c (gtk_tree_view_button_press): fix some memleaks, (#84426, patch from Matthias Clasen). Fri Jul 26 22:31:25 2002 Kristian Rietveld <kris@gtk.org> Merge from stable: * gtk/gtktreeview.c (gtk_tree_view_unref_tree_helper): _iter_children check shouldn't be in g_return_return_val_if_fail (pointed out by Josh Green, #88997), (gtk_tree_view_set_model): call _gtk_tree_view_column_unset_model for each column when we unset the model (part of #82484), (gtk_tree_view_get_cell_area): return if we ran out of tree or if we got an invalid path (#82376). * gtk/gtktreeprivate.h: add _gtk_tree_view_column_unset_model. * gtk/gtktreeviewcolumn.c: implement _gtk_tree_view_column_unset_model which disconnects the sort_column_changed_signal (part of #82484). * gtk/gtkliststore.c (gtk_list_store_insert): append row if the given postion is off the end of the tree (#85813). * gtk/gtkentry.c (gtk_cell_editable_key_press_event): let's use 2-space indent, commit changes if up/down keys has been pressed, this overrides the focus key foo so the user won't be surprised (#84665).
2002-07-26 20:51:13 +00:00
if ((!ret && tree == NULL) || ret)
return;
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
rect->y = CELL_FIRST_PIXEL (tree_view, tree, node, vertical_separator);
rect->height = MAX (CELL_HEIGHT (node, vertical_separator), tree_view->priv->expander_size - vertical_separator);
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
if (column &&
gtk_tree_view_is_expander_column (tree_view, column) &&
TREE_VIEW_DRAW_EXPANDERS (tree_view))
{
gint depth = gtk_tree_path_get_depth (path) - 1;
rect->x += depth * tree_view->priv->expander_size;
rect->width -= depth * tree_view->priv->expander_size;
rect->width = MAX (rect->width, 0);
}
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
}
}
/**
* gtk_tree_view_get_background_area:
* @tree_view: a #GtkTreeView
* @path: a #GtkTreePath for the row, or %NULL to get only horizontal coordinates
* @column: a #GtkTreeViewColumn for the column, or %NULL to get only vertical coordiantes
* @rect: rectangle to fill with cell background rect
*
* Fills the bounding rectangle in tree window coordinates for the cell at the
* row specified by @path and the column specified by @column. If @path is
* %NULL, or points to a node not found in the tree, the @y and @height fields of
* the rectangle will be filled with 0. If @column is %NULL, the @x and @width
* fields will be filled with 0. The returned rectangle is equivalent to the
* @background_area passed to gtk_cell_renderer_render(). These background
* areas tile to cover the entire tree window (except for the area used for
* header buttons). Contrast with the @cell_area, returned by
* gtk_tree_view_get_cell_area(), which returns only the cell itself, excluding
* surrounding borders and the tree expander area.
*
**/
void
gtk_tree_view_get_background_area (GtkTreeView *tree_view,
GtkTreePath *path,
GtkTreeViewColumn *column,
GdkRectangle *rect)
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
{
GtkRBTree *tree = NULL;
GtkRBNode *node = NULL;
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
g_return_if_fail (column == NULL || GTK_IS_TREE_VIEW_COLUMN (column));
g_return_if_fail (rect != NULL);
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
rect->x = 0;
rect->y = 0;
rect->width = 0;
rect->height = 0;
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
if (path)
{
/* Get vertical coords */
if (!_gtk_tree_view_find_node (tree_view, path, &tree, &node) &&
tree == NULL)
return;
fix bug in here where prev pointer was set to the wrong thing 2001-01-30 Havoc Pennington <hp@redhat.com> * gtk/gtkliststore.c (gtk_list_store_insert_before): fix bug in here where prev pointer was set to the wrong thing * gtk/gtktreemodel.c (gtk_tree_path_is_ancestor): new function (gtk_tree_path_is_descendant): new function * gtk/gtkliststore.c (gtk_list_store_iter_n_children): return cached length (gtk_list_store_get_iter): don't modify iter if we can't get the path. * gtk/gtkliststore.h (struct _GtkListStore): cache the length * gtk/gtktreednd.h: add virtual function row_drop_possible() to GtkTreeDragDest * gtk/gtktreestore.c (copy_node_data): fix varargs type error that was causing segfault * gtk/gtktreedatalist.c (_gtk_tree_data_list_node_copy): set next pointer to NULL * gtk/gtktreestore.c (gtk_tree_store_append): fix memleak * gtk/gtkliststore.c (gtk_list_store_iter_next): don't modify iter on returning FALSE (gtk_list_store_iter_children): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_parent): ditto * gtk/gtktreestore.c (gtk_tree_store_get_path): g_return_if_fail on iter->user_data != NULL instead of silently accepting it. (gtk_tree_store_iter_next): ditto. Also, don't modify iter unless we are returning TRUE. (gtk_tree_store_iter_children): ditto (gtk_tree_store_iter_nth_child): ditto (gtk_tree_store_iter_parent): ditto (gtk_tree_store_insert): remove handling of parent->user_data == NULL, replace with parent == NULL * gtk/gtktreemodel.c (inserted_callback): put some fixes in here, and a comment explaining things * gtk/gtktreestore.c: add GtkTreeDragSource/GtkTreeDragDest interface support to GtkTreeStore. * gtk/gtktreemodel.c (gtk_tree_path_prev): didn't properly return FALSE if no prev, fix * gtk/gtktreeview.c (set_source_row): use a row reference (set_dest_row): use a row reference
2001-01-31 00:57:49 +00:00
rect->y = BACKGROUND_FIRST_PIXEL (tree_view, tree, node);
rect->height = ROW_HEIGHT (tree_view, BACKGROUND_HEIGHT (node));
}
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
if (column)
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
{
gint x2 = 0;
gtk_tree_view_get_background_xrange (tree_view, tree, column, &rect->x, &x2);
rect->width = x2 - rect->x;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
}
}
/**
* gtk_tree_view_get_visible_rect:
* @tree_view: a #GtkTreeView
* @visible_rect: rectangle to fill
*
* Fills @visible_rect with the currently-visible region of the
* buffer, in tree coordinates. Convert to widget coordinates with
* gtk_tree_view_tree_to_widget_coords(). Tree coordinates start at
* 0,0 for row 0 of the tree, and cover the entire scrollable area of
* the tree.
**/
void
gtk_tree_view_get_visible_rect (GtkTreeView *tree_view,
GdkRectangle *visible_rect)
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
{
GtkWidget *widget;
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
widget = GTK_WIDGET (tree_view);
if (visible_rect)
{
visible_rect->x = tree_view->priv->hadjustment->value;
visible_rect->y = tree_view->priv->vadjustment->value;
visible_rect->width = widget->allocation.width;
visible_rect->height = widget->allocation.height - TREE_VIEW_HEADER_HEIGHT (tree_view);
}
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
}
/**
* gtk_tree_view_widget_to_tree_coords:
* @tree_view: a #GtkTreeView
* @wx: widget X coordinate
* @wy: widget Y coordinate
* @tx: return location for tree X coordinate
* @ty: return location for tree Y coordinate
*
* Converts widget coordinates to coordinates for the
* tree window (the full scrollable area of the tree).
*
**/
void
gtk_tree_view_widget_to_tree_coords (GtkTreeView *tree_view,
gint wx,
gint wy,
gint *tx,
gint *ty)
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
{
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
if (tx)
*tx = wx + tree_view->priv->hadjustment->value;
if (ty)
start implementing Thu Mar 7 02:58:16 2002 Jonathan Blandford <jrb@redhat.com> * gtk/tmpl/gtkliststore.sgml: start implementing * gtk/question_index.sgml: "I can set with the tree, but not get???!?!" Wed Mar 6 23:20:51 2002 Jonathan Blandford <jrb@redhat.com> and Kristian Rietveld <kris@gtk.org> Finishing touch for 2.0.0 release, fixes #70782, #72729, the 'stealth' bug and other last-minute minor issues. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): set dnd dest line drawing right. We can't draw the line at the position of the next row, because that one still has to be drawn. So draw everthing at a -1 offset. (validate_visible_area): add check for invalid descendants and NULL scroll_to_path path, get scrolling right. Also, fix the area_above value. Pretty amazing I got it wrong. (get_logical_dest_row): add gtk-tree-model-drop-append magic, so dragging a row to the end of the model works right. (gtk_tree_view_get_dest_row_at_pos): minor floating point fix (gtk_tree_view_start_editing): add call to validate_row (gtk_tree_view_tree_to_widget_coords): Never subtract HEADER_HEIGHT from y values anymore!!! (gtk_tree_view_widget_coords_to_tree): ditto. (gtk_tree_view_scroll_to_point): allow -1 as values for the scroll_to coords (gtk_tree_view_move_cursor_page_up_down): Don't need scroll_to_y as clamp_node_visible will make it work. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): also check path depth, as we can't get iters from empty paths * gtk/gtkliststore.c (gtk_list_store_drag_data_received): handle gtk-tree-model-drop-append * gtk/gtktreednd.c (gtk_tree_set_row_drag_data): free path_str * tests/testtreeflow.c (main): select path where we are scrolling to
2002-03-07 08:03:09 +00:00
*ty = wy + tree_view->priv->dy;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
}
static void
gtk_tree_view_tree_window_to_tree_coords (GtkTreeView *tree_view,
gint wx,
gint wy,
gint *tx,
gint *ty)
{
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
if (tx)
*tx = wx;
if (ty)
*ty = wy + tree_view->priv->dy;
}
/**
* gtk_tree_view_tree_to_widget_coords:
* @tree_view: a #GtkTreeView
* @tx: tree X coordinate
* @ty: tree Y coordinate
* @wx: return location for widget X coordinate
* @wy: return location for widget Y coordinate
*
* Converts tree coordinates (coordinates in full scrollable area of the tree)
* to widget coordinates.
*
**/
void
gtk_tree_view_tree_to_widget_coords (GtkTreeView *tree_view,
gint tx,
gint ty,
gint *wx,
gint *wy)
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
{
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
if (wx)
*wx = tx - tree_view->priv->hadjustment->value;
if (wy)
start implementing Thu Mar 7 02:58:16 2002 Jonathan Blandford <jrb@redhat.com> * gtk/tmpl/gtkliststore.sgml: start implementing * gtk/question_index.sgml: "I can set with the tree, but not get???!?!" Wed Mar 6 23:20:51 2002 Jonathan Blandford <jrb@redhat.com> and Kristian Rietveld <kris@gtk.org> Finishing touch for 2.0.0 release, fixes #70782, #72729, the 'stealth' bug and other last-minute minor issues. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): set dnd dest line drawing right. We can't draw the line at the position of the next row, because that one still has to be drawn. So draw everthing at a -1 offset. (validate_visible_area): add check for invalid descendants and NULL scroll_to_path path, get scrolling right. Also, fix the area_above value. Pretty amazing I got it wrong. (get_logical_dest_row): add gtk-tree-model-drop-append magic, so dragging a row to the end of the model works right. (gtk_tree_view_get_dest_row_at_pos): minor floating point fix (gtk_tree_view_start_editing): add call to validate_row (gtk_tree_view_tree_to_widget_coords): Never subtract HEADER_HEIGHT from y values anymore!!! (gtk_tree_view_widget_coords_to_tree): ditto. (gtk_tree_view_scroll_to_point): allow -1 as values for the scroll_to coords (gtk_tree_view_move_cursor_page_up_down): Don't need scroll_to_y as clamp_node_visible will make it work. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): also check path depth, as we can't get iters from empty paths * gtk/gtkliststore.c (gtk_list_store_drag_data_received): handle gtk-tree-model-drop-append * gtk/gtktreednd.c (gtk_tree_set_row_drag_data): free path_str * tests/testtreeflow.c (main): select path where we are scrolling to
2002-03-07 08:03:09 +00:00
*wy = ty - tree_view->priv->dy;
}
static void
unset_reorderable (GtkTreeView *tree_view)
{
if (tree_view->priv->reorderable)
{
tree_view->priv->reorderable = FALSE;
g_object_notify (G_OBJECT (tree_view), "reorderable");
}
}
/**
* gtk_tree_view_enable_model_drag_source:
* @tree_view: a #GtkTreeView
* @start_button_mask: Mask of allowed buttons to start drag
* @targets: the table of targets that the drag will support
* @n_targets: the number of items in @targets
* @actions: the bitmask of possible actions for a drag from this
* widget
*
* Turns @tree_view into a drag source for automatic DND.
**/
void
gtk_tree_view_enable_model_drag_source (GtkTreeView *tree_view,
GdkModifierType start_button_mask,
const GtkTargetEntry *targets,
gint n_targets,
GdkDragAction actions)
{
TreeViewDragInfo *di;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
gtk_drag_source_set (GTK_WIDGET (tree_view),
0,
NULL,
0,
actions);
di = ensure_info (tree_view);
clear_source_info (di);
di->start_button_mask = start_button_mask;
di->source_target_list = gtk_target_list_new (targets, n_targets);
di->source_actions = actions;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
di->source_set = TRUE;
unset_reorderable (tree_view);
}
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
/**
* gtk_tree_view_enable_model_drag_dest:
* @tree_view: a #GtkTreeView
* @targets: the table of targets that the drag will support
* @n_targets: the number of items in @targets
* @actions: the bitmask of possible actions for a drag from this
* widget
*
* Turns @tree_view into a drop destination for automatic DND.
**/
void
gtk_tree_view_enable_model_drag_dest (GtkTreeView *tree_view,
const GtkTargetEntry *targets,
gint n_targets,
GdkDragAction actions)
{
TreeViewDragInfo *di;
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
gtk_drag_dest_set (GTK_WIDGET (tree_view),
0,
NULL,
0,
actions);
di = ensure_info (tree_view);
clear_dest_info (di);
if (targets)
di->dest_target_list = gtk_target_list_new (targets, n_targets);
di->dest_set = TRUE;
unset_reorderable (tree_view);
}
/**
* gtk_tree_view_unset_rows_drag_source:
* @tree_view: a #GtkTreeView
*
* Undoes the effect of gtk_tree_view_enable_model_drag_source().
**/
void
gtk_tree_view_unset_rows_drag_source (GtkTreeView *tree_view)
{
TreeViewDragInfo *di;
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
di = get_info (tree_view);
if (di)
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
{
if (di->source_set)
{
gtk_drag_source_unset (GTK_WIDGET (tree_view));
clear_source_info (di);
di->source_set = FALSE;
}
if (!di->dest_set && !di->source_set)
remove_info (tree_view);
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
}
unset_reorderable (tree_view);
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
}
/**
* gtk_tree_view_unset_rows_drag_dest:
* @tree_view: a #GtkTreeView
*
* Undoes the effect of gtk_tree_view_enable_model_drag_dest().
**/
void
gtk_tree_view_unset_rows_drag_dest (GtkTreeView *tree_view)
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
{
TreeViewDragInfo *di;
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
di = get_info (tree_view);
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
if (di)
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
{
if (di->dest_set)
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
{
gtk_drag_dest_unset (GTK_WIDGET (tree_view));
clear_dest_info (di);
di->dest_set = FALSE;
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
}
if (!di->dest_set && !di->source_set)
remove_info (tree_view);
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
}
unset_reorderable (tree_view);
}
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
/**
* gtk_tree_view_set_drag_dest_row:
* @tree_view: a #GtkTreeView
* @path: The path of the row to highlight, or %NULL.
* @pos: Specifies whether to drop before, after or into the row
*
* Sets the row that is highlighted for feedback.
**/
void
gtk_tree_view_set_drag_dest_row (GtkTreeView *tree_view,
GtkTreePath *path,
GtkTreeViewDropPosition pos)
{
GtkTreePath *current_dest;
Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore Wed Sep 10 01:06:44 2003 Kristian Rietveld <kris@gtk.org> Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore DnD work and gets rid of gtk-tree-model-drop-append. Related bugs #95362 and #113314. I don't want to touch this code ever again. * gtk/gtktreeprivate.h (GtkTreePrivate): add empty_view_drop field. * gtk/gtktreednd.c (gtk_tree_get_row_drag_data): add check for selection_data->length. * gtk/gtktreeview.c (struct DestRow), (dest_row_free), (set_dest_row), (get_dest_row): we don't store just the row ref anymore, but a struct with the row ref and additional info, (set_destination_row): handle drops on empty space and some style fixes, (get_logical_dest_row): also return path_down_mode/drop_append_mode flags, handle dropping childs on their new parents, rewrite drop append handling into something saner, (gtk_tree_view_drag_motion): show a "drop possible arrow" on empty spaces, (gtk_tree_view_drag_drop): updates for updated backend, (gtk_tree_view_drag_data_received): updates for updated backend, path down mode (treestore DnD) handling, (gtk_tree_view_set_drag_dest_row): set empty_view_drop flag, when we are trying to drop a row on an empty model, (gtk_tree_view_get_drag_dest_row): handle empty_view_drop flag. * gtk/gtkliststore.c (gtk_list_store_drag_data_received), (gtk_list_store_row_drop_possible): style and drop-append fixes. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): ditto.
2003-09-09 23:13:39 +00:00
/* Note; this function is exported to allow a custom DND
* implementation, so it can't touch TreeViewDragInfo
*/
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
current_dest = NULL;
fix bug in here where prev pointer was set to the wrong thing 2001-01-30 Havoc Pennington <hp@redhat.com> * gtk/gtkliststore.c (gtk_list_store_insert_before): fix bug in here where prev pointer was set to the wrong thing * gtk/gtktreemodel.c (gtk_tree_path_is_ancestor): new function (gtk_tree_path_is_descendant): new function * gtk/gtkliststore.c (gtk_list_store_iter_n_children): return cached length (gtk_list_store_get_iter): don't modify iter if we can't get the path. * gtk/gtkliststore.h (struct _GtkListStore): cache the length * gtk/gtktreednd.h: add virtual function row_drop_possible() to GtkTreeDragDest * gtk/gtktreestore.c (copy_node_data): fix varargs type error that was causing segfault * gtk/gtktreedatalist.c (_gtk_tree_data_list_node_copy): set next pointer to NULL * gtk/gtktreestore.c (gtk_tree_store_append): fix memleak * gtk/gtkliststore.c (gtk_list_store_iter_next): don't modify iter on returning FALSE (gtk_list_store_iter_children): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_parent): ditto * gtk/gtktreestore.c (gtk_tree_store_get_path): g_return_if_fail on iter->user_data != NULL instead of silently accepting it. (gtk_tree_store_iter_next): ditto. Also, don't modify iter unless we are returning TRUE. (gtk_tree_store_iter_children): ditto (gtk_tree_store_iter_nth_child): ditto (gtk_tree_store_iter_parent): ditto (gtk_tree_store_insert): remove handling of parent->user_data == NULL, replace with parent == NULL * gtk/gtktreemodel.c (inserted_callback): put some fixes in here, and a comment explaining things * gtk/gtktreestore.c: add GtkTreeDragSource/GtkTreeDragDest interface support to GtkTreeStore. * gtk/gtktreemodel.c (gtk_tree_path_prev): didn't properly return FALSE if no prev, fix * gtk/gtktreeview.c (set_source_row): use a row reference (set_dest_row): use a row reference
2001-01-31 00:57:49 +00:00
if (tree_view->priv->drag_dest_row)
Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore Wed Sep 10 01:06:44 2003 Kristian Rietveld <kris@gtk.org> Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore DnD work and gets rid of gtk-tree-model-drop-append. Related bugs #95362 and #113314. I don't want to touch this code ever again. * gtk/gtktreeprivate.h (GtkTreePrivate): add empty_view_drop field. * gtk/gtktreednd.c (gtk_tree_get_row_drag_data): add check for selection_data->length. * gtk/gtktreeview.c (struct DestRow), (dest_row_free), (set_dest_row), (get_dest_row): we don't store just the row ref anymore, but a struct with the row ref and additional info, (set_destination_row): handle drops on empty space and some style fixes, (get_logical_dest_row): also return path_down_mode/drop_append_mode flags, handle dropping childs on their new parents, rewrite drop append handling into something saner, (gtk_tree_view_drag_motion): show a "drop possible arrow" on empty spaces, (gtk_tree_view_drag_drop): updates for updated backend, (gtk_tree_view_drag_data_received): updates for updated backend, path down mode (treestore DnD) handling, (gtk_tree_view_set_drag_dest_row): set empty_view_drop flag, when we are trying to drop a row on an empty model, (gtk_tree_view_get_drag_dest_row): handle empty_view_drop flag. * gtk/gtkliststore.c (gtk_list_store_drag_data_received), (gtk_list_store_row_drop_possible): style and drop-append fixes. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): ditto.
2003-09-09 23:13:39 +00:00
{
current_dest = gtk_tree_row_reference_get_path (tree_view->priv->drag_dest_row);
gtk_tree_row_reference_free (tree_view->priv->drag_dest_row);
}
fix bug in here where prev pointer was set to the wrong thing 2001-01-30 Havoc Pennington <hp@redhat.com> * gtk/gtkliststore.c (gtk_list_store_insert_before): fix bug in here where prev pointer was set to the wrong thing * gtk/gtktreemodel.c (gtk_tree_path_is_ancestor): new function (gtk_tree_path_is_descendant): new function * gtk/gtkliststore.c (gtk_list_store_iter_n_children): return cached length (gtk_list_store_get_iter): don't modify iter if we can't get the path. * gtk/gtkliststore.h (struct _GtkListStore): cache the length * gtk/gtktreednd.h: add virtual function row_drop_possible() to GtkTreeDragDest * gtk/gtktreestore.c (copy_node_data): fix varargs type error that was causing segfault * gtk/gtktreedatalist.c (_gtk_tree_data_list_node_copy): set next pointer to NULL * gtk/gtktreestore.c (gtk_tree_store_append): fix memleak * gtk/gtkliststore.c (gtk_list_store_iter_next): don't modify iter on returning FALSE (gtk_list_store_iter_children): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_parent): ditto * gtk/gtktreestore.c (gtk_tree_store_get_path): g_return_if_fail on iter->user_data != NULL instead of silently accepting it. (gtk_tree_store_iter_next): ditto. Also, don't modify iter unless we are returning TRUE. (gtk_tree_store_iter_children): ditto (gtk_tree_store_iter_nth_child): ditto (gtk_tree_store_iter_parent): ditto (gtk_tree_store_insert): remove handling of parent->user_data == NULL, replace with parent == NULL * gtk/gtktreemodel.c (inserted_callback): put some fixes in here, and a comment explaining things * gtk/gtktreestore.c: add GtkTreeDragSource/GtkTreeDragDest interface support to GtkTreeStore. * gtk/gtktreemodel.c (gtk_tree_path_prev): didn't properly return FALSE if no prev, fix * gtk/gtktreeview.c (set_source_row): use a row reference (set_dest_row): use a row reference
2001-01-31 00:57:49 +00:00
Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore Wed Sep 10 01:06:44 2003 Kristian Rietveld <kris@gtk.org> Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore DnD work and gets rid of gtk-tree-model-drop-append. Related bugs #95362 and #113314. I don't want to touch this code ever again. * gtk/gtktreeprivate.h (GtkTreePrivate): add empty_view_drop field. * gtk/gtktreednd.c (gtk_tree_get_row_drag_data): add check for selection_data->length. * gtk/gtktreeview.c (struct DestRow), (dest_row_free), (set_dest_row), (get_dest_row): we don't store just the row ref anymore, but a struct with the row ref and additional info, (set_destination_row): handle drops on empty space and some style fixes, (get_logical_dest_row): also return path_down_mode/drop_append_mode flags, handle dropping childs on their new parents, rewrite drop append handling into something saner, (gtk_tree_view_drag_motion): show a "drop possible arrow" on empty spaces, (gtk_tree_view_drag_drop): updates for updated backend, (gtk_tree_view_drag_data_received): updates for updated backend, path down mode (treestore DnD) handling, (gtk_tree_view_set_drag_dest_row): set empty_view_drop flag, when we are trying to drop a row on an empty model, (gtk_tree_view_get_drag_dest_row): handle empty_view_drop flag. * gtk/gtkliststore.c (gtk_list_store_drag_data_received), (gtk_list_store_row_drop_possible): style and drop-append fixes. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): ditto.
2003-09-09 23:13:39 +00:00
/* special case a drop on an empty model */
tree_view->priv->empty_view_drop = 0;
if (pos == GTK_TREE_VIEW_DROP_BEFORE && path
&& gtk_tree_path_get_depth (path) == 1
&& gtk_tree_path_get_indices (path)[0] == 0)
{
gint n_children;
n_children = gtk_tree_model_iter_n_children (tree_view->priv->model,
NULL);
if (!n_children)
tree_view->priv->empty_view_drop = 1;
}
tree_view->priv->drag_dest_pos = pos;
if (path)
fix bug in here where prev pointer was set to the wrong thing 2001-01-30 Havoc Pennington <hp@redhat.com> * gtk/gtkliststore.c (gtk_list_store_insert_before): fix bug in here where prev pointer was set to the wrong thing * gtk/gtktreemodel.c (gtk_tree_path_is_ancestor): new function (gtk_tree_path_is_descendant): new function * gtk/gtkliststore.c (gtk_list_store_iter_n_children): return cached length (gtk_list_store_get_iter): don't modify iter if we can't get the path. * gtk/gtkliststore.h (struct _GtkListStore): cache the length * gtk/gtktreednd.h: add virtual function row_drop_possible() to GtkTreeDragDest * gtk/gtktreestore.c (copy_node_data): fix varargs type error that was causing segfault * gtk/gtktreedatalist.c (_gtk_tree_data_list_node_copy): set next pointer to NULL * gtk/gtktreestore.c (gtk_tree_store_append): fix memleak * gtk/gtkliststore.c (gtk_list_store_iter_next): don't modify iter on returning FALSE (gtk_list_store_iter_children): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_parent): ditto * gtk/gtktreestore.c (gtk_tree_store_get_path): g_return_if_fail on iter->user_data != NULL instead of silently accepting it. (gtk_tree_store_iter_next): ditto. Also, don't modify iter unless we are returning TRUE. (gtk_tree_store_iter_children): ditto (gtk_tree_store_iter_nth_child): ditto (gtk_tree_store_iter_parent): ditto (gtk_tree_store_insert): remove handling of parent->user_data == NULL, replace with parent == NULL * gtk/gtktreemodel.c (inserted_callback): put some fixes in here, and a comment explaining things * gtk/gtktreestore.c: add GtkTreeDragSource/GtkTreeDragDest interface support to GtkTreeStore. * gtk/gtktreemodel.c (gtk_tree_path_prev): didn't properly return FALSE if no prev, fix * gtk/gtktreeview.c (set_source_row): use a row reference (set_dest_row): use a row reference
2001-01-31 00:57:49 +00:00
{
tree_view->priv->drag_dest_row =
gtk_tree_row_reference_new_proxy (G_OBJECT (tree_view), tree_view->priv->model, path);
gtk_tree_view_queue_draw_path (tree_view, path, NULL);
fix bug in here where prev pointer was set to the wrong thing 2001-01-30 Havoc Pennington <hp@redhat.com> * gtk/gtkliststore.c (gtk_list_store_insert_before): fix bug in here where prev pointer was set to the wrong thing * gtk/gtktreemodel.c (gtk_tree_path_is_ancestor): new function (gtk_tree_path_is_descendant): new function * gtk/gtkliststore.c (gtk_list_store_iter_n_children): return cached length (gtk_list_store_get_iter): don't modify iter if we can't get the path. * gtk/gtkliststore.h (struct _GtkListStore): cache the length * gtk/gtktreednd.h: add virtual function row_drop_possible() to GtkTreeDragDest * gtk/gtktreestore.c (copy_node_data): fix varargs type error that was causing segfault * gtk/gtktreedatalist.c (_gtk_tree_data_list_node_copy): set next pointer to NULL * gtk/gtktreestore.c (gtk_tree_store_append): fix memleak * gtk/gtkliststore.c (gtk_list_store_iter_next): don't modify iter on returning FALSE (gtk_list_store_iter_children): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_parent): ditto * gtk/gtktreestore.c (gtk_tree_store_get_path): g_return_if_fail on iter->user_data != NULL instead of silently accepting it. (gtk_tree_store_iter_next): ditto. Also, don't modify iter unless we are returning TRUE. (gtk_tree_store_iter_children): ditto (gtk_tree_store_iter_nth_child): ditto (gtk_tree_store_iter_parent): ditto (gtk_tree_store_insert): remove handling of parent->user_data == NULL, replace with parent == NULL * gtk/gtktreemodel.c (inserted_callback): put some fixes in here, and a comment explaining things * gtk/gtktreestore.c: add GtkTreeDragSource/GtkTreeDragDest interface support to GtkTreeStore. * gtk/gtktreemodel.c (gtk_tree_path_prev): didn't properly return FALSE if no prev, fix * gtk/gtktreeview.c (set_source_row): use a row reference (set_dest_row): use a row reference
2001-01-31 00:57:49 +00:00
}
else
tree_view->priv->drag_dest_row = NULL;
if (current_dest)
{
GtkRBTree *tree, *new_tree;
GtkRBNode *node, *new_node;
_gtk_tree_view_find_node (tree_view, current_dest, &tree, &node);
_gtk_tree_view_queue_draw_node (tree_view, tree, node, NULL);
if (tree && node)
{
_gtk_rbtree_next_full (tree, node, &new_tree, &new_node);
if (new_tree && new_node)
_gtk_tree_view_queue_draw_node (tree_view, new_tree, new_node, NULL);
_gtk_rbtree_prev_full (tree, node, &new_tree, &new_node);
if (new_tree && new_node)
_gtk_tree_view_queue_draw_node (tree_view, new_tree, new_node, NULL);
}
gtk_tree_path_free (current_dest);
}
}
/**
* gtk_tree_view_get_drag_dest_row:
* @tree_view: a #GtkTreeView
* @path: Return location for the path of the highlighted row, or %NULL.
* @pos: Return location for the drop position, or %NULL
*
* Gets information about the row that is highlighted for feedback.
**/
void
gtk_tree_view_get_drag_dest_row (GtkTreeView *tree_view,
GtkTreePath **path,
GtkTreeViewDropPosition *pos)
{
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
if (path)
fix bug in here where prev pointer was set to the wrong thing 2001-01-30 Havoc Pennington <hp@redhat.com> * gtk/gtkliststore.c (gtk_list_store_insert_before): fix bug in here where prev pointer was set to the wrong thing * gtk/gtktreemodel.c (gtk_tree_path_is_ancestor): new function (gtk_tree_path_is_descendant): new function * gtk/gtkliststore.c (gtk_list_store_iter_n_children): return cached length (gtk_list_store_get_iter): don't modify iter if we can't get the path. * gtk/gtkliststore.h (struct _GtkListStore): cache the length * gtk/gtktreednd.h: add virtual function row_drop_possible() to GtkTreeDragDest * gtk/gtktreestore.c (copy_node_data): fix varargs type error that was causing segfault * gtk/gtktreedatalist.c (_gtk_tree_data_list_node_copy): set next pointer to NULL * gtk/gtktreestore.c (gtk_tree_store_append): fix memleak * gtk/gtkliststore.c (gtk_list_store_iter_next): don't modify iter on returning FALSE (gtk_list_store_iter_children): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_parent): ditto * gtk/gtktreestore.c (gtk_tree_store_get_path): g_return_if_fail on iter->user_data != NULL instead of silently accepting it. (gtk_tree_store_iter_next): ditto. Also, don't modify iter unless we are returning TRUE. (gtk_tree_store_iter_children): ditto (gtk_tree_store_iter_nth_child): ditto (gtk_tree_store_iter_parent): ditto (gtk_tree_store_insert): remove handling of parent->user_data == NULL, replace with parent == NULL * gtk/gtktreemodel.c (inserted_callback): put some fixes in here, and a comment explaining things * gtk/gtktreestore.c: add GtkTreeDragSource/GtkTreeDragDest interface support to GtkTreeStore. * gtk/gtktreemodel.c (gtk_tree_path_prev): didn't properly return FALSE if no prev, fix * gtk/gtktreeview.c (set_source_row): use a row reference (set_dest_row): use a row reference
2001-01-31 00:57:49 +00:00
{
if (tree_view->priv->drag_dest_row)
*path = gtk_tree_row_reference_get_path (tree_view->priv->drag_dest_row);
else
Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore Wed Sep 10 01:06:44 2003 Kristian Rietveld <kris@gtk.org> Big TreeView DnD fixage, makes drops on empty models work, makes TreeStore DnD work and gets rid of gtk-tree-model-drop-append. Related bugs #95362 and #113314. I don't want to touch this code ever again. * gtk/gtktreeprivate.h (GtkTreePrivate): add empty_view_drop field. * gtk/gtktreednd.c (gtk_tree_get_row_drag_data): add check for selection_data->length. * gtk/gtktreeview.c (struct DestRow), (dest_row_free), (set_dest_row), (get_dest_row): we don't store just the row ref anymore, but a struct with the row ref and additional info, (set_destination_row): handle drops on empty space and some style fixes, (get_logical_dest_row): also return path_down_mode/drop_append_mode flags, handle dropping childs on their new parents, rewrite drop append handling into something saner, (gtk_tree_view_drag_motion): show a "drop possible arrow" on empty spaces, (gtk_tree_view_drag_drop): updates for updated backend, (gtk_tree_view_drag_data_received): updates for updated backend, path down mode (treestore DnD) handling, (gtk_tree_view_set_drag_dest_row): set empty_view_drop flag, when we are trying to drop a row on an empty model, (gtk_tree_view_get_drag_dest_row): handle empty_view_drop flag. * gtk/gtkliststore.c (gtk_list_store_drag_data_received), (gtk_list_store_row_drop_possible): style and drop-append fixes. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): ditto.
2003-09-09 23:13:39 +00:00
{
if (tree_view->priv->empty_view_drop)
*path = gtk_tree_path_new_from_indices (0, -1);
else
*path = NULL;
}
fix bug in here where prev pointer was set to the wrong thing 2001-01-30 Havoc Pennington <hp@redhat.com> * gtk/gtkliststore.c (gtk_list_store_insert_before): fix bug in here where prev pointer was set to the wrong thing * gtk/gtktreemodel.c (gtk_tree_path_is_ancestor): new function (gtk_tree_path_is_descendant): new function * gtk/gtkliststore.c (gtk_list_store_iter_n_children): return cached length (gtk_list_store_get_iter): don't modify iter if we can't get the path. * gtk/gtkliststore.h (struct _GtkListStore): cache the length * gtk/gtktreednd.h: add virtual function row_drop_possible() to GtkTreeDragDest * gtk/gtktreestore.c (copy_node_data): fix varargs type error that was causing segfault * gtk/gtktreedatalist.c (_gtk_tree_data_list_node_copy): set next pointer to NULL * gtk/gtktreestore.c (gtk_tree_store_append): fix memleak * gtk/gtkliststore.c (gtk_list_store_iter_next): don't modify iter on returning FALSE (gtk_list_store_iter_children): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_parent): ditto * gtk/gtktreestore.c (gtk_tree_store_get_path): g_return_if_fail on iter->user_data != NULL instead of silently accepting it. (gtk_tree_store_iter_next): ditto. Also, don't modify iter unless we are returning TRUE. (gtk_tree_store_iter_children): ditto (gtk_tree_store_iter_nth_child): ditto (gtk_tree_store_iter_parent): ditto (gtk_tree_store_insert): remove handling of parent->user_data == NULL, replace with parent == NULL * gtk/gtktreemodel.c (inserted_callback): put some fixes in here, and a comment explaining things * gtk/gtktreestore.c: add GtkTreeDragSource/GtkTreeDragDest interface support to GtkTreeStore. * gtk/gtktreemodel.c (gtk_tree_path_prev): didn't properly return FALSE if no prev, fix * gtk/gtktreeview.c (set_source_row): use a row reference (set_dest_row): use a row reference
2001-01-31 00:57:49 +00:00
}
if (pos)
*pos = tree_view->priv->drag_dest_pos;
fix bug in here where prev pointer was set to the wrong thing 2001-01-30 Havoc Pennington <hp@redhat.com> * gtk/gtkliststore.c (gtk_list_store_insert_before): fix bug in here where prev pointer was set to the wrong thing * gtk/gtktreemodel.c (gtk_tree_path_is_ancestor): new function (gtk_tree_path_is_descendant): new function * gtk/gtkliststore.c (gtk_list_store_iter_n_children): return cached length (gtk_list_store_get_iter): don't modify iter if we can't get the path. * gtk/gtkliststore.h (struct _GtkListStore): cache the length * gtk/gtktreednd.h: add virtual function row_drop_possible() to GtkTreeDragDest * gtk/gtktreestore.c (copy_node_data): fix varargs type error that was causing segfault * gtk/gtktreedatalist.c (_gtk_tree_data_list_node_copy): set next pointer to NULL * gtk/gtktreestore.c (gtk_tree_store_append): fix memleak * gtk/gtkliststore.c (gtk_list_store_iter_next): don't modify iter on returning FALSE (gtk_list_store_iter_children): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_parent): ditto * gtk/gtktreestore.c (gtk_tree_store_get_path): g_return_if_fail on iter->user_data != NULL instead of silently accepting it. (gtk_tree_store_iter_next): ditto. Also, don't modify iter unless we are returning TRUE. (gtk_tree_store_iter_children): ditto (gtk_tree_store_iter_nth_child): ditto (gtk_tree_store_iter_parent): ditto (gtk_tree_store_insert): remove handling of parent->user_data == NULL, replace with parent == NULL * gtk/gtktreemodel.c (inserted_callback): put some fixes in here, and a comment explaining things * gtk/gtktreestore.c: add GtkTreeDragSource/GtkTreeDragDest interface support to GtkTreeStore. * gtk/gtktreemodel.c (gtk_tree_path_prev): didn't properly return FALSE if no prev, fix * gtk/gtktreeview.c (set_source_row): use a row reference (set_dest_row): use a row reference
2001-01-31 00:57:49 +00:00
}
/**
* gtk_tree_view_get_dest_row_at_pos:
* @tree_view: a #GtkTreeView
* @drag_x: the position to determine the destination row for
* @drag_y: the position to determine the destination row for
* @path: Return location for the path of the highlighted row, or %NULL.
* @pos: Return location for the drop position, or %NULL
*
* Determines the destination row for a given position.
*
* Return value: whether there is a row at the given postiion,
**/
gboolean
gtk_tree_view_get_dest_row_at_pos (GtkTreeView *tree_view,
gint drag_x,
gint drag_y,
GtkTreePath **path,
GtkTreeViewDropPosition *pos)
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
{
gint cell_y;
gdouble offset_into_row;
gdouble third;
GdkRectangle cell;
GtkTreeViewColumn *column = NULL;
GtkTreePath *tmp_path = NULL;
/* Note; this function is exported to allow a custom DND
* implementation, so it can't touch TreeViewDragInfo
*/
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
g_return_val_if_fail (tree_view != NULL, FALSE);
g_return_val_if_fail (drag_x >= 0, FALSE);
g_return_val_if_fail (drag_y >= 0, FALSE);
g_return_val_if_fail (tree_view->priv->bin_window != NULL, FALSE);
if (path)
*path = NULL;
if (tree_view->priv->tree == NULL)
return FALSE;
/* If in the top third of a row, we drop before that row; if
* in the bottom third, drop after that row; if in the middle,
* and the row has children, drop into the row.
*/
if (!gtk_tree_view_get_path_at_pos (tree_view,
drag_x,
drag_y - TREE_VIEW_HEADER_HEIGHT (tree_view),
&tmp_path,
&column,
NULL,
&cell_y))
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
return FALSE;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
gtk_tree_view_get_background_area (tree_view, tmp_path, column,
&cell);
offset_into_row = cell_y;
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
if (path)
*path = tmp_path;
else
gtk_tree_path_free (tmp_path);
tmp_path = NULL;
third = cell.height / 3.0;
if (pos)
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
{
if (offset_into_row < third)
{
*pos = GTK_TREE_VIEW_DROP_BEFORE;
}
else if (offset_into_row < (cell.height / 2.0))
{
*pos = GTK_TREE_VIEW_DROP_INTO_OR_BEFORE;
}
start implementing Thu Mar 7 02:58:16 2002 Jonathan Blandford <jrb@redhat.com> * gtk/tmpl/gtkliststore.sgml: start implementing * gtk/question_index.sgml: "I can set with the tree, but not get???!?!" Wed Mar 6 23:20:51 2002 Jonathan Blandford <jrb@redhat.com> and Kristian Rietveld <kris@gtk.org> Finishing touch for 2.0.0 release, fixes #70782, #72729, the 'stealth' bug and other last-minute minor issues. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): set dnd dest line drawing right. We can't draw the line at the position of the next row, because that one still has to be drawn. So draw everthing at a -1 offset. (validate_visible_area): add check for invalid descendants and NULL scroll_to_path path, get scrolling right. Also, fix the area_above value. Pretty amazing I got it wrong. (get_logical_dest_row): add gtk-tree-model-drop-append magic, so dragging a row to the end of the model works right. (gtk_tree_view_get_dest_row_at_pos): minor floating point fix (gtk_tree_view_start_editing): add call to validate_row (gtk_tree_view_tree_to_widget_coords): Never subtract HEADER_HEIGHT from y values anymore!!! (gtk_tree_view_widget_coords_to_tree): ditto. (gtk_tree_view_scroll_to_point): allow -1 as values for the scroll_to coords (gtk_tree_view_move_cursor_page_up_down): Don't need scroll_to_y as clamp_node_visible will make it work. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): also check path depth, as we can't get iters from empty paths * gtk/gtkliststore.c (gtk_list_store_drag_data_received): handle gtk-tree-model-drop-append * gtk/gtktreednd.c (gtk_tree_set_row_drag_data): free path_str * tests/testtreeflow.c (main): select path where we are scrolling to
2002-03-07 08:03:09 +00:00
else if (offset_into_row < third * 2.0)
{
*pos = GTK_TREE_VIEW_DROP_INTO_OR_AFTER;
}
else
{
*pos = GTK_TREE_VIEW_DROP_AFTER;
}
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
}
return TRUE;
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
}
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
/* KEEP IN SYNC WITH GTK_TREE_VIEW_BIN_EXPOSE */
/**
* gtk_tree_view_create_row_drag_icon:
* @tree_view: a #GtkTreeView
* @path: a #GtkTreePath in @tree_view
*
* Creates a #GdkPixmap representation of the row at @path. This image is used
* for a drag icon.
*
* Return value: a newly-allocated pixmap of the drag icon.
**/
GdkPixmap *
gtk_tree_view_create_row_drag_icon (GtkTreeView *tree_view,
GtkTreePath *path)
{
GtkTreeIter iter;
GtkRBTree *tree;
GtkRBNode *node;
gint cell_offset;
GList *list;
GdkRectangle background_area;
GdkRectangle expose_area;
GtkWidget *widget;
gint depth;
/* start drawing inside the black outline */
gint x = 1, y = 1;
GdkDrawable *drawable;
gint bin_window_width;
Support separators in combo boxes and more generally in tree views 2004-07-07 Matthias Clasen <mclasen@redhat.com> Support separators in combo boxes and more generally in tree views (#135873): * gtk/gtkcombobox.h: * gtk/gtkcombobox.c (gtk_combo_box_get_row_separator_column): * gtk/gtkcombobox.c (gtk_combo_box_set_row_separator_column): Add a ::row-separator-column property with getter and setter, which can indicate a boolean model column to determine which rows are separators. * gtk/gtkcombobox.c: Display separator rows as separator menu items in menu mode, and by using the new treeview separator functionality in list mode. * gtk/gtktreeview.h: * gtk/gtktreeview.c (gtk_tree_view_get_row_separator_func): * gtk/gtktreeview.c (gtk_tree_view_set_row_separator_func): Add a callback to determine whether a row is a separator. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): * gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon): * gtk/gtktreeview.c (validate_row): Use the new callback to determine whether a row is a separator, and draw it as a separator then. Since separators should take up less vertical space than regular rows, this requires removing the redundant MAX(...,expander_size) calls which appear in many places. Instead, the MAX() is now only done in validate_row(), and only if the row is not a separator. To catch possible side effects of this intrusive change, I have left EXPANDER_MAX() calls in place of the MAX() calls which will emit a warning if something breaks. They should be removed before 2.6. * gtk/gtktreeselection.c (row_is_selectable): Don't let separator rows be selected. * tests/testcombo.c (create_blaat): Add a separator column.
2004-07-07 15:15:35 +00:00
gboolean is_separator = FALSE;
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
widget = GTK_WIDGET (tree_view);
depth = gtk_tree_path_get_depth (path);
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
_gtk_tree_view_find_node (tree_view,
path,
&tree,
&node);
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
if (tree == NULL)
return NULL;
fix bug in here where prev pointer was set to the wrong thing 2001-01-30 Havoc Pennington <hp@redhat.com> * gtk/gtkliststore.c (gtk_list_store_insert_before): fix bug in here where prev pointer was set to the wrong thing * gtk/gtktreemodel.c (gtk_tree_path_is_ancestor): new function (gtk_tree_path_is_descendant): new function * gtk/gtkliststore.c (gtk_list_store_iter_n_children): return cached length (gtk_list_store_get_iter): don't modify iter if we can't get the path. * gtk/gtkliststore.h (struct _GtkListStore): cache the length * gtk/gtktreednd.h: add virtual function row_drop_possible() to GtkTreeDragDest * gtk/gtktreestore.c (copy_node_data): fix varargs type error that was causing segfault * gtk/gtktreedatalist.c (_gtk_tree_data_list_node_copy): set next pointer to NULL * gtk/gtktreestore.c (gtk_tree_store_append): fix memleak * gtk/gtkliststore.c (gtk_list_store_iter_next): don't modify iter on returning FALSE (gtk_list_store_iter_children): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_parent): ditto * gtk/gtktreestore.c (gtk_tree_store_get_path): g_return_if_fail on iter->user_data != NULL instead of silently accepting it. (gtk_tree_store_iter_next): ditto. Also, don't modify iter unless we are returning TRUE. (gtk_tree_store_iter_children): ditto (gtk_tree_store_iter_nth_child): ditto (gtk_tree_store_iter_parent): ditto (gtk_tree_store_insert): remove handling of parent->user_data == NULL, replace with parent == NULL * gtk/gtktreemodel.c (inserted_callback): put some fixes in here, and a comment explaining things * gtk/gtktreestore.c: add GtkTreeDragSource/GtkTreeDragDest interface support to GtkTreeStore. * gtk/gtktreemodel.c (gtk_tree_path_prev): didn't properly return FALSE if no prev, fix * gtk/gtktreeview.c (set_source_row): use a row reference (set_dest_row): use a row reference
2001-01-31 00:57:49 +00:00
if (!gtk_tree_model_get_iter (tree_view->priv->model,
&iter,
path))
return NULL;
Support separators in combo boxes and more generally in tree views 2004-07-07 Matthias Clasen <mclasen@redhat.com> Support separators in combo boxes and more generally in tree views (#135873): * gtk/gtkcombobox.h: * gtk/gtkcombobox.c (gtk_combo_box_get_row_separator_column): * gtk/gtkcombobox.c (gtk_combo_box_set_row_separator_column): Add a ::row-separator-column property with getter and setter, which can indicate a boolean model column to determine which rows are separators. * gtk/gtkcombobox.c: Display separator rows as separator menu items in menu mode, and by using the new treeview separator functionality in list mode. * gtk/gtktreeview.h: * gtk/gtktreeview.c (gtk_tree_view_get_row_separator_func): * gtk/gtktreeview.c (gtk_tree_view_set_row_separator_func): Add a callback to determine whether a row is a separator. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): * gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon): * gtk/gtktreeview.c (validate_row): Use the new callback to determine whether a row is a separator, and draw it as a separator then. Since separators should take up less vertical space than regular rows, this requires removing the redundant MAX(...,expander_size) calls which appear in many places. Instead, the MAX() is now only done in validate_row(), and only if the row is not a separator. To catch possible side effects of this intrusive change, I have left EXPANDER_MAX() calls in place of the MAX() calls which will emit a warning if something breaks. They should be removed before 2.6. * gtk/gtktreeselection.c (row_is_selectable): Don't let separator rows be selected. * tests/testcombo.c (create_blaat): Add a separator column.
2004-07-07 15:15:35 +00:00
if (tree_view->priv->row_separator_func)
{
is_separator = (* tree_view->priv->row_separator_func) (tree_view->priv->model,
&iter,
tree_view->priv->row_separator_data);
}
fix bug in here where prev pointer was set to the wrong thing 2001-01-30 Havoc Pennington <hp@redhat.com> * gtk/gtkliststore.c (gtk_list_store_insert_before): fix bug in here where prev pointer was set to the wrong thing * gtk/gtktreemodel.c (gtk_tree_path_is_ancestor): new function (gtk_tree_path_is_descendant): new function * gtk/gtkliststore.c (gtk_list_store_iter_n_children): return cached length (gtk_list_store_get_iter): don't modify iter if we can't get the path. * gtk/gtkliststore.h (struct _GtkListStore): cache the length * gtk/gtktreednd.h: add virtual function row_drop_possible() to GtkTreeDragDest * gtk/gtktreestore.c (copy_node_data): fix varargs type error that was causing segfault * gtk/gtktreedatalist.c (_gtk_tree_data_list_node_copy): set next pointer to NULL * gtk/gtktreestore.c (gtk_tree_store_append): fix memleak * gtk/gtkliststore.c (gtk_list_store_iter_next): don't modify iter on returning FALSE (gtk_list_store_iter_children): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_parent): ditto * gtk/gtktreestore.c (gtk_tree_store_get_path): g_return_if_fail on iter->user_data != NULL instead of silently accepting it. (gtk_tree_store_iter_next): ditto. Also, don't modify iter unless we are returning TRUE. (gtk_tree_store_iter_children): ditto (gtk_tree_store_iter_nth_child): ditto (gtk_tree_store_iter_parent): ditto (gtk_tree_store_insert): remove handling of parent->user_data == NULL, replace with parent == NULL * gtk/gtktreemodel.c (inserted_callback): put some fixes in here, and a comment explaining things * gtk/gtktreestore.c: add GtkTreeDragSource/GtkTreeDragDest interface support to GtkTreeStore. * gtk/gtktreemodel.c (gtk_tree_path_prev): didn't properly return FALSE if no prev, fix * gtk/gtktreeview.c (set_source_row): use a row reference (set_dest_row): use a row reference
2001-01-31 00:57:49 +00:00
cell_offset = x;
fix bug in here where prev pointer was set to the wrong thing 2001-01-30 Havoc Pennington <hp@redhat.com> * gtk/gtkliststore.c (gtk_list_store_insert_before): fix bug in here where prev pointer was set to the wrong thing * gtk/gtktreemodel.c (gtk_tree_path_is_ancestor): new function (gtk_tree_path_is_descendant): new function * gtk/gtkliststore.c (gtk_list_store_iter_n_children): return cached length (gtk_list_store_get_iter): don't modify iter if we can't get the path. * gtk/gtkliststore.h (struct _GtkListStore): cache the length * gtk/gtktreednd.h: add virtual function row_drop_possible() to GtkTreeDragDest * gtk/gtktreestore.c (copy_node_data): fix varargs type error that was causing segfault * gtk/gtktreedatalist.c (_gtk_tree_data_list_node_copy): set next pointer to NULL * gtk/gtktreestore.c (gtk_tree_store_append): fix memleak * gtk/gtkliststore.c (gtk_list_store_iter_next): don't modify iter on returning FALSE (gtk_list_store_iter_children): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_parent): ditto * gtk/gtktreestore.c (gtk_tree_store_get_path): g_return_if_fail on iter->user_data != NULL instead of silently accepting it. (gtk_tree_store_iter_next): ditto. Also, don't modify iter unless we are returning TRUE. (gtk_tree_store_iter_children): ditto (gtk_tree_store_iter_nth_child): ditto (gtk_tree_store_iter_parent): ditto (gtk_tree_store_insert): remove handling of parent->user_data == NULL, replace with parent == NULL * gtk/gtktreemodel.c (inserted_callback): put some fixes in here, and a comment explaining things * gtk/gtktreestore.c: add GtkTreeDragSource/GtkTreeDragDest interface support to GtkTreeStore. * gtk/gtktreemodel.c (gtk_tree_path_prev): didn't properly return FALSE if no prev, fix * gtk/gtktreeview.c (set_source_row): use a row reference (set_dest_row): use a row reference
2001-01-31 00:57:49 +00:00
background_area.y = y;
background_area.height = ROW_HEIGHT (tree_view, BACKGROUND_HEIGHT (node));
gdk_drawable_get_size (tree_view->priv->bin_window,
&bin_window_width, NULL);
fix bug in here where prev pointer was set to the wrong thing 2001-01-30 Havoc Pennington <hp@redhat.com> * gtk/gtkliststore.c (gtk_list_store_insert_before): fix bug in here where prev pointer was set to the wrong thing * gtk/gtktreemodel.c (gtk_tree_path_is_ancestor): new function (gtk_tree_path_is_descendant): new function * gtk/gtkliststore.c (gtk_list_store_iter_n_children): return cached length (gtk_list_store_get_iter): don't modify iter if we can't get the path. * gtk/gtkliststore.h (struct _GtkListStore): cache the length * gtk/gtktreednd.h: add virtual function row_drop_possible() to GtkTreeDragDest * gtk/gtktreestore.c (copy_node_data): fix varargs type error that was causing segfault * gtk/gtktreedatalist.c (_gtk_tree_data_list_node_copy): set next pointer to NULL * gtk/gtktreestore.c (gtk_tree_store_append): fix memleak * gtk/gtkliststore.c (gtk_list_store_iter_next): don't modify iter on returning FALSE (gtk_list_store_iter_children): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_parent): ditto * gtk/gtktreestore.c (gtk_tree_store_get_path): g_return_if_fail on iter->user_data != NULL instead of silently accepting it. (gtk_tree_store_iter_next): ditto. Also, don't modify iter unless we are returning TRUE. (gtk_tree_store_iter_children): ditto (gtk_tree_store_iter_nth_child): ditto (gtk_tree_store_iter_parent): ditto (gtk_tree_store_insert): remove handling of parent->user_data == NULL, replace with parent == NULL * gtk/gtktreemodel.c (inserted_callback): put some fixes in here, and a comment explaining things * gtk/gtktreestore.c: add GtkTreeDragSource/GtkTreeDragDest interface support to GtkTreeStore. * gtk/gtktreemodel.c (gtk_tree_path_prev): didn't properly return FALSE if no prev, fix * gtk/gtktreeview.c (set_source_row): use a row reference (set_dest_row): use a row reference
2001-01-31 00:57:49 +00:00
drawable = gdk_pixmap_new (tree_view->priv->bin_window,
bin_window_width + 2,
background_area.height + 2,
-1);
fix bug in here where prev pointer was set to the wrong thing 2001-01-30 Havoc Pennington <hp@redhat.com> * gtk/gtkliststore.c (gtk_list_store_insert_before): fix bug in here where prev pointer was set to the wrong thing * gtk/gtktreemodel.c (gtk_tree_path_is_ancestor): new function (gtk_tree_path_is_descendant): new function * gtk/gtkliststore.c (gtk_list_store_iter_n_children): return cached length (gtk_list_store_get_iter): don't modify iter if we can't get the path. * gtk/gtkliststore.h (struct _GtkListStore): cache the length * gtk/gtktreednd.h: add virtual function row_drop_possible() to GtkTreeDragDest * gtk/gtktreestore.c (copy_node_data): fix varargs type error that was causing segfault * gtk/gtktreedatalist.c (_gtk_tree_data_list_node_copy): set next pointer to NULL * gtk/gtktreestore.c (gtk_tree_store_append): fix memleak * gtk/gtkliststore.c (gtk_list_store_iter_next): don't modify iter on returning FALSE (gtk_list_store_iter_children): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_parent): ditto * gtk/gtktreestore.c (gtk_tree_store_get_path): g_return_if_fail on iter->user_data != NULL instead of silently accepting it. (gtk_tree_store_iter_next): ditto. Also, don't modify iter unless we are returning TRUE. (gtk_tree_store_iter_children): ditto (gtk_tree_store_iter_nth_child): ditto (gtk_tree_store_iter_parent): ditto (gtk_tree_store_insert): remove handling of parent->user_data == NULL, replace with parent == NULL * gtk/gtktreemodel.c (inserted_callback): put some fixes in here, and a comment explaining things * gtk/gtktreestore.c: add GtkTreeDragSource/GtkTreeDragDest interface support to GtkTreeStore. * gtk/gtktreemodel.c (gtk_tree_path_prev): didn't properly return FALSE if no prev, fix * gtk/gtktreeview.c (set_source_row): use a row reference (set_dest_row): use a row reference
2001-01-31 00:57:49 +00:00
expose_area.x = 0;
expose_area.y = 0;
expose_area.width = bin_window_width + 2;
expose_area.height = background_area.height + 2;
gdk_draw_rectangle (drawable,
widget->style->base_gc [GTK_WIDGET_STATE (widget)],
TRUE,
0, 0,
bin_window_width + 2,
background_area.height + 2);
for (list = tree_view->priv->columns; list; list = list->next)
{
GtkTreeViewColumn *column = list->data;
GdkRectangle cell_area;
gint vertical_separator;
fix bug in here where prev pointer was set to the wrong thing 2001-01-30 Havoc Pennington <hp@redhat.com> * gtk/gtkliststore.c (gtk_list_store_insert_before): fix bug in here where prev pointer was set to the wrong thing * gtk/gtktreemodel.c (gtk_tree_path_is_ancestor): new function (gtk_tree_path_is_descendant): new function * gtk/gtkliststore.c (gtk_list_store_iter_n_children): return cached length (gtk_list_store_get_iter): don't modify iter if we can't get the path. * gtk/gtkliststore.h (struct _GtkListStore): cache the length * gtk/gtktreednd.h: add virtual function row_drop_possible() to GtkTreeDragDest * gtk/gtktreestore.c (copy_node_data): fix varargs type error that was causing segfault * gtk/gtktreedatalist.c (_gtk_tree_data_list_node_copy): set next pointer to NULL * gtk/gtktreestore.c (gtk_tree_store_append): fix memleak * gtk/gtkliststore.c (gtk_list_store_iter_next): don't modify iter on returning FALSE (gtk_list_store_iter_children): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_parent): ditto * gtk/gtktreestore.c (gtk_tree_store_get_path): g_return_if_fail on iter->user_data != NULL instead of silently accepting it. (gtk_tree_store_iter_next): ditto. Also, don't modify iter unless we are returning TRUE. (gtk_tree_store_iter_children): ditto (gtk_tree_store_iter_nth_child): ditto (gtk_tree_store_iter_parent): ditto (gtk_tree_store_insert): remove handling of parent->user_data == NULL, replace with parent == NULL * gtk/gtktreemodel.c (inserted_callback): put some fixes in here, and a comment explaining things * gtk/gtktreestore.c: add GtkTreeDragSource/GtkTreeDragDest interface support to GtkTreeStore. * gtk/gtktreemodel.c (gtk_tree_path_prev): didn't properly return FALSE if no prev, fix * gtk/gtktreeview.c (set_source_row): use a row reference (set_dest_row): use a row reference
2001-01-31 00:57:49 +00:00
if (!column->visible)
continue;
gtk_tree_view_column_cell_set_cell_data (column, tree_view->priv->model, &iter,
GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_PARENT),
node->children?TRUE:FALSE);
background_area.x = cell_offset;
background_area.width = column->width;
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
cell_area = background_area;
gtk_widget_style_get (widget, "vertical_separator", &vertical_separator, NULL);
cell_area.y += vertical_separator / 2;
cell_area.height -= vertical_separator;
if (gtk_tree_view_is_expander_column (tree_view, column) &&
TREE_VIEW_DRAW_EXPANDERS(tree_view))
{
cell_area.x += depth * tree_view->priv->expander_size;
cell_area.width -= depth * tree_view->priv->expander_size;
}
sync to tree changes 2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
2001-01-19 22:39:19 +00:00
if (gtk_tree_view_column_cell_is_visible (column))
Support separators in combo boxes and more generally in tree views 2004-07-07 Matthias Clasen <mclasen@redhat.com> Support separators in combo boxes and more generally in tree views (#135873): * gtk/gtkcombobox.h: * gtk/gtkcombobox.c (gtk_combo_box_get_row_separator_column): * gtk/gtkcombobox.c (gtk_combo_box_set_row_separator_column): Add a ::row-separator-column property with getter and setter, which can indicate a boolean model column to determine which rows are separators. * gtk/gtkcombobox.c: Display separator rows as separator menu items in menu mode, and by using the new treeview separator functionality in list mode. * gtk/gtktreeview.h: * gtk/gtktreeview.c (gtk_tree_view_get_row_separator_func): * gtk/gtktreeview.c (gtk_tree_view_set_row_separator_func): Add a callback to determine whether a row is a separator. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): * gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon): * gtk/gtktreeview.c (validate_row): Use the new callback to determine whether a row is a separator, and draw it as a separator then. Since separators should take up less vertical space than regular rows, this requires removing the redundant MAX(...,expander_size) calls which appear in many places. Instead, the MAX() is now only done in validate_row(), and only if the row is not a separator. To catch possible side effects of this intrusive change, I have left EXPANDER_MAX() calls in place of the MAX() calls which will emit a warning if something breaks. They should be removed before 2.6. * gtk/gtktreeselection.c (row_is_selectable): Don't let separator rows be selected. * tests/testcombo.c (create_blaat): Add a separator column.
2004-07-07 15:15:35 +00:00
{
if (is_separator)
gtk_paint_hline (widget->style,
drawable,
GTK_STATE_NORMAL,
&cell_area,
widget,
NULL,
cell_area.x,
cell_area.x + cell_area.width,
cell_area.y + cell_area.height / 2);
else
_gtk_tree_view_column_cell_render (column,
drawable,
&background_area,
&cell_area,
&expose_area,
0);
}
cell_offset += column->width;
}
gdk_draw_rectangle (drawable,
widget->style->black_gc,
FALSE,
0, 0,
bin_window_width + 1,
background_area.height + 1);
return drawable;
fix bug in here where prev pointer was set to the wrong thing 2001-01-30 Havoc Pennington <hp@redhat.com> * gtk/gtkliststore.c (gtk_list_store_insert_before): fix bug in here where prev pointer was set to the wrong thing * gtk/gtktreemodel.c (gtk_tree_path_is_ancestor): new function (gtk_tree_path_is_descendant): new function * gtk/gtkliststore.c (gtk_list_store_iter_n_children): return cached length (gtk_list_store_get_iter): don't modify iter if we can't get the path. * gtk/gtkliststore.h (struct _GtkListStore): cache the length * gtk/gtktreednd.h: add virtual function row_drop_possible() to GtkTreeDragDest * gtk/gtktreestore.c (copy_node_data): fix varargs type error that was causing segfault * gtk/gtktreedatalist.c (_gtk_tree_data_list_node_copy): set next pointer to NULL * gtk/gtktreestore.c (gtk_tree_store_append): fix memleak * gtk/gtkliststore.c (gtk_list_store_iter_next): don't modify iter on returning FALSE (gtk_list_store_iter_children): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_nth_child): ditto (gtk_list_store_iter_parent): ditto * gtk/gtktreestore.c (gtk_tree_store_get_path): g_return_if_fail on iter->user_data != NULL instead of silently accepting it. (gtk_tree_store_iter_next): ditto. Also, don't modify iter unless we are returning TRUE. (gtk_tree_store_iter_children): ditto (gtk_tree_store_iter_nth_child): ditto (gtk_tree_store_iter_parent): ditto (gtk_tree_store_insert): remove handling of parent->user_data == NULL, replace with parent == NULL * gtk/gtktreemodel.c (inserted_callback): put some fixes in here, and a comment explaining things * gtk/gtktreestore.c: add GtkTreeDragSource/GtkTreeDragDest interface support to GtkTreeStore. * gtk/gtktreemodel.c (gtk_tree_path_prev): didn't properly return FALSE if no prev, fix * gtk/gtktreeview.c (set_source_row): use a row reference (set_dest_row): use a row reference
2001-01-31 00:57:49 +00:00
}
/**
* gtk_tree_view_set_destroy_count_func:
* @tree_view: A #GtkTreeView
* @func: Function to be called when a view row is destroyed, or %NULL
* @data: User data to be passed to @func, or %NULL
* @destroy: Destroy notifier for @data, or %NULL
*
* This function should almost never be used. It is meant for private use by
* ATK for determining the number of visible children that are removed when the
* user collapses a row, or a row is deleted.
**/
void
gtk_tree_view_set_destroy_count_func (GtkTreeView *tree_view,
GtkTreeDestroyCountFunc func,
gpointer data,
GtkDestroyNotify destroy)
{
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
if (tree_view->priv->destroy_count_destroy)
(* tree_view->priv->destroy_count_destroy) (tree_view->priv->destroy_count_data);
tree_view->priv->destroy_count_func = func;
tree_view->priv->destroy_count_data = data;
tree_view->priv->destroy_count_destroy = destroy;
}
/*
* Interactive search
*/
/**
* gtk_tree_view_set_enable_search:
* @tree_view: A #GtkTreeView
* @enable_search: %TRUE, if the user can search interactively
*
* If @enable_search is set, then the user can type in text to search through
* the tree interactively.
*/
void
gtk_tree_view_set_enable_search (GtkTreeView *tree_view,
gboolean enable_search)
{
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
2002-01-28 18:52:49 +00:00
enable_search = !!enable_search;
if (tree_view->priv->enable_search != enable_search)
{
tree_view->priv->enable_search = enable_search;
g_object_notify (G_OBJECT (tree_view), "enable_search");
}
}
/**
* gtk_tree_view_get_enable_search:
* @tree_view: A #GtkTreeView
*
* Returns whether or not the tree allows interactive searching.
*
* Return value: whether or not to let the user search interactively
*/
gboolean
gtk_tree_view_get_enable_search (GtkTreeView *tree_view)
{
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), FALSE);
return tree_view->priv->enable_search;
}
/**
* gtk_tree_view_get_search_column:
* @tree_view: A #GtkTreeView
*
* Gets the column searched on by the interactive search code.
*
* Return value: the column the interactive search code searches in.
*/
gint
gtk_tree_view_get_search_column (GtkTreeView *tree_view)
{
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), 0);
return (tree_view->priv->search_column);
}
/**
* gtk_tree_view_set_search_column:
* @tree_view: A #GtkTreeView
* @column: the column of the model to search in
*
* Sets @column as the column where the interactive search code should
* search in. Additionally, turns on interactive searching. Note that
* @column refers to a column of the model.
*/
void
gtk_tree_view_set_search_column (GtkTreeView *tree_view,
gint column)
{
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
g_return_if_fail (column >= 0);
if (tree_view->priv->search_column == column)
return;
tree_view->priv->search_column = column;
2002-01-28 18:52:49 +00:00
g_object_notify (G_OBJECT (tree_view), "search_column");
}
/**
* gtk_tree_view_get_search_equal_func:
* @tree_view: A #GtkTreeView
*
* Returns the compare function currently in use.
*
* Return value: the currently used compare function for the search code.
*/
GtkTreeViewSearchEqualFunc
gtk_tree_view_get_search_equal_func (GtkTreeView *tree_view)
{
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), NULL);
return tree_view->priv->search_equal_func;
}
/**
* gtk_tree_view_set_search_equal_func:
* @tree_view: A #GtkTreeView
* @search_equal_func: the compare function to use during the search
* @search_user_data: user data to pass to @search_equal_func, or %NULL
* @search_destroy: Destroy notifier for @search_user_data, or %NULL
*
* Sets the compare function for the interactive search capabilities; note
* that somewhat like strcmp() returning 0 for equality
* #GtkTreeViewSearchEqualFunc returns %FALSE on matches.
**/
void
gtk_tree_view_set_search_equal_func (GtkTreeView *tree_view,
GtkTreeViewSearchEqualFunc search_equal_func,
gpointer search_user_data,
GtkDestroyNotify search_destroy)
{
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
g_return_if_fail (search_equal_func !=NULL);
if (tree_view->priv->search_destroy)
(* tree_view->priv->search_destroy) (tree_view->priv->search_user_data);
tree_view->priv->search_equal_func = search_equal_func;
tree_view->priv->search_user_data = search_user_data;
tree_view->priv->search_destroy = search_destroy;
if (tree_view->priv->search_equal_func == NULL)
tree_view->priv->search_equal_func = gtk_tree_view_search_equal_func;
}
static void
gtk_tree_view_search_dialog_hide (GtkWidget *search_dialog,
GtkTreeView *tree_view)
{
if (tree_view->priv->disable_popdown)
return;
if (tree_view->priv->search_entry_changed_id)
{
g_signal_handler_disconnect (tree_view->priv->search_entry,
tree_view->priv->search_entry_changed_id);
tree_view->priv->search_entry_changed_id = 0;
}
if (tree_view->priv->typeselect_flush_timeout)
{
g_source_remove (tree_view->priv->typeselect_flush_timeout);
tree_view->priv->typeselect_flush_timeout = 0;
}
/* send focus-in event */
send_focus_change (GTK_WIDGET (tree_view->priv->search_entry), FALSE);
gtk_widget_hide (search_dialog);
gtk_entry_set_text (GTK_ENTRY (tree_view->priv->search_entry), "");
}
static void
gtk_tree_view_search_position_func (GtkTreeView *tree_view,
GtkWidget *search_dialog)
{
gint x, y;
gint tree_x, tree_y;
gint tree_width, tree_height;
GdkWindow *tree_window = GTK_WIDGET (tree_view)->window;
Integrate Erwann Chenede's multihead changes for the gtk/ directory. Mon Apr 29 18:28:00 2002 Owen Taylor <otaylor@redhat.com> Integrate Erwann Chenede's multihead changes for the gtk/ directory. * gtk/gtkclipboard.[ch]: Add gtk_clipboard_get_for_display(), make internals multihead aware. * gtk/gtkcolorsel.[ch]: Add gtk_color_selection_set_change_palette_with_screen_hook () [ugh!] make up for non-multihead safety of gtk_color_selection_set_change_palette_hook() * gtk/gtkinvisible.[ch] gtk/gtkmenu.[ch] gtkwindow.[ch]: Add gtk_{invisible,menu,window}_set_screen(); add "screen" properties for GtkWindow and GtkMenu. * gtk/gtkplug.[ch]: Add gtk_plug_construct_for_display(), gtk_plug_new_for_display(). Multihead fixes. * gtk/gtkselection.[ch]: Add gtk_selection_owner_set_for_display(), make internals multihead aware. * gtk/gtksettings.[ch]: Add gtk_settings_get_for_screen(), get rid of now-useless gtk_settings_constructor(). * gtk/gtkstyle.[ch]: Add gtk_style_get_font_for_display(), fix check/radio button indicators bitmap handling to be multihead safe. * gtk/gtkwidget.[ch]: Add gtk_widget_get_screen(), gtk_widget_has_screen(), gtk_widget_get_display(), gtk_widget_get_clipboard(), gtk_widget_get_root_window(). * gtk/gtkbindings.c gtk/gtkbutton.c gtk/gtkclist.c gtk/gtkcombo.c gtk/gtkctree.c gtk/gtkdnd.c gtk/gtkfilesel.c gtk/gtkgamma.c gtk/gtkhandlebox.c gtk/gtkhsv.c gtk/gtkimcontext.c gtk/gtklabel.c gtk/gtklist.c gtk/gtkmain.c gtk/gtkmenuitem.c gtk/gtkmenushell.c gtk/gtknotebook.c gtk/gtkoldeditable.c gtk/gtkoptionmenu.c gtk/gtkpaned.c gtk/gtkpreview.c gtk/gtksocket.c gtk/gtktext.c gtk/gtktextbuffer.c gtk/gtktextview.c gtk/gtktipsquery.c gtk/gtktooltips.c gtk/gtktreeview.c gtk/gtktreeviewcolumn.c: misc mechanical multihead-safety fixes. * gtk/gtkclipboard.c: Use a GtkImage rather than a pixmap for the dropper, look up the color palette only at realization time, other multihead fixes. * gtk/gtkcombo.c (gtk_combo_unrealize): Popdown the list when unrealizing. * gtk/gtkentry.c: Only claim ownership of the primary selection when realized, misc multihead fixes. * gtk/gtkfontsel.c: Only fill in fonts when attached to a screen, fix gtk_font_selection_get_font() for multihead. * gtk/gtkgc.c: make the depth => drawable hash per-screen. * gtk/gtkinvisible.c: Add a constructor that realizes the widget, so we get a realized widget with g_object_new() as well gtk_invisible_new() as before. * gtk/gtkmain.c: Get rid of unused gtk_visual/gtk_colormap variables. * gtk/gtktextdisplay.c: Add warnings if stipple bitmaps are used on the wrong screen. * gtk/gtktoolbar.c: Make handling of GtkSettings-based layout read properties and connect to settings when the screen is changed, rather than on init/finalize. * gtk/gtkwindow.c: Fix icon handing to be multihead safe ... default icon pixmaps/mask are only shared between windows on the same screen. Misc multihead fixes. Sat Apr 27 13:49:53 2002 Owen Taylor <otaylor@redhat.com> * gtk/gtkclipboard.c (gtk_clipboard_get_for_display): Update docs to reference GDK_SELECTION_CLIPBOARD rather GDK_NONE. 2002-04-29 Alex Larsson <alexl@redhat.com> * gdk/linux-fb/gdkproperty-fb.c (gdk_property_get): Fix silly bug, noticed by Sven Neumann. Sun Apr 28 22:43:55 2002 Jonathan Blandford <jrb@gnome.org> * gtk/gtktreemodelsort.c (gtk_tree_model_sort_set_sort_func): Fix so that you can set a new sort func.
2002-04-29 22:53:45 +00:00
GdkScreen *screen = gdk_drawable_get_screen (tree_window);
GtkRequisition requisition;
gtk_widget_realize (search_dialog);
gdk_window_get_origin (tree_window, &tree_x, &tree_y);
gdk_drawable_get_size (tree_window,
&tree_width,
&tree_height);
gtk_widget_size_request (search_dialog, &requisition);
Integrate Erwann Chenede's multihead changes for the gtk/ directory. Mon Apr 29 18:28:00 2002 Owen Taylor <otaylor@redhat.com> Integrate Erwann Chenede's multihead changes for the gtk/ directory. * gtk/gtkclipboard.[ch]: Add gtk_clipboard_get_for_display(), make internals multihead aware. * gtk/gtkcolorsel.[ch]: Add gtk_color_selection_set_change_palette_with_screen_hook () [ugh!] make up for non-multihead safety of gtk_color_selection_set_change_palette_hook() * gtk/gtkinvisible.[ch] gtk/gtkmenu.[ch] gtkwindow.[ch]: Add gtk_{invisible,menu,window}_set_screen(); add "screen" properties for GtkWindow and GtkMenu. * gtk/gtkplug.[ch]: Add gtk_plug_construct_for_display(), gtk_plug_new_for_display(). Multihead fixes. * gtk/gtkselection.[ch]: Add gtk_selection_owner_set_for_display(), make internals multihead aware. * gtk/gtksettings.[ch]: Add gtk_settings_get_for_screen(), get rid of now-useless gtk_settings_constructor(). * gtk/gtkstyle.[ch]: Add gtk_style_get_font_for_display(), fix check/radio button indicators bitmap handling to be multihead safe. * gtk/gtkwidget.[ch]: Add gtk_widget_get_screen(), gtk_widget_has_screen(), gtk_widget_get_display(), gtk_widget_get_clipboard(), gtk_widget_get_root_window(). * gtk/gtkbindings.c gtk/gtkbutton.c gtk/gtkclist.c gtk/gtkcombo.c gtk/gtkctree.c gtk/gtkdnd.c gtk/gtkfilesel.c gtk/gtkgamma.c gtk/gtkhandlebox.c gtk/gtkhsv.c gtk/gtkimcontext.c gtk/gtklabel.c gtk/gtklist.c gtk/gtkmain.c gtk/gtkmenuitem.c gtk/gtkmenushell.c gtk/gtknotebook.c gtk/gtkoldeditable.c gtk/gtkoptionmenu.c gtk/gtkpaned.c gtk/gtkpreview.c gtk/gtksocket.c gtk/gtktext.c gtk/gtktextbuffer.c gtk/gtktextview.c gtk/gtktipsquery.c gtk/gtktooltips.c gtk/gtktreeview.c gtk/gtktreeviewcolumn.c: misc mechanical multihead-safety fixes. * gtk/gtkclipboard.c: Use a GtkImage rather than a pixmap for the dropper, look up the color palette only at realization time, other multihead fixes. * gtk/gtkcombo.c (gtk_combo_unrealize): Popdown the list when unrealizing. * gtk/gtkentry.c: Only claim ownership of the primary selection when realized, misc multihead fixes. * gtk/gtkfontsel.c: Only fill in fonts when attached to a screen, fix gtk_font_selection_get_font() for multihead. * gtk/gtkgc.c: make the depth => drawable hash per-screen. * gtk/gtkinvisible.c: Add a constructor that realizes the widget, so we get a realized widget with g_object_new() as well gtk_invisible_new() as before. * gtk/gtkmain.c: Get rid of unused gtk_visual/gtk_colormap variables. * gtk/gtktextdisplay.c: Add warnings if stipple bitmaps are used on the wrong screen. * gtk/gtktoolbar.c: Make handling of GtkSettings-based layout read properties and connect to settings when the screen is changed, rather than on init/finalize. * gtk/gtkwindow.c: Fix icon handing to be multihead safe ... default icon pixmaps/mask are only shared between windows on the same screen. Misc multihead fixes. Sat Apr 27 13:49:53 2002 Owen Taylor <otaylor@redhat.com> * gtk/gtkclipboard.c (gtk_clipboard_get_for_display): Update docs to reference GDK_SELECTION_CLIPBOARD rather GDK_NONE. 2002-04-29 Alex Larsson <alexl@redhat.com> * gdk/linux-fb/gdkproperty-fb.c (gdk_property_get): Fix silly bug, noticed by Sven Neumann. Sun Apr 28 22:43:55 2002 Jonathan Blandford <jrb@gnome.org> * gtk/gtktreemodelsort.c (gtk_tree_model_sort_set_sort_func): Fix so that you can set a new sort func.
2002-04-29 22:53:45 +00:00
if (tree_x + tree_width - requisition.width > gdk_screen_get_width (screen))
x = gdk_screen_get_width (screen) - requisition.width;
else if (tree_x + tree_width - requisition.width < 0)
x = 0;
else
x = tree_x + tree_width - requisition.width;
Integrate Erwann Chenede's multihead changes for the gtk/ directory. Mon Apr 29 18:28:00 2002 Owen Taylor <otaylor@redhat.com> Integrate Erwann Chenede's multihead changes for the gtk/ directory. * gtk/gtkclipboard.[ch]: Add gtk_clipboard_get_for_display(), make internals multihead aware. * gtk/gtkcolorsel.[ch]: Add gtk_color_selection_set_change_palette_with_screen_hook () [ugh!] make up for non-multihead safety of gtk_color_selection_set_change_palette_hook() * gtk/gtkinvisible.[ch] gtk/gtkmenu.[ch] gtkwindow.[ch]: Add gtk_{invisible,menu,window}_set_screen(); add "screen" properties for GtkWindow and GtkMenu. * gtk/gtkplug.[ch]: Add gtk_plug_construct_for_display(), gtk_plug_new_for_display(). Multihead fixes. * gtk/gtkselection.[ch]: Add gtk_selection_owner_set_for_display(), make internals multihead aware. * gtk/gtksettings.[ch]: Add gtk_settings_get_for_screen(), get rid of now-useless gtk_settings_constructor(). * gtk/gtkstyle.[ch]: Add gtk_style_get_font_for_display(), fix check/radio button indicators bitmap handling to be multihead safe. * gtk/gtkwidget.[ch]: Add gtk_widget_get_screen(), gtk_widget_has_screen(), gtk_widget_get_display(), gtk_widget_get_clipboard(), gtk_widget_get_root_window(). * gtk/gtkbindings.c gtk/gtkbutton.c gtk/gtkclist.c gtk/gtkcombo.c gtk/gtkctree.c gtk/gtkdnd.c gtk/gtkfilesel.c gtk/gtkgamma.c gtk/gtkhandlebox.c gtk/gtkhsv.c gtk/gtkimcontext.c gtk/gtklabel.c gtk/gtklist.c gtk/gtkmain.c gtk/gtkmenuitem.c gtk/gtkmenushell.c gtk/gtknotebook.c gtk/gtkoldeditable.c gtk/gtkoptionmenu.c gtk/gtkpaned.c gtk/gtkpreview.c gtk/gtksocket.c gtk/gtktext.c gtk/gtktextbuffer.c gtk/gtktextview.c gtk/gtktipsquery.c gtk/gtktooltips.c gtk/gtktreeview.c gtk/gtktreeviewcolumn.c: misc mechanical multihead-safety fixes. * gtk/gtkclipboard.c: Use a GtkImage rather than a pixmap for the dropper, look up the color palette only at realization time, other multihead fixes. * gtk/gtkcombo.c (gtk_combo_unrealize): Popdown the list when unrealizing. * gtk/gtkentry.c: Only claim ownership of the primary selection when realized, misc multihead fixes. * gtk/gtkfontsel.c: Only fill in fonts when attached to a screen, fix gtk_font_selection_get_font() for multihead. * gtk/gtkgc.c: make the depth => drawable hash per-screen. * gtk/gtkinvisible.c: Add a constructor that realizes the widget, so we get a realized widget with g_object_new() as well gtk_invisible_new() as before. * gtk/gtkmain.c: Get rid of unused gtk_visual/gtk_colormap variables. * gtk/gtktextdisplay.c: Add warnings if stipple bitmaps are used on the wrong screen. * gtk/gtktoolbar.c: Make handling of GtkSettings-based layout read properties and connect to settings when the screen is changed, rather than on init/finalize. * gtk/gtkwindow.c: Fix icon handing to be multihead safe ... default icon pixmaps/mask are only shared between windows on the same screen. Misc multihead fixes. Sat Apr 27 13:49:53 2002 Owen Taylor <otaylor@redhat.com> * gtk/gtkclipboard.c (gtk_clipboard_get_for_display): Update docs to reference GDK_SELECTION_CLIPBOARD rather GDK_NONE. 2002-04-29 Alex Larsson <alexl@redhat.com> * gdk/linux-fb/gdkproperty-fb.c (gdk_property_get): Fix silly bug, noticed by Sven Neumann. Sun Apr 28 22:43:55 2002 Jonathan Blandford <jrb@gnome.org> * gtk/gtktreemodelsort.c (gtk_tree_model_sort_set_sort_func): Fix so that you can set a new sort func.
2002-04-29 22:53:45 +00:00
if (tree_y + tree_height > gdk_screen_get_height (screen))
y = gdk_screen_get_height (screen) - requisition.height;
else if (tree_y + tree_height < 0) /* isn't really possible ... */
y = 0;
else
y = tree_y + tree_height;
gtk_window_move (GTK_WINDOW (search_dialog), x, y);
}
static void
gtk_tree_view_search_disable_popdown (GtkEntry *entry,
GtkMenu *menu,
gpointer data)
{
GtkTreeView *tree_view = (GtkTreeView *)data;
tree_view->priv->disable_popdown = 1;
g_signal_connect (menu, "hide",
G_CALLBACK (gtk_tree_view_search_enable_popdown), data);
}
/* Because we're visible but offscreen, we just set a flag in the preedit
* callback.
*/
static void
gtk_tree_view_search_preedit_changed (GtkIMContext *im_context,
GtkTreeView *tree_view)
{
g_print ("in gtk_tree_view_search_preedit_changed\n");
tree_view->priv->imcontext_changed = 1;
if (tree_view->priv->typeselect_flush_timeout)
{
g_source_remove (tree_view->priv->typeselect_flush_timeout);
tree_view->priv->typeselect_flush_timeout =
g_timeout_add (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
(GSourceFunc) gtk_tree_view_search_entry_flush_timeout,
tree_view);
}
}
static gboolean
gtk_tree_view_real_search_enable_popdown (gpointer data)
{
GtkTreeView *tree_view = (GtkTreeView *)data;
GDK_THREADS_ENTER ();
tree_view->priv->disable_popdown = 0;
GDK_THREADS_LEAVE ();
return FALSE;
}
static void
gtk_tree_view_search_enable_popdown (GtkWidget *widget,
gpointer data)
{
g_timeout_add (200, gtk_tree_view_real_search_enable_popdown, data);
}
static gboolean
gtk_tree_view_search_delete_event (GtkWidget *widget,
GdkEventAny *event,
GtkTreeView *tree_view)
{
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
gtk_tree_view_search_dialog_hide (widget, tree_view);
return TRUE;
}
static gboolean
gtk_tree_view_search_button_press_event (GtkWidget *widget,
GdkEventButton *event,
GtkTreeView *tree_view)
{
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
gtk_tree_view_search_dialog_hide (widget, tree_view);
return TRUE;
}
static gboolean
gtk_tree_view_search_key_press_event (GtkWidget *widget,
GdkEventKey *event,
GtkTreeView *tree_view)
{
gboolean retval = FALSE;
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), FALSE);
/* close window */
if (event->keyval == GDK_Escape ||
event->keyval == GDK_Return ||
event->keyval == GDK_Tab)
{
gtk_tree_view_search_dialog_hide (widget, tree_view);
return TRUE;
}
/* select previous matching iter */
if (event->keyval == GDK_Up || event->keyval == GDK_KP_Up)
{
gtk_tree_view_search_move (widget, tree_view, TRUE);
retval = TRUE;
}
/* select next matching iter */
if (event->keyval == GDK_Down || event->keyval == GDK_KP_Down)
{
gtk_tree_view_search_move (widget, tree_view, FALSE);
retval = TRUE;
}
/* renew the flush timeout */
if (retval && tree_view->priv->typeselect_flush_timeout)
{
g_source_remove (tree_view->priv->typeselect_flush_timeout);
tree_view->priv->typeselect_flush_timeout =
g_timeout_add (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
(GSourceFunc) gtk_tree_view_search_entry_flush_timeout,
tree_view);
}
return retval;
}
static void
gtk_tree_view_search_move (GtkWidget *window,
GtkTreeView *tree_view,
gboolean up)
{
gboolean ret;
gint len;
gint count = 0;
const gchar *text;
GtkTreeIter iter;
GtkTreeModel *model;
GtkTreeSelection *selection;
text = gtk_entry_get_text (GTK_ENTRY (tree_view->priv->search_entry));
g_return_if_fail (text != NULL);
if (up && tree_view->priv->selected_iter == 1)
return;
len = strlen (text);
if (len < 1)
return;
model = gtk_tree_view_get_model (tree_view);
selection = gtk_tree_view_get_selection (tree_view);
/* search */
gtk_tree_selection_unselect_all (selection);
gtk_tree_model_get_iter_first (model, &iter);
ret = gtk_tree_view_search_iter (model, selection, &iter, text,
&count, up?((tree_view->priv->selected_iter) - 1):((tree_view->priv->selected_iter + 1)));
if (ret)
{
/* found */
tree_view->priv->selected_iter += up?(-1):(1);
}
else
{
/* return to old iter */
count = 0;
gtk_tree_model_get_iter_first (model, &iter);
gtk_tree_view_search_iter (model, selection,
&iter, text,
&count, tree_view->priv->selected_iter);
}
}
static gboolean
gtk_tree_view_search_equal_func (GtkTreeModel *model,
gint column,
const gchar *key,
GtkTreeIter *iter,
gpointer search_data)
{
gboolean retval = TRUE;
const gchar *str;
gchar *normalized_string;
gchar *normalized_key;
gchar *case_normalized_string = NULL;
gchar *case_normalized_key = NULL;
GValue value = {0,};
GValue transformed = {0,};
gtk_tree_model_get_value (model, iter, column, &value);
g_value_init (&transformed, G_TYPE_STRING);
if (!g_value_transform (&value, &transformed))
{
g_value_unset (&value);
return TRUE;
}
g_value_unset (&value);
str = g_value_get_string (&transformed);
if (!str)
{
g_value_unset (&transformed);
return TRUE;
}
normalized_string = g_utf8_normalize (str, -1, G_NORMALIZE_ALL);
normalized_key = g_utf8_normalize (key, -1, G_NORMALIZE_ALL);
if (normalized_string && normalized_key)
{
case_normalized_string = g_utf8_casefold (normalized_string, -1);
case_normalized_key = g_utf8_casefold (normalized_key, -1);
if (strstr (case_normalized_string, case_normalized_key))
retval = FALSE;
}
g_value_unset (&transformed);
g_free (normalized_key);
g_free (normalized_string);
g_free (case_normalized_key);
g_free (case_normalized_string);
return retval;
}
static gboolean
gtk_tree_view_search_iter (GtkTreeModel *model,
GtkTreeSelection *selection,
GtkTreeIter *iter,
const gchar *text,
gint *count,
gint n)
{
GtkRBTree *tree = NULL;
GtkRBNode *node = NULL;
GtkTreePath *path;
GtkTreeView *tree_view = gtk_tree_selection_get_tree_view (selection);
path = gtk_tree_model_get_path (model, iter);
_gtk_tree_view_find_node (tree_view, path, &tree, &node);
do
{
if (! tree_view->priv->search_equal_func (model, tree_view->priv->search_column, text, iter, tree_view->priv->search_user_data))
{
(*count)++;
if (*count == n)
{
gtk_tree_view_scroll_to_cell (tree_view, path, NULL,
TRUE, 0.5, 0.0);
gtk_tree_selection_select_iter (selection, iter);
gtk_tree_view_real_set_cursor (tree_view, path, FALSE, TRUE);
if (path)
gtk_tree_path_free (path);
return TRUE;
}
}
if (node->children)
{
gboolean has_child;
GtkTreeIter tmp;
tree = node->children;
node = tree->root;
while (node->left != tree->nil)
node = node->left;
tmp = *iter;
has_child = gtk_tree_model_iter_children (model, iter, &tmp);
gtk_tree_path_down (path);
/* sanity check */
TREE_VIEW_INTERNAL_ASSERT (has_child, FALSE);
}
else
{
gboolean done = FALSE;
do
{
node = _gtk_rbtree_next (tree, node);
if (node)
{
gboolean has_next;
has_next = gtk_tree_model_iter_next (model, iter);
done = TRUE;
gtk_tree_path_next (path);
/* sanity check */
TREE_VIEW_INTERNAL_ASSERT (has_next, FALSE);
}
else
{
gboolean has_parent;
GtkTreeIter tmp_iter = *iter;
node = tree->parent_node;
tree = tree->parent_tree;
if (!tree)
{
if (path)
gtk_tree_path_free (path);
/* we've run out of tree, done with this func */
return FALSE;
}
has_parent = gtk_tree_model_iter_parent (model,
iter,
&tmp_iter);
gtk_tree_path_up (path);
/* sanity check */
TREE_VIEW_INTERNAL_ASSERT (has_parent, FALSE);
}
}
while (!done);
}
}
while (1);
return FALSE;
}
static void
gtk_tree_view_search_init (GtkWidget *entry,
GtkTreeView *tree_view)
{
gint ret;
gint len;
gint count = 0;
const gchar *text;
GtkWidget *window;
GtkTreeIter iter;
GtkTreeModel *model;
GtkTreeSelection *selection;
g_return_if_fail (GTK_IS_ENTRY (entry));
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
window = gtk_widget_get_parent (entry);
text = gtk_entry_get_text (GTK_ENTRY (entry));
len = strlen (text);
model = gtk_tree_view_get_model (tree_view);
selection = gtk_tree_view_get_selection (tree_view);
/* search */
gtk_tree_selection_unselect_all (selection);
if (tree_view->priv->typeselect_flush_timeout)
{
g_source_remove (tree_view->priv->typeselect_flush_timeout);
tree_view->priv->typeselect_flush_timeout =
g_timeout_add (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
(GSourceFunc) gtk_tree_view_search_entry_flush_timeout,
tree_view);
}
if (len < 1)
return;
if (!gtk_tree_model_get_iter_first (model, &iter))
return;
ret = gtk_tree_view_search_iter (model, selection,
&iter, text,
&count, 1);
if (ret)
tree_view->priv->selected_iter = 1;
}
static void
gtk_tree_view_remove_widget (GtkCellEditable *cell_editable,
GtkTreeView *tree_view)
{
if (tree_view->priv->edited_column == NULL)
return;
_gtk_tree_view_column_stop_editing (tree_view->priv->edited_column);
tree_view->priv->edited_column = NULL;
if (GTK_WIDGET_HAS_FOCUS (cell_editable))
gtk_widget_grab_focus (GTK_WIDGET (tree_view));
gtk_container_remove (GTK_CONTAINER (tree_view),
2004-07-16 20:27:40 +00:00
GTK_WIDGET (cell_editable));
/* FIXME should only redraw a single node */
gtk_widget_queue_draw (GTK_WIDGET (tree_view));
}
static gboolean
gtk_tree_view_start_editing (GtkTreeView *tree_view,
GtkTreePath *cursor_path)
{
GtkTreeIter iter;
GdkRectangle background_area;
GdkRectangle cell_area;
GtkCellEditable *editable_widget = NULL;
gchar *path_string;
guint flags = 0; /* can be 0, as the flags are primarily for rendering */
gint retval = FALSE;
GtkRBTree *cursor_tree;
GtkRBNode *cursor_node;
g_assert (tree_view->priv->focus_column);
if (! GTK_WIDGET_REALIZED (tree_view))
return FALSE;
if (_gtk_tree_view_find_node (tree_view, cursor_path, &cursor_tree, &cursor_node) ||
cursor_node == NULL)
return FALSE;
path_string = gtk_tree_path_to_string (cursor_path);
gtk_tree_model_get_iter (tree_view->priv->model, &iter, cursor_path);
start implementing Thu Mar 7 02:58:16 2002 Jonathan Blandford <jrb@redhat.com> * gtk/tmpl/gtkliststore.sgml: start implementing * gtk/question_index.sgml: "I can set with the tree, but not get???!?!" Wed Mar 6 23:20:51 2002 Jonathan Blandford <jrb@redhat.com> and Kristian Rietveld <kris@gtk.org> Finishing touch for 2.0.0 release, fixes #70782, #72729, the 'stealth' bug and other last-minute minor issues. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): set dnd dest line drawing right. We can't draw the line at the position of the next row, because that one still has to be drawn. So draw everthing at a -1 offset. (validate_visible_area): add check for invalid descendants and NULL scroll_to_path path, get scrolling right. Also, fix the area_above value. Pretty amazing I got it wrong. (get_logical_dest_row): add gtk-tree-model-drop-append magic, so dragging a row to the end of the model works right. (gtk_tree_view_get_dest_row_at_pos): minor floating point fix (gtk_tree_view_start_editing): add call to validate_row (gtk_tree_view_tree_to_widget_coords): Never subtract HEADER_HEIGHT from y values anymore!!! (gtk_tree_view_widget_coords_to_tree): ditto. (gtk_tree_view_scroll_to_point): allow -1 as values for the scroll_to coords (gtk_tree_view_move_cursor_page_up_down): Don't need scroll_to_y as clamp_node_visible will make it work. * gtk/gtktreestore.c (gtk_tree_store_drag_data_received): also check path depth, as we can't get iters from empty paths * gtk/gtkliststore.c (gtk_list_store_drag_data_received): handle gtk-tree-model-drop-append * gtk/gtktreednd.c (gtk_tree_set_row_drag_data): free path_str * tests/testtreeflow.c (main): select path where we are scrolling to
2002-03-07 08:03:09 +00:00
validate_row (tree_view, cursor_tree, cursor_node, &iter, cursor_path);
gtk_tree_view_column_cell_set_cell_data (tree_view->priv->focus_column,
tree_view->priv->model,
&iter,
GTK_RBNODE_FLAG_SET (cursor_node, GTK_RBNODE_IS_PARENT),
cursor_node->children?TRUE:FALSE);
gtk_tree_view_get_background_area (tree_view,
cursor_path,
tree_view->priv->focus_column,
&background_area);
gtk_tree_view_get_cell_area (tree_view,
cursor_path,
tree_view->priv->focus_column,
&cell_area);
if (gtk_tree_view_is_expander_column (tree_view, tree_view->priv->focus_column) && TREE_VIEW_DRAW_EXPANDERS (tree_view))
{
cell_area.x += tree_view->priv->expander_size;
cell_area.width -= tree_view->priv->expander_size;
}
if (_gtk_tree_view_column_cell_event (tree_view->priv->focus_column,
&editable_widget,
NULL,
path_string,
&background_area,
&cell_area,
flags))
{
retval = TRUE;
if (editable_widget != NULL)
{
The "big treeview focus patch". Fixes several issues and adds some Sun May 5 16:42:32 2002 Kristian Rietveld <kris@gtk.org> The "big treeview focus patch". Fixes several issues and adds some goodies. Related bugs: #73676, #73734, #78660. * gtk/gtktreeview.h: add gtk_tree_view_set_cursor_on_cell * gtk/gtktreeview.c (gtk_tree_view_button_press): focus on a cell if applicable, (gtk_tree_view_bin_expose): set_cell_data before iterating columns, add support for row-spanning focus rectangles, (gtk_tree_view_has_special_cell): new function, (gtk_tree_view_move_cursor_left_right): add support for multiple focusable cells in one column, (gtk_tree_view_set_cursor): call _set_cursor_on_cell now, (gtk_tree_view_set_cursor_on_cell): copy of _set_cursor, extended with focus_cell parameter, (gtk_tree_view_search_iter): removed unused column variable, (gtk_tree_view_start_editing): add neighbor size code to allow for multiple editable cells in one column. * gtk/gtktreeviewcolumn.c (_GtkTreeViewColumnCellInfo): add in_editing_mode field, (gtk_tree_view_column_get_edited_cell): new function, removed _get_editable_cell, (_gtk_tree_view_column_get_cell_at_pos): new function, (gtk_tree_view_column_pack_end): s/g_new/g_new0/ ..., (gtk_tree_view_column_cell_process_action): loads of changes to get it right and to allow for multiple special cells, etc, (gtk_tree_view_column_cell_first): new function, (gtk_tree_view_column_cell_last): ditto, (gtk_tree_view_column_cell_next): ditto, (gtk_tree_view_column_cell_prev): ditto, (gtk_tree_view_column_cell_focus): add left and right parameters, allow for multiple special cells, (gtk_tree_view_column_cell_is_visible): add assertion, (gtk_tree_view_column_focus_cell): new function, (gtk_tree_view_column_stop_editing): unset in_editing_mode flag, (_gtk_tree_view_column_get_neighbor_sizes): iterate through cells correctly * gtk/gtktreeviewcolumn.h: add gtk_tree_view_column_focus_cell * gtk/gtktreeprivate.h: s/_get_editable_cell/_get_edited_cell/, add _gtk_tree_view_column_get_cell_at_pos, add new parameters to _gtk_tree_view_column_cell_focus. * tests/testtreeedit.c: add some cells in order to test new code.
2002-05-05 14:54:00 +00:00
gint left, right;
GdkRectangle area;
GtkCellRenderer *cell;
area = cell_area;
cell = _gtk_tree_view_column_get_edited_cell (tree_view->priv->focus_column);
_gtk_tree_view_column_get_neighbor_sizes (tree_view->priv->focus_column, cell, &left, &right);
area.x += left;
area.width -= right + left;
gtk_tree_view_real_start_editing (tree_view,
tree_view->priv->focus_column,
cursor_path,
editable_widget,
The "big treeview focus patch". Fixes several issues and adds some Sun May 5 16:42:32 2002 Kristian Rietveld <kris@gtk.org> The "big treeview focus patch". Fixes several issues and adds some goodies. Related bugs: #73676, #73734, #78660. * gtk/gtktreeview.h: add gtk_tree_view_set_cursor_on_cell * gtk/gtktreeview.c (gtk_tree_view_button_press): focus on a cell if applicable, (gtk_tree_view_bin_expose): set_cell_data before iterating columns, add support for row-spanning focus rectangles, (gtk_tree_view_has_special_cell): new function, (gtk_tree_view_move_cursor_left_right): add support for multiple focusable cells in one column, (gtk_tree_view_set_cursor): call _set_cursor_on_cell now, (gtk_tree_view_set_cursor_on_cell): copy of _set_cursor, extended with focus_cell parameter, (gtk_tree_view_search_iter): removed unused column variable, (gtk_tree_view_start_editing): add neighbor size code to allow for multiple editable cells in one column. * gtk/gtktreeviewcolumn.c (_GtkTreeViewColumnCellInfo): add in_editing_mode field, (gtk_tree_view_column_get_edited_cell): new function, removed _get_editable_cell, (_gtk_tree_view_column_get_cell_at_pos): new function, (gtk_tree_view_column_pack_end): s/g_new/g_new0/ ..., (gtk_tree_view_column_cell_process_action): loads of changes to get it right and to allow for multiple special cells, etc, (gtk_tree_view_column_cell_first): new function, (gtk_tree_view_column_cell_last): ditto, (gtk_tree_view_column_cell_next): ditto, (gtk_tree_view_column_cell_prev): ditto, (gtk_tree_view_column_cell_focus): add left and right parameters, allow for multiple special cells, (gtk_tree_view_column_cell_is_visible): add assertion, (gtk_tree_view_column_focus_cell): new function, (gtk_tree_view_column_stop_editing): unset in_editing_mode flag, (_gtk_tree_view_column_get_neighbor_sizes): iterate through cells correctly * gtk/gtktreeviewcolumn.h: add gtk_tree_view_column_focus_cell * gtk/gtktreeprivate.h: s/_get_editable_cell/_get_edited_cell/, add _gtk_tree_view_column_get_cell_at_pos, add new parameters to _gtk_tree_view_column_cell_focus. * tests/testtreeedit.c: add some cells in order to test new code.
2002-05-05 14:54:00 +00:00
&area,
NULL,
flags);
}
}
g_free (path_string);
return retval;
}
static void
gtk_tree_view_real_start_editing (GtkTreeView *tree_view,
GtkTreeViewColumn *column,
GtkTreePath *path,
GtkCellEditable *cell_editable,
GdkRectangle *cell_area,
GdkEvent *event,
guint flags)
{
gint pre_val = tree_view->priv->vadjustment->value;
tree_view->priv->edited_column = column;
_gtk_tree_view_column_start_editing (column, GTK_CELL_EDITABLE (cell_editable));
gtk_tree_view_real_set_cursor (tree_view, path, FALSE, TRUE);
cell_area->y += pre_val - tree_view->priv->vadjustment->value;
GTK_TREE_VIEW_SET_FLAG (tree_view, GTK_TREE_VIEW_DRAW_KEYFOCUS);
gtk_tree_view_put (tree_view,
GTK_WIDGET (cell_editable),
cell_area->x, cell_area->y, cell_area->width, cell_area->height);
gtk_cell_editable_start_editing (GTK_CELL_EDITABLE (cell_editable),
(GdkEvent *)event);
gtk_widget_grab_focus (GTK_WIDGET (cell_editable));
g_signal_connect (cell_editable, "remove_widget",
G_CALLBACK (gtk_tree_view_remove_widget), tree_view);
}
static void
gtk_tree_view_stop_editing (GtkTreeView *tree_view,
gboolean cancel_editing)
{
GtkTreeViewColumn *column;
if (tree_view->priv->edited_column == NULL)
return;
/*
* This is very evil. We need to do this, because
* gtk_cell_editable_editing_done may trigger gtk_tree_view_row_changed
* later on. If gtk_tree_view_row_changed notices
* tree_view->priv->edited_column != NULL, it'll call
* gtk_tree_view_stop_editing again. Bad things will happen then.
*
* Please read that again if you intend to modify anything here.
*/
column = tree_view->priv->edited_column;
tree_view->priv->edited_column = NULL;
if (! cancel_editing)
gtk_cell_editable_editing_done (column->editable_widget);
tree_view->priv->edited_column = column;
gtk_cell_editable_remove_widget (column->editable_widget);
}
/**
* gtk_tree_view_set_hover_selection:
* @tree_view: a #GtkTreeView
* @hover: %TRUE to enable hover selection mode
*
* Enables of disables the hover selection mode of @tree_view.
* Hover selection makes the selected row follow the pointer.
* Currently, this works only for the selection modes
* %GTK_SELECTION_SINGLE and %GTK_SELECTION_BROWSE.
*
* Since: 2.6
**/
void
gtk_tree_view_set_hover_selection (GtkTreeView *tree_view,
gboolean hover)
{
hover = hover != FALSE;
if (hover != tree_view->priv->hover_selection)
{
tree_view->priv->hover_selection = hover;
g_object_notify (G_OBJECT (tree_view), "hover-selection");
}
}
/**
* gtk_tree_view_get_hover_selection:
* @tree_view: a #GtkTreeView
*
* Returns whether hover selection mode is turned on for @tree_view.
*
* Return value: %TRUE if @tree_view is in hover selection mode
*
* Since: 2.6
**/
gboolean
gtk_tree_view_get_hover_selection (GtkTreeView *tree_view)
{
return tree_view->priv->hover_selection;
}
Support separators in combo boxes and more generally in tree views 2004-07-07 Matthias Clasen <mclasen@redhat.com> Support separators in combo boxes and more generally in tree views (#135873): * gtk/gtkcombobox.h: * gtk/gtkcombobox.c (gtk_combo_box_get_row_separator_column): * gtk/gtkcombobox.c (gtk_combo_box_set_row_separator_column): Add a ::row-separator-column property with getter and setter, which can indicate a boolean model column to determine which rows are separators. * gtk/gtkcombobox.c: Display separator rows as separator menu items in menu mode, and by using the new treeview separator functionality in list mode. * gtk/gtktreeview.h: * gtk/gtktreeview.c (gtk_tree_view_get_row_separator_func): * gtk/gtktreeview.c (gtk_tree_view_set_row_separator_func): Add a callback to determine whether a row is a separator. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): * gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon): * gtk/gtktreeview.c (validate_row): Use the new callback to determine whether a row is a separator, and draw it as a separator then. Since separators should take up less vertical space than regular rows, this requires removing the redundant MAX(...,expander_size) calls which appear in many places. Instead, the MAX() is now only done in validate_row(), and only if the row is not a separator. To catch possible side effects of this intrusive change, I have left EXPANDER_MAX() calls in place of the MAX() calls which will emit a warning if something breaks. They should be removed before 2.6. * gtk/gtktreeselection.c (row_is_selectable): Don't let separator rows be selected. * tests/testcombo.c (create_blaat): Add a separator column.
2004-07-07 15:15:35 +00:00
/**
* gtk_tree_view_set_hover_expand:
* @tree_view: a #GtkTreeView
* @expand: %TRUE to enable hover selection mode
*
* Enables of disables the hover expansion mode of @tree_view.
* Hover expansion makes rows expand or collaps if the pointer
* moves over them.
*
* Since: 2.6
**/
void
gtk_tree_view_set_hover_expand (GtkTreeView *tree_view,
gboolean expand)
{
expand = expand != FALSE;
if (expand != tree_view->priv->hover_expand)
{
tree_view->priv->hover_expand = expand;
g_object_notify (G_OBJECT (tree_view), "hover-expand");
}
}
/**
* gtk_tree_view_get_hover_expand:
* @tree_view: a #GtkTreeView
*
* Returns whether hover expansion mode is turned on for @tree_view.
*
* Return value: %TRUE if @tree_view is in hover expansion mode
*
* Since: 2.6
**/
gboolean
gtk_tree_view_get_hover_expand (GtkTreeView *tree_view)
{
return tree_view->priv->hover_expand;
}
Support separators in combo boxes and more generally in tree views 2004-07-07 Matthias Clasen <mclasen@redhat.com> Support separators in combo boxes and more generally in tree views (#135873): * gtk/gtkcombobox.h: * gtk/gtkcombobox.c (gtk_combo_box_get_row_separator_column): * gtk/gtkcombobox.c (gtk_combo_box_set_row_separator_column): Add a ::row-separator-column property with getter and setter, which can indicate a boolean model column to determine which rows are separators. * gtk/gtkcombobox.c: Display separator rows as separator menu items in menu mode, and by using the new treeview separator functionality in list mode. * gtk/gtktreeview.h: * gtk/gtktreeview.c (gtk_tree_view_get_row_separator_func): * gtk/gtktreeview.c (gtk_tree_view_set_row_separator_func): Add a callback to determine whether a row is a separator. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): * gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon): * gtk/gtktreeview.c (validate_row): Use the new callback to determine whether a row is a separator, and draw it as a separator then. Since separators should take up less vertical space than regular rows, this requires removing the redundant MAX(...,expander_size) calls which appear in many places. Instead, the MAX() is now only done in validate_row(), and only if the row is not a separator. To catch possible side effects of this intrusive change, I have left EXPANDER_MAX() calls in place of the MAX() calls which will emit a warning if something breaks. They should be removed before 2.6. * gtk/gtktreeselection.c (row_is_selectable): Don't let separator rows be selected. * tests/testcombo.c (create_blaat): Add a separator column.
2004-07-07 15:15:35 +00:00
/**
* gtk_tree_view_get_row_separator_func:
* @tree_view: a #GtkTreeView
*
* Returns the current row separator function.
*
* Return value: the current row separator function.
*
* Since: 2.6
**/
GtkTreeViewRowSeparatorFunc
gtk_tree_view_get_row_separator_func (GtkTreeView *tree_view)
{
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), NULL);
return tree_view->priv->row_separator_func;
}
/**
* gtk_tree_view_set_row_separator_func:
* @tree_view: a #GtkTreeView
* @func: a #GtkTreeViewRowSeparatorFunc
Support separators in combo boxes and more generally in tree views 2004-07-07 Matthias Clasen <mclasen@redhat.com> Support separators in combo boxes and more generally in tree views (#135873): * gtk/gtkcombobox.h: * gtk/gtkcombobox.c (gtk_combo_box_get_row_separator_column): * gtk/gtkcombobox.c (gtk_combo_box_set_row_separator_column): Add a ::row-separator-column property with getter and setter, which can indicate a boolean model column to determine which rows are separators. * gtk/gtkcombobox.c: Display separator rows as separator menu items in menu mode, and by using the new treeview separator functionality in list mode. * gtk/gtktreeview.h: * gtk/gtktreeview.c (gtk_tree_view_get_row_separator_func): * gtk/gtktreeview.c (gtk_tree_view_set_row_separator_func): Add a callback to determine whether a row is a separator. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): * gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon): * gtk/gtktreeview.c (validate_row): Use the new callback to determine whether a row is a separator, and draw it as a separator then. Since separators should take up less vertical space than regular rows, this requires removing the redundant MAX(...,expander_size) calls which appear in many places. Instead, the MAX() is now only done in validate_row(), and only if the row is not a separator. To catch possible side effects of this intrusive change, I have left EXPANDER_MAX() calls in place of the MAX() calls which will emit a warning if something breaks. They should be removed before 2.6. * gtk/gtktreeselection.c (row_is_selectable): Don't let separator rows be selected. * tests/testcombo.c (create_blaat): Add a separator column.
2004-07-07 15:15:35 +00:00
* @data: user data to pass to @func, or %NULL
* @destroy: destroy notifier for @data, or %NULL
*
* Sets the row separator function, which is used to determine
* whether a row should be drawn as a separator. If the row separator
* function is %NULL, no separators are drawn. This is the default value.
Support separators in combo boxes and more generally in tree views 2004-07-07 Matthias Clasen <mclasen@redhat.com> Support separators in combo boxes and more generally in tree views (#135873): * gtk/gtkcombobox.h: * gtk/gtkcombobox.c (gtk_combo_box_get_row_separator_column): * gtk/gtkcombobox.c (gtk_combo_box_set_row_separator_column): Add a ::row-separator-column property with getter and setter, which can indicate a boolean model column to determine which rows are separators. * gtk/gtkcombobox.c: Display separator rows as separator menu items in menu mode, and by using the new treeview separator functionality in list mode. * gtk/gtktreeview.h: * gtk/gtktreeview.c (gtk_tree_view_get_row_separator_func): * gtk/gtktreeview.c (gtk_tree_view_set_row_separator_func): Add a callback to determine whether a row is a separator. * gtk/gtktreeview.c (gtk_tree_view_bin_expose): * gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon): * gtk/gtktreeview.c (validate_row): Use the new callback to determine whether a row is a separator, and draw it as a separator then. Since separators should take up less vertical space than regular rows, this requires removing the redundant MAX(...,expander_size) calls which appear in many places. Instead, the MAX() is now only done in validate_row(), and only if the row is not a separator. To catch possible side effects of this intrusive change, I have left EXPANDER_MAX() calls in place of the MAX() calls which will emit a warning if something breaks. They should be removed before 2.6. * gtk/gtktreeselection.c (row_is_selectable): Don't let separator rows be selected. * tests/testcombo.c (create_blaat): Add a separator column.
2004-07-07 15:15:35 +00:00
*
* Since: 2.6
**/
void
gtk_tree_view_set_row_separator_func (GtkTreeView *tree_view,
GtkTreeViewRowSeparatorFunc func,
gpointer data,
GtkDestroyNotify destroy)
{
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
if (tree_view->priv->row_separator_destroy)
(* tree_view->priv->row_separator_destroy) (tree_view->priv->row_separator_data);
tree_view->priv->row_separator_func = func;
tree_view->priv->row_separator_data = data;
tree_view->priv->row_separator_destroy = destroy;
}