首页 > 代码库 > temp12
temp12
satff.c
#include <gtk/gtk.h>#include "Staff_Login.h"#include "Staff_Work1.h"#include "Staff_Work2.h"int main( int argc,char *argv[] ) { //初始化GTK+工具库 gtk_init(&argc,&argv); Staff_Login(); return 0;}
Staff_Login.c
#include <gtk/gtk.h>void login( GtkWidget *widget,gpointer data ) { gtk_widget_hide(data); Staff_Work1(); }void end_Login( GtkWidget *widget,gpointer data ) { gtk_widget_hide(data); }gint delete_event( GtkWidget *widget,GdkEvent *event,gpointer data ) { g_print ("delete event occurred\n"); return TRUE; }void destroy( GtkWidget *widget,gpointer data ) { gtk_main_quit (); }int Staff_Login( ) { GtkWidget *window2; GtkWidget *label8; GtkWidget *label9; GtkWidget *label10; GtkWidget *label11; GtkWidget *button4; GtkWidget *button5; GtkWidget *table; window2 = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (window2), "柜员登陆"); gtk_window_set_default_size(GTK_WINDOW(window2), 400, 400); gtk_container_set_border_width (GTK_CONTAINER (window2), 30); table = gtk_table_new (12, 9, TRUE); gtk_container_add (GTK_CONTAINER (window2), table); label8 = gtk_label_new ("用户名:"); label9= gtk_entry_new (); label10 = gtk_label_new ("密码:"); label11 = gtk_entry_new (); button4 = gtk_button_new_with_label ("登陆"); button5 = gtk_button_new_with_label ("取消"); g_signal_connect (G_OBJECT (button4), "clicked",G_CALLBACK (login), (gpointer) window2); g_signal_connect (G_OBJECT (button5), "clicked",G_CALLBACK (end_Login), (gpointer) window2); gtk_table_attach_defaults (GTK_TABLE (table), label8, 1, 4, 3, 4); gtk_table_attach_defaults (GTK_TABLE (table), label9, 4, 8, 3, 4); gtk_table_attach_defaults (GTK_TABLE (table), label10, 1, 4, 5, 6); gtk_table_attach_defaults (GTK_TABLE (table), label11, 4, 8, 5, 6); gtk_table_attach_defaults (GTK_TABLE (table), button5, 2, 3, 7, 8); gtk_table_attach_defaults (GTK_TABLE (table), button4, 6, 7, 7, 8); gtk_widget_show_all(window2); gtk_main (); return 0; }
Staff_Login.h
#ifndef STAFF_LOGIN_H#define STAFF_LOGIN_H void login( GtkWidget *widget,gpointer data ); void end_Login( GtkWidget *widget,gpointer data ); gint delete_event( GtkWidget *widget,GdkEvent *event,gpointer data ); void destroy( GtkWidget *widget,gpointer data ); int Staff_Login( );#endif
Staff_Work1.c
#include <gtk/gtk.h>void call( GtkWidget *widget,gpointer data ) { gtk_widget_hide(data); Staff_Work2( ); }void stop_Work( GtkWidget *widget,gpointer data ) { gtk_widget_hide(data); Staff_Login(); }int Staff_Work1( ) { GtkWidget *window2; GtkWidget *label8; GtkWidget *label9; GtkWidget *label10; GtkWidget *label11; GtkWidget *button4; GtkWidget *button5; GtkWidget *table; window2 = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (window2), "柜员服务页面"); gtk_window_set_default_size(GTK_WINDOW(window2), 400, 400); gtk_container_set_border_width (GTK_CONTAINER (window2), 30); table = gtk_table_new (12, 9, TRUE); gtk_container_add (GTK_CONTAINER (window2), table); label8 = gtk_label_new ("公告栏:"); button4 = gtk_button_new_with_label ("暂停服务(退出)"); button5 = gtk_button_new_with_label ("呼叫客户"); g_signal_connect (G_OBJECT (button5), "clicked",G_CALLBACK (call), (gpointer) window2); g_signal_connect (G_OBJECT (button4), "clicked",G_CALLBACK (stop_Work), (gpointer) window2); gtk_table_attach_defaults (GTK_TABLE (table), label8, 0, 3, 1, 10); gtk_table_attach_defaults (GTK_TABLE (table), button5, 4, 9, 1, 5); gtk_table_attach_defaults (GTK_TABLE (table), button4, 4, 9, 6, 10); gtk_widget_show_all(window2); gtk_main (); return 0; }
Staff_Work1.h
#ifndef STAFF_WORK1_H#define STAFF_WORK1_Hvoid call( GtkWidget *widget,gpointer data );void stop_Work( GtkWidget *widget,gpointer data );int Staff_Work1( );#endif
Staff_Work2.c
#include <gtk/gtk.h>int times = 1;void calls( GtkWidget *widget,gpointer data ) { times++; g_print("%d\n",times); if(times == 3){ times = 1; gtk_widget_hide(data); Staff_Work1(); } }void working( GtkWidget *widget,gpointer data ) { gtk_widget_hide(data); Staff_Work1(); }int Staff_Work2( ) { GtkWidget *window2; GtkWidget *label8; GtkWidget *label10; GtkWidget *label11; GtkWidget *button4; GtkWidget *button5; GtkWidget *table; window2 = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (window2), "柜员服务页面"); gtk_window_set_default_size(GTK_WINDOW(window2), 400, 400); gtk_container_set_border_width (GTK_CONTAINER (window2), 30); table = gtk_table_new (9, 9, TRUE); gtk_container_add (GTK_CONTAINER (window2), table); label8 = gtk_label_new ("最多提供三次呼叫"); label10 = gtk_label_new ("是否应答"); label11 = gtk_label_new ("内容"); button4 = gtk_button_new_with_label ("继续呼叫"); button5 = gtk_button_new_with_label ("受理业务中"); g_signal_connect (G_OBJECT (button4), "clicked",G_CALLBACK (calls), (gpointer) window2); g_signal_connect (G_OBJECT (button5), "clicked",G_CALLBACK (working), (gpointer) window2); //创建标签后,要改变标签你的文本,用以下函数: //void gtk_label_set_text( GtkLabel *label,const char *str ); gtk_table_attach_defaults (GTK_TABLE (table), label8, 0, 4, 6, 7); gtk_table_attach_defaults (GTK_TABLE (table), label10, 5, 9, 6, 7); gtk_table_attach_defaults (GTK_TABLE (table), button5, 5, 9, 1, 5); gtk_table_attach_defaults (GTK_TABLE (table), button4, 0, 4, 1, 5); gtk_widget_show_all(window2); gtk_main (); return 0; }
Staff_Work2.h
#ifndef STAFF_WORK2_H#define STAFF_WORK2_Hvoid calls( GtkWidget *widget,gpointer data );void working( GtkWidget *widget,gpointer data );int Staff_Work2( );#endif
Manager.c
#include <gtk/gtk.h>#include "Manager_Login.h"#include "Manager_Work.h"int main( int argc,char *argv[] ) { gtk_init(&argc,&argv); Manager_Login(); return 0;}
Manager_Login.c
#include <gtk/gtk.h>void login2( GtkWidget *widget,gpointer data ) { gtk_widget_hide(data); Manager_Work(); }void end_Login2( GtkWidget *widget,gpointer data ) { gtk_widget_hide(data); Manager_Login( ); }gint delete_event( GtkWidget *widget,GdkEvent *event,gpointer data ) { g_print ("delete event occurred\n"); return TRUE; }void destroy( GtkWidget *widget,gpointer data ) { gtk_main_quit (); }int Manager_Login( ) { GtkWidget *window2; GtkWidget *label8; GtkWidget *label9; GtkWidget *label10; GtkWidget *label11; GtkWidget *button4; GtkWidget *button5; GtkWidget *table; window2 = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (window2), "经理登陆"); gtk_window_set_default_size(GTK_WINDOW(window2), 400, 400); gtk_container_set_border_width (GTK_CONTAINER (window2), 30); table = gtk_table_new (12, 9, TRUE); gtk_container_add (GTK_CONTAINER (window2), table); label8 = gtk_label_new ("用户名:"); label9= gtk_entry_new (); label10 = gtk_label_new ("密码:"); label11 = gtk_entry_new (); button4 = gtk_button_new_with_label ("登陆"); button5 = gtk_button_new_with_label ("取消"); g_signal_connect (G_OBJECT (button4), "clicked",G_CALLBACK (login2), (gpointer) window2); g_signal_connect (G_OBJECT (button5), "clicked",G_CALLBACK (end_Login2), (gpointer) window2); gtk_table_attach_defaults (GTK_TABLE (table), label8, 1, 4, 3, 4); gtk_table_attach_defaults (GTK_TABLE (table), label9, 4, 8, 3, 4); gtk_table_attach_defaults (GTK_TABLE (table), label10, 1, 4, 5, 6); gtk_table_attach_defaults (GTK_TABLE (table), label11, 4, 8, 5, 6); gtk_table_attach_defaults (GTK_TABLE (table), button5, 2, 3, 7, 8); gtk_table_attach_defaults (GTK_TABLE (table), button4, 6, 7, 7, 8); gtk_widget_show_all(window2); gtk_main (); return 0; }
Manager_Login.h
#ifndef MANAGER_LOGIC_H#define MANAGER_LOGIC_Hvoid login2( GtkWidget *widget,gpointer data );void end_Login2( GtkWidget *widget,gpointer data );gint delete_event( GtkWidget *widget,GdkEvent *event,gpointer data );void destroy( GtkWidget *widget,gpointer data );int Manager_Login( );#endif
Manager_Work.c
#include <gtk/gtk.h>void f1( GtkWidget *widget,gpointer data ) { }void f2( GtkWidget *widget,gpointer data ) { }void f3( GtkWidget *widget,gpointer data ) { }void f4( GtkWidget *widget,gpointer data ) { }void f( GtkWidget *widget,gpointer data ) { gtk_widget_hide(data); Manager_Login( ); }int Manager_Work( ) { GtkWidget *window2; GtkWidget *label1; GtkWidget *label2; GtkWidget *label3; GtkWidget *label4; GtkWidget *button1; GtkWidget *button2; GtkWidget *button3; GtkWidget *button4; GtkWidget *button; GtkWidget *table; window2 = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (window2), "查询页面"); gtk_window_set_default_size(GTK_WINDOW(window2), 400, 400); gtk_container_set_border_width (GTK_CONTAINER (window2), 30); table = gtk_table_new (12, 10, TRUE); gtk_container_add (GTK_CONTAINER (window2), table); label1 = gtk_label_new ("经理VIP操作区:"); label2 = gtk_label_new ("经理业务查询区:"); label3 = gtk_label_new (""); label4 = gtk_label_new (""); button1 = gtk_button_new_with_label ("VIP查询"); button2 = gtk_button_new_with_label ("VIP添加"); button3 = gtk_button_new_with_label ("VIP删除"); button4 = gtk_button_new_with_label ("业务办理查询"); button = gtk_button_new_with_label ("经理退出"); g_signal_connect (G_OBJECT (button4), "clicked",G_CALLBACK (f4), (gpointer) window2); g_signal_connect (G_OBJECT (button3), "clicked",G_CALLBACK (f3), (gpointer) window2); g_signal_connect (G_OBJECT (button2), "clicked",G_CALLBACK (f2), (gpointer) window2); g_signal_connect (G_OBJECT (button1), "clicked",G_CALLBACK (f1), (gpointer) window2); g_signal_connect (G_OBJECT (button), "clicked",G_CALLBACK (f), (gpointer) window2); gtk_table_attach_defaults (GTK_TABLE (table), label1, 0, 3, 1, 2); gtk_table_attach_defaults (GTK_TABLE (table), button1, 0, 3, 2, 3); gtk_table_attach_defaults (GTK_TABLE (table), button2, 0, 3, 3, 4); gtk_table_attach_defaults (GTK_TABLE (table), button3, 0, 3, 4, 5); gtk_table_attach_defaults (GTK_TABLE (table), label2, 0, 3, 6, 7); gtk_table_attach_defaults (GTK_TABLE (table), button4, 0, 3, 7, 8); gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 3, 11, 12); gtk_widget_show_all(window2); gtk_main (); return 0; }
Maanager_Work.h
#ifndef MANAGER_WORK_H#define MANAGER_WORK_Hvoid f1( GtkWidget *widget,gpointer data );void f2( GtkWidget *widget,gpointer data );void f3( GtkWidget *widget,gpointer data );void f4( GtkWidget *widget,gpointer data );void f( GtkWidget *widget,gpointer data );int Manager_Work( );#endif
零散
/*char buf[BUFSIZ]; char buf1[] = gtk_entry_get_text( (GtkEntry*) label9); char buf2[] = gtk_entry_get_text( (GtkEntry*) label11); gtk_widget_hide(data); Staff_Work1(); strcpy(buf,"staffLogin"); strcat(buf,"#"); strcat(buf, "luo" ); strcat(buf,"#"); strcat(buf,"098"); g_print("%s",buf); //*buf=sendMsg(buf); 醉了*/
temp12
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。