diff options
author | Owen Taylor <otaylor@gtk.org> | 1998-12-07 06:37:27 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 1998-12-07 06:37:27 +0000 |
commit | 621beb8aaf93c8cfe234723d7001e114ac5a8345 (patch) | |
tree | 40c4267ff9db1dbbe02c70bb1dee962c2e8a20a8 /tests | |
parent | fd7bdf03e002ecd5686ecab534b6254d83ea20ba (diff) | |
download | gdk-pixbuf-621beb8aaf93c8cfe234723d7001e114ac5a8345.tar.gz |
New functions gtk_window_set_transient_for() - set up a "transient for"
Mon Dec 7 01:29:27 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkwindow.c: New functions
gtk_window_set_transient_for() - set up a "transient for" relationship.
gtk_window_set_default_size() - set the initial size of a window
distinct from its minimum size.
gtk_window_set_geometry_hints() - Allow the user to set
minimum, maximum sizes, aspect rations, and gridded geometry,
possibly all with respect to a subwidget of the window.
These interfaces are still a wee bit experimental.
* gdk/gdk.c: Added gdk_window_set_transient_for(),
gdk_window_set_geometry_hints(), and gdk_window_set_role().
* gdk/gdktypes.h: Added new types for find-grained specification
of WM hints.
* gtk/testgtk.c: Various changes to tests to test the
above new functions.
* gtk/gtkfontsel.c: Squash a few 'const' warnings.
* gtk/gtktogglebutton.c (gtk_toggle_button_realize): Restored
call to gtk_style_set_background() to prevent egregious
flashing to black.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testgtk.c | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/tests/testgtk.c b/tests/testgtk.c index 08e7edc59..f2f22dcad 100644 --- a/tests/testgtk.c +++ b/tests/testgtk.c @@ -2375,7 +2375,7 @@ cmw_destroy_cb(GtkWidget *widget) } static void -cmw_color (GtkWidget *widget) +cmw_color (GtkWidget *widget, GtkWidget *parent) { GtkWidget *csd; @@ -2383,6 +2383,9 @@ cmw_color (GtkWidget *widget) /* Set as modal */ gtk_window_set_modal (GTK_WINDOW(csd),TRUE); + + /* And mark it as a transient dialog */ + gtk_window_set_transient_for (GTK_WINDOW (csd), GTK_WINDOW (parent)); gtk_signal_connect (GTK_OBJECT(csd), "destroy", GTK_SIGNAL_FUNC(cmw_destroy_cb),NULL); @@ -2400,7 +2403,7 @@ cmw_color (GtkWidget *widget) } static void -cmw_file (GtkWidget *widget) +cmw_file (GtkWidget *widget, GtkWidget *parent) { GtkWidget *fs; @@ -2409,6 +2412,9 @@ cmw_file (GtkWidget *widget) /* Set as modal */ gtk_window_set_modal (GTK_WINDOW(fs),TRUE); + /* And mark it as a transient dialog */ + gtk_window_set_transient_for (GTK_WINDOW (fs), GTK_WINDOW (parent)); + gtk_signal_connect (GTK_OBJECT(fs), "destroy", GTK_SIGNAL_FUNC(cmw_destroy_cb),NULL); @@ -2471,9 +2477,9 @@ create_modal_window (void) GTK_SIGNAL_FUNC (cmw_destroy_cb),NULL); gtk_signal_connect (GTK_OBJECT (btnColor), "clicked", - GTK_SIGNAL_FUNC (cmw_color),NULL); + GTK_SIGNAL_FUNC (cmw_color),window); gtk_signal_connect (GTK_OBJECT (btnFile), "clicked", - GTK_SIGNAL_FUNC (cmw_file),NULL); + GTK_SIGNAL_FUNC (cmw_file),window); /* Show widgets */ gtk_widget_show_all (window); @@ -2558,6 +2564,7 @@ create_scrolled_windows (void) gtk_widget_grab_default (button); gtk_widget_show (button); + gtk_window_set_default_size (GTK_WINDOW (window), 300, 300); } if (!GTK_WIDGET_VISIBLE (window)) @@ -7548,6 +7555,8 @@ create_scroll_test (void) GtkWidget *scrollbar; GtkWidget *button; GtkAdjustment *adj; + GdkGeometry geometry; + GdkWindowHints geometry_mask; if (!window) { @@ -7599,6 +7608,22 @@ create_scroll_test (void) GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT (window)); gtk_widget_show (button); + + /* Set up gridded geometry */ + + geometry_mask = GDK_HINT_MIN_SIZE | + GDK_HINT_BASE_SIZE | + GDK_HINT_RESIZE_INC; + + geometry.min_width = 20; + geometry.min_height = 20; + geometry.base_width = 0; + geometry.base_height = 0; + geometry.width_inc = 10; + geometry.height_inc = 10; + + gtk_window_set_geometry_hints (GTK_WINDOW (window), + drawing_area, &geometry, geometry_mask); } if (!GTK_WIDGET_VISIBLE (window)) @@ -8109,7 +8134,8 @@ void create_layout (void) { sprintf(buf, "Button %d, %d", i, j); if ((i + j) % 2) - button = gtk_button_new_with_label (buf); + // button = gtk_button_new_with_label (buf); + button = gtk_combo_new(); else button = gtk_label_new (buf); |