GtkWindow

Name

GtkWindow -- 

Synopsis


#include <gtk/gtk.h>


struct      GtkWindow;
GtkWidget*  gtk_window_new                  (GtkWindowType type);
void        gtk_window_set_title            (GtkWindow *window,
                                             const gchar *title);
void        gtk_window_set_wmclass          (GtkWindow *window,
                                             const gchar *wmclass_name,
                                             const gchar *wmclass_class);
void        gtk_window_set_focus            (GtkWindow *window,
                                             GtkWidget *focus);
void        gtk_window_set_default          (GtkWindow *window,
                                             GtkWidget *defaultw);
void        gtk_window_set_policy           (GtkWindow *window,
                                             gint allow_shrink,
                                             gint allow_grow,
                                             gint auto_shrink);
void        gtk_window_add_accel_group      (GtkWindow *window,
                                             GtkAccelGroup *accel_group);
void        gtk_window_remove_accel_group   (GtkWindow *window,
                                             GtkAccelGroup *accel_group);
#define     gtk_window_position
gint        gtk_window_activate_focus       (GtkWindow *window);
gint        gtk_window_activate_default     (GtkWindow *window);
void        gtk_window_set_modal            (GtkWindow *window,
                                             gboolean modal);
void        gtk_window_add_embedded_xid     (GtkWindow *window,
                                             guint xid);
void        gtk_window_remove_embedded_xid  (GtkWindow *window,
                                             guint xid);
void        gtk_window_set_default_size     (GtkWindow *window,
                                             gint width,
                                             gint height);
void        gtk_window_set_geometry_hints   (GtkWindow *window,
                                             GtkWidget *geometry_widget,
                                             GdkGeometry *geometry,
                                             GdkWindowHints geom_mask);
void        gtk_window_set_position         (GtkWindow *window,
                                             GtkWindowPosition position);
void        gtk_window_set_transient_for    (GtkWindow *window,
                                             GtkWindow *parent);

Object Hierarchy


  GtkObject
   +----GtkWidget
         +----GtkContainer
               +----GtkBin
                     +----GtkWindow

Args


  "type"                 GtkWindowType        : Read / Write
  "title"                gchar*               : Read / Write
  "auto_shrink"          gboolean             : Read / Write
  "allow_shrink"         gboolean             : Read / Write
  "allow_grow"           gboolean             : Read / Write
  "modal"                gboolean             : Read / Write
  "window_position"      GtkWindowPosition    : Read / Write

Signal Prototypes


"set-focus" void        user_function      (GtkWindow *window,
                                            GtkWidget *widget,
                                            gpointer user_data);

Description

Details

struct GtkWindow

struct GtkWindow;


gtk_window_new ()

GtkWidget*  gtk_window_new                  (GtkWindowType type);

type : 
Returns : 


gtk_window_set_title ()

void        gtk_window_set_title            (GtkWindow *window,
                                             const gchar *title);

window : 
title : 


gtk_window_set_wmclass ()

void        gtk_window_set_wmclass          (GtkWindow *window,
                                             const gchar *wmclass_name,
                                             const gchar *wmclass_class);

window : 
wmclass_name : 
wmclass_class : 


gtk_window_set_focus ()

void        gtk_window_set_focus            (GtkWindow *window,
                                             GtkWidget *focus);

window : 
focus : 


gtk_window_set_default ()

void        gtk_window_set_default          (GtkWindow *window,
                                             GtkWidget *defaultw);

window : 
defaultw : 


gtk_window_set_policy ()

void        gtk_window_set_policy           (GtkWindow *window,
                                             gint allow_shrink,
                                             gint allow_grow,
                                             gint auto_shrink);

Changes how a toplevel window deals with its size request and user resize attempts. There are really only two reasonable ways to call this function:

  1. gtk_window_set_policy(GTK_WINDOW(window), FALSE, TRUE, FALSE) means that the window is user-resizable.

  2. gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, TRUE) means that the window's size is program-controlled, and should simply match the current size request of the window's children.

The first policy is the default, that is, by default windows are designed to be resized by users.

The basic ugly truth of this function is that it should be simply:
 void gtk_window_set_user_resizeable(GtkWidget* window, gboolean setting);
So, pretend it is like that, and only use the two policies mentioned above. GTK+ 1.4 may replace gtk_window_set_policy() with a nicer function like gtk_window_set_user_resizeable().

