📄 aboutdialog.c
字号:
/* * Compaq Hot Plug Controller Graphical User Interface * Copyright 2000, 2001 Compaq Computer Corporation * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or * NON INFRINGEMENT. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Please send all questions or concerns to linuxhotplug@compaq.com */#include <gtk/gtk.h>void CloseDialog (GtkWidget *widget, gpointer data);void Popup (char *szMessage);// CloseDialog//// Close the dialog window. The dialog handle is passed// in as the data.void CloseDialog (GtkWidget *widget, gpointer data){ /* --- Remove grab --- */ gtk_grab_remove (GTK_WIDGET (data)); /* --- Close it. --- */ gtk_widget_destroy (GTK_WIDGET (data));}// Popup//// Display a popup dialog window with a message and an // "Ok" buttonvoid Popup (char *szMessage){ static GtkWidget *label; GtkWidget *button; GtkWidget *dialog_window; // Create a dialog window dialog_window = gtk_dialog_new (); // Trap the destroy button gtk_signal_connect (GTK_OBJECT (dialog_window), "destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed), &dialog_window); gtk_window_set_position (GTK_WINDOW (dialog_window), GTK_WIN_POS_CENTER); gtk_window_set_default_size (GTK_WINDOW (dialog_window), 200, 200); // Add a title to the window gtk_window_set_title (GTK_WINDOW (dialog_window), "About"); // Create a small border gtk_container_border_width (GTK_CONTAINER (dialog_window), 2); // Create the message // Create the message in a label label = gtk_label_new (szMessage); // Put some room around the label gtk_misc_set_padding (GTK_MISC (label), 5, 5); // Add the label to the dialog gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog_window)->vbox), label, TRUE, TRUE, 0); // Make the label visible gtk_widget_show (label); // "OK" button // Create the "OK" button button = gtk_button_new_with_label ("OK"); // Need to close the window if they press "OK" gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (CloseDialog), dialog_window); // Allow it to be the default button GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); // Add the button to the dialog gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog_window)->action_area), button, TRUE, TRUE, 0); // Make the button the default button gtk_widget_grab_default (button); // Make the button visible gtk_widget_show (button); // Make the dialog visible gtk_widget_show (dialog_window); gtk_grab_add (dialog_window);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -