Re: Maximize project



Krzysztof Magrel wrote:

How can I run my project (in gtk+) on full screen? It means I want to
maximize window of project. I can of course maximize it "by heand" after
application run. But I want my application do it itself on the start (of
course size of the window will depend of resolution (640x480,  800x600,
1024x768 etc.)). How function should I use ? Please help.


For the same purpose, I wrote that (note sure this is the simplest way):

/*--------------------------------------------------------------------*/
 /* GTK init */
 gtk_init (&argc, &argv);

 /* Colors init */
 gdk_rgb_init ();
 gtk_widget_set_default_colormap (gdk_rgb_get_cmap ());
 gtk_widget_set_default_visual (gdk_rgb_get_visual ());

 /* Let's create the top level window */
 main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

 /* A good name for the window */
 gtk_widget_set_name (main_window, "foobar");

 /* Maximum size for the window (that of the screen) */
gtk_widget_set_usize (main_window, gdk_screen_width(), gdk_screen_height());

 /* Not resizable! */
 gtk_window_set_policy (GTK_WINDOW (main_window), FALSE, FALSE, FALSE);

 /* WM hints */
 gtk_window_set_wmclass (GTK_WINDOW (main_window), "Foobar", "foobar");

 /* When we get the destroy message we exit */
 gtk_signal_connect (GTK_OBJECT (main_window), "destroy",
                     GTK_SIGNAL_FUNC (gtk_exit), NULL);
 gtk_signal_connect (GTK_OBJECT (main_window), "delete_event",
                     GTK_SIGNAL_FUNC (gtk_exit), NULL);

 /* We suppress any window decoration (must be after "realize") */
 gtk_widget_realize (main_window);
 gdk_window_set_decorations (main_window->window, 0);
/*--------------------------------------------------------------------*/

Hope it helps...





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]