⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 menus.c

📁 Nemesis a complete Linux video security system. It s idea is a cheap replacement for your commercia
💻 C
字号:
/* Nemesis * Copyright (C) 1999 John Ferlito <johnf@inodes.org> * * 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.  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. * */#include <stdio.h>#include <gtk/gtk.h>#include "menus.h"GtkWidget *create_menus(void){		GtkWidget *menu_bar;	GtkWidget *file_menu, *help_menu;	GtkWidget *file_item, *help_item; 	GtkWidget *quit_item, *about_item;		/* Create the menu bar */	menu_bar = gtk_menu_bar_new();		/* Create a menu */	file_menu = gtk_menu_new();		file_item = gtk_menu_item_new_with_label("File");	gtk_widget_show(file_item);		gtk_menu_item_set_submenu(GTK_MENU_ITEM(file_item), file_menu);	gtk_menu_bar_append(GTK_MENU_BAR(menu_bar), file_item);		/* Create items for menu */ 	quit_item = gtk_menu_item_new_with_label("Quit");		/* Append items to menu */	gtk_menu_append(GTK_MENU (file_menu), quit_item);			/* Attach callback functions to items */	gtk_signal_connect(GTK_OBJECT (quit_item), "activate",			   GTK_SIGNAL_FUNC(gtk_exit), NULL); 		/* Show menu items */	gtk_widget_show(quit_item);			help_menu = gtk_menu_new();		help_item = gtk_menu_item_new_with_label("Help");	gtk_menu_item_right_justify(GTK_MENU_ITEM(help_item));	gtk_widget_show(help_item);		gtk_menu_item_set_submenu(GTK_MENU_ITEM(help_item), help_menu);	gtk_menu_bar_append(GTK_MENU_BAR(menu_bar), help_item);			about_item = gtk_menu_item_new_with_label("About Security...");		gtk_menu_append(GTK_MENU (help_menu), about_item);	/* Attach callback functions to items */	gtk_signal_connect(GTK_OBJECT (about_item), "activate",			   GTK_SIGNAL_FUNC(on_about), NULL); 	gtk_widget_show(about_item);					return menu_bar;}static void on_about (GtkWidget * widget, gpointer data){	/* I hope the translations don't overflow the buffer! */	gchar buf[1024];	/* VERSION comes from configure.in - the only place it should be * defined */	sprintf (buf,	"G L E N G A R R Y\n 			S E C U R I T Y\n	S Y S T E M\n\n	A GTK+ User Security System\n\n	Version 0.8\n\n	By John Ferlito\n\n	Email: johnf@zipworld.com.au\n	Web: http://www.zipworld.com.au/~johnf\n"	);	show_message_box (buf);}/* * Shows a simple message box with a label and an 'OK' button. * e.g. show_message_box ("Error saving file"); */void show_message_box (gchar * message){  GtkWidget *dialog, *label, *button;  dialog = gtk_dialog_new ();  gtk_window_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);  gtk_container_border_width (GTK_CONTAINER (dialog), 5);  label = gtk_label_new (message);  gtk_misc_set_padding (GTK_MISC (label), 20, 20);  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), label,                      TRUE, TRUE, 0);  gtk_widget_show (label);  button = gtk_button_new_with_label ("OK");  gtk_widget_set_usize (button, 80, -1);  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), button,                      FALSE, FALSE, 14);  GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);  gtk_widget_grab_default (button);  gtk_widget_show (button);  gtk_signal_connect_object (GTK_OBJECT (dialog), "delete_event",                             GTK_SIGNAL_FUNC (gtk_widget_destroy),                             GTK_OBJECT (dialog));  gtk_signal_connect_object (GTK_OBJECT (button), "clicked",                             GTK_SIGNAL_FUNC (gtk_widget_destroy),                             GTK_OBJECT (dialog));  gtk_widget_show (dialog);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -