Add gtk66
This commit is contained in:
parent
e4c5319a95
commit
e48d3b9195
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Linux",
|
||||
"includePath": [
|
||||
//This is the gtk4 config file on vscode
|
||||
//Due to no gtk4 on debian and ubuntu till now,the configure only support manjaro(Arch linux may can use it)
|
||||
"${workspaceFolder}/**",
|
||||
"/usr/include/gtk-4.0/**",
|
||||
"/usr/include/pango-1.0/**",
|
||||
"/usr/include/glib-2.0/**",
|
||||
"/usr/lib/glib-2.0/include/**",
|
||||
"/usr/include/harfbuzz/**",
|
||||
"/usr/include/freetype2/**",
|
||||
"/usr/include/libpng16/**",
|
||||
"/usr/include/libmount/**",
|
||||
"/usr/include/blkid/**",
|
||||
"/usr/include/fribidi/**",
|
||||
"/usr/include/cairo/**",
|
||||
"/usr/include/lzo/**",
|
||||
"/usr/include/pixman-1/**",
|
||||
"/usr/include/gdk-pixbuf-2.0/**",
|
||||
"/usr/include/graphene-1.0/**",
|
||||
"/usr/lib/graphene-1.0/include/**",
|
||||
"/usr/include/gio-unix-2.0/**"
|
||||
],
|
||||
"defines": [],
|
||||
"compilerPath": "/usr/bin/gcc",
|
||||
"cStandard": "gnu17",
|
||||
"cppStandard": "gnu++14",
|
||||
"intelliSenseMode": "gcc-x64",
|
||||
"compilerArgs": [
|
||||
"`pkg-config --cflags --libs gtk+-3.0`"
|
||||
],
|
||||
"configurationProvider": "ms-vscode.cmake-tools"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
|
||||
{
|
||||
"name": "g++ - Build and debug active file",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/bin/gtk64",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"MIMode": "gdb",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
],
|
||||
"preLaunchTask": "C/C++: g++ build active file",
|
||||
"miDebuggerPath": "/usr/bin/gdb"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"C_Cpp.errorSquiggles": "Disabled",
|
||||
"cmake.configureOnOpen": false
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
{
|
||||
"tasks": [
|
||||
{
|
||||
"type": "cppbuild",
|
||||
"label": "C/C++: g++ build active file",
|
||||
"command": "/usr/bin/g++",
|
||||
"args": [
|
||||
"-g",
|
||||
"src/*.cpp",
|
||||
"-o",
|
||||
"${workspaceFolder}/bin/gtk64",
|
||||
"-pthread",
|
||||
"-I${workspaceFolder}/",
|
||||
"-I/usr/include/gtk-4.0",
|
||||
"-I/usr/include/pango-1.0",
|
||||
"-I/usr/include/glib-2.0",
|
||||
"-I/usr/lib/glib-2.0/include",
|
||||
"-I/usr/include/harfbuzz",
|
||||
"-I/usr/include/freetype2",
|
||||
"-I/usr/include/libpng16",
|
||||
"-I/usr/include/libmount",
|
||||
"-I/usr/include/blkid",
|
||||
"-I/usr/include/fribidi",
|
||||
"-I/usr/include/cairo",
|
||||
"-I/usr/include/lzo",
|
||||
"-I/usr/include/pixman-1",
|
||||
"-I/usr/include/gdk-pixbuf-2.0",
|
||||
"-I/usr/include/graphene-1.0",
|
||||
"-I/usr/lib/graphene-1.0/include",
|
||||
"-I/usr/include/gio-unix-2.0",
|
||||
"-mfpmath=sse",
|
||||
"-msse",
|
||||
"-msse2",
|
||||
"-lgtk-4",
|
||||
"-lpangocairo-1.0",
|
||||
"-lpango-1.0",
|
||||
"-lharfbuzz",
|
||||
"-lgdk_pixbuf-2.0",
|
||||
"-lcairo-gobject",
|
||||
"-lcairo",
|
||||
"-lvulkan",
|
||||
"-lgraphene-1.0",
|
||||
"-lgio-2.0",
|
||||
"-lgobject-2.0",
|
||||
"-lglib-2.0"
|
||||
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$gcc"
|
||||
],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"detail": "Task generated by Debugger."
|
||||
}
|
||||
],
|
||||
"version": "2.0.0"
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1 @@
|
|||
glib-compile-resources gtk66.gresource.xml --target=../src/resources.cpp --generate-source
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<gresources>
|
||||
<gresource prefix="org/gtk/daleclack">
|
||||
<file>icons/48x48/actions/gtk66.png</file>
|
||||
</gresource>
|
||||
</gresources>
|
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
|
@ -0,0 +1,43 @@
|
|||
#include<gtk/gtk.h>
|
||||
|
||||
static void button_clicked(GtkWidget *widget,GtkApplication *app){
|
||||
//A text function of gtk_overlay_get_child
|
||||
GtkWindow *win=gtk_application_get_active_window(app);
|
||||
GtkWidget *overlay,*label;
|
||||
overlay=gtk_window_get_child(win);
|
||||
label=gtk_overlay_get_child(GTK_OVERLAY(overlay));
|
||||
gtk_label_set_label(GTK_LABEL(label),"Test");
|
||||
}
|
||||
|
||||
static void gtkmain(GtkApplication *app,gpointer user_data){
|
||||
GtkWidget *window,*label1,*label2,*overlay,*button;
|
||||
//Main window
|
||||
window=gtk_application_window_new(app);
|
||||
gtk_window_set_default_size(GTK_WINDOW(window),400,100);
|
||||
gtk_window_set_icon_name(GTK_WINDOW(window),"gtk66");
|
||||
//Overlay widgets
|
||||
overlay=gtk_overlay_new();
|
||||
//Button
|
||||
button=gtk_button_new_with_label("Test");
|
||||
g_signal_connect(button,"clicked",G_CALLBACK(button_clicked),app);
|
||||
gtk_widget_set_halign(button,GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign(button,GTK_ALIGN_END);
|
||||
gtk_overlay_add_overlay(GTK_OVERLAY(overlay),button);
|
||||
//Label1
|
||||
label1=gtk_label_new("label1");
|
||||
gtk_widget_set_valign(label1,GTK_ALIGN_START);
|
||||
gtk_widget_set_halign(label1,GTK_ALIGN_CENTER);
|
||||
gtk_overlay_add_overlay(GTK_OVERLAY(overlay),label1);
|
||||
//label2
|
||||
label2=gtk_label_new("label2");
|
||||
gtk_overlay_set_child(GTK_OVERLAY(overlay),label2);
|
||||
gtk_window_set_child(GTK_WINDOW(window),overlay);
|
||||
gtk_widget_show(window);
|
||||
}
|
||||
|
||||
int main(int argc,char **argv){
|
||||
GtkApplication *app;
|
||||
app=gtk_application_new("org.gtk.daleclack",G_APPLICATION_NON_UNIQUE);
|
||||
g_signal_connect(app,"activate",G_CALLBACK(gtkmain),NULL);
|
||||
return g_application_run(G_APPLICATION(app),argc,argv);
|
||||
}
|
Binary file not shown.
Loading…
Reference in New Issue