Add gtkmm3 version:

This commit is contained in:
daleclack 2021-06-14 09:18:59 +08:00
parent 1e70275fcf
commit c443dbc3e4
21 changed files with 468 additions and 1046 deletions

View File

@ -8,12 +8,26 @@
//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/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/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
/*
@ -26,6 +40,7 @@
"/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/**",
@ -42,17 +57,136 @@
"/usr/include/gdk-pixbuf-2.0/**",
"/usr/include/libmount/**",
"/usr/include/blkid/**",
"/usr/include/glib-2.0/**"
"/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++14",
"intelliSenseMode": "gcc-arm64",
"cppStandard": "gnu++17",
"intelliSenseMode": "gcc-x64",
"compilerArgs": [
"`pkg-config --cflags --libs gtk+-3.0`"
"`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

View File

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

View File

@ -1,6 +1,6 @@
set(CMAKE_CXX_STANDARD 17)
cmake_minimum_required(VERSION 3.0.0)
project(gtk84 VERSION 0.1.0)
project(My_GtkUI VERSION 3.0.0)
include(CTest)
enable_testing()
@ -9,11 +9,13 @@ set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
include_directories(.)
include_directories(..)
find_package (PkgConfig REQUIRED)
pkg_check_modules (GTKMM3 REQUIRED gtkmm-3.0)
include_directories (${GTKMM3_INCLUDE_DIRS})
link_directories (${GTKMM3_LIBRARY_DIRS})
add_executable(gtk84 src/main.cc src/MyWin.cc)
add_executable(My_GtkUI src/main.cc src/MyWin.cc src/MyStack.cc)
add_definitions (${GTKMM3_CFLAGS_OTHER})
target_link_libraries (${PROJECT_NAME} ${GTKMM3_LIBRARIES})

View File

@ -1,3 +1,3 @@
cd build_mingw
mingw32-make
gtk84
gtk85

23
Gtkmm3/res/appmenu.xml Normal file
View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<menu id="app-menu">
<section>
<item>
<attribute name='label'>Change background</attribute>
<attribute name='action'>win.back</attribute>
</item>
<item>
<attribute name='label'>Default background</attribute>
<attribute name='action'>win.default</attribute>
</item>
<item>
<attribute name='label'>About</attribute>
<attribute name="action">win.about</attribute>
</item>
<item>
<attribute name='label'>Exit</attribute>
<attribute name='action'>win.quit</attribute>
</item>
</section>
</menu>
</interface>

View File

@ -1,219 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.24"/>
<object class="GtkWindow" id="window">
<property name="can-focus">False</property>
<property name="border-width">15</property>
<property name="title" translatable="yes">gtk31-guess</property>
<property name="destroy-with-parent">True</property>
<child>
<!-- n-columns=5 n-rows=7 -->
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkLabel" id="label">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Select a button</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
<property name="width">3</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btn_1">
<property name="label" translatable="yes">1</property>
<property name="width-request">100</property>
<property name="height-request">100</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image-position">top</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btn_2">
<property name="label" translatable="yes">2</property>
<property name="width-request">100</property>
<property name="height-request">100</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image-position">top</property>
</object>
<packing>
<property name="left-attach">3</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btn_3">
<property name="label" translatable="yes">3</property>
<property name="width-request">100</property>
<property name="height-request">100</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image-position">top</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">4</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btn_4">
<property name="label" translatable="yes">4</property>
<property name="width-request">100</property>
<property name="height-request">100</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image-position">top</property>
</object>
<packing>
<property name="left-attach">3</property>
<property name="top-attach">4</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btn_go">
<property name="label" translatable="yes">Go</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">6</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btn_exit">
<property name="label" translatable="yes">Exit</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="left-attach">3</property>
<property name="top-attach">6</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="width-request">20</property>
<property name="height-request">20</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<packing>
<property name="left-attach">2</property>
<property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="width-request">20</property>
<property name="height-request">20</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<packing>
<property name="left-attach">2</property>
<property name="top-attach">5</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="width-request">20</property>
<property name="height-request">20</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<packing>
<property name="left-attach">2</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
</interface>

View File

@ -1,258 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<object class="GtkImage" id="image2">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<object class="GtkPopover" id="popover1">
<property name="width-request">300</property>
<property name="height-request">400</property>
<property name="can-focus">False</property>
<property name="modal">False</property>
<child>
<object class="GtkNotebook">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="tab-pos">left</property>
<property name="enable-popup">True</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkButton" id="btnaud">
<property name="label" translatable="yes">audacious</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="relief">none</property>
<property name="always-show-image">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btngedit">
<property name="label" translatable="yes">Gedit Text Editor</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image2</property>
<property name="relief">none</property>
<property name="always-show-image">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btnvlc">
<property name="label" translatable="yes">VLC Media Player</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image1</property>
<property name="relief">none</property>
<property name="always-show-image">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
<child type="tab">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Applications (Linux)</property>
</object>
<packing>
<property name="tab-fill">False</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkButton" id="btn_vlc">
<property name="label" translatable="yes">VLC Media Player</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="relief">none</property>
<property name="always-show-image">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btn_note">
<property name="label" translatable="yes">Notepad</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="relief">none</property>
<property name="always-show-image">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child type="tab">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Applications (Win32)</property>
</object>
<packing>
<property name="position">1</property>
<property name="tab-fill">False</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkButton" id="btngame">
<property name="label" translatable="yes">Guess Game</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="relief">none</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btnabout">
<property name="label" translatable="yes">About</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image3</property>
<property name="relief">none</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="position">2</property>
</packing>
</child>
<child type="tab">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">General Apps</property>
</object>
<packing>
<property name="position">2</property>
<property name="tab-fill">False</property>
</packing>
</child>
</object>
</child>
</object>
<object class="GtkButtonBox" id="left_panel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<property name="layout-style">start</property>
<child>
<object class="GtkMenuButton" id="btnstart">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="focus-on-click">False</property>
<property name="receives-default">True</property>
<property name="relief">none</property>
<property name="direction">right</property>
<property name="popover">popover1</property>
<child>
<object class="GtkImage" id="btn_image">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">start-here</property>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
<property name="non-homogeneous">True</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<object class="GtkImage" id="image3">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="stock">gtk-about</property>
</object>
</interface>

89
Gtkmm3/res/main_stack.ui Normal file
View File

@ -0,0 +1,89 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.24"/>
<object class="GtkStack" id="main_stack">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="transition-duration">400</property>
<property name="transition-type">under-up</property>
<child>
<object class="GtkOverlay" id="login_overlay">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="name">page0</property>
<property name="title" translatable="yes">page0</property>
</packing>
</child>
<child>
<object class="GtkOverlay" id="main_overlay">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkLabel" id="welcome_label">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Welcome!</property>
</object>
<packing>
<property name="index">-1</property>
</packing>
</child>
</object>
<packing>
<property name="name">page1</property>
<property name="title" translatable="yes">page1</property>
<property name="position">1</property>
</packing>
</child>
</object>
<object class="GtkBox" id="user_box">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkImage" id="user_image">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="user_label">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">dale</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="login_btn">
<property name="label" translatable="yes">login</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="relief">none</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</interface>

View File

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.24"/>
<object class="GtkButtonBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="layout-style">start</property>
<child>
<object class="GtkLabel" id="labeltitle">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Gtk42 Desktop</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
</interface>

View File

@ -1,197 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">ac-adapter-symbolic</property>
</object>
<object class="GtkImage" id="image2">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">system-help</property>
</object>
<object class="GtkImage" id="image3">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<object class="GtkImage" id="image4">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<object class="GtkImage" id="image5">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<object class="GtkPopover" id="popover1">
<property name="can-focus">False</property>
<child>
<object class="GtkButtonBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<property name="layout-style">start</property>
<child>
<object class="GtkButton" id="btnback">
<property name="label" translatable="yes">Change back</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image3</property>
<property name="relief">none</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btnset">
<property name="label" translatable="yes">Win Settings</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image5</property>
<property name="relief">none</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkButton" id="PanelExit">
<property name="label" translatable="yes">Exit mainwin</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image4</property>
<property name="relief">none</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">5</property>
</packing>
</child>
</object>
</child>
</object>
<object class="GtkButtonBox" id="btnbox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="layout-style">end</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<object class="GtkLabel" id="label_time">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">20:00 2021/2/14</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">5</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image2</property>
<property name="relief">none</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">6</property>
<property name="non-homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image1</property>
<property name="relief">none</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">7</property>
<property name="non-homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkVolumeButton">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="focus-on-click">False</property>
<property name="receives-default">True</property>
<property name="relief">none</property>
<property name="orientation">vertical</property>
<property name="icons">audio-volume-muted-symbolic
audio-volume-high-symbolic
audio-volume-low-symbolic
audio-volume-medium-symbolic</property>
<child internal-child="plus_button">
<object class="GtkButton">
<property name="can-focus">False</property>
<property name="receives-default">False</property>
</object>
</child>
<child internal-child="minus_button">
<object class="GtkButton">
<property name="can-focus">False</property>
<property name="receives-default">False</property>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">8</property>
<property name="non-homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkMenuButton">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="focus-on-click">False</property>
<property name="receives-default">True</property>
<property name="relief">none</property>
<property name="popover">popover1</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">9</property>
<property name="non-homogeneous">True</property>
</packing>
</child>
</object>
</interface>

View File

@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.24"/>
<object class="GtkAboutDialog" id="window1">
<property name="can-focus">False</property>
<property name="type-hint">dialog</property>
<property name="program-name">Gtk Ui</property>
<property name="version">2.0</property>
<property name="copyright" translatable="yes">2020-2021 Xe Corporation</property>
<property name="website">github.com/daleclack</property>
<property name="authors">Dale </property>
<property name="logo-icon-name">org.gtk.daleclack</property>
<child internal-child="vbox">
<object class="GtkBox" id="window">
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can-focus">False</property>
<property name="layout-style">end</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
</interface>

View File

@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.24"/>
<object class="GtkAboutDialog" id="window1">
<property name="can-focus">False</property>
<property name="type-hint">dialog</property>
<property name="program-name">Gtk Ui</property>
<property name="version">2.0</property>
<property name="copyright" translatable="yes">2020-2021 Xe Corporation</property>
<property name="website">github.com/daleclack</property>
<property name="authors">Dale </property>
<property name="logo-icon-name">org.gtk.daleclack</property>
<child internal-child="vbox">
<object class="GtkBox" id="window">
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can-focus">False</property>
<property name="layout-style">end</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
</interface>

View File

@ -1,159 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.24"/>
<object class="GtkDialog" id="dialog">
<property name="can-focus">False</property>
<property name="title" translatable="yes">Window size config</property>
<property name="type-hint">dialog</property>
<child internal-child="vbox">
<object class="GtkBox">
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can-focus">False</property>
<property name="layout-style">end</property>
<child>
<object class="GtkButton" id="btncancel">
<property name="label" translatable="yes">Cancel</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btnok">
<property name="label" translatable="yes">OK</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Input window size</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkEntry" id="entry_width">
<property name="visible">True</property>
<property name="can-focus">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">x</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="entry_height">
<property name="visible">True</property>
<property name="can-focus">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btnGet">
<property name="label" translatable="yes">Get size</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkButtonBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="layout-style">end</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<object class="GtkButton" id="btn_default">
<property name="label" translatable="yes">Use default config</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="-6">btncancel</action-widget>
<action-widget response="-5">btnok</action-widget>
</action-widgets>
</object>
</interface>

View File

@ -1,51 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.24"/>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">user-home</property>
</object>
<object class="GtkWindow" id="window">
<property name="can-focus">False</property>
<property name="title" translatable="yes">gtk(42)</property>
<property name="default-width">640</property>
<property name="default-height">360</property>
<property name="hide-titlebar-when-maximized">True</property>
<property name="icon-name">gtk4-icon</property>
<child>
<object class="GtkFixed" id="fixed">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkImage" id="background">
<property name="width-request">100</property>
<property name="height-request">80</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="stock">gtk-missing-image</property>
</object>
</child>
<child>
<object class="GtkButton" id="btn_home">
<property name="label" translatable="yes">Home</property>
<property name="width-request">100</property>
<property name="height-request">80</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image1</property>
<property name="relief">none</property>
<property name="image-position">top</property>
<property name="always-show-image">True</property>
</object>
<packing>
<property name="x">70</property>
<property name="y">30</property>
</packing>
</child>
</object>
</child>
</object>
</interface>

View File

@ -1,51 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.24"/>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">user-home</property>
</object>
<object class="GtkWindow" id="window">
<property name="can-focus">False</property>
<property name="title" translatable="yes">gtk(42)</property>
<property name="default-width">640</property>
<property name="default-height">360</property>
<property name="hide-titlebar-when-maximized">True</property>
<property name="icon-name">gtk4-icon</property>
<child>
<object class="GtkFixed" id="fixed">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkImage" id="background">
<property name="width-request">100</property>
<property name="height-request">80</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="stock">gtk-missing-image</property>
</object>
</child>
<child>
<object class="GtkButton" id="btn_home">
<property name="label" translatable="yes">Home</property>
<property name="width-request">100</property>
<property name="height-request">80</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image1</property>
<property name="relief">none</property>
<property name="image-position">top</property>
<property name="always-show-image">True</property>
</object>
<packing>
<property name="x">70</property>
<property name="y">30</property>
</packing>
</child>
</object>
</child>
</object>
</interface>

21
Gtkmm3/src/MyStack.cc Normal file
View File

@ -0,0 +1,21 @@
#include "MyStack.hh"
MyStack::MyStack(){
//Create a builder
ref_builder=Gtk::Builder::create_from_file("../res/main_stack.ui");
//Get widgets
ref_builder->get_widget("main_stack",stack);
ref_builder->get_widget("login_overlay",login_overlay);
ref_builder->get_widget("user_box",user_box);
ref_builder->get_widget("user_image",user_image);
ref_builder->get_widget("login_btn",login_btn);
ref_builder->get_widget("main_overlay",main_overlay);
//Initalize Interface
user_image->set_from_icon_name("org.gtk.daleclack",Gtk::ICON_SIZE_DIALOG);
login_btn->signal_clicked().connect(sigc::mem_fun(*this,&MyStack::btnlogin_clicked));
login_overlay->add_overlay(*user_box);
}
void MyStack::btnlogin_clicked(){
stack->set_visible_child(*main_overlay);
}

19
Gtkmm3/src/MyStack.hh Normal file
View File

@ -0,0 +1,19 @@
#pragma once
#include <gtkmm.h>
class MyStack{
public:
MyStack();
Gtk::Stack *stack;
private:
//Main builder
Glib::RefPtr<Gtk::Builder> ref_builder;
//Child widgets
Gtk::Overlay *main_overlay,*login_overlay;
Gtk::Box *user_box;
Gtk::Image *user_image;
Gtk::Button *login_btn;
//Signal Handlers
void btnlogin_clicked();
};

129
Gtkmm3/src/MyWin.cc Normal file
View File

@ -0,0 +1,129 @@
#include "MyWin.hh"
#include "winpe.xpm"
MyWin::MyWin():
main_box(Gtk::ORIENTATION_VERTICAL)
{
//Initalize Window
set_icon_name("org.gtk.daleclack");
set_default_size(800,450);
overlay.add_overlay(draw_area);
default_background();
overlay.add(background);
//Initalize menu
menu_builder=Gtk::Builder::create_from_file("../res/appmenu.xml");
auto object=menu_builder->get_object("app-menu");
auto gmenu=Glib::RefPtr<Gio::Menu>::cast_dynamic(object);
//Menu actions
add_action("quit",sigc::mem_fun(*this,&MyWin::win_quit));
add_action("default",sigc::mem_fun(*this,&MyWin::default_background));
add_action("back",sigc::mem_fun(*this,&MyWin::back_dialog));
add_action("about",sigc::mem_fun(*this,&MyWin::about_dialog));
//Set Popover Menu
popover.bind_model(gmenu);
popover.set_relative_to(draw_area);
//Set Gesture
gesture=Gtk::GestureMultiPress::create(overlay);
gesture->set_button(GDK_BUTTON_SECONDARY);
gesture->signal_pressed().connect(sigc::mem_fun(*this,&MyWin::btn_pressed));
//Add Toppanel
//Add Stack
main_box.pack_start(*(main_stack.stack));
overlay.add_overlay(main_box);
//Add Overlay to window and show everything
add(overlay);
show_all();
}
void MyWin::btn_pressed(int n_press,double x,double y){
//When mouse pressed,show a menu
Gdk::Rectangle point{(int)x,(int)y,1,1};
popover.set_pointing_to(point);
popover.popup();
}
void MyWin::default_background(){
//Default background
Glib::RefPtr<Gdk::Pixbuf> pixbuf=Gdk::Pixbuf::create_from_xpm_data(winpe);
Glib::RefPtr<Gdk::Pixbuf> sized=pixbuf->scale_simple(800,450,Gdk::INTERP_BILINEAR);
gtk_image_set_from_pixbuf(background.gobj(),sized->gobj());
//Free Memory of pixbufs
pixbuf.reset();
sized.reset();
}
void MyWin::back_dialog(){
//Initalize dialog
auto dialog=new Gtk::FileChooserDialog("Open Image File",
Gtk::FILE_CHOOSER_ACTION_OPEN);
dialog->set_transient_for(*this);
dialog->signal_response().connect(sigc::bind(
sigc::mem_fun(*this,&MyWin::change_background),dialog));
//Add button for dialog
dialog->add_button("OK",Gtk::RESPONSE_OK);
dialog->add_button("Cancel",Gtk::RESPONSE_CANCEL);
//Add Filter
auto filter=Gtk::FileFilter::create();
filter->set_name("Image Files");
filter->add_mime_type("image/*");
dialog->add_filter(filter);
auto filter2=Gtk::FileFilter::create();
filter2->set_name("All Files");
filter2->add_pattern("*");
dialog->add_filter(filter2);
dialog->show_all();
filter.reset();
filter2.reset();
}
void MyWin::change_background(int response,Gtk::FileChooserDialog *dialog){
Glib::ustring filename;
if(response==Gtk::RESPONSE_OK){
filename=dialog->get_filename();
//Default background
Glib::RefPtr<Gdk::Pixbuf> pixbuf=Gdk::Pixbuf::create_from_file(filename.c_str());
Glib::RefPtr<Gdk::Pixbuf> sized=pixbuf->scale_simple(800,450,Gdk::INTERP_BILINEAR);
gtk_image_set_from_pixbuf(background.gobj(),sized->gobj());
//Free Memory of pixbufs
pixbuf.reset();
sized.reset();
}
delete dialog;
}
void MyWin::about_dialog(){
char *version;
Gtk::AboutDialog about_dialog(true);
about_dialog.set_transient_for(*this);
//Create Comments
version=g_strdup_printf("3.0\nRunning against Gtkmm %d.%d.%d",
GTKMM_MAJOR_VERSION,
GTKMM_MINOR_VERSION,
GTKMM_MICRO_VERSION);
about_dialog.set_program_name("My Gtk UI");
about_dialog.set_version(version);
about_dialog.set_logo_icon_name("org.gtk.daleclack");
about_dialog.set_copyright("©2019—2021 The Xe Project");
about_dialog.set_comments("A test program for menu and background in gtkmm");
about_dialog.set_title("About Gtk UI");
about_dialog.run();
g_free(version);
}
void MyWin::win_quit(){
hide();
}
MyWin::~MyWin(){
}

32
Gtkmm3/src/MyWin.hh Normal file
View File

@ -0,0 +1,32 @@
#pragma once
#include <gtkmm.h>
#include "MyStack.hh"
class MyWin : public Gtk::ApplicationWindow{
public:
MyWin();
virtual ~MyWin();
private:
//Child widgets
Glib::RefPtr<Gtk::Builder> menu_builder;
Gtk::Overlay overlay;
Gtk::DrawingArea draw_area;
Gtk::Box main_box;
Gtk::PopoverMenu popover;
Gtk::Image background;
//Main Pages
MyStack main_stack;
//Gesture Widgets
Glib::RefPtr<Gtk::GestureMultiPress> gesture;
void btn_pressed(int n_press,double x,double y);
//Signal Handlers
void default_background();
void back_dialog();
void change_background(int response,Gtk::FileChooserDialog *dialog);
void about_dialog();
void win_quit();
};

7
Gtkmm3/src/main.cc Normal file
View File

@ -0,0 +1,7 @@
#include "MyWin.hh"
int main(int argc,char **argv){
auto app=Gtk::Application::create(argc,argv,"org.gtk.daleclack");
MyWin window;
return app->run(window);
}