diff --git a/Gtkmm3/gtk72_gtkmm_buttons/.vscode/c_cpp_properties.json b/Gtkmm3/gtk72_gtkmm_buttons/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..10c7ce3 --- /dev/null +++ b/Gtkmm3/gtk72_gtkmm_buttons/.vscode/c_cpp_properties.json @@ -0,0 +1,94 @@ +{ + "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/**", + "/usr/lib/aarch64-linux-gnu/gtkmm-3.0/include/**", + "/usr/lib/aarch64-linux-gnu/gdkmm-3.0/include/**", + "/usr/lib/aarch64-linux-gnu/giomm-2.4/include/**", + "/usr/lib/aarch64-linux-gnu/pangomm-1.4/include/**", + "/usr/lib/aarch64-linux-gnu/glibmm-2.4/include/**", + "/usr/lib/aarch64-linux-gnu/cairomm-1.0/include/**", + "/usr/lib/aarch64-linux-gnu/sigc++-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/**", + "/usr/lib/x86_64-linux-gnu/gtkmm-3.0/include/**", + "/usr/lib/x86_64-linux-gnu/gdkmm-3.0/include/**", + "/usr/lib/x86_64-linux-gnu/giomm-2.4/include/**", + "/usr/lib/x86_64-linux-gnu/pangomm-1.4/include/**", + "/usr/lib/x86_64-linux-gnu/glibmm-2.4/include/**", + "/usr/lib/x86_64-linux-gnu/cairomm-1.0/include/**", + "/usr/lib/x86_64-linux-gnu/sigc++-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/**", + + //Gtkmm libs + "/usr/include/gtkmm-3.0/**", + "/usr/lib/gtkmm-3.0/include/**", + "/usr/include/giomm-2.4/**", + "/usr/lib/giomm-2.4/include/**", + "/usr/include/glibmm-2.4/**", + "/usr/lib/glibmm-2.4/include/**", + "/usr/include/sigc++-2.0/**", + "/usr/lib/sigc++-2.0/include/**", + "/usr/include/cairomm-1.0/**", + "/usr/lib/cairomm-1.0/include/**", + "/usr/include/pangomm-1.4/**", + "/usr/lib/pangomm-1.4/include/**", + "/usr/include/atkmm-1.6/**", + "/usr/lib/atkmm-1.6/include/**", + "/usr/include/gtk-3.0/unix-print/**", + "/usr/include/gdkmm-3.0/**", + "/usr/lib/gdkmm-3.0/include/**" + ], + "defines": [], + "compilerPath": "/usr/bin/gcc", + "cStandard": "gnu17", + "cppStandard": "gnu++17", + "intelliSenseMode": "gcc-x64", + "compilerArgs": [ + "`pkg-config --cflags --libs gtkmm-3.0`" + ], + "configurationProvider": "ms-vscode.cmake-tools" + } + ], + "version": 4 +} \ No newline at end of file diff --git a/Gtkmm3/gtk72_gtkmm_buttons/.vscode/launch.json b/Gtkmm3/gtk72_gtkmm_buttons/.vscode/launch.json new file mode 100644 index 0000000..e730961 --- /dev/null +++ b/Gtkmm3/gtk72_gtkmm_buttons/.vscode/launch.json @@ -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/gtk72", + "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" + } + ] +} diff --git a/Gtkmm3/gtk72_gtkmm_buttons/.vscode/settings.json b/Gtkmm3/gtk72_gtkmm_buttons/.vscode/settings.json new file mode 100644 index 0000000..208afcc --- /dev/null +++ b/Gtkmm3/gtk72_gtkmm_buttons/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "C_Cpp.errorSquiggles": "Disabled", + "cmake.configureOnOpen": false, + "C_Cpp.dimInactiveRegions": false +} \ No newline at end of file diff --git a/Gtkmm3/gtk72_gtkmm_buttons/.vscode/tasks.json b/Gtkmm3/gtk72_gtkmm_buttons/.vscode/tasks.json new file mode 100644 index 0000000..83c33d5 --- /dev/null +++ b/Gtkmm3/gtk72_gtkmm_buttons/.vscode/tasks.json @@ -0,0 +1,132 @@ +{ + "tasks": [ + { + "type": "cppbuild", + "label": "C/C++: g++ build active file", + "command": "/usr/bin/g++", + "args": [ + "-g", + "src/*.cc", + "-o", + "${workspaceFolder}/bin/gtk72", + "-pthread", + //For Arm64 linux + /* + "-I/usr/lib/aarch64-linux-gnu/dbus-1.0/include", + "-I/usr/lib/aarch64-linux-gnu/glib-2.0/include", + "-I/usr/lib/aarch64-linux-gnu/gtkmm-3.0/include", + "-I/usr/lib/aarch64-linux-gnu/gdkmm-3.0/include", + "-I/usr/lib/aarch64-linux-gnu/giomm-2.4/include", + "-I/usr/lib/aarch64-linux-gnu/pangomm-1.4/include", + "-I/usr/lib/aarch64-linux-gnu/glibmm-2.4/include", + "-I/usr/lib/aarch64-linux-gnu/cairomm-1.0/include", + "-I/usr/lib/aarch64-linux-gnu/sigc++-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", + "-I/usr/lib/x86_64-linux-gnu/gtkmm-3.0/include", + "-I/usr/lib/x86_64-linux-gnu/gdkmm-3.0/include", + "-I/usr/lib/x86_64-linux-gnu/giomm-2.4/include", + "-I/usr/lib/x86_64-linux-gnu/pangomm-1.4/include", + "-I/usr/lib/x86_64-linux-gnu/glibmm-2.4/include", + "-I/usr/lib/x86_64-linux-gnu/cairomm-1.0/include", + "-I/usr/lib/x86_64-linux-gnu/sigc++-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", + + //Gtkmm For Archlinux and Manjaro + + "-I/usr/lib/gtkmm-3.0/include", + "-I/usr/lib/giomm-2.4/include", + "-I/usr/lib/glibmm-2.4/include", + "-I/usr/lib/sigc++-2.0/include", + "-I/usr/lib/cairomm-1.0/include", + "-I/usr/lib/atkmm-1.6/include", + "-I/usr/lib/gdkmm-3.0/include", + "-I/usr/lib/pangomm-1.4/include", + + //Gtkmm libs + "-I/usr/include/gtkmm-3.0", + "-I/usr/include/giomm-2.4", + "-I/usr/include/glibmm-2.4", + "-I/usr/include/sigc++-2.0", + "-I/usr/include/cairomm-1.0", + "-I/usr/include/pangomm-1.4", + "-I/usr/include/atkmm-1.6", + "-I/usr/include/gtk-3.0/unix-print", + "-I/usr/include/gdkmm-3.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", + + //For gtkmm + + "-lgtkmm-3.0", + "-latkmm-1.6", + "-lgdkmm-3.0", + "-lgiomm-2.4", + "-lpangomm-1.4", + "-lglibmm-2.4", + "-lcairomm-1.0", + "-lsigc-2.0" + ], + "options": { + "cwd": "${workspaceFolder}" + }, + "problemMatcher": [ + "$gcc" + ], + "group": { + "kind": "build", + "isDefault": true + }, + "detail": "Task generated by Debugger." + } + ], + "version": "2.0.0" +} diff --git a/Gtkmm3/gtk72_gtkmm_buttons/config b/Gtkmm3/gtk72_gtkmm_buttons/config new file mode 100644 index 0000000..850b3a6 --- /dev/null +++ b/Gtkmm3/gtk72_gtkmm_buttons/config @@ -0,0 +1,2 @@ +checkbutton=1 +radiobutton=2 \ No newline at end of file diff --git a/Gtkmm3/gtk72_gtkmm_buttons/src/gtkwin.cc b/Gtkmm3/gtk72_gtkmm_buttons/src/gtkwin.cc new file mode 100644 index 0000000..02bdb2f --- /dev/null +++ b/Gtkmm3/gtk72_gtkmm_buttons/src/gtkwin.cc @@ -0,0 +1,60 @@ +#include +#include "gtkwin.hh" + +GtkWin::GtkWin() +:button1("Write Config"), +check1("Check 1"), +hbox(Gtk::ORIENTATION_VERTICAL) +{ + //Initalize Window + set_icon_name("org.gtk.daleclack"); + set_default_size(200,250); + add(hbox); + //Initalize check status + rb[1].set_active(); + rb[0].set_label("Selection 1"); + rb[1].set_label("Selection 2"); + rb[1].join_group(rb[0]); + rb[2].set_label("Selection 3"); + rb[2].join_group(rb[0]); + //Initalize box and buttons + hbox.pack_start(check1); + hbox.pack_start(separtor); + hbox.pack_start(rb[0]); + hbox.pack_start(rb[1]); + hbox.pack_start(rb[2]); + hbox.pack_start(separtor1); + hbox.pack_start(button1); + button1.signal_clicked().connect(sigc::mem_fun(*this,&GtkWin::write_config)); + //top_box.pack_start(hbox); + //Set Button Status and show all widgets + get_config(); + show_all(); +} + +GtkWin::~GtkWin(){ +} + +void GtkWin::get_config(){ + //Get Config from a file and set active + int check_active=1,radio_index=1; + freopen("config","r",stdin); + scanf("checkbutton=%d",&check_active); + getchar(); + scanf("radiobutton=%d",&radio_index); + fclose(stdin); + check1.set_active(check_active); + rb[radio_index].set_active(); +} + +void GtkWin::write_config(){ + //Write Config to a config file + freopen("config","w",stdout); + printf("checkbutton=%d\n",check1.get_active()); + for(int i=0;i<3;i++){ + if(rb[i].get_active()==true){ + printf("radiobutton=%d",i); + } + } + fclose(stdout); +} \ No newline at end of file diff --git a/Gtkmm3/gtk72_gtkmm_buttons/src/gtkwin.hh b/Gtkmm3/gtk72_gtkmm_buttons/src/gtkwin.hh new file mode 100644 index 0000000..9f621d9 --- /dev/null +++ b/Gtkmm3/gtk72_gtkmm_buttons/src/gtkwin.hh @@ -0,0 +1,22 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +class GtkWin : public Gtk::Window{ +public: + GtkWin(); + virtual ~GtkWin(); +protected: + Gtk::Box hbox; + Gtk::Button button1; + Gtk::CheckButton check1; + Gtk::Separator separtor,separtor1; + Gtk::RadioButton rb[3]; + void get_config(); + void write_config(); +}; diff --git a/Gtkmm3/gtk72_gtkmm_buttons/src/main.cc b/Gtkmm3/gtk72_gtkmm_buttons/src/main.cc new file mode 100644 index 0000000..9a899e8 --- /dev/null +++ b/Gtkmm3/gtk72_gtkmm_buttons/src/main.cc @@ -0,0 +1,8 @@ +#include +#include "gtkwin.hh" + +int main(int argc,char **argv){ + auto app=Gtk::Application::create(argc,argv,"org.gtk.daleclack"); + GtkWin window; + return app->run(window); +} \ No newline at end of file