#include <stdio.h> #include <stdlib.h> #include <gtk/gtk.h>
void enter_callback( GtkWidget *widget, GtkWidget *entry ) { const gchar *entry_text; entry_text = gtk_entry_get_text (GTK_ENTRY (entry)); printf("Entry contents: %s\n", entry_text); }
void entry_toggle_editable( GtkWidget *checkbutton, GtkWidget *entry ) { gtk_editable_set_editable (GTK_EDITABLE (entry), GTK_TOGGLE_BUTTON (checkbutton)->active); }
void entry_toggle_visibility( GtkWidget *checkbutton, GtkWidget *entry ) { gtk_entry_set_visibility (GTK_ENTRY (entry), GTK_TOGGLE_BUTTON (checkbutton)->active); }
int main( int argc, char *argv[] ) {
GtkWidget *window; GtkWidget *vbox, *hbox; GtkWidget *entry; GtkWidget *button; GtkWidget *check; gint tmp_pos;
gtk_init (&argc, &argv);
/* 创建一个新窗口 */ window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_widget_set_size_request (GTK_WIDGET (window), 200, 100); gtk_window_set_title (GTK_WINDOW (window), "GTK Entry"); g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (gtk_main_quit), NULL); g_signal_connect_swapped (G_OBJECT (window), "delete_event", G_CALLBACK (gtk_widget_destroy), window);
%2
阅读(1360) | 评论(0) | 转发(0) |
|