Update gtk28
This commit is contained in:
parent
3efd959565
commit
113c30e599
|
@ -30,7 +30,7 @@
|
|||
|
||||
1606780433 /root/cpp50/winpe.xpm
|
||||
|
||||
1608950527 source:/root/gtk28/gtkwin.cpp
|
||||
1608952131 source:/root/gtk28/gtkwin.cpp
|
||||
"gtkwin.h"
|
||||
"test.h"
|
||||
"winpe.xpm"
|
||||
|
@ -39,7 +39,7 @@
|
|||
1608952150 /root/gtk28/gtkwin.h
|
||||
<gtk/gtk.h>
|
||||
|
||||
1608874688 /root/gtk28/test.h
|
||||
1609035234 /root/gtk28/test.h
|
||||
<gtk/gtk.h>
|
||||
|
||||
1606780433 /root/gtk28/winpe.xpm
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
void print(GtkWidget *widget,gpointer data){
|
||||
const gchar *filename;
|
||||
//Use the combo box id to check the selection
|
||||
int id=gtk_combo_box_get_active(GTK_COMBO_BOX(data));
|
||||
switch(id){
|
||||
case 0:
|
||||
|
@ -43,6 +44,7 @@ void config2_activate(GtkWidget *widget,gpointer data){
|
|||
}
|
||||
|
||||
void InputBox(const gchar *content,const char *filename){
|
||||
//Initalize InputBox
|
||||
const gchar *str;
|
||||
int response;
|
||||
GtkWidget *dialog=gtk_dialog_new();
|
||||
|
@ -53,6 +55,7 @@ void InputBox(const gchar *content,const char *filename){
|
|||
gtk_window_set_title(_dialog,"Change config");
|
||||
gtk_dialog_add_buttons(dialog1,"Cancel",GTK_RESPONSE_CANCEL,"OK",GTK_RESPONSE_OK,NULL);
|
||||
|
||||
//Get content_area and put entry and label to the dialog
|
||||
GtkWidget *content_area=gtk_dialog_get_content_area(GTK_DIALOG(_dialog));
|
||||
GtkContainer *_content_area=GTK_CONTAINER(content_area);
|
||||
GtkWidget *label=gtk_label_new(" ");
|
||||
|
@ -68,6 +71,7 @@ void InputBox(const gchar *content,const char *filename){
|
|||
gtk_container_add(_content_area,entry);
|
||||
gtk_widget_show_all(content_area);
|
||||
response=gtk_dialog_run(dialog1);
|
||||
//Check the response and update the file with the "OK" Response
|
||||
if(response==GTK_RESPONSE_OK){
|
||||
str=gtk_entry_get_text(GTK_ENTRY(entry));
|
||||
freopen(filename,"w",stdout);
|
||||
|
@ -85,6 +89,7 @@ void entry_activate(GtkWidget *widget,gpointer data){
|
|||
}
|
||||
|
||||
void MsgBox(const gchar *title,const gchar *msg){
|
||||
//Initalize the MsgBox
|
||||
GtkWidget *dialog=gtk_dialog_new();
|
||||
GtkWindow *win=GTK_WINDOW(dialog);
|
||||
gtk_window_set_default_size(win,300,150);
|
||||
|
@ -92,6 +97,7 @@ void MsgBox(const gchar *title,const gchar *msg){
|
|||
gtk_window_set_title(win,title);
|
||||
gtk_dialog_add_button(GTK_DIALOG(dialog),"OK",GTK_RESPONSE_OK);
|
||||
|
||||
//Get GtkDialog's content_area and put widgets
|
||||
GtkWidget *content_area=gtk_dialog_get_content_area(GTK_DIALOG(dialog));
|
||||
GtkContainer *_content_area=GTK_CONTAINER(content_area);
|
||||
GtkWidget *label=gtk_label_new(" ");
|
||||
|
@ -105,6 +111,7 @@ void MsgBox(const gchar *title,const gchar *msg){
|
|||
label=gtk_label_new(msg);
|
||||
hbox.pack_start(label,FALSE,FALSE,5);
|
||||
|
||||
//Add a GtkBox to the dialog and run
|
||||
gtk_container_add(_content_area,hbox.hbox);
|
||||
gtk_widget_show_all(content_area);
|
||||
gtk_dialog_run(GTK_DIALOG(dialog));
|
||||
|
|
|
@ -1,19 +1,28 @@
|
|||
#include <gtk/gtk.h>
|
||||
|
||||
//Show config
|
||||
void print(GtkWidget *widget,gpointer data);
|
||||
|
||||
//Quit application
|
||||
void quit(GtkWidget *widget,gpointer data);
|
||||
|
||||
//Callback function of "config" menuitem
|
||||
void config_activate(GtkWidget *widget,gpointer data);
|
||||
|
||||
//Callback function of "config1" menuitem
|
||||
void config1_activate(GtkWidget *widget,gpointer data);
|
||||
|
||||
//InputBox:Input content and write the content to specificed file
|
||||
void InputBox(const gchar *content,const char *filename);
|
||||
|
||||
//A callback function of entry "activate" signal
|
||||
void entry_activate(GtkWidget *widget,gpointer data);
|
||||
|
||||
//MsgBox:Show Message and use a specific title
|
||||
void MsgBox(const gchar *title,const gchar *msg);
|
||||
|
||||
//Callback function of "config2" menuitem
|
||||
void config2_activate(GtkWidget *widget,gpointer data);
|
||||
|
||||
//Callback function of "about" menuitem
|
||||
void about_activate(GtkWidget *widget,gpointer data);
|
||||
|
|
Loading…
Reference in New Issue