亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? gtk_tut-4.html

?? GTK development guide
?? HTML
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
 <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.7">
 <TITLE>GTK v1.2 Tutorial: Packing Widgets </TITLE>
 <LINK HREF="gtk_tut-5.html" REL=next>
 <LINK HREF="gtk_tut-3.html" REL=previous>
 <LINK HREF="gtk_tut.html#toc4" REL=contents>
</HEAD>
<BODY TEXT="#CCCCCC" BGCOLOR="#000000" LINK="#33cc00" VLINK="#009900" ALINK="#FF0000">
<A HREF="gtk_tut-5.html">Next</A>
<A HREF="gtk_tut-3.html">Previous</A>
<A HREF="gtk_tut.html#toc4">Contents</A>
<HR>
<H2><A NAME="sec_packing_widgets"></A> <A NAME="s4">4. Packing Widgets </A></H2>

<P>When creating an application, you'll want to put more than one widget
inside a window. Our first <EM>helloworld</EM> example only used one
widget so we could simply use a gtk_container_add call to "pack" the
widget into the window. But when you want to put more than one widget
into a window, how do you control where that widget is positioned?
This is where packing comes in.
<P>
<H2><A NAME="ss4.1">4.1 Theory of Packing Boxes</A>
</H2>

<P>Most packing is done by creating boxes as in the example above. These
are invisible widget containers that we can pack our widgets into
which come in two forms, a horizontal box, and a vertical box. When
packing widgets into a horizontal box, the objects are inserted
horizontally from left to right or right to left depending on the call
used. In a vertical box, widgets are packed from top to bottom or vice
versa. You may use any combination of boxes inside or beside other
boxes to create the desired effect.
<P>To create a new horizontal box, we use a call to gtk_hbox_new(), and
for vertical boxes, gtk_vbox_new(). The gtk_box_pack_start() and
gtk_box_pack_end() functions are used to place objects inside of these
containers. The gtk_box_pack_start() function will start at the top
and work its way down in a vbox, and pack left to right in an hbox.
gtk_box_pack_end() will do the opposite, packing from bottom to top in
a vbox, and right to left in an hbox. Using these functions allows us
to right justify or left justify our widgets and may be mixed in any
way to achieve the desired effect. We will use gtk_box_pack_start() in
most of our examples. An object may be another container or a
widget. In fact, many widgets are actually containers themselves,
including the button, but we usually only use a label inside a button.
<P>By using these calls, GTK knows where you want to place your widgets
so it can do automatic resizing and other nifty things. There are also
a number of options as to how your widgets should be packed. As you
can imagine, this method gives us a quite a bit of flexibility when
placing and creating widgets.
<P>
<H2><A NAME="ss4.2">4.2 Details of Boxes</A>
</H2>

<P>Because of this flexibility, packing boxes in GTK can be confusing at
first. There are a lot of options, and it's not immediately obvious how
they all fit together. In the end, however, there are basically five
different styles.
<P> <CENTER >
<IMG SRC="gtk_tut_packbox1.gif" VSPACE="15" HSPACE="10" WIDTH="528"
HEIGHT="235" ALT="Box Packing Example Image"
> </CENTER
 >
<P>Each line contains one horizontal box (hbox) with several buttons. The
call to gtk_box_pack is shorthand for the call to pack each of the
buttons into the hbox. Each of the buttons is packed into the hbox the
same way (i.e., same arguments to the gtk_box_pack_start() function).
<P>This is the declaration of the gtk_box_pack_start function.
<P>
<BLOCKQUOTE><CODE>
<PRE>
void gtk_box_pack_start( GtkBox    *box,
                         GtkWidget *child,
                         gint       expand,
                         gint       fill,
                         gint       padding );
