Re: Resizing window
- From: "Samuel Cormier-Iijima" <sciyoshi gmail com>
- To: "Iago Rubio" <iago iagorubio com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Resizing window
- Date: Sat, 9 Sep 2006 13:16:46 -0400
Hi,
Sorry for replying so late... but your example didn't really work for
me. Basically, I need a GtkExpander inside a file chooser dialog for
some advanced options. I'd like it to work similarly to the
FileChooserDialog when in "save" mode (try it out with GEdit->Save As,
and the expander makes the window grow bigger to fit the dialog).
However, my expander grows *into* the window - the window doesn't
change size, the filechooser widget shrinks. How can I fix this to
make it act similarly to the open file dialog?
Thanks,
Samuel Cormier-Iijima
On 8/22/06, Iago Rubio <iago iagorubio com> wrote:
On Tue, 2006-08-22 at 11:54 +0200, Iago Rubio wrote:
> On Tue, 2006-08-22 at 09:22 +0200, Fernando Apesteguía wrote:
> > I'm still looking for a solution. My app has internationalization support.
> > So make the window fixed is not possible in order to allow all the different
> > messages to fit in the window. I'll read more documentation.
> >
> > More ideas?
>
> Have you tried to pick the child's requisition and resize the window to
> it ?
>
> Try out the example attached.
Sorry, the attachment didn't make it.
// gcc test.c -o test `pkg-config --cflags --libs gtk+-2.0`
#include <gtk/gtk.h>
void
on_notebook_switch_page (GtkNotebook *notebook,
GtkNotebookPage *page,
guint page_num,
gpointer user_data)
{
GtkWidget *child;
GtkRequisition requisition;
child = gtk_notebook_get_nth_page (notebook,
page_num);
// pick the child's requisition
gtk_widget_size_request (child, &requisition);
// The "+10" stuff below is used because we're not taking
// into account the frame's width.
gtk_window_resize (GTK_WINDOW(user_data),
requisition.width + 10,
requisition.height + 10);
}
int main(int argc, char **argv)
{
GtkWidget *window, *window_vbox;
GtkWidget *notebook, *small_label, *big_label;
gtk_init (&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
window_vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER(window), window_vbox);
gtk_widget_show (window_vbox);
notebook = gtk_notebook_new ();
gtk_widget_show (notebook);
gtk_box_pack_start (GTK_BOX (window_vbox), notebook, TRUE, TRUE, 0);
small_label = gtk_label_new ("Small label");
gtk_widget_show (small_label);
gtk_notebook_append_page (GTK_NOTEBOOK(notebook),
small_label,
NULL);
big_label = gtk_label_new (
"T H I S I S A B I G G E R L A B E L"
);
gtk_widget_show (big_label);
gtk_notebook_append_page (GTK_NOTEBOOK(notebook),
big_label,
NULL);
g_signal_connect ( notebook,
"switch-page",
G_CALLBACK(on_notebook_switch_page),
window );
g_signal_connect_swapped ( window,
"delete_event",
gtk_main_quit,
NULL );
// force it to be smaller than it ought to be
gtk_widget_set_size_request (GTK_WIDGET(window), 100, 50);
gtk_widget_show (window);
gtk_main ();
return 0;
}
--
Iago Rubio
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]