Update gtk28

This commit is contained in:
daleclack 2020-12-21 18:37:01 +08:00
parent 4d20ac60f4
commit 6ef68c7e6b
8 changed files with 1134 additions and 6 deletions

1
Gtk3/gtk28/config Normal file
View File

@ -0,0 +1 @@
strafda

View File

@ -31,6 +31,11 @@
<Compiler> <Compiler>
<Add option="-Wall" /> <Add option="-Wall" />
</Compiler> </Compiler>
<Unit filename="gtkwin.cpp" />
<Unit filename="gtkwin.h" />
<Unit filename="main.cpp" />
<Unit filename="test.cpp" />
<Unit filename="test.h" />
<Extensions /> <Extensions />
</Project> </Project>
</CodeBlocks_project_file> </CodeBlocks_project_file>

View File

@ -5,17 +5,25 @@
1608375016 /root/cpp50/gtkclass.h 1608375016 /root/cpp50/gtkclass.h
<gtk/gtk.h> <gtk/gtk.h>
1608431207 source:/root/cpp50/gtkwin.cpp 1608545704 source:/root/cpp50/gtkwin.cpp
"gtkwin.h"
"test.h"
"winpe.xpm"
"360.xpm"
1608433745 /root/cpp50/gtkwin.h 1608516460 /root/cpp50/gtkwin.h
<gtk/gtk.h> <gtk/gtk.h>
1608432192 source:/root/cpp50/main.cpp 1608434422 source:/root/cpp50/main.cpp
"gtkwin.h" "gtkwin.h"
1608433787 source:/root/cpp50/test.cpp 1608473418 source:/root/cpp50/test.cpp
"test.h" "test.h"
1608433607 /root/cpp50/test.h 1608544329 /root/cpp50/test.h
<gtk/gtk.h> <gtk/gtk.h>
1608125195 /root/cpp50/360.xpm
1606780433 /root/cpp50/winpe.xpm

View File

@ -2,4 +2,56 @@
<CodeBlocks_layout_file> <CodeBlocks_layout_file>
<FileVersion major="1" minor="0" /> <FileVersion major="1" minor="0" />
<ActiveTarget name="Debug" /> <ActiveTarget name="Debug" />
<File name="gtkwin.cpp" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1964" topLine="23" />
</Cursor>
<Folding>
<Collapse line="5" />
<Collapse line="12" />
<Collapse line="18" />
<Collapse line="23" />
<Collapse line="28" />
<Collapse line="38" />
<Collapse line="46" />
<Collapse line="50" />
<Collapse line="76" />
<Collapse line="80" />
<Collapse line="85" />
<Collapse line="93" />
<Collapse line="98" />
<Collapse line="117" />
<Collapse line="122" />
</Folding>
</File>
<File name="test.h" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="167" topLine="0" />
</Cursor>
</File>
<File name="gtkwin.h" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="442" topLine="3" />
</Cursor>
<Folding>
<Collapse line="3" />
<Collapse line="12" />
<Collapse line="20" />
<Collapse line="27" />
<Collapse line="35" />
<Collapse line="41" />
<Collapse line="48" />
<Collapse line="56" />
</Folding>
</File>
<File name="test.cpp" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="909" topLine="9" />
</Cursor>
</File>
<File name="main.cpp" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="187" topLine="0" />
</Cursor>
</File>
</CodeBlocks_layout_file> </CodeBlocks_layout_file>

View File

@ -1,5 +1,6 @@
#include "gtkwin.h" #include "gtkwin.h"
#include "test.h" #include "test.h"
#include "winpe.xpm"
#include "360.xpm" #include "360.xpm"
void Icon::get_image(const gchar **str,int width,int height){ void Icon::get_image(const gchar **str,int width,int height){
@ -26,6 +27,9 @@ void Winlayout::put(GtkWidget *child,int x,int y){
//Initalize Gtklayout //Initalize Gtklayout
void Winlayout::init(){ void Winlayout::init(){
Icon background;
background.get_image(winpe,400,300);
put(background.img1,0,0);
GtkBtn button1; GtkBtn button1;
button1.init("Test",100,50); button1.init("Test",100,50);
button1.signal_clicked(print,NULL); button1.signal_clicked(print,NULL);
@ -56,8 +60,18 @@ void MenuBar::menu_init(GtkWidget *window){
menu.set_submenu(menuitem2); menu.set_submenu(menuitem2);
menuitem2.menuitem_init("Exit",quit,(gpointer)window); menuitem2.menuitem_init("Exit",quit,(gpointer)window);
menu.menu_append(menuitem2); menu.menu_append(menuitem2);
menuitem2.menuitem_init("config",NULL,NULL);
menubar_append(menuitem2);
menu.set_submenu(menuitem2);
menuitem2.menuitem_init("Change config",config_activate,NULL);
menu.menu_append(menuitem2);
menuitem2.menuitem_init("Help",NULL,NULL); menuitem2.menuitem_init("Help",NULL,NULL);
menubar_append(menuitem2); menubar_append(menuitem2);
menu.set_submenu(menuitem2);
menuitem2.menuitem_init("About",NULL,NULL);
menu.menu_append(menuitem2);
} }
void Menu::menu_append(Menuitem child){ void Menu::menu_append(Menuitem child){

View File

@ -1,9 +1,41 @@
#include "test.h" #include "test.h"
#include <stdio.h>
void print(GtkWidget *widget,gpointer data){ void print(GtkWidget *widget,gpointer data){
g_print("hello"); char str[57];
FILE *config=NULL;
config=fopen("config","r");
fgets(str,57,config);
g_print("%s",str);
fclose(stdin);
} }
void quit(GtkWidget *widget,gpointer data){ void quit(GtkWidget *widget,gpointer data){
gtk_widget_destroy((GtkWidget *)data); gtk_widget_destroy((GtkWidget *)data);
} }
void config_activate(GtkWidget *widget,gpointer data){
const gchar *str;
GtkWidget *dialog=gtk_dialog_new();
GtkWindow *_dialog=GTK_WINDOW(dialog);
GtkDialog *dialog1=GTK_DIALOG(dialog);
gtk_window_set_default_size(_dialog,300,150);
gtk_window_set_position(_dialog,GTK_WIN_POS_CENTER);
gtk_window_set_title(_dialog,"Change config");
gtk_dialog_add_button(dialog1,"OK",GTK_RESPONSE_OK);
GtkWidget *content_area=gtk_dialog_get_content_area(GTK_DIALOG(_dialog));
GtkContainer *_content_area=GTK_CONTAINER(content_area);
GtkWidget *label=gtk_label_new("Input config");
GtkWidget *entry=gtk_entry_new();
gtk_container_add(_content_area,label);
gtk_container_add(_content_area,entry);
gtk_widget_show_all(content_area);
gtk_dialog_run(dialog1);
str=gtk_entry_get_text(GTK_ENTRY(entry));
freopen("config","w",stdout);
g_print(str);
fclose(stdout);
gtk_widget_destroy(dialog);
}

View File

@ -3,3 +3,5 @@
void print(GtkWidget *widget,gpointer data); void print(GtkWidget *widget,gpointer data);
void quit(GtkWidget *widget,gpointer data); void quit(GtkWidget *widget,gpointer data);
void config_activate(GtkWidget *widget,gpointer data);

1014
Gtk3/gtk28/winpe.xpm Normal file

File diff suppressed because it is too large Load Diff