</PRE>
</CODE></BLOCKQUOTE>
<P>The first argument is the box you are packing the object into, the
second is the object. The objects will all be buttons for now, so
we'll be packing buttons into boxes.
<P>The expand argument to gtk_box_pack_start() and gtk_box_pack_end()
controls whether the widgets are laid out in the box to fill in all
the extra space in the box so the box is expanded to fill the area
allotted to it (TRUE); or the box is shrunk to just fit the widgets
(FALSE). Setting expand to FALSE will allow you to do right and left
justification of your widgets.  Otherwise, they will all expand to fit
into the box, and the same effect could be achieved by using only one
of gtk_box_pack_start or gtk_box_pack_end.
<P>The fill argument to the gtk_box_pack functions control whether the
extra space is allocated to the objects themselves (TRUE), or as extra
padding in the box around these objects (FALSE). It only has an effect
if the expand argument is also TRUE.
<P>When creating a new box, the function looks like this:
<P>
<BLOCKQUOTE><CODE>
<PRE>
GtkWidget *gtk_hbox_new (gint homogeneous,
                         gint spacing);
</PRE>
</CODE></BLOCKQUOTE>
<P>The homogeneous argument to gtk_hbox_new (and the same for
gtk_vbox_new) controls whether each object in the box has the same
size (i.e., the same width in an hbox, or the same height in a
vbox). If it is set, the gtk_box_pack routines function essentially
as if the <CODE>expand</CODE> argument was always turned on.
<P>What's the difference between spacing (set when the box is created)
and padding (set when elements are packed)? Spacing is added between
objects, and padding is added on either side of an object. The
following figure should make it clearer:
<P> <CENTER >
<IMG ALIGN="center" SRC="gtk_tut_packbox2.gif" WIDTH="509"
HEIGHT="213" VSPACE="15" HSPACE="10"
ALT="Box Packing Example Image"
> </CENTER
 >
<P>Here is the code used to create the above images. I've commented it
fairly heavily so I hope you won't have any problems following
it. Compile it yourself and play with it.
<P>
<H2><A NAME="ss4.3">4.3 Packing Demonstration Program</A>
</H2>

<P>
<BLOCKQUOTE><CODE>
<PRE>
/* example-start packbox packbox.c */

#include &lt;stdio.h>
#include &lt;stdlib.h>
#include "gtk/gtk.h"

gint delete_event( GtkWidget *widget,
                   GdkEvent  *event,
                   gpointer   data )
{
    gtk_main_quit();
    return(FALSE);
}

/* Make a new hbox filled with button-labels. Arguments for the 
 * variables we're interested are passed in to this function. 
 * We do not show the box, but do show everything inside. */
GtkWidget *make_box( gint homogeneous,
                     gint spacing,
                     gint expand,
                     gint fill,
                     gint padding ) 
{
    GtkWidget *box;
    GtkWidget *button;
    char padstr[80];
    
    /* Create a new hbox with the appropriate homogeneous
     * and spacing settings */
    box = gtk_hbox_new (homogeneous, spacing);
    
    /* Create a series of buttons with the appropriate settings */
    button = gtk_button_new_with_label ("gtk_box_pack");
    gtk_box_pack_start (GTK_BOX (box), button, expand, fill, padding);
    gtk_widget_show (button);
    
    button = gtk_button_new_with_label ("(box,");
    gtk_box_pack_start (GTK_BOX (box), button, expand, fill, padding);
    gtk_widget_show (button);
    
    button = gtk_button_new_with_label ("button,");
    gtk_box_pack_start (GTK_BOX (box), button, expand, fill, padding);
    gtk_widget_show (button);
    
    /* Create a button with the label depending on the value of
     * expand. */
    if (expand == TRUE)
            button = gtk_button_new_with_label ("TRUE,");
    else
            button = gtk_button_new_with_label ("FALSE,");
    
    gtk_box_pack_start (GTK_BOX (box), button, expand, fill, padding);
    gtk_widget_show (button);
    
    /* This is the same as the button creation for "expand"
     * above, but uses the shorthand form. */
    button = gtk_button_new_with_label (fill ? "TRUE," : "FALSE,");
    gtk_box_pack_start (GTK_BOX (box), button, expand, fill, padding);
    gtk_widget_show (button);
    
    sprintf (padstr, "%d);", padding);
    
    button = gtk_button_new_with_label (padstr);
    gtk_box_pack_start (GTK_BOX (box), button, expand, fill, padding);
    gtk_widget_show (button);
    
    return box;
}

int main( int   argc,
          char *argv[]) 
{
    GtkWidget *window;
    GtkWidget *button;
    GtkWidget *box1;
    GtkWidget *box2;
    GtkWidget *separator;
    GtkWidget *label;
    GtkWidget *quitbox;
    int which;
    
    /* Our init, don't forget this! :) */
    gtk_init (&amp;argc, &amp;argv);
    
    if (argc != 2) {
        fprintf (stderr, "usage: packbox num, where num is 1, 2, or 3.\n");
        /* This just does cleanup in GTK and exits with an exit status of 1. */
        gtk_exit (1);
    }
    
    which = atoi (argv[1]);

    /* Create our window */
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

    /* You should always remember to connect the delete_event signal
     * to the main window. This is very important for proper intuitive
     * behavior */
    gtk_signal_connect (GTK_OBJECT (window), "delete_event",
                        GTK_SIGNAL_FUNC (delete_event), NULL);
    gtk_container_set_border_width (GTK_CONTAINER (window), 10);
    
    /* We create a vertical box (vbox) to pack the horizontal boxes into.
     * This allows us to stack the horizontal boxes filled with buttons one
     * on top of the other in this vbox. */
    box1 = gtk_vbox_new (FALSE, 0);
    
    /* which example to show. These correspond to the pictures above. */
    switch (which) {
    case 1:
        /* create a new label. */
        label = gtk_label_new ("gtk_hbox_new (FALSE, 0);");
        
        /* Align the label to the left side.  We'll discuss this function and 
         * others in the section on Widget Attributes. */
        gtk_misc_set_alignment (GTK_MISC (label), 0, 0);

        /* Pack the label into the vertical box (vbox box1).  Remember that 
         * widgets added to a vbox will be packed one on top of the other in
         * order. */
        gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 0);
        
        /* Show the label */
        gtk_widget_show (label);
        
        /* Call our make box function - homogeneous = FALSE, spacing = 0,
         * expand = FALSE, fill = FALSE, padding = 0 */
        box2 = make_box (FALSE, 0, FALSE, FALSE, 0);
        gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
        gtk_widget_show (box2);

        /* Call our make box function - homogeneous = FALSE, spacing = 0,
         * expand = TRUE, fill = FALSE, padding = 0 */
        box2 = make_box (FALSE, 0, TRUE, FALSE, 0);
        gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
        gtk_widget_show (box2);
        
        /* Args are: homogeneous, spacing, expand, fill, padding */
        box2 = make_box (FALSE, 0, TRUE, TRUE, 0);
        gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
        gtk_widget_show (box2);
        
        /* Creates a separator, we'll learn more about these later, 
         * but they are quite simple. */
        separator = gtk_hseparator_new ();
        
        /* Pack the separator into the vbox. Remember each of these
         * widgets is being packed into a vbox, so they'll be stacked
         * vertically. */
        gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 5);
        gtk_widget_show (separator);
        
        /* Create another new label, and show it. */
        label = gtk_label_new ("gtk_hbox_new (TRUE, 0);");
        gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
        gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 0);
        gtk_widget_show (label);
        
        /* Args are: homogeneous, spacing, expand, fill, padding */
        box2 = make_box (TRUE, 0, TRUE, FALSE, 0);
        gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
        gtk_widget_show (box2);
        
        /* Args are: homogeneous, spacing, expand, fill, padding */
        box2 = make_box (TRUE, 0, TRUE, TRUE, 0);
        gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
        gtk_widget_show (box2);
        
        /* Another new separator. */
        separator = gtk_hseparator_new ();
        /* The last 3 arguments to gtk_box_pack_start are:
         * expand, fill, padding. */
        gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 5);
        gtk_widget_show (separator);
        
        break;

    case 2:

        /* Create a new label, remember box1 is a vbox as created 
         * near the beginning of main() */
        label = gtk_label_new ("gtk_hbox_new (FALSE, 10);");
        gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
        gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 0);
        gtk_widget_show (label);
        
        /* Args are: homogeneous, spacing, expand, fill, padding */
        box2 = make_box (FALSE, 10, TRUE, FALSE, 0);
        gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
        gtk_widget_show (box2);
        
        /* Args are: homogeneous, spacing, expand, fill, padding */
        box2 = make_box (FALSE, 10, TRUE, TRUE, 0);
        gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
        gtk_widget_show (box2);
        
        separator = gtk_hseparator_new ();
        /* The last 3 arguments to gtk_box_pack_start are:
         * expand, fill, padding. */
        gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 5);
        gtk_widget_show (separator);
        
        label = gtk_label_new ("gtk_hbox_new (FALSE, 0);");
        gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
        gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 0);
        gtk_widget_show (label);
        
        /* Args are: homogeneous, spacing, expand, fill, padding */
        box2 = make_box (FALSE, 0, TRUE, FALSE, 10);
        gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
        gtk_widget_show (box2);
        
        /* Args are: homogeneous, spacing, expand, fill, padding */
        box2 = make_box (FALSE, 0, TRUE, TRUE, 10);
        gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
        gtk_widget_show (box2);
        

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲精品久久久蜜桃| 美国十次了思思久久精品导航| 国产视频亚洲色图| 日韩一区二区麻豆国产| 日韩一区二区三区在线观看| 欧美一区二区高清| 91麻豆精品国产综合久久久久久| 欧美日本一道本在线视频| 欧美日韩成人综合| 欧美一区二区国产| 久久综合色天天久久综合图片| 亚洲精品一区二区三区精华液 | 在线精品国精品国产尤物884a| 91在线视频观看| 色域天天综合网| 欧美三级资源在线| 91精品国产综合久久小美女| 日韩精品一区二区三区老鸭窝| 精品美女一区二区| 国产欧美日韩不卡| 日韩伦理av电影| 亚洲va在线va天堂| 久久99热国产| 成人av网址在线| 日本电影欧美片| 欧美一区二区久久| 久久精品无码一区二区三区 | 国产精品自拍av| 成人午夜又粗又硬又大| 欧美亚洲综合一区| 日韩视频在线你懂得| 欧美极品美女视频| 一区二区三区资源| 开心九九激情九九欧美日韩精美视频电影| 国内精品国产三级国产a久久| 成人动漫一区二区| 欧美日韩三级一区二区| 26uuu久久综合| 亚洲天堂网中文字| 久久电影网站中文字幕| 成人丝袜18视频在线观看| 欧美色涩在线第一页| 亚洲精品一区二区三区影院 | 免费欧美在线视频| 成人国产精品免费| 欧美巨大另类极品videosbest| 欧美成人乱码一区二区三区| 亚洲欧洲av在线| 强制捆绑调教一区二区| 成人激情小说网站| 日韩网站在线看片你懂的| 亚洲视频香蕉人妖| 久久99精品久久久| 欧美亚洲日本一区| 国产日产精品1区| 舔着乳尖日韩一区| av在线不卡免费看| 日韩欧美一二三区| 亚洲综合男人的天堂| 国产久卡久卡久卡久卡视频精品| 欧美主播一区二区三区美女| 久久久国产综合精品女国产盗摄| 亚洲一区视频在线| 不卡的av在线| 国产亚洲一区二区三区在线观看 | 成人午夜精品在线| 日韩一区二区视频| 午夜精品久久久久影视| 99久久精品99国产精品| 久久久久9999亚洲精品| 日韩电影在线看| 色狠狠色狠狠综合| 国产精品日韩成人| 精品亚洲免费视频| 欧美一区二区在线观看| 亚洲综合在线视频| 99久久精品久久久久久清纯| 欧美极品xxx| 国产精品18久久久| 26uuu亚洲| 精品一区二区三区在线观看国产| 欧美日韩综合色| 亚洲精品乱码久久久久久日本蜜臀| 国产精品18久久久久久久久久久久| 日韩一区二区三区在线| 午夜视频一区二区| 欧美性感一区二区三区| 亚洲天天做日日做天天谢日日欢| 成人精品视频一区二区三区| 久久久91精品国产一区二区精品| 麻豆91精品91久久久的内涵| 欧美电影一区二区| 亚洲福中文字幕伊人影院| 91麻豆自制传媒国产之光| 国产精品久久久久9999吃药| 国产不卡在线一区| 国产亚洲一区字幕| 国产91高潮流白浆在线麻豆| 欧美国产日产图区| 成人国产精品视频| 中文字幕日韩一区二区| 波波电影院一区二区三区| 国产精品久久99| 91在线观看污| 亚洲精品乱码久久久久| 欧美无人高清视频在线观看| 亚洲成人自拍网| 欧美嫩在线观看| 老司机免费视频一区二区| 日韩精品一区二区三区视频播放 | 日本一区二区三区国色天香| 国产一区二区电影| 日本一区二区三区在线不卡| 成人免费视频app| 日韩一区在线播放| 欧美午夜片在线看| 天使萌一区二区三区免费观看| 日韩一级二级三级精品视频| 久久精品国产精品亚洲精品| ww亚洲ww在线观看国产| 国产91在线看| 亚洲品质自拍视频网站| 欧美性大战xxxxx久久久| 天天亚洲美女在线视频| 欧美va亚洲va在线观看蝴蝶网| 狠狠色综合日日| 国产精品每日更新在线播放网址| 色呦呦国产精品| 日韩激情在线观看| 国产欧美日本一区二区三区| 一本一本久久a久久精品综合麻豆| 亚洲国产日产av| 精品剧情v国产在线观看在线| 国产99久久久国产精品免费看| 亚洲欧美日韩国产手机在线 | 亚洲欧美在线视频观看| 欧美性色黄大片| 国产在线观看一区二区| 亚洲品质自拍视频| 91精品国产欧美日韩| 高清视频一区二区| 亚洲综合视频在线观看| www激情久久| 色噜噜久久综合| 久久www免费人成看片高清| 国产精品欧美久久久久一区二区| 在线观看日韩毛片| 国产一区二区在线电影| 亚洲精品免费在线| 久久色在线观看| 在线观看av不卡| 国产精品一区在线| 亚洲成人动漫在线免费观看| 久久精品一区四区| 欧美精品久久一区二区三区| 高清shemale亚洲人妖| 日韩在线一区二区| 综合激情网...| 精品久久久久久最新网址| 色综合久久天天| 国产一区视频在线看| 亚洲国产精品一区二区久久恐怖片 | 欧美人妖巨大在线| av一区二区久久| 极品少妇xxxx精品少妇偷拍| 亚洲在线中文字幕| 亚洲国产精品激情在线观看| 日韩一区和二区| 欧美日韩在线播放三区| 成人av免费在线观看| 黑人精品欧美一区二区蜜桃| 亚洲国产美国国产综合一区二区| 成人欧美一区二区三区小说 | 亚洲精品免费在线播放| 日本一区二区视频在线| 欧美大片在线观看一区| 欧美日韩国产系列| 一本一道综合狠狠老| 成人爱爱电影网址| 国产一区二区调教| 免费高清在线一区| 石原莉奈在线亚洲三区| 亚洲一区二区在线观看视频| 中文久久乱码一区二区| 久久久久久**毛片大全| 日韩精品一区二区在线观看| 欧美精选一区二区| 在线观看av一区二区| 色综合天天综合狠狠| 成人黄色免费短视频| 成人午夜在线视频| 国产成人精品影视| 国产精品综合在线视频| 精品一区二区三区的国产在线播放| 日韩制服丝袜先锋影音| 日韩精品免费视频人成| 秋霞午夜av一区二区三区| 午夜精品福利一区二区三区蜜桃| 亚洲最大成人综合| 亚洲国产另类av|