📄 gtkwindow.html
字号:
WIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>focus</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP"> </TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN49228"></A><H3><ANAME="GTK-WINDOW-SET-DEFAULT"></A>gtk_window_set_default ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">void gtk_window_set_default (<AHREF="gtkwindow.html">GtkWindow</A> *window, <AHREF="gtkwidget.html">GtkWidget</A> *defaultw);</PRE></TD></TR></TABLE><P></P><DIVCLASS="INFORMALTABLE"><ANAME="AEN49235"></A><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>window</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP"> </TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>defaultw</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP"> </TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN49248"></A><H3><ANAME="GTK-WINDOW-SET-POLICY"></A>gtk_window_set_policy ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">void gtk_window_set_policy (<AHREF="gtkwindow.html">GtkWindow</A> *window, <AHREF=../glib/glib-basic-types.html#GINT>gint</A> allow_shrink, <AHREF=../glib/glib-basic-types.html#GINT>gint</A> allow_grow, <AHREF=../glib/glib-basic-types.html#GINT>gint</A> auto_shrink);</PRE></TD></TR></TABLE><P>Changes how a toplevel window deals with its size request and user resizeattempts. There are really only two reasonable ways to call this function:<P></P><OLTYPE="1"><LI><P><TTCLASS="LITERAL">gtk_window_set_policy(GTK_WINDOW(window), FALSE, TRUE, FALSE)</TT> means that the window is user-resizable.</P></LI><LI><P><TTCLASS="LITERAL">gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, TRUE)</TT> means that the window's size is program-controlled, and should simply match the current size request of the window's children.</P></LI></OL>The first policy is the default, that is, by default windows are designed to be resized by users.</P><P>The basic ugly truth of this function is that it should be simply:<TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING"> void gtk_window_set_user_resizeable(GtkWidget* window, gboolean setting);</PRE></TD></TR></TABLE>So, pretend it is like that, and only use the two policies mentioned above.GTK+ 1.4 may replace <AHREF="gtkwindow.html#GTK-WINDOW-SET-POLICY">gtk_window_set_policy</A>() with a nicer function likegtk_window_set_user_resizeable().</P><P>If set to TRUE, the <TTCLASS="PARAMETER"><I>allow_grow</I></TT> parameter allows the user to expand the windowbeyond the size request of its child widgets. If <TTCLASS="PARAMETER"><I>allow_grow</I></TT> is TRUE, be sure tocheck that your child widgets work properly as the window is resized.</P><P>A toplevel window will always change size to ensure its child widgets receivetheir requested size. This means that if you add child widgets, the toplevelwindow will expand to contain them. However, normally the toplevel will notshrink to fit the size request of its children if it's too large; the<TTCLASS="PARAMETER"><I>auto_shrink</I></TT> parameter causes the window to shrink when child widgets have toomuch space. <TTCLASS="PARAMETER"><I>auto_shrink</I></TT> is normally used with the second of the two windowpolicies mentioned above. That is, set <TTCLASS="PARAMETER"><I>auto_shrink</I></TT> to TRUE if you want thewindow to have a fixed, always-optimal size determined by your program.</P><P>Note that <TTCLASS="PARAMETER"><I>auto_shrink</I></TT> doesn't do anything if <TTCLASS="PARAMETER"><I>allow_shrink</I></TT> and <TTCLASS="PARAMETER"><I>allow_grow</I></TT> areboth set to FALSE.</P><P>Neither of the two suggested window policies set the <TTCLASS="PARAMETER"><I>allow_shrink</I></TT> paramter toTRUE. If <TTCLASS="PARAMETER"><I>allow_shrink</I></TT> is TRUE, the user can shrink the window so that itschildren 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 atendency to re-expand the window if size is recalculated for any reason. Theupshot is that <TTCLASS="PARAMETER"><I>allow_shrink</I></TT> should always be set to FALSE.</P><P>Sometimes when you think you want to use <TTCLASS="PARAMETER"><I>allow_shrink</I></TT>, the real problem is thatsome specific child widget is requesting too much space, so the user can'tshrink the window sufficiently. Perhaps you are calling <AHREF="gtkwidget.html#GTK-WIDGET-SET-USIZE">gtk_widget_set_usize</A>()on a child widget, and forcing its size request to be too large. Instead ofsetting the child's usize, consider using <AHREF="gtkwindow.html#GTK-WINDOW-SET-DEFAULT-SIZE">gtk_window_set_default_size</A>() so thatthe child gets a larger allocation than it requests.</P><DIVCLASS="INFORMALTABLE"><ANAME="AEN49287"></A><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>window</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">the window</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>allow_shrink</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">whether the user can shrink the window below its size request</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>allow_grow</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">whether the user can grow the window larger than its size request</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>auto_shrink</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">whether the window automatically snaps back to its size request ifit's larger </TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN49308"></A><H3><ANAME="GTK-WINDOW-ADD-ACCEL-GROUP"></A>gtk_window_add_accel_group ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">void gtk_window_add_accel_group (<AHREF="gtkwindow.html">GtkWindow</A> *window, <AHREF="gtk-keyboard-accelerators.html#GTKACCELGROUP">GtkAccelGroup</A> *accel_group);</PRE></TD></TR></TABLE><P></P><DIVCLASS="INFORMALTABLE"><ANAME="AEN49315"></A><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>window</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP"> </TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>accel_group</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP"> </TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN49328"></A><H3><ANAME="GTK-WINDOW-REMOVE-ACCEL-GROUP"></A>gtk_window_remove_accel_group ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">void gtk_window_remove_accel_group (<AHREF="gtkwindow.html">GtkWindow</A> *window, <AHREF="gtk-keyboard-accelerators.html#GTKACCELGROUP">GtkAccelGroup</A> *accel_group);</PRE></TD></TR></TABLE><P></P><DIVCLASS="INFORMALTABLE"><ANAME="AEN49335"></A><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>window</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP"> </TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>accel_group</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP"> </TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN49348"></A><H3><ANAME="GTK-WINDOW-POSITION"></A>gtk_window_position</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">#define gtk_window_position gtk_window_set_position</PRE></TD></TR></TABLE><P></P></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN49353"></A><H3><ANAME="GTK-WINDOW-ACTIVATE-FOCUS"></A>gtk_window_activate_focus ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING"><AHREF=../glib/glib-basic-types.html#GINT>gint</A> gtk_window_activate_focus (<AHREF="gtkwindow.html">GtkWindow</A> *window);</PRE></TD></TR></TABLE><P></P><DIVCLASS="INFORMALTABLE"><ANAME="AEN49360"></A><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>window</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP"> </TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><ICLASS="EMPHASIS">Returns</I> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP"> </TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN49373"></A><H3><ANAME="GTK-WINDOW-ACTIVATE-DEFAULT"></A>gtk_window_activate_default ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING"><AHREF=../glib/glib-basic-types.html#GINT>gint</A> gtk_window_activate_default (<AHREF="gtkwindow.html">GtkWindow</A> *window);</PRE></TD></TR></TABLE><P></P><DIVCLASS="INFORMALTABLE"><ANAME="AEN49380"></A><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>window</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP"> </TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><ICLASS="EMPHASIS">Returns</I> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP"> </TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN49393"></A><H3><ANAME="GTK-WINDOW-SET-MODAL"></A>gtk_window_set_modal ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">void gtk_window_set_modal (<AHREF="gtkwindow.html">GtkWindow</A> *window, <AHREF=../glib/glib-basic-types.html#GBOOLEAN>gboolean</A> modal);</PRE></TD></TR></TABLE><P></P><DIVCLASS="INFORMALTABLE"><ANAME="AEN49400"></A><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>window</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP"> </TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>modal</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP"> </TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN49413"></A><H3><ANAME="GTK-WINDOW-ADD-EMBEDDED-XID"></A>gtk_window_add_embedded_xid ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">void gtk_window_add_embedded_xid (<AHREF="gtkwindow.html">GtkWindow</A> *window, <AHREF=../glib/glib-basic-types.html#GUINT>guint</A> xid);</PRE></TD></TR></TABLE><P></P><DIVCLASS="INFORMALTABLE"><ANAME="AEN49420"></A><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -