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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? gtk_tut-6.html

?? GTK development guide
?? HTML
?? 第 1 頁 / 共 2 頁
字號:
<!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: The Button Widget</TITLE>
 <LINK HREF="gtk_tut-7.html" REL=next>
 <LINK HREF="gtk_tut-5.html" REL=previous>
 <LINK HREF="gtk_tut.html#toc6" REL=contents>
</HEAD>
<BODY TEXT="#CCCCCC" BGCOLOR="#000000" LINK="#33cc00" VLINK="#009900" ALINK="#FF0000">
<A HREF="gtk_tut-7.html">Next</A>
<A HREF="gtk_tut-5.html">Previous</A>
<A HREF="gtk_tut.html#toc6">Contents</A>
<HR>
<H2><A NAME="s6">6. The Button Widget</A></H2>

<H2><A NAME="ss6.1">6.1 Normal Buttons</A>
</H2>

<P>We've almost seen all there is to see of the button widget. It's
pretty simple. There are however two ways to create a button. You can
use the gtk_button_new_with_label() to create a button with a label,
or use gtk_button_new() to create a blank button. It's then up to you
to pack a label or pixmap into this new button. To do this, create a
new box, and then pack your objects into this box using the usual
gtk_box_pack_start, and then use gtk_container_add to pack the box
into the button.
<P>Here's an example of using gtk_button_new to create a button with a
picture and a label in it. I've broken up the code to create a box
from the rest so you can use it in your programs. There are further
examples of using pixmaps later in the tutorial.
<P>
<BLOCKQUOTE><CODE>
<PRE>
/* example-start buttons buttons.c */

#include &lt;gtk/gtk.h>

/* Create a new hbox with an image and a label packed into it
 * and return the box. */

GtkWidget *xpm_label_box( GtkWidget *parent,
                          gchar     *xpm_filename,
                          gchar     *label_text )
{
    GtkWidget *box1;
    GtkWidget *label;
    GtkWidget *pixmapwid;
    GdkPixmap *pixmap;
    GdkBitmap *mask;
    GtkStyle *style;

    /* Create box for xpm and label */
    box1 = gtk_hbox_new (FALSE, 0);
    gtk_container_set_border_width (GTK_CONTAINER (box1), 2);

    /* Get the style of the button to get the
     * background color. */
    style = gtk_widget_get_style(parent);

    /* Now on to the xpm stuff */
    pixmap = gdk_pixmap_create_from_xpm (parent->window, &amp;mask,
                                         &amp;style->bg[GTK_STATE_NORMAL],
                                         xpm_filename);
    pixmapwid = gtk_pixmap_new (pixmap, mask);

    /* Create a label for the button */
    label = gtk_label_new (label_text);

    /* Pack the pixmap and label into the box */
    gtk_box_pack_start (GTK_BOX (box1),
                        pixmapwid, FALSE, FALSE, 3);

    gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 3);

    gtk_widget_show(pixmapwid);
    gtk_widget_show(label);

    return(box1);
}

/* Our usual callback function */
void callback( GtkWidget *widget,
               gpointer   data )
{
    g_print ("Hello again - %s was pressed\n", (char *) data);
}


int main( int   argc,
          char *argv[] )
{
    /* GtkWidget is the storage type for widgets */
    GtkWidget *window;
    GtkWidget *button;
    GtkWidget *box1;

    gtk_init (&amp;argc, &amp;argv);

    /* Create a new window */
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

    gtk_window_set_title (GTK_WINDOW (window), "Pixmap'd Buttons!");

    /* It's a good idea to do this for all windows. */
    gtk_signal_connect (GTK_OBJECT (window), "destroy",
                        GTK_SIGNAL_FUNC (gtk_exit), NULL);

    gtk_signal_connect (GTK_OBJECT (window), "delete_event",
                        GTK_SIGNAL_FUNC (gtk_exit), NULL);

    /* Sets the border width of the window. */
    gtk_container_set_border_width (GTK_CONTAINER (window), 10);
    gtk_widget_realize(window);

    /* Create a new button */
    button = gtk_button_new ();

    /* Connect the "clicked" signal of the button to our callback */
    gtk_signal_connect (GTK_OBJECT (button), "clicked",
                        GTK_SIGNAL_FUNC (callback), (gpointer) "cool button");

    /* This calls our box creating function */
    box1 = xpm_label_box(window, "info.xpm", "cool button");

    /* Pack and show all our widgets */
    gtk_widget_show(box1);

    gtk_container_add (GTK_CONTAINER (button), box1);

    gtk_widget_show(button);

    gtk_container_add (GTK_CONTAINER (window), button);

    gtk_widget_show (window);

    /* Rest in gtk_main and wait for the fun to begin! */
    gtk_main ();

    return(0);
}
/* example-end */
</PRE>
</CODE></BLOCKQUOTE>
<P>The xpm_label_box function could be used to pack xpm's and labels into
any widget that can be a container.
<P>Notice in <CODE>xpm_label_box</CODE> how there is a call to
<CODE>gtk_widget_get_style</CODE>. Every widget has a "style", consisting of
foreground and background colors for a variety of situations, font
selection, and other graphics data relevant to a widget. These style
values are defaulted in each widget, and are required by many GDK
function calls, such as <CODE>gdk_pixmap_create_from_xpm</CODE>, which here is
given the "normal" background color. The style data of widgets may
be customized, using 
<A HREF="gtk_tut-21.html#sec_gtkrc_files">GTK's rc files</A>.
<P>Also notice the call to <CODE>gtk_widget_realize</CODE> after setting the
window's border width. This function uses GDK to create the X
windows related to the widget. The function is automatically called
when you invoke <CODE>gtk_widget_show</CODE> for a widget, and so has not been
shown in earlier examples. But the call to
<CODE>gdk_pixmap_create_from_xpm</CODE> requires that its <CODE>window</CODE> argument
refer to a real X window, so it is necessary to realize the widget
before this GDK call.
<P>The Button widget has the following signals:
<P>
<UL>
<LI><CODE>pressed</CODE> - emitted when pointer button is pressed within
Button widget</LI>
<LI><CODE>released</CODE> - emitted when pointer button is released within
Button widget</LI>
<LI><CODE>clicked</CODE> - emitted when pointer button is pressed and then
released within Button widget</LI>
<LI><CODE>enter</CODE> - emitted when pointer enters Button widget</LI>
<LI><CODE>leave</CODE> - emitted when pointer leaves Button widget</LI>
</UL>
<P>
<H2><A NAME="ss6.2">6.2 Toggle Buttons</A>
</H2>

<P>Toggle buttons are derived from normal buttons and are very similar,
except they will always be in one of two states, alternated by a
click. They may be depressed, and when you click again, they will pop
back up. Click again, and they will pop back down.
<P>Toggle buttons are the basis for check buttons and radio buttons, as
such, many of the calls used for toggle buttons are inherited by radio
and check buttons. I will point these out when we come to them.
<P>Creating a new toggle button:
<P>
<BLOCKQUOTE><CODE>
<PRE>
GtkWidget *gtk_toggle_button_new( void );

GtkWidget *gtk_toggle_button_new_with_label( gchar *label );
</PRE>
</CODE></BLOCKQUOTE>
<P>As you can imagine, these work identically to the normal button widget
calls. The first creates a blank toggle button, and the second, a
button with a label widget already packed into it.
<P>To retrieve the state of the toggle widget, including radio and check
buttons, we use a construct as shown in our example below. This tests
the state of the toggle, by accessing the <CODE>active</CODE> field of the
toggle widget's structure, after first using the
<CODE>GTK_TOGGLE_BUTTON</CODE> macro to cast the widget pointer into a toggle
widget pointer. The signal of interest to us emitted by toggle
buttons (the toggle button, check button, and radio button widgets) is
the "toggled" signal. To check the state of these buttons, set up a
signal handler to catch the toggled signal, and access the structure
to determine its state. The callback will look something like:
<P>
<BLOCKQUOTE><CODE>
<PRE>
void toggle_button_callback (GtkWidget *widget, gpointer data)
{
    if (GTK_TOGGLE_BUTTON (widget)->active) 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久亚洲一级片| 久久品道一品道久久精品| 久久激情五月激情| 国产欧美一区二区三区在线看蜜臀 | 亚洲一区电影777| 精品少妇一区二区三区| 91福利小视频| 国产91对白在线观看九色| 午夜成人免费电影| 亚洲三级免费观看| 久久精品网站免费观看| 欧美精品国产精品| 日本乱人伦aⅴ精品| 成人综合在线网站| 精久久久久久久久久久| 亚洲国产一区二区视频| 亚洲免费观看高清完整版在线观看| 精品国产网站在线观看| 欧美群妇大交群中文字幕| 色综合中文字幕| 大白屁股一区二区视频| 国产一区亚洲一区| 美国十次综合导航| 日韩国产成人精品| 亚洲成av人影院| 亚洲午夜电影网| 夜夜夜精品看看| 亚洲色图一区二区| 亚洲天堂网中文字| 国产精品麻豆欧美日韩ww| 久久久久久久久97黄色工厂| 欧美大度的电影原声| 91精品在线免费| 91精品国产综合久久久久久漫画| 欧美亚洲国产一卡| 欧美日韩小视频| 欧美日韩一区二区三区四区| 在线亚洲免费视频| 欧美色男人天堂| 欧美日韩精品欧美日韩精品一| 色88888久久久久久影院野外| 91色在线porny| 日本韩国精品一区二区在线观看| 色婷婷激情综合| 在线视频欧美精品| 欧美另类高清zo欧美| 欧美日韩夫妻久久| 欧美一二三区精品| 亚洲精品在线免费观看视频| 久久色.com| 国产精品久久久久久久久免费相片| 欧美国产日韩亚洲一区| 亚洲图片激情小说| 亚洲一区二区三区三| 午夜精品成人在线视频| 美女爽到高潮91| 国产成人亚洲精品狼色在线| 国产成a人亚洲| 91在线无精精品入口| 欧美性一级生活| 日韩欧美中文字幕制服| 精品裸体舞一区二区三区| 国产拍揄自揄精品视频麻豆| 亚洲色图20p| 五月综合激情婷婷六月色窝| 久久99国产精品尤物| 成人黄色小视频| 欧美性xxxxx极品少妇| 欧美一区二区人人喊爽| 国产日韩欧美综合一区| 一区二区三区日韩精品视频| 天天av天天翘天天综合网| 国产中文字幕一区| 色噜噜夜夜夜综合网| 欧美成人伊人久久综合网| 中文字幕一区二区日韩精品绯色| 一区二区三区精品视频| 久久99国产精品久久| av一本久道久久综合久久鬼色| 欧美视频日韩视频| 久久亚洲一区二区三区四区| 一区二区三区蜜桃网| 狠狠久久亚洲欧美| 欧美视频一区在线| 欧美国产欧美综合| 日韩电影在线一区二区三区| 成人免费福利片| 欧美一级二级三级乱码| 亚洲精品日韩专区silk| 韩日精品视频一区| 欧美日韩国产乱码电影| 欧美国产国产综合| 麻豆中文一区二区| 色婷婷精品久久二区二区蜜臀av| 久久综合五月天婷婷伊人| 亚洲一区视频在线观看视频| 韩国精品久久久| 欧美老肥妇做.爰bbww| 国产精品久久久久久福利一牛影视 | 欧美精品高清视频| 亚洲欧洲制服丝袜| 国产精品一区在线观看乱码 | 91精品国产全国免费观看| 最新热久久免费视频| 青青草精品视频| 色综合中文字幕国产 | 欧美午夜精品一区二区蜜桃| 国产夜色精品一区二区av| 午夜欧美2019年伦理| 一本色道久久加勒比精品| 国产欧美精品一区二区色综合朱莉| 日韩专区中文字幕一区二区| 色94色欧美sute亚洲线路一久| 国产精品毛片a∨一区二区三区| 国产在线看一区| 91精品综合久久久久久| 亚洲国产精品尤物yw在线观看| www.66久久| 中文乱码免费一区二区| 国产精品综合一区二区三区| 日韩免费观看2025年上映的电影 | 久久99精品一区二区三区三区| 911精品国产一区二区在线| 亚洲乱码中文字幕| 91亚洲午夜精品久久久久久| 中文字幕一区视频| caoporn国产一区二区| 欧美国产国产综合| 成人av免费网站| 中文字幕av一区二区三区高| 国产乱妇无码大片在线观看| 欧美mv和日韩mv国产网站| 老司机精品视频线观看86| 日韩美一区二区三区| 久久国产精品免费| 久久精品亚洲精品国产欧美kt∨| 精品综合久久久久久8888| 欧美精品一区二区在线播放| 国产最新精品精品你懂的| 久久久美女毛片| 成人小视频免费观看| 国产精品网站在线观看| 99久久婷婷国产综合精品电影| 专区另类欧美日韩| 91国产成人在线| 亚洲chinese男男1069| 91精品国产综合久久久久久| 蜜桃精品视频在线| 国产日产欧美一区二区视频| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | 色综合天天综合网国产成人综合天 | 免费成人av在线播放| 久久免费精品国产久精品久久久久| 国产在线精品不卡| 国产免费成人在线视频| 一本色道久久综合亚洲精品按摩| 亚洲成av人影院| 久久综合久久综合久久综合| 国产成人在线视频网址| 最新中文字幕一区二区三区| 欧美猛男男办公室激情| 精品亚洲欧美一区| 中文字幕一区二区三区色视频| 91国模大尺度私拍在线视频| 日韩av电影天堂| 国产欧美日韩精品在线| 日本丰满少妇一区二区三区| 秋霞午夜av一区二区三区| 久久久精品国产免大香伊| 色婷婷av一区二区三区大白胸| 日韩国产精品久久久久久亚洲| 国产亚洲精品aa| 欧美性猛交xxxx黑人交| 狠狠色丁香久久婷婷综| 亚洲精品少妇30p| 久久丝袜美腿综合| 欧美色窝79yyyycom| 国产剧情一区二区| 午夜视频一区在线观看| 国产日韩精品一区| 欧美日韩国产经典色站一区二区三区 | 精品动漫一区二区三区在线观看| bt7086福利一区国产| 秋霞成人午夜伦在线观看| 国产精品久99| 精品日本一线二线三线不卡| 色婷婷亚洲综合| 国产中文一区二区三区| 午夜精品福利一区二区三区蜜桃| 欧美激情一区二区三区在线| 欧美精品高清视频| 91麻豆精品在线观看| 激情综合五月天| 亚洲成av人**亚洲成av**| 国产校园另类小说区| 欧美一级日韩一级| 欧美午夜电影一区| 99这里只有精品| 国产在线观看免费一区| 天堂精品中文字幕在线|