Initial Test on Gtkmm4
This commit is contained in:
parent
4292d68e42
commit
9e9e633d6e
|
@ -0,0 +1,191 @@
|
||||||
|
{
|
||||||
|
"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-4.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/**",
|
||||||
|
"/usr/include/gtk-4.0/unix-print/**",
|
||||||
|
//Gtkmm4 libs
|
||||||
|
"/usr/include/gtkmm-4.0/**",
|
||||||
|
"/usr/lib/gtkmm-4.0/include/**",
|
||||||
|
"/usr/include/giomm-2.68/**",
|
||||||
|
"/usr/lib/giomm-2.68/include/**",
|
||||||
|
"/usr/include/glibmm-2.68/**",
|
||||||
|
"/usr/lib/glibmm-2.68/include/**",
|
||||||
|
"/usr/include/sigc++-3.0/**",
|
||||||
|
"/usr/lib/sigc++-3.0/include/**",
|
||||||
|
"/usr/include/graphene-1.0/**",
|
||||||
|
"/usr/lib/graphene-1.0/include/**",
|
||||||
|
"/usr/include/cairomm-1.16/**",
|
||||||
|
"/usr/lib/cairomm-1.16/include/**",
|
||||||
|
"/usr/include/pangomm-2.48/**",
|
||||||
|
"/usr/lib/pangomm-2.48/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"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "win32",
|
||||||
|
"includePath": [
|
||||||
|
"${workspaceFolder}/**",
|
||||||
|
"${workspaceFolder}/src/**",
|
||||||
|
//I assume the msys2 installed in D:/msys64
|
||||||
|
"D:/msys64/mingw64/include/gtkmm-3.0/**",
|
||||||
|
"D:/msys64/mingw64/lib/gtkmm-3.0/include/**",
|
||||||
|
"D:/msys64/mingw64/include/giomm-2.4/**",
|
||||||
|
"D:/msys64/mingw64/lib/giomm-2.4/include/**",
|
||||||
|
"D:/msys64/mingw64/include/**",
|
||||||
|
"D:/msys64/mingw64/include/glib-2.0/**",
|
||||||
|
"D:/msys64/mingw64/lib/glib-2.0/include/**",
|
||||||
|
"D:/msys64/mingw64/include/glibmm-2.4/**",
|
||||||
|
"D:/msys64/mingw64/lib/glibmm-2.4/include/**",
|
||||||
|
"D:/msys64/mingw64/include/sigc++-2.0/**",
|
||||||
|
"D:/msys64/mingw64/lib/sigc++-2.0/include/**",
|
||||||
|
"D:/msys64/mingw64/include/gtk-3.0/**",
|
||||||
|
"D:/msys64/mingw64/include/pango-1.0/**",
|
||||||
|
"D:/msys64/mingw64/include/harfbuzz/**",
|
||||||
|
"D:/msys64/mingw64/include/freetype2/**",
|
||||||
|
"D:/msys64/mingw64/include/libpng16/**",
|
||||||
|
"D:/msys64/mingw64/include/fribidi/**",
|
||||||
|
"D:/msys64/mingw64/include/cairo/**",
|
||||||
|
"D:/msys64/mingw64/include/lzo/**",
|
||||||
|
"D:/msys64/mingw64/include/pixman-1/**",
|
||||||
|
"D:/msys64/mingw64/include/gdk-pixbuf-2.0",
|
||||||
|
"D:/msys64/mingw64/include/atk-1.0",
|
||||||
|
"D:/msys64/mingw64/include/cairomm-1.0/**",
|
||||||
|
"D:/msys64/mingw64/lib/cairomm-1.0/include/**",
|
||||||
|
"D:/msys64/mingw64/include/pangomm-1.4/**",
|
||||||
|
"D:/msys64/mingw64/lib/pangomm-1.4/include/**"
|
||||||
|
],
|
||||||
|
"defines": [],
|
||||||
|
"compilerPath": "D:/msys64/MinGW64/bin/gcc.exe",
|
||||||
|
"cStandard": "c17",
|
||||||
|
"cppStandard": "c++17",
|
||||||
|
"intelliSenseMode": "windows-gcc-x64"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Mac",
|
||||||
|
"includePath": [
|
||||||
|
"${workspaceFolder}/**",
|
||||||
|
"/usr/local/Cellar/libffi/3.3_3/include/**",
|
||||||
|
"/usr/local/Cellar/gtkmm3/3.24.4/include/gtkmm-3.0/**",
|
||||||
|
"/usr/local/Cellar/gtkmm3/3.24.4/lib/gtkmm-3.0/include",
|
||||||
|
"/usr/local/Cellar/atkmm@2.28/2.28.1_1/include/atkmm-1.6/**",
|
||||||
|
"/usr/local/Cellar/atkmm@2.28/2.28.1_1/lib/atkmm-1.6/include/**",
|
||||||
|
"/usr/local/Cellar/gtk+3/3.24.29/include/gtk-3.0/unix-print/**",
|
||||||
|
"/usr/local/Cellar/gtkmm3/3.24.4/include/gdkmm-3.0/**",
|
||||||
|
"/usr/local/Cellar/gtkmm3/3.24.4/lib/gdkmm-3.0/include/**",
|
||||||
|
"/usr/local/Cellar/glibmm@2.66/2.66.0/include/giomm-2.4/**",
|
||||||
|
"/usr/local/Cellar/glibmm@2.66/2.66.0/lib/giomm-2.4/include/**",
|
||||||
|
"/usr/local/Cellar/pangomm@2.46/2.46.0/include/pangomm-1.4/**",
|
||||||
|
"/usr/local/Cellar/pangomm@2.46/2.46.0/lib/pangomm-1.4/include/**",
|
||||||
|
"/usr/local/Cellar/glibmm@2.66/2.66.0/include/glibmm-2.4/**",
|
||||||
|
"/usr/local/Cellar/glibmm@2.66/2.66.0/lib/glibmm-2.4/include/**",
|
||||||
|
"/usr/local/Cellar/cairomm@1.14/1.14.2/include/cairomm-1.0/**",
|
||||||
|
"/usr/local/Cellar/cairomm@1.14/1.14.2/lib/cairomm-1.0/include/**",
|
||||||
|
"/usr/local/Cellar/libsigc++@2/2.10.6/include/sigc++-2.0/**",
|
||||||
|
"/usr/local/Cellar/libsigc++@2/2.10.6/lib/sigc++-2.0/include/**",
|
||||||
|
"/usr/local/Cellar/gtk+3/3.24.29/include/gtk-3.0/**",
|
||||||
|
"/usr/local/Cellar/glib/2.68.2/include/gio-unix-2.0/**",
|
||||||
|
"/usr/local/Cellar/cairo/1.16.0_5/include/cairo/**",
|
||||||
|
"/usr/local/Cellar/libepoxy/1.5.7/include/**",
|
||||||
|
"/usr/local/Cellar/pango/1.48.4/include/pango-1.0",
|
||||||
|
"/usr/local/Cellar/harfbuzz/2.8.1/include/harfbuzz",
|
||||||
|
"/usr/local/Cellar/pango/1.48.4/include/pango-1.0/**",
|
||||||
|
"/usr/local/Cellar/fribidi/1.0.10/include/fribidi/**",
|
||||||
|
"/usr/local/Cellar/harfbuzz/2.8.1/include/harfbuzz/**",
|
||||||
|
"/usr/local/Cellar/graphite2/1.3.14/include/**",
|
||||||
|
"/usr/local/Cellar/atk/2.36.0/include/atk-1.0/**",
|
||||||
|
"/usr/local/Cellar/cairo/1.16.0_5/include/cairo/**",
|
||||||
|
"/usr/local/Cellar/pixman/0.40.0/include/pixman-1/**",
|
||||||
|
"/usr/local/Cellar/fontconfig/2.13.1/include/**",
|
||||||
|
"/usr/local/opt/freetype/include/freetype2/**",
|
||||||
|
"/usr/local/Cellar/libpng/1.6.37/include/libpng16/**",
|
||||||
|
"/usr/local/Cellar/libxcb/1.14_1/include/**",
|
||||||
|
"/usr/local/Cellar/libxrender/0.9.10/include/**",
|
||||||
|
"/usr/local/Cellar/libxext/1.3.4/include/**",
|
||||||
|
"/usr/local/Cellar/libx11/1.7.0/include/**",
|
||||||
|
"/usr/local/Cellar/libxcb/1.14_1/include/**",
|
||||||
|
"/usr/local/Cellar/libxau/1.0.9/include/**",
|
||||||
|
"/usr/local/Cellar/libxdmcp/1.1.3/include/**",
|
||||||
|
"/usr/local/Cellar/gdk-pixbuf/2.42.6/include/gdk-pixbuf-2.0/**",
|
||||||
|
"/usr/local/Cellar/libpng/1.6.37/include/libpng16/**",
|
||||||
|
"/usr/local/Cellar/libtiff/4.3.0/include/**",
|
||||||
|
"/usr/local/Cellar/glib/2.68.2/include/**",
|
||||||
|
"/usr/local/Cellar/glib/2.68.2/include/glib-2.0/**",
|
||||||
|
"/usr/local/Cellar/glib/2.68.2/lib/glib-2.0/include/**",
|
||||||
|
"/usr/local/opt/gettext/include/**",
|
||||||
|
"/usr/local/Cellar/pcre/8.44/include/**",
|
||||||
|
"/usr/local/Cellar/xorgproto/2021.4/include/**"
|
||||||
|
],
|
||||||
|
"defines": [],
|
||||||
|
"macFrameworkPath": [],
|
||||||
|
"compilerPath": "/usr/local/bin/gcc-11",
|
||||||
|
"cStandard": "gnu17",
|
||||||
|
"cppStandard": "gnu++17",
|
||||||
|
"intelliSenseMode": "macos-gcc-x64"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"version": 4
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"C_Cpp.errorSquiggles": "Disabled",
|
||||||
|
"cmake.configureOnOpen": false,
|
||||||
|
"C_Cpp.dimInactiveRegions": false
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
cmake_minimum_required(VERSION 3.0.0)
|
||||||
|
project(gtk88 VERSION 0.1.0)
|
||||||
|
|
||||||
|
include(CTest)
|
||||||
|
enable_testing()
|
||||||
|
|
||||||
|
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
|
||||||
|
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
|
||||||
|
|
||||||
|
include(CPack)
|
||||||
|
include_directories(..)
|
||||||
|
|
||||||
|
find_package (PkgConfig REQUIRED)
|
||||||
|
pkg_check_modules (GTKMM3 REQUIRED gtkmm-4.0)
|
||||||
|
include_directories (${GTKMM3_INCLUDE_DIRS})
|
||||||
|
link_directories (${GTKMM3_LIBRARY_DIRS})
|
||||||
|
|
||||||
|
add_executable(gtk88 src/main.cc)
|
||||||
|
|
||||||
|
IF(WIN32)
|
||||||
|
SET(CMAKE_EXE_LINKER_FLAGS -mwindows)
|
||||||
|
ENDIF(WIN32)
|
||||||
|
|
||||||
|
add_definitions (${GTKMM3_CFLAGS_OTHER})
|
||||||
|
target_link_libraries (${PROJECT_NAME} ${GTKMM3_LIBRARIES})
|
|
@ -0,0 +1,72 @@
|
||||||
|
#include <gtkmm.h>
|
||||||
|
#include "winpe.xpm"
|
||||||
|
|
||||||
|
class MyWindow : public Gtk::Window
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MyWindow()
|
||||||
|
:btn_test("Change Background")
|
||||||
|
{
|
||||||
|
//Initalize Window
|
||||||
|
set_default_size(640,360);
|
||||||
|
set_icon_name("org.gtk.daleclack");
|
||||||
|
//Add Button
|
||||||
|
btn_test.set_halign(Gtk::Align::CENTER);
|
||||||
|
btn_test.set_valign(Gtk::Align::CENTER);
|
||||||
|
btn_test.signal_clicked().connect(sigc::mem_fun(*this,&MyWindow::change_background));
|
||||||
|
overlay.add_overlay(btn_test);
|
||||||
|
//Add Background
|
||||||
|
back.set_can_shrink(true);
|
||||||
|
back.set_size_request(640,360);
|
||||||
|
back.set_keep_aspect_ratio(false);
|
||||||
|
//Set Default Background
|
||||||
|
auto pixbuf=Gdk::Pixbuf::create_from_xpm_data(winpe);
|
||||||
|
back.set_pixbuf(pixbuf);
|
||||||
|
overlay.set_child(back);
|
||||||
|
set_child(overlay);
|
||||||
|
pixbuf.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
//Child Widgets
|
||||||
|
Gtk::Picture back;
|
||||||
|
Gtk::Overlay overlay;
|
||||||
|
Gtk::Button btn_test;
|
||||||
|
Gtk::FileChooserDialog *dialog;
|
||||||
|
//Signal Handlers
|
||||||
|
void change_background(){
|
||||||
|
//Initalize Dialog
|
||||||
|
dialog=new Gtk::FileChooserDialog("Choose a Image File",
|
||||||
|
Gtk::FileChooser::Action::OPEN,true);
|
||||||
|
dialog->set_transient_for(*this);
|
||||||
|
dialog->add_button("OK",Gtk::ResponseType::OK);
|
||||||
|
dialog->add_button("Cancel",Gtk::ResponseType::CANCEL);
|
||||||
|
dialog->signal_response().connect(sigc::mem_fun(*this,&MyWindow::dialog_response));
|
||||||
|
//Add File Filters
|
||||||
|
auto filter_image=Gtk::FileFilter::create();
|
||||||
|
filter_image->set_name("Image Files");
|
||||||
|
filter_image->add_mime_type("image/*");
|
||||||
|
dialog->add_filter(filter_image);
|
||||||
|
|
||||||
|
auto filter_any=Gtk::FileFilter::create();
|
||||||
|
filter_any->set_name("Any Files");
|
||||||
|
filter_any->add_pattern("*");
|
||||||
|
dialog->add_filter(filter_any);
|
||||||
|
|
||||||
|
dialog->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
void dialog_response(int response_id){
|
||||||
|
if(response_id==Gtk::ResponseType::OK){
|
||||||
|
auto file=dialog->get_file();
|
||||||
|
back.set_file(file);
|
||||||
|
file.reset();
|
||||||
|
}
|
||||||
|
delete dialog;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
int main(int argc,char **argv){
|
||||||
|
auto app=Gtk::Application::create("org.gtk.daleclack");
|
||||||
|
return app->make_window_and_run<MyWindow>(argc,argv);
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue