Commit 7c659465 authored by Soeren Sandmann's avatar Soeren Sandmann Committed by Søren Sandmann Pedersen

Add support for OS X like sliding of toolbar items during drag and drop,

Mon Oct 20 20:27:22 2003  Soeren Sandmann  <sandmann@daimi.au.dk>

	Add support for OS X like sliding of toolbar items during drag and
	drop, (#110919, Dave Bordoley)

	Make dnd highlighting the responsibility of the
	application. (Fixes #116298, Owen Taylor)

	* gtk/gtktoolbar.h: Add prototypes for new API.

	* gtk/gtktoolbar.c
	(physical_to_logical, logical_to_physical): new functions
	converting between "position including placeholders" and "position
	excluding placeholders".
	(gtk_toolbar_class_init): remove drag_leave and drag_motion
	handlers
	(struct _ToolbarContent): new struct containing information
	related to toolbar items.
	(gtk_toolbar_highlight_drop_location): new public function
	(gtk_toolbar_unhighlight_drop_location): new public function

	* tests/testtoolbar.c
	(toolbar_drag_motion, toolbar_drag_leave): new functions
	(main): connect to dnd signals.  Make the "New" item expand to
	make drag and drop more exciting.
parent c7353d84
Mon Oct 20 20:27:22 2003 Soeren Sandmann <sandmann@daimi.au.dk>
Add support for OS X like sliding of toolbar items during drag and
drop, (#110919, Dave Bordoley)
Make dnd highlighting the responsibility of the
application. (Fixes #116298, Owen Taylor)
* gtk/gtktoolbar.h: Add prototypes for new API.
* gtk/gtktoolbar.c
(physical_to_logical, logical_to_physical): new functions
converting between "position including placeholders" and "position
excluding placeholders".
(gtk_toolbar_class_init): remove drag_leave and drag_motion
handlers
(struct _ToolbarContent): new struct containing information
related to toolbar items.
(gtk_toolbar_highlight_drop_location): new public function
(gtk_toolbar_unhighlight_drop_location): new public function
* tests/testtoolbar.c
(toolbar_drag_motion, toolbar_drag_leave): new functions
(main): connect to dnd signals. Make the "New" item expand to
make drag and drop more exciting.
Wed Oct 15 22:39:23 2003 Kristian Rietveld <kris@gtk.org>
* gtk/gtkcomboboxentry.c (gtk_combo_box_entry_init): it's
......
Mon Oct 20 20:27:22 2003 Soeren Sandmann <sandmann@daimi.au.dk>
Add support for OS X like sliding of toolbar items during drag and
drop, (#110919, Dave Bordoley)
Make dnd highlighting the responsibility of the
application. (Fixes #116298, Owen Taylor)
* gtk/gtktoolbar.h: Add prototypes for new API.
* gtk/gtktoolbar.c
(physical_to_logical, logical_to_physical): new functions
converting between "position including placeholders" and "position
excluding placeholders".
(gtk_toolbar_class_init): remove drag_leave and drag_motion
handlers
(struct _ToolbarContent): new struct containing information
related to toolbar items.
(gtk_toolbar_highlight_drop_location): new public function
(gtk_toolbar_unhighlight_drop_location): new public function
* tests/testtoolbar.c
(toolbar_drag_motion, toolbar_drag_leave): new functions
(main): connect to dnd signals. Make the "New" item expand to
make drag and drop more exciting.
Wed Oct 15 22:39:23 2003 Kristian Rietveld <kris@gtk.org>
* gtk/gtkcomboboxentry.c (gtk_combo_box_entry_init): it's
......
Mon Oct 20 20:27:22 2003 Soeren Sandmann <sandmann@daimi.au.dk>
Add support for OS X like sliding of toolbar items during drag and
drop, (#110919, Dave Bordoley)
Make dnd highlighting the responsibility of the
application. (Fixes #116298, Owen Taylor)
* gtk/gtktoolbar.h: Add prototypes for new API.
* gtk/gtktoolbar.c
(physical_to_logical, logical_to_physical): new functions
converting between "position including placeholders" and "position
excluding placeholders".
(gtk_toolbar_class_init): remove drag_leave and drag_motion
handlers
(struct _ToolbarContent): new struct containing information
related to toolbar items.
(gtk_toolbar_highlight_drop_location): new public function
(gtk_toolbar_unhighlight_drop_location): new public function
* tests/testtoolbar.c
(toolbar_drag_motion, toolbar_drag_leave): new functions
(main): connect to dnd signals. Make the "New" item expand to
make drag and drop more exciting.
Wed Oct 15 22:39:23 2003 Kristian Rietveld <kris@gtk.org>
* gtk/gtkcomboboxentry.c (gtk_combo_box_entry_init): it's
......
Mon Oct 20 20:27:22 2003 Soeren Sandmann <sandmann@daimi.au.dk>
Add support for OS X like sliding of toolbar items during drag and
drop, (#110919, Dave Bordoley)
Make dnd highlighting the responsibility of the
application. (Fixes #116298, Owen Taylor)
* gtk/gtktoolbar.h: Add prototypes for new API.
* gtk/gtktoolbar.c
(physical_to_logical, logical_to_physical): new functions
converting between "position including placeholders" and "position
excluding placeholders".
(gtk_toolbar_class_init): remove drag_leave and drag_motion
handlers
(struct _ToolbarContent): new struct containing information
related to toolbar items.
(gtk_toolbar_highlight_drop_location): new public function
(gtk_toolbar_unhighlight_drop_location): new public function
* tests/testtoolbar.c
(toolbar_drag_motion, toolbar_drag_leave): new functions
(main): connect to dnd signals. Make the "New" item expand to
make drag and drop more exciting.
Wed Oct 15 22:39:23 2003 Kristian Rietveld <kris@gtk.org>
* gtk/gtkcomboboxentry.c (gtk_combo_box_entry_init): it's
......
Mon Oct 20 20:27:22 2003 Soeren Sandmann <sandmann@daimi.au.dk>
Add support for OS X like sliding of toolbar items during drag and
drop, (#110919, Dave Bordoley)
Make dnd highlighting the responsibility of the
application. (Fixes #116298, Owen Taylor)
* gtk/gtktoolbar.h: Add prototypes for new API.
* gtk/gtktoolbar.c
(physical_to_logical, logical_to_physical): new functions
converting between "position including placeholders" and "position
excluding placeholders".
(gtk_toolbar_class_init): remove drag_leave and drag_motion
handlers
(struct _ToolbarContent): new struct containing information
related to toolbar items.
(gtk_toolbar_highlight_drop_location): new public function
(gtk_toolbar_unhighlight_drop_location): new public function
* tests/testtoolbar.c
(toolbar_drag_motion, toolbar_drag_leave): new functions
(main): connect to dnd signals. Make the "New" item expand to
make drag and drop more exciting.
Wed Oct 15 22:39:23 2003 Kristian Rietveld <kris@gtk.org>
* gtk/gtkcomboboxentry.c (gtk_combo_box_entry_init): it's
......
This diff is collapsed.
......@@ -91,21 +91,21 @@ typedef struct _GtkToolbarPrivate GtkToolbarPrivate;
struct _GtkToolbar
{
GtkContainer container;
gint num_children;
GList *children;
GtkOrientation orientation;
GtkToolbarStyle style;
GtkIconSize icon_size;
GtkTooltips *tooltips;
gint button_maxw; /* maximum width of homogeneous children */
gint button_maxh; /* maximum height of homogeneous children */
guint style_set_connection;
guint icon_size_connection;
guint style_set : 1;
guint icon_size_set : 1;
};
......@@ -113,7 +113,7 @@ struct _GtkToolbar
struct _GtkToolbarClass
{
GtkContainerClass parent_class;
/* signals */
void (* orientation_changed) (GtkToolbar *toolbar,
GtkOrientation orientation);
......@@ -123,7 +123,7 @@ struct _GtkToolbarClass
gint x,
gint y,
gint button_number);
/* Padding for future expansion */
void (*_gtk_reserved1) (void);
void (*_gtk_reserved2) (void);
......@@ -131,33 +131,39 @@ struct _GtkToolbarClass
};
GType gtk_toolbar_get_type (void) G_GNUC_CONST;
GtkWidget* gtk_toolbar_new (void);
void gtk_toolbar_insert (GtkToolbar *toolbar,
GtkToolItem *item,
gint pos);
gint gtk_toolbar_get_item_index (GtkToolbar *toolbar,
GtkToolItem *item);
gint gtk_toolbar_get_n_items (GtkToolbar *toolbar);
GtkToolItem * gtk_toolbar_get_nth_item (GtkToolbar *toolbar,
gint n);
gint gtk_toolbar_get_drop_index (GtkToolbar *toolbar,
gint x,
gint y);
void gtk_toolbar_set_show_arrow (GtkToolbar *toolbar,
gboolean show_arrow);
void gtk_toolbar_set_orientation (GtkToolbar *toolbar,
GtkOrientation orientation);
void gtk_toolbar_set_tooltips (GtkToolbar *toolbar,
gboolean enable);
gboolean gtk_toolbar_get_show_arrow (GtkToolbar *toolbar);
GtkOrientation gtk_toolbar_get_orientation (GtkToolbar *toolbar);
GtkToolbarStyle gtk_toolbar_get_style (GtkToolbar *toolbar);
GtkIconSize gtk_toolbar_get_icon_size (GtkToolbar *toolbar);
gboolean gtk_toolbar_get_tooltips (GtkToolbar *toolbar);
GtkReliefStyle gtk_toolbar_get_relief_style (GtkToolbar *toolbar);
void gtk_toolbar_set_style (GtkToolbar *toolbar,
GtkToolbarStyle style);
void gtk_toolbar_unset_style (GtkToolbar *toolbar);
GtkWidget* gtk_toolbar_new (void);
void gtk_toolbar_insert (GtkToolbar *toolbar,
GtkToolItem *item,
gint pos);
gint gtk_toolbar_get_item_index (GtkToolbar *toolbar,
GtkToolItem *item);
gint gtk_toolbar_get_n_items (GtkToolbar *toolbar);
GtkToolItem * gtk_toolbar_get_nth_item (GtkToolbar *toolbar,
gint n);
void gtk_toolbar_set_show_arrow (GtkToolbar *toolbar,
gboolean show_arrow);
void gtk_toolbar_set_orientation (GtkToolbar *toolbar,
GtkOrientation orientation);
void gtk_toolbar_set_tooltips (GtkToolbar *toolbar,
gboolean enable);
gboolean gtk_toolbar_get_show_arrow (GtkToolbar *toolbar);
GtkOrientation gtk_toolbar_get_orientation (GtkToolbar *toolbar);
GtkToolbarStyle gtk_toolbar_get_style (GtkToolbar *toolbar);
GtkIconSize gtk_toolbar_get_icon_size (GtkToolbar *toolbar);
gboolean gtk_toolbar_get_tooltips (GtkToolbar *toolbar);
GtkReliefStyle gtk_toolbar_get_relief_style (GtkToolbar *toolbar);
void gtk_toolbar_set_style (GtkToolbar *toolbar,
GtkToolbarStyle style);
void gtk_toolbar_unset_style (GtkToolbar *toolbar);
gint gtk_toolbar_get_drop_index (GtkToolbar *toolbar,
gint x,
gint y);
void gtk_toolbar_highlight_drop_location (GtkToolbar *toolbar,
gint x,
gint y,
gint width,
gint height);
void gtk_toolbar_unhighlight_drop_location (GtkToolbar *toolbar);
......
......@@ -472,6 +472,28 @@ popup_context_menu (GtkToolbar *toolbar, gint x, gint y, gint button_number)
return TRUE;
}
static gboolean
toolbar_drag_motion (GtkToolbar *toolbar,
GdkDragContext *context,
gint x,
gint y,
guint time,
gpointer null)
{
gdk_drag_status (context, GDK_ACTION_MOVE, time);
gtk_toolbar_highlight_drop_location (toolbar, x, y, 100, 60);
return TRUE;
}
static void
toolbar_drag_leave (GtkToolbar *toolbar,
GdkDragContext *context,
guint time,
gpointer null)
{
gtk_toolbar_unhighlight_drop_location (toolbar);
}
gint
main (gint argc, gchar **argv)
{
......@@ -577,6 +599,7 @@ main (gint argc, gchar **argv)
gtk_tool_button_set_label (GTK_TOOL_BUTTON (item), NULL);
add_item_to_list (store, item, "New");
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
gtk_tool_item_set_expand (item, TRUE);
item = gtk_tool_button_new_from_stock (GTK_STOCK_OPEN);
add_item_to_list (store, item, "Open");
......@@ -624,7 +647,10 @@ main (gint argc, gchar **argv)
add_item_to_list (store, item, "Left");
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
item = gtk_radio_tool_button_new_from_stock (group, GTK_STOCK_JUSTIFY_CENTER); make_prop_editor (G_OBJECT (item));
item = gtk_radio_tool_button_new_from_stock (group, GTK_STOCK_JUSTIFY_CENTER);
#if 0
make_prop_editor (G_OBJECT (item));
#endif
group = gtk_radio_tool_button_get_group (GTK_RADIO_TOOL_BUTTON (item));
add_item_to_list (store, item, "Center");
......@@ -668,12 +694,18 @@ main (gint argc, gchar **argv)
gtk_drag_dest_set (toolbar, GTK_DEST_DEFAULT_DROP,
target_table, G_N_ELEMENTS (target_table),
GDK_ACTION_MOVE);
g_signal_connect (toolbar, "drag_motion",
G_CALLBACK (toolbar_drag_motion), NULL);
g_signal_connect (toolbar, "drag_leave",
G_CALLBACK (toolbar_drag_leave), NULL);
g_signal_connect (toolbar, "drag_drop",
G_CALLBACK (toolbar_drag_drop), label);
gtk_widget_show_all (window);
#if 0
make_prop_editor (G_OBJECT (toolbar));
#endif
g_signal_connect (window, "delete_event", G_CALLBACK (gtk_main_quit), NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment