Re: [gtk-list] Minimized / Restored / Maximized window status and control ?




Anthony Tekatch <tekatch@idirect.com> writes:

> How can I tell if a window is minimized?
> 
> I want to be able to see if the window is minimized then when the user selects
> a menu item to show that window I can just restore it to it's original state
> rather than opening up a new window. Also if the window has been closed then
> I would like to create a new one.

It's hard to tell if a window has been minimized, but not difficult to
unminimize it. 

What you basically want to do is something like:

static GtkWidget *my_foo_window = NULL;

foo_activate_cb ()
{
 if (my_foo_window)
   gdk_window_show (my_foo_window->window);
 else
   {
     my_foo_window = create_foo_window();
     gtk_signal_connect (GTK_OBJECT (my_foo_window), "destroy",
                         GTK_SIGNAL_FUNC (gtk_widget_destroyed),
                         &my_foo_window);
     gtk_widget_show (GTK_WIDGET (my_foo_window));
   }
}

This says:

 - If my_foo_window exists, unminimize it and raise it
 - If my_foo_window does not exist , create, and set up a handler
   that NULLs out the my_foo_window pointer when the window
   is closed.

Regards,
                                        Owen



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