summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLars Hamann <lars@gtk.org>1998-12-16 01:28:31 +0000
committerOwen Taylor <otaylor@src.gnome.org>1998-12-16 01:28:31 +0000
commit8a202e6f5b6303b612fe80b90934089e71b71908 (patch)
treeb21be69b77f1731c9a638a90da7783dfa31ff154 /tests
parent1566d988672c8c86813e1e748645aee44686de73 (diff)
downloadgdk-pixbuf-8a202e6f5b6303b612fe80b90934089e71b71908.tar.gz
removed clist flag : GTK_CLIST_DRAG_SELECTION added flags :
Tue Dec 15 22:30:44 1998 Lars Hamann <lars@gtk.org> * gtk/gtkclist.h : removed clist flag : GTK_CLIST_DRAG_SELECTION added flags : GTK_CLIST_REORDERABLE, GTK_CLIST_USE_DRAG_ICONS, GTK_CLIST_DRAW_DRAG_LINE, GTK_CLIST_DRAW_DRAG_RECT (GtkCListDragPos) : new enum for DND (GtkButtonAction) : new enum of possible mouse button actions (struct _GtkCList): added button_actions array. Added drag_button and click_cell struct, to store cell and mouse button of last button_press_event (struct _GtkCListClass): new class method draw_drag_highlight. (gtk_clist_set_reorderable) (gtk_clist_set_use_drag_icons) : new functions. Moved from gtkctree.h. Now clist is reorderable as well. (gtk_clist_set_button_actions) new function to customize mouse button actions. * gtk/gtkclist.c: (gtk_clist_drag_begin) (gtk_clist_drag_motion) (gtk_clist_drag_leave) (gtk_clist_drag_end) (gtk_clist_drag_drop) (gtk_clist_drag_data_get) (gtk_clist_drag_data_received) : new dnd widget methods to implement clists reorderability via DND (remove_grab) : new function. remove mouse grab if necessary. (draw_drag_highlight) : new method. Draw dnd highlight depending on clist flags GTK_CLIST_DRAW_DRAG_LINE and GTK_CLIST_DRAW_DRAG_RECT (gtk_clist_class_init): added object args "reorderable" and "use_drag_icons" (gtk_clist_button_press) (gtk_clist_button_release) : use button_actions array to decide which action to perform. (gtk_clist_motion) : start reorder operation if necessary. * gtk/gtkctree.h : (struct _GtkCTree): removed drag_icon, icon_widht, icon_height, drag_row, drag_source, drag_target, reorderable, use_icons, in_drag, drag_rect (gtk_ctree_set_reorderable) : deprecated function. use gtk_clist_set_reorderable instead. (gtk_ctree_set_use_drag_icons) : deprecated function. use gtk_clist_set_use_drag_icons instead. * gtk/gtkctree.c : (gtk_ctree_class_init): removed object args "reorderable" and and "use_drag_icons" (draw_xor_line) (draw_xor_rect) (create_drag_icon) (check_cursor) (tree_toggle_selection) (set_mouse_cursor) : removed (draw_drag_highlight) : new clist method. replacement for draw_xor_line and draw_xor_rect functions (check_drag) renamed check_cursor function (gtk_ctree_drag_begin) (gtk_ctree_drag_motion) (gtk_ctree_drag_data_received) : new dnd methods to implement ctrees reorderability via DND (gtk_ctree_button_release) (gtk_ctree_button_motion) : removed. * gtk/testgtk.c: (create_clist) : added new reorderable toggle button
Diffstat (limited to 'tests')
-rw-r--r--tests/testgtk.c102
1 files changed, 12 insertions, 90 deletions
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 52f88989f..0cf829b36 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -3722,6 +3722,11 @@ hide_titles_clist (GtkWidget *widget, gpointer data)
gtk_clist_column_titles_hide (GTK_CLIST (data));
}
+void toggle_reorderable (GtkWidget *widget, GtkCList *clist)
+{
+ gtk_clist_set_reorderable (clist, GTK_TOGGLE_BUTTON (widget)->active);
+}
+
void
select_clist (GtkWidget *widget,
gint row,
@@ -3995,6 +4000,7 @@ create_clist (void)
GtkWidget *button;
GtkWidget *separator;
GtkWidget *scrolled_win;
+ GtkWidget *check;
GtkWidget *undo_button;
GtkWidget *label;
@@ -4097,6 +4103,12 @@ create_clist (void)
gtk_signal_connect (GTK_OBJECT (undo_button), "clicked",
(GtkSignalFunc) undo_selection, (gpointer) clist);
+ check = gtk_check_button_new_with_label ("Reorderable");
+ gtk_signal_connect (GTK_OBJECT (check), "clicked",
+ GTK_SIGNAL_FUNC (toggle_reorderable), clist);
+ gtk_box_pack_start (GTK_BOX (box2), check, FALSE, TRUE, 0);
+ gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (check), TRUE);
+
label = gtk_label_new ("Selection Mode :");
gtk_box_pack_start (GTK_BOX (box2), label, FALSE, TRUE, 0);
@@ -4112,18 +4124,6 @@ create_clist (void)
* the rest of the clist configuration
*/
- /*
- gtk_signal_connect (GTK_OBJECT (clist),
- "select_row",
- (GtkSignalFunc) select_clist,
- undo_button);
-
- gtk_signal_connect (GTK_OBJECT (clist),
- "unselect_row",
- (GtkSignalFunc) unselect_clist,
- undo_button);
- */
-
gtk_clist_set_row_height (GTK_CLIST (clist), 18);
gtk_widget_set_usize (clist, -1, 300);
@@ -4275,74 +4275,6 @@ void after_move (GtkCTree *ctree, GtkCTreeNode *child, GtkCTreeNode *parent,
(parent) ? target1 : "nil", (sibling) ? target2 : "nil");
}
-gint button_press (GtkCTree *ctree, GdkEventButton *event, gpointer data)
-{
- gint row;
- gint column;
- GtkCTreeNode *work;
- gint res;
-
- res = gtk_clist_get_selection_info (GTK_CLIST (ctree), event->x, event->y,
- &row, &column);
- if (!res && event->button != 3)
- return FALSE;
-
- work = GTK_CTREE_NODE (g_list_nth (GTK_CLIST (ctree)->row_list, row));
-
- switch (event->button)
- {
- case 1:
- if (GTK_CLIST (ctree)->selection_mode == GTK_SELECTION_MULTIPLE &&
- event->state & GDK_SHIFT_MASK)
- gtk_signal_emit_stop_by_name (GTK_OBJECT (ctree),"button_press_event");
- break;
- case 2:
- if (GTK_CTREE_ROW (work)->children &&
- gtk_ctree_is_hot_spot (ctree, event->x, event->y))
- {
- if (GTK_CTREE_ROW (work)->expanded)
- gtk_ctree_collapse_recursive (ctree, work);
- else
- gtk_ctree_expand_recursive (ctree, work);
- after_press (ctree, NULL);
- gtk_signal_emit_stop_by_name (GTK_OBJECT (ctree),
- "button_press_event");
- }
- break;
- default:
- break;
- }
- return FALSE;
-}
-
-gint button_release (GtkCTree *ctree, GdkEventButton *event, gpointer data)
-{
- gint row;
- gint column;
- GtkCTreeNode *work;
- gint res;
-
- res = gtk_clist_get_selection_info (GTK_CLIST (ctree), event->x, event->y,
- &row, &column);
- if (!res || event->button != 1)
- return FALSE;
-
- work = GTK_CTREE_NODE (g_list_nth (GTK_CLIST (ctree)->row_list, row));
-
- if (GTK_CLIST (ctree)->selection_mode == GTK_SELECTION_MULTIPLE &&
- event->state & GDK_SHIFT_MASK)
- {
- if (GTK_CTREE_ROW (work)->row.state == GTK_STATE_SELECTED)
- gtk_ctree_unselect_recursive (ctree, work);
- else
- gtk_ctree_select_recursive (ctree, work);
- after_press (ctree, NULL);
- gtk_signal_emit_stop_by_name (GTK_OBJECT (ctree),
- "button_release_event");
- }
- return FALSE;
-}
-
void count_items (GtkCTree *ctree, GtkCTreeNode *list)
{
if (GTK_CTREE_ROW (list)->is_leaf)
@@ -4616,11 +4548,6 @@ void change_row_height (GtkWidget *widget, GtkCList *clist)
gtk_clist_set_row_height (clist, GTK_ADJUSTMENT (widget)->value);
}
-void toggle_reorderable (GtkWidget *widget, GtkCTree *ctree)
-{
- gtk_ctree_set_reorderable (ctree, GTK_TOGGLE_BUTTON (widget)->active);
-}
-
void set_background (GtkCTree *ctree, GtkCTreeNode *node, gpointer data)
{
GtkStyle *style = NULL;
@@ -4953,16 +4880,11 @@ void create_ctree (void)
gtk_ctree_set_line_style (ctree, GTK_CTREE_LINES_DOTTED);
line_style = GTK_CTREE_LINES_DOTTED;
- gtk_ctree_set_reorderable (ctree, TRUE);
gtk_signal_connect (GTK_OBJECT (ctree), "click_column",
(GtkSignalFunc) ctree_click_column,
NULL);
- gtk_signal_connect (GTK_OBJECT (ctree), "button_press_event",
- GTK_SIGNAL_FUNC (button_press), NULL);
gtk_signal_connect_after (GTK_OBJECT (ctree), "button_press_event",
GTK_SIGNAL_FUNC (after_press), NULL);
- gtk_signal_connect (GTK_OBJECT (ctree), "button_release_event",
- GTK_SIGNAL_FUNC (button_release), NULL);
gtk_signal_connect_after (GTK_OBJECT (ctree), "button_release_event",
GTK_SIGNAL_FUNC (after_press), NULL);
gtk_signal_connect_after (GTK_OBJECT (ctree), "tree_move",