Add gtk75

This commit is contained in:
daleclack 2021-05-08 21:17:09 +08:00
parent ff2d7ff5c7
commit 2d8228219d
7 changed files with 372 additions and 0 deletions

View File

@ -0,0 +1,95 @@
{
"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}/**",
"${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
}

View File

@ -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/gtk75",
"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"
}
]
}

View File

@ -0,0 +1,5 @@
{
"C_Cpp.errorSquiggles": "Disabled",
"cmake.configureOnOpen": false,
"C_Cpp.dimInactiveRegions": false
}

133
Gtkmm3/gtk75_progress/.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,133 @@
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++ build active file",
"command": "/usr/bin/g++",
"args": [
"-g",
"src/*.cc",
"-o",
"${workspaceFolder}/bin/gtk75",
"-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${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"
}

View File

@ -0,0 +1,75 @@
#include "GtkWin.hh"
GtkWin::GtkWin()
:hbox(Gtk::ORIENTATION_VERTICAL,5),
checkshow("Show text"),
check_activity("Activity Mode"),
check_inverted("Right to Left"),
btn_exit("Exit")
{
set_icon_name("org.gtk.daleclack");
set_title("Gtk (75)");
set_default_size(300,300);
set_border_width(10);
//Initalize Progress Bar
progress1.set_text("Progress Test");
progress1.set_show_text();
hbox.pack_start(progress1);
//Add a timer
connection_timeout=Glib::signal_timeout().connect(sigc::mem_fun(*this,&GtkWin::on_timeout),50);
//Check Button
checkshow.signal_clicked().connect(sigc::mem_fun(*this,&GtkWin::checkshow_clicked));
checkshow.set_active();
hbox.pack_start(checkshow);
//Activity mode
check_activity.signal_clicked().connect(sigc::mem_fun(*this,&GtkWin::activity_clicked));
hbox.pack_start(check_activity);
//Inverted Mode
check_inverted.signal_clicked().connect(sigc::mem_fun(*this,&GtkWin::invert_clicked));
hbox.pack_start(check_inverted);
//"Exit" button
btn_exit.signal_clicked().connect(sigc::mem_fun(*this,&GtkWin::exit_clicked));
hbox.pack_end(btn_exit);
add(hbox);
show_all();
}
void GtkWin::checkshow_clicked(){
bool checked=checkshow.get_active();
progress1.set_show_text(checked);
}
void GtkWin::activity_clicked(){
activity_mode=check_activity.get_active();
if(activity_mode){
progress1.pulse();
}else{
progress1.set_fraction(0.0);
}
}
void GtkWin::invert_clicked(){
bool inverted=check_inverted.get_active();
progress1.set_inverted(inverted);
}
bool GtkWin::on_timeout(){
//Change the progress Bar Value
if(activity_mode){
progress1.pulse();
}else{
double new_val=progress1.get_fraction()+0.01;
if(new_val>1.0){
new_val=0.0;
}
progress1.set_fraction(new_val);
}
return true;
}
void GtkWin::exit_clicked(){
hide();
}
GtkWin::~GtkWin(){
}

View File

@ -0,0 +1,28 @@
#pragma once
#include <gtkmm.h>
class GtkWin : public Gtk::Window{
public:
GtkWin();
virtual ~GtkWin();
protected:
bool activity_mode=false;
//Child widgets
Gtk::ProgressBar progress1;
Gtk::Box hbox;
Gtk::CheckButton checkshow,check_activity,check_inverted;
Gtk::Button btn_exit;
sigc::connection connection_timeout;
//Signal Handlers
bool on_timeout();
void checkshow_clicked();
void activity_clicked();
void invert_clicked();
void exit_clicked();
};

View File

@ -0,0 +1,7 @@
#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);
}