Add gtk76
This commit is contained in:
parent
2d8228219d
commit
a7b9d41abc
|
@ -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
|
||||
}
|
|
@ -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/gtk76",
|
||||
"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,5 @@
|
|||
{
|
||||
"C_Cpp.errorSquiggles": "Disabled",
|
||||
"cmake.configureOnOpen": false,
|
||||
"C_Cpp.dimInactiveRegions": false
|
||||
}
|
|
@ -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/gtk76",
|
||||
"-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"
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
#include "GtkWin.hh"
|
||||
|
||||
GtkWin::GtkWin()
|
||||
:vbox(Gtk::ORIENTATION_VERTICAL,5),
|
||||
hbox(Gtk::ORIENTATION_HORIZONTAL,5),
|
||||
btn_clear("Clear"),
|
||||
btn_close("Close"){
|
||||
//Initalize window
|
||||
set_icon_name("org.gtk.daleclack");
|
||||
set_title("My Text Editor");
|
||||
set_default_size(400,300);
|
||||
//Initalize InfoBar
|
||||
auto content_area=dynamic_cast<Gtk::Container*>(m_infobar.get_content_area());
|
||||
if(content_area){
|
||||
content_area->add(info_label);
|
||||
}
|
||||
//Add a button
|
||||
m_infobar.add_button("OK",0);
|
||||
vbox.pack_start(m_infobar,Gtk::PACK_SHRINK);
|
||||
//Initalize textview
|
||||
sw.set_policy(Gtk::POLICY_AUTOMATIC,Gtk::POLICY_AUTOMATIC);
|
||||
sw.add(m_textview);
|
||||
m_textbuffer=m_textview.get_buffer();
|
||||
vbox.pack_start(sw);
|
||||
//Connect Signals
|
||||
btn_close.signal_clicked().connect(sigc::mem_fun(*this,&GtkWin::close_clicked));
|
||||
btn_clear.signal_clicked().connect(sigc::mem_fun(*this,&GtkWin::clear_clicked));
|
||||
m_infobar.signal_response().connect(sigc::mem_fun(*this,&GtkWin::infobar_reponse));
|
||||
m_textbuffer->signal_changed().connect(sigc::mem_fun(*this,&GtkWin::buffer_changed));
|
||||
//Initalize layouts
|
||||
hbox.pack_end(btn_close,false,false);
|
||||
hbox.pack_end(btn_clear,false,false);
|
||||
vbox.pack_end(hbox,false,false);
|
||||
add(vbox);
|
||||
show_all();
|
||||
m_infobar.hide();
|
||||
btn_clear.set_sensitive(false);
|
||||
}
|
||||
|
||||
void GtkWin::clear_clicked(){
|
||||
m_textbuffer->set_text("");
|
||||
info_label.set_label("Cleared the text");
|
||||
m_infobar.set_message_type(Gtk::MESSAGE_INFO);
|
||||
m_infobar.show();
|
||||
}
|
||||
|
||||
void GtkWin::close_clicked(){
|
||||
hide();
|
||||
}
|
||||
|
||||
void GtkWin::infobar_reponse(int response){
|
||||
info_label.set_label("");
|
||||
m_infobar.hide();
|
||||
}
|
||||
|
||||
void GtkWin::buffer_changed(){
|
||||
btn_clear.set_sensitive(m_textbuffer->size() > 0);
|
||||
}
|
||||
|
||||
GtkWin::~GtkWin(){
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
#pragma once
|
||||
|
||||
#include <gtkmm.h>
|
||||
|
||||
class GtkWin : public Gtk::Window
|
||||
{
|
||||
public:
|
||||
|
||||
GtkWin();
|
||||
virtual ~GtkWin();
|
||||
|
||||
protected:
|
||||
|
||||
//Child widgets
|
||||
Gtk::Box hbox;
|
||||
Gtk::Box vbox;
|
||||
Gtk::TextView m_textview;
|
||||
Gtk::ScrolledWindow sw;
|
||||
Gtk::Button btn_clear,btn_close;
|
||||
Glib::RefPtr<Gtk::TextBuffer> m_textbuffer;
|
||||
Gtk::InfoBar m_infobar;
|
||||
Gtk::Label info_label;
|
||||
|
||||
//Signal Handlers
|
||||
void clear_clicked();
|
||||
void close_clicked();
|
||||
void infobar_reponse(int response);
|
||||
void buffer_changed();
|
||||
};
|
|
@ -0,0 +1,8 @@
|
|||
#include "GtkWin.hh"
|
||||
|
||||
int main(int argc,char **argv){
|
||||
auto app=Gtk::Application::create(argc,argv,"org.gtk.daleclack");
|
||||
//Create a window and run it
|
||||
GtkWin window;
|
||||
return app->run(window);
|
||||
}
|
Loading…
Reference in New Issue