Add gtk47
This commit is contained in:
parent
ed78225ade
commit
9120a04113
|
@ -0,0 +1,59 @@
|
|||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Linux",
|
||||
"includePath": [
|
||||
//For linux amd64 and linux on arm64,some include path may different
|
||||
//Commet and uncomment these lines to compile on a specificed archtiecture
|
||||
//Arm64 linux libs
|
||||
/*
|
||||
"/usr/lib/aarch64-linux-gnu/dbus-1.0/include/**",
|
||||
"/usr/lib/aarch64-linux-gnu/glib-2.0/include",
|
||||
*/
|
||||
//amd64 linux libs(For ubuntu)
|
||||
/*
|
||||
"/usr/lib/x86_64-linux-gnu/dbus-1.0/include",
|
||||
"/usr/lib/x86_64-linux-gnu/glib-2.0/include",
|
||||
*/
|
||||
//For debian and ubuntu,kali
|
||||
/*
|
||||
"/usr/include/gtk-3.0/gtk/**",
|
||||
"/usr/include/uuid/**",
|
||||
*/
|
||||
//For manjaro(Arch linux)
|
||||
"/usr/lib/dbus-1.0/include/**",
|
||||
"/usr/lib/glib-2.0/include/**",
|
||||
"/usr/include/lzo/**",
|
||||
"/usr/include/cloudproviders/**",
|
||||
"${workspaceFolder}/**",
|
||||
"/usr/include/gtk-3.0/**",
|
||||
"/usr/include/at-spi2-atk/2.0/**",
|
||||
"/usr/include/at-spi-2.0/**",
|
||||
"/usr/include/dbus-1.0/**",
|
||||
"/usr/include/gio-unix-2.0/**",
|
||||
"/usr/include/cairo/**",
|
||||
"/usr/include/pango-1.0/**",
|
||||
"/usr/include/fribidi/**",
|
||||
"/usr/include/harfbuzz/**",
|
||||
"/usr/include/atk-1.0/**",
|
||||
"/usr/include/pixman-1/**",
|
||||
"/usr/include/freetype2/**",
|
||||
"/usr/include/libpng16/**",
|
||||
"/usr/include/gdk-pixbuf-2.0/**",
|
||||
"/usr/include/libmount/**",
|
||||
"/usr/include/blkid/**",
|
||||
"/usr/include/glib-2.0/**"
|
||||
],
|
||||
"defines": [],
|
||||
"compilerPath": "/usr/bin/gcc",
|
||||
"cStandard": "gnu17",
|
||||
"cppStandard": "gnu++14",
|
||||
"intelliSenseMode": "gcc-arm64",
|
||||
"compilerArgs": [
|
||||
"`pkg-config --cflags --libs gtk+-3.0`"
|
||||
],
|
||||
"configurationProvider": "ms-vscode.cmake-tools"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
// 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/gtk46",
|
||||
"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,82 @@
|
|||
{
|
||||
"tasks": [
|
||||
{
|
||||
"type": "cppbuild",
|
||||
"label": "C/C++: g++ build active file",
|
||||
"command": "/usr/bin/g++",
|
||||
"args": [
|
||||
"-g",
|
||||
"src/*.cpp",
|
||||
"-o",
|
||||
"${workspaceFolder}/bin/gtk46",
|
||||
"-pthread",
|
||||
//For Arm64 linux
|
||||
/*
|
||||
"-I/usr/lib/aarch64-linux-gnu/dbus-1.0/include",
|
||||
"-I/usr/lib/aarch64-linux-gnu/glib-2.0/include",
|
||||
*/
|
||||
//For amd64 linux
|
||||
/*
|
||||
"-I/usr/lib/x86_64-linux-gnu/dbus-1.0/include",
|
||||
"-I/usr/lib/x86_64-linux-gnu/glib-2.0/include",
|
||||
*/
|
||||
//Ubuntu and kali include paths
|
||||
/*
|
||||
"-I/usr/include/uuid",
|
||||
*/
|
||||
//Manjaro linux and Arch linux include args
|
||||
|
||||
"-I${workspaceFolder}",
|
||||
"-I/usr/lib/glib-2.0/include",
|
||||
"-I/usr/lib/dbus-1.0/include",
|
||||
"-I/usr/include/lzo",
|
||||
"-I/usr/include/cloudproviders",
|
||||
|
||||
"-I/usr/include/gtk-3.0",
|
||||
"-I/usr/include/at-spi2-atk/2.0",
|
||||
"-I/usr/include/at-spi-2.0",
|
||||
"-I/usr/include/dbus-1.0",
|
||||
"-I/usr/include/gio-unix-2.0",
|
||||
"-I/usr/include/cairo",
|
||||
"-I/usr/include/pango-1.0",
|
||||
"-I/usr/include/fribidi",
|
||||
"-I/usr/include/harfbuzz",
|
||||
"-I/usr/include/atk-1.0",
|
||||
"-I/usr/include/pixman-1",
|
||||
"-I/usr/include/freetype2",
|
||||
"-I/usr/include/libpng16",
|
||||
"-I/usr/include/gdk-pixbuf-2.0",
|
||||
"-I/usr/include/libmount",
|
||||
"-I/usr/include/blkid",
|
||||
"-I/usr/include/glib-2.0",
|
||||
//Manjaro linux lib args
|
||||
"-lz",
|
||||
|
||||
"-lgtk-3",
|
||||
"-lgdk-3",
|
||||
"-lpangocairo-1.0",
|
||||
"-lpango-1.0",
|
||||
"-lharfbuzz",
|
||||
"-latk-1.0",
|
||||
"-lcairo-gobject",
|
||||
"-lcairo",
|
||||
"-lgdk_pixbuf-2.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,65 @@
|
|||
#include <gtk/gtk.h>
|
||||
|
||||
enum {
|
||||
LIST_ITEM = 0,
|
||||
N_COLUMNS
|
||||
};
|
||||
|
||||
static void add_to_list(GtkWidget *list,const gchar *str){
|
||||
GtkListStore *store;
|
||||
GtkTreeIter iter;
|
||||
store=GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(list)));
|
||||
gtk_list_store_append(store,&iter);
|
||||
gtk_list_store_set(store,&iter,LIST_ITEM,str,-1);
|
||||
}
|
||||
|
||||
static void init_list(GtkWidget *list){
|
||||
GtkCellRenderer *render;
|
||||
GtkTreeViewColumn *column;
|
||||
GtkListStore *store;
|
||||
render=gtk_cell_renderer_text_new();
|
||||
column=gtk_tree_view_column_new_with_attributes("List Items",render,"text",LIST_ITEM,NULL);
|
||||
gtk_tree_view_append_column(GTK_TREE_VIEW(list),column);
|
||||
store=gtk_list_store_new(N_COLUMNS,G_TYPE_STRING);
|
||||
gtk_tree_view_set_model(GTK_TREE_VIEW(list),GTK_TREE_MODEL(store));
|
||||
g_object_unref(store);
|
||||
}
|
||||
|
||||
static void gtkmain(GtkApplication *app,gpointer user_data){
|
||||
GtkWidget *window,*list,*vbox,*label;
|
||||
GtkTreeSelection *selection;
|
||||
//Main window
|
||||
window=gtk_application_window_new(app);
|
||||
gtk_window_set_default_size(GTK_WINDOW(window),270,250);
|
||||
gtk_window_set_title(GTK_WINDOW(window),"gtk(47)");
|
||||
gtk_window_set_position(GTK_WINDOW(window),GTK_WIN_POS_CENTER);
|
||||
gtk_window_set_icon_name(GTK_WINDOW(window),"org.gtk.daleclack");
|
||||
//TreeView Widget
|
||||
list=gtk_tree_view_new();
|
||||
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(list),FALSE);
|
||||
//Label to show
|
||||
label=gtk_label_new("");
|
||||
gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_CENTER);
|
||||
|
||||
vbox=gtk_box_new(GTK_ORIENTATION_VERTICAL,0);
|
||||
gtk_box_pack_start(GTK_BOX(vbox),list,TRUE,TRUE,0);
|
||||
gtk_box_pack_start(GTK_BOX(vbox),label,FALSE,FALSE,0);
|
||||
|
||||
init_list(list);
|
||||
add_to_list(list,"List1");
|
||||
add_to_list(list,"List2");
|
||||
add_to_list(list,"List3");
|
||||
add_to_list(list,"List4");
|
||||
add_to_list(list,"List5");
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(window),vbox);
|
||||
gtk_widget_show_all(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);
|
||||
}
|
Loading…
Reference in New Issue