Add gtk3-test

This commit is contained in:
daleclack 2020-11-23 12:45:09 +08:00
parent a5f4c0a327
commit 51a6a6a62a
4 changed files with 70 additions and 0 deletions

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="gtk3-test" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Debug">
<Option output="bin/Debug/gtk3-test" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Debug/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-g" />
</Compiler>
</Target>
<Target title="Release">
<Option output="bin/Release/gtk3-test" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Release/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-O2" />
</Compiler>
<Linker>
<Add option="-s" />
</Linker>
</Target>
</Build>
<Compiler>
<Add option="-Wall" />
</Compiler>
<Unit filename="main.cpp" />
<Extensions />
</Project>
</CodeBlocks_project_file>

View File

@ -0,0 +1,4 @@
# depslib dependency file v1.0
1605149352 source:/root/gtk3-test/main.cpp
<gtk/gtk.h>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<FileVersion major="1" minor="0" />
<ActiveTarget name="Debug" />
<File name="main.cpp" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="311" topLine="8" />
</Cursor>
</File>
</CodeBlocks_layout_file>

19
Gtk3/gtk3-test/main.cpp Normal file
View File

@ -0,0 +1,19 @@
#include<gtk/gtk.h>
static void activate(GtkApplication *app,gpointer user_data){
GtkWidget *window;
window=gtk_application_window_new(app);
gtk_window_set_position(GTK_WINDOW(window),GTK_WIN_POS_CENTER);
gtk_window_set_title(GTK_WINDOW(window),"gtk3 test");
gtk_widget_show_all(window);
}
int main(int argc,char *argv[]){
GtkApplication *app;
int status;
app=gtk_application_new("org.gtk.example",G_APPLICATION_FLAGS_NONE);
g_signal_connect(app,"activate",G_CALLBACK(activate),NULL);
status=g_application_run(G_APPLICATION(app),argc,argv);
g_object_unref(app);
return status;
}