diff options
author | Tim Janik <timj@gtk.org> | 2001-06-19 12:54:10 +0000 |
---|---|---|
committer | Tim Janik <timj@src.gnome.org> | 2001-06-19 12:54:10 +0000 |
commit | 5ebd1d022ac2fa4f32f4cdf218efd62c7ffaf323 (patch) | |
tree | 7591b5b7e706dde79cd2f8bd62f2eb98d0c3baa6 /tests | |
parent | 07ddd35c5710631b349c4517b4be4705b4438d08 (diff) | |
download | gtk+-5ebd1d022ac2fa4f32f4cdf218efd62c7ffaf323.tar.gz |
fix PROP_EVENTS.
Mon Jun 18 02:00:49 2001 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_get_property): fix PROP_EVENTS.
* gtk/Makefile.am:
* gtk/gtk.h: disabled GtkPacker compilation.
* gtk/gtkarg.[hc], gtk/gtkargcollector.c: got rid of these.
* gtk/gtknotebook.c:
* gtk/gtktable.c:
* gtk/gtkbox.c: ported this over to child properties.
* gtk/gtksettings.c: fetch class properties via
g_object_class_list_properties().
* gtk/gtkcontainer.[hc]: implemented child properties, got rid of the
child arg interface. use gobjectnotifyqueue.c for child property
notification.
* gtk/gtkwidget.[hc]: provide necessary means for container child
properties, i.e. ::child_notify signal,
gtk_widget_freeze_child_notify(),
gtk_widget_child_notify(),
gtk_widget_thaw_child_notify().
* tests/testgtk.c: removed inferior property handling code, for
property editing, a generic module should be used, and GLE
coincidentally fullfills that purpose.
* docs/reference/Makefile.am: disabled gtk docs building, gtk-doc
needs to be adapted to g_object_class_list_properties() before this
builds again.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/prop-editor.c | 4 | ||||
-rw-r--r-- | tests/testgtk.c | 297 |
2 files changed, 3 insertions, 298 deletions
diff --git a/tests/prop-editor.c b/tests/prop-editor.c index a8e3cc2610..701bde8030 100644 --- a/tests/prop-editor.c +++ b/tests/prop-editor.c @@ -35,8 +35,8 @@ get_param_specs (GType type, */ /* Use private interface for now, fix later */ - *specs = class->property_specs; - *n_specs = class->n_property_specs; + *specs = NULL; /* class->property_specs; */ + *n_specs = 0; /* class->n_property_specs; */ } typedef struct diff --git a/tests/testgtk.c b/tests/testgtk.c index cd0ad710ca..4c7d54c9ee 100644 --- a/tests/testgtk.c +++ b/tests/testgtk.c @@ -47,8 +47,6 @@ #define sleep(n) _sleep(n) #endif -#include "prop-editor.h" - #include "circles.xbm" #include "test.xpm" @@ -3534,15 +3532,6 @@ entry_toggle_sensitive (GtkWidget *checkbutton, } static void -entry_props_clicked (GtkWidget *button, - GObject *entry) -{ - GtkWidget *window = create_prop_editor (entry, 0); - - gtk_window_set_title (GTK_WINDOW (window), "Entry Properties"); -} - -static void create_entry (void) { static GtkWidget *window = NULL; @@ -3595,12 +3584,6 @@ create_entry (void) gtk_editable_select_region (GTK_EDITABLE (entry), 0, 5); gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0); - button = gtk_button_new_with_mnemonic ("_Props"); - gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); - gtk_signal_connect (GTK_OBJECT (button), "clicked", - GTK_SIGNAL_FUNC (entry_props_clicked), - entry); - cb = gtk_combo_new (); gtk_combo_set_popdown_strings (GTK_COMBO (cb), cbitems); gtk_entry_set_text (GTK_ENTRY (GTK_COMBO(cb)->entry), "hello world \n\n\n foo"); @@ -7488,15 +7471,6 @@ toggle_shrink (GtkWidget *widget, GtkWidget *child) gtk_widget_unref (child); } -static void -paned_props_clicked (GtkWidget *button, - GObject *paned) -{ - GtkWidget *window = create_prop_editor (paned, GTK_TYPE_PANED); - - gtk_window_set_title (GTK_WINDOW (window), "Paned Properties"); -} - GtkWidget * create_pane_options (GtkPaned *paned, const gchar *frame_label, @@ -7506,7 +7480,6 @@ create_pane_options (GtkPaned *paned, GtkWidget *frame; GtkWidget *table; GtkWidget *label; - GtkWidget *button; GtkWidget *check_button; frame = gtk_frame_new (frame_label); @@ -7557,13 +7530,6 @@ create_pane_options (GtkPaned *paned, GTK_SIGNAL_FUNC (toggle_shrink), paned->child2); - button = gtk_button_new_with_mnemonic ("_Properties"); - gtk_table_attach_defaults (GTK_TABLE (table), button, - 0, 2, 3, 4); - gtk_signal_connect (GTK_OBJECT (button), "clicked", - GTK_SIGNAL_FUNC (paned_props_clicked), - paned); - return frame; } @@ -9126,266 +9092,6 @@ create_progress_bar (void) } /* - * Properties - */ - -typedef struct { - int x; - int y; - gboolean found; - gboolean first; - GtkWidget *res_widget; -} FindWidgetData; - -static void -find_widget (GtkWidget *widget, FindWidgetData *data) -{ - GtkAllocation new_allocation; - gint x_offset = 0; - gint y_offset = 0; - - new_allocation = widget->allocation; - - if (data->found || !GTK_WIDGET_MAPPED (widget)) - return; - - /* Note that in the following code, we only count the - * position as being inside a WINDOW widget if it is inside - * widget->window; points that are outside of widget->window - * but within the allocation are not counted. This is consistent - * with the way we highlight drag targets. - */ - if (!GTK_WIDGET_NO_WINDOW (widget)) - { - new_allocation.x = 0; - new_allocation.y = 0; - } - - if (widget->parent && !data->first) - { - GdkWindow *window = widget->window; - while (window != widget->parent->window) - { - gint tx, ty, twidth, theight; - gdk_window_get_size (window, &twidth, &theight); - - if (new_allocation.x < 0) - { - new_allocation.width += new_allocation.x; - new_allocation.x = 0; - } - if (new_allocation.y < 0) - { - new_allocation.height += new_allocation.y; - new_allocation.y = 0; - } - if (new_allocation.x + new_allocation.width > twidth) - new_allocation.width = twidth - new_allocation.x; - if (new_allocation.y + new_allocation.height > theight) - new_allocation.height = theight - new_allocation.y; - - gdk_window_get_position (window, &tx, &ty); - new_allocation.x += tx; - x_offset += tx; - new_allocation.y += ty; - y_offset += ty; - - window = gdk_window_get_parent (window); - } - } - - if ((data->x >= new_allocation.x) && (data->y >= new_allocation.y) && - (data->x < new_allocation.x + new_allocation.width) && - (data->y < new_allocation.y + new_allocation.height)) - { - /* First, check if the drag is in a valid drop site in - * one of our children - */ - if (GTK_IS_CONTAINER (widget)) - { - FindWidgetData new_data = *data; - - new_data.x -= x_offset; - new_data.y -= y_offset; - new_data.found = FALSE; - new_data.first = FALSE; - - gtk_container_forall (GTK_CONTAINER (widget), - (GtkCallback)find_widget, - &new_data); - - data->found = new_data.found; - if (data->found) - data->res_widget = new_data.res_widget; - } - - /* If not, and this widget is registered as a drop site, check to - * emit "drag_motion" to check if we are actually in - * a drop site. - */ - if (!data->found) - { - data->found = TRUE; - data->res_widget = widget; - } - } -} - -static GtkWidget * -find_widget_at_pointer (void) -{ - GtkWidget *widget = NULL; - GdkWindow *pointer_window; - gint x, y; - FindWidgetData data; - - pointer_window = gdk_window_at_pointer (NULL, NULL); - - if (pointer_window) - gdk_window_get_user_data (pointer_window, (gpointer*) &widget); - - if (widget) - { - gdk_window_get_pointer (widget->window, - &x, &y, NULL); - - data.x = x; - data.y = y; - data.found = FALSE; - data.first = TRUE; - - find_widget (widget, &data); - if (data.found) - return data.res_widget; - return widget; - } - return NULL; -} - -struct PropertiesData { - GtkWidget **window; - GdkCursor *cursor; - gboolean in_query; - gint handler; -}; - -static void -destroy_properties (GtkWidget *widget, - struct PropertiesData *data) -{ - if (data->window) - { - *data->window = NULL; - data->window = NULL; - } - - if (data->cursor) - { - gdk_cursor_destroy (data->cursor); - data->cursor = NULL; - } - - if (data->handler) - { - gtk_signal_disconnect (widget, data->handler); - data->handler = 0; - } - - g_free (data); -} - -static gint -property_query_event (GtkWidget *widget, - GdkEvent *event, - struct PropertiesData *data) -{ - GtkWidget *res_widget = NULL; - - if (!data->in_query) - return FALSE; - - if (event->type == GDK_BUTTON_RELEASE) - { - gtk_grab_remove (widget); - gdk_pointer_ungrab (GDK_CURRENT_TIME); - - res_widget = find_widget_at_pointer (); - if (res_widget) - create_prop_editor (G_OBJECT (res_widget), 0); - - data->in_query = FALSE; - } - return FALSE; -} - - -static void -query_properties (GtkButton *button, - struct PropertiesData *data) -{ - gint failure; - - gtk_signal_connect (GTK_OBJECT (button), "event", - (GtkSignalFunc) property_query_event, data); - - - if (!data->cursor) - data->cursor = gdk_cursor_new (GDK_TARGET); - - failure = gdk_pointer_grab (GTK_WIDGET (button)->window, - TRUE, - GDK_BUTTON_RELEASE_MASK, - NULL, - data->cursor, - GDK_CURRENT_TIME); - - gtk_grab_add (GTK_WIDGET (button)); - - data->in_query = TRUE; -} - -static void -create_properties (void) -{ - static GtkWidget *window = NULL; - GtkWidget *button; - struct PropertiesData *data; - - data = g_new (struct PropertiesData, 1); - data->window = &window; - data->in_query = FALSE; - data->cursor = NULL; - data->handler = 0; - - if (!window) - { - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - - data->handler = gtk_signal_connect (GTK_OBJECT (window), "destroy", - GTK_SIGNAL_FUNC(destroy_properties), - data); - - gtk_window_set_title (GTK_WINDOW (window), "test properties"); - gtk_container_set_border_width (GTK_CONTAINER (window), 10); - - button = gtk_button_new_with_label ("Query properties"); - gtk_signal_connect (GTK_OBJECT (button), "clicked", - GTK_SIGNAL_FUNC(query_properties), - data); - - - gtk_container_add (GTK_CONTAINER (window), button); - } - - if (!GTK_WIDGET_VISIBLE (window)) - gtk_widget_show_all (window); - else - gtk_widget_destroy (window); - -} - - -/* * Color Preview */ @@ -9794,7 +9500,7 @@ scroll_test_configure (GtkWidget *widget, GdkEventConfigure *event, static void scroll_test_adjustment_changed (GtkAdjustment *adj, GtkWidget *widget) { - gint source_min = (int)adj->value - scroll_test_pos; + /* gint source_min = (int)adj->value - scroll_test_pos; */ gint dy; dy = scroll_test_pos - (int)adj->value; @@ -10604,7 +10310,6 @@ create_main_window (void) { "preview color", create_color_preview }, { "preview gray", create_gray_preview }, { "progress bar", create_progress_bar }, - { "properties", create_properties }, { "radio buttons", create_radio_buttons }, { "range controls", create_range_controls }, { "rc file", create_rc_file }, |