If set to TRUE, the allow_grow parameter allows the user to expand the window beyond the size request of its child widgets. If allow_grow is TRUE, be sure to check that your child widgets work properly as the window is resized.

A toplevel window will always change size to ensure its child widgets receive their requested size. This means that if you add child widgets, the toplevel window will expand to contain them. However, normally the toplevel will not shrink to fit the size request of its children if it's too large; the auto_shrink parameter causes the window to shrink when child widgets have too much space. auto_shrink is normally used with the second of the two window policies mentioned above. That is, set auto_shrink to TRUE if you want the window to have a fixed, always-optimal size determined by your program.

Note that auto_shrink doesn't do anything if allow_shrink and allow_grow are both set to FALSE.

Neither of the two suggested window policies set the allow_shrink paramter to TRUE. If allow_shrink is TRUE, the user can shrink the window so that its children do not receive their full size request; this is basically a bad thing, because most widgets will look wrong if this happens. Furthermore GTK+ has a tendency to re-expand the window if size is recalculated for any reason. The upshot is that allow_shrink should always be set to FALSE.

Sometimes when you think you want to use allow_shrink, the real problem is that some specific child widget is requesting too much space, so the user can't shrink the window sufficiently. Perhaps you are calling gtk_widget_set_usize() on a child widget, and forcing its size request to be too large. Instead of setting the child's usize, consider using gtk_window_set_default_size() so that the child gets a larger allocation than it requests.

window :the window
allow_shrink :whether the user can shrink the window below its size request
allow_grow :whether the user can grow the window larger than its size request
auto_shrink :whether the window automatically snaps back to its size request if it's larger


gtk_window_add_accel_group ()

void        gtk_window_add_accel_group      (GtkWindow *window,
                                             GtkAccelGroup *accel_group);

window : 
accel_group : 


gtk_window_remove_accel_group ()

void        gtk_window_remove_accel_group   (GtkWindow *window,
                                             GtkAccelGroup *accel_group);

window : 
accel_group : 


gtk_window_position

#define	gtk_window_position			gtk_window_set_position


gtk_window_activate_focus ()

gint        gtk_window_activate_focus       (GtkWindow *window);

window : 
Returns : 


gtk_window_activate_default ()

gint        gtk_window_activate_default     (GtkWindow *window);

window : 
Returns : 


gtk_window_set_modal ()

void        gtk_window_set_modal            (GtkWindow *window,
                                             gboolean modal);

window : 
modal : 


gtk_window_add_embedded_xid ()

void        gtk_window_add_embedded_xid     (GtkWindow *window,
                                             guint xid);

window : 
xid : 


gtk_window_remove_embedded_xid ()

void        gtk_window_remove_embedded_xid  (GtkWindow *window,
                                             guint xid);

window : 
xid : 


gtk_window_set_default_size ()

void        gtk_window_set_default_size     (GtkWindow *window,
                                             gint width,
                                             gint height);

window : 
width : 
height : 


gtk_window_set_geometry_hints ()

void        gtk_window_set_geometry_hints   (GtkWindow *window,
                                             GtkWidget *geometry_widget,
                                             GdkGeometry *geometry,
                                             GdkWindowHints geom_mask);

window : 
geometry_widget : 
geometry : 
geom_mask : 


gtk_window_set_position ()

void        gtk_window_set_position         (GtkWindow *window,
                                             GtkWindowPosition position);

window : 
position : 


gtk_window_set_transient_for ()

void        gtk_window_set_transient_for    (GtkWindow *window,
                                             GtkWindow *parent);

window : 
parent : 

Args

"type" (GtkWindowType : Read / Write)

The type of the window.

"title" (gchar* : Read / Write)

The title of the window.

"auto_shrink" (gboolean : Read / Write)

If the window shrinks automatically when widgets within it shrink.

"allow_shrink" (gboolean : Read / Write)

If the window can be resized to a smaller size by the user.

"allow_grow" (gboolean : Read / Write)

If the window can be resized to a larger size by the user.

"modal" (gboolean : Read / Write)

If the window is modal, i.e. it grabs all GTK+ events.

"window_position" (GtkWindowPosition : Read / Write)

The position of the window.

Signals

The "set-focus" signal

void        user_function                  (GtkWindow *window,
                                            GtkWidget *widget,
                                            gpointer user_data);

window :the object which received the signal.
widget : 
user_data :user data set when the signal handler was connected.