Add gtk151
This commit is contained in:
parent
473ce13537
commit
c0435467b4
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools"
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
set(CMAKE_CXX_STANDARD 17)
|
||||
cmake_minimum_required(VERSION 3.0.0)
|
||||
project(gtk149_file_exp VERSION 1.0.0)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../GCR_CMake/macros)
|
||||
include(GlibCompileResourcesSupport)
|
||||
|
||||
include(CTest)
|
||||
enable_testing()
|
||||
|
||||
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
|
||||
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
|
||||
|
||||
include(CPack)
|
||||
include_directories(.)
|
||||
include_directories(..)
|
||||
|
||||
#Find PkgConfig to use gtkmm3
|
||||
find_package (PkgConfig REQUIRED)
|
||||
pkg_check_modules (GTK4 REQUIRED gtk4)
|
||||
include_directories (${GTK4_INCLUDE_DIRS})
|
||||
link_directories (${GTK4_LIBRARY_DIRS})
|
||||
|
||||
#Find Gettext
|
||||
# find_package (Gettext REQUIRED)
|
||||
# set(PO_DIR ${CMAKE_BINARY_DIR}/po/zh_CN/LC_MESSAGES)
|
||||
|
||||
#Source files
|
||||
set(SOURCE_FILE src/main.cpp src/MyPrefs.cpp)
|
||||
|
||||
#Compile Resource
|
||||
|
||||
set(RESOURCE_LIST
|
||||
icons/16x16/actions/list-add.svg
|
||||
icons/16x16/actions/list-remove.svg
|
||||
icons/scalable/status/display_prefs.svg
|
||||
prefs_stack.ui
|
||||
)
|
||||
|
||||
compile_gresources(RESOURCE_FILE
|
||||
XML_OUT
|
||||
TYPE EMBED_C
|
||||
RESOURCES ${RESOURCE_LIST}
|
||||
PREFIX "/org/gtk/daleclack"
|
||||
SOURCE_DIR ${PROJECT_SOURCE_DIR}/res)
|
||||
|
||||
# Add a custom target to the makefile. Now make builds our resource file.
|
||||
# It depends on the output RESOURCE_FILE.
|
||||
|
||||
add_custom_target(resource ALL DEPENDS ${RESOURCE_FILE})
|
||||
|
||||
#For win32 platform,use rc resource and .ico icon
|
||||
if(WIN32)
|
||||
SET(CMAKE_RC_COMPILER windres)
|
||||
set(app_WINRC ../icon.rc)
|
||||
set_property(SOURCE ../icon.rc APPEND PROPERTY
|
||||
OBJECT_DEPENDS ${PROJECT_SOURCE_DIR}/../icon.ico
|
||||
)
|
||||
add_executable(${PROJECT_NAME} WIN32 ${app_WINRC} ${SOURCE_FILE} ${RESOURCE_FILE})
|
||||
add_custom_command( TARGET ${PROJECT_NAME}
|
||||
COMMAND echo * > ${CMAKE_BINARY_DIR}/.gitignore
|
||||
COMMAND echo **/* > ${CMAKE_BINARY_DIR}/.hgignore)
|
||||
else()
|
||||
add_executable(${PROJECT_NAME} ${SOURCE_FILE} ${RESOURCE_FILE})
|
||||
add_custom_command( TARGET ${PROJECT_NAME}
|
||||
COMMAND echo \"*\" > ${CMAKE_BINARY_DIR}/.gitignore
|
||||
COMMAND echo \"**/*\" > ${CMAKE_BINARY_DIR}/.hgignore)
|
||||
endif(WIN32)
|
||||
|
||||
#Add command to generate .gitignore and .mo files
|
||||
# add_custom_command( TARGET ${PROJECT_NAME}
|
||||
# COMMAND mkdir -p ${PO_DIR}
|
||||
# COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} ${CMAKE_SOURCE_DIR}/po/zh_CN.po -o ${PO_DIR}/${PROJECT_NAME}.mo)
|
||||
|
||||
SET (CMAKE_EXTRA_CXX_FLAGS ${GTK4_CFLAGS_OTHER})
|
||||
target_link_libraries (${PROJECT_NAME} ${GTK4_LIBRARIES} -lpthread)
|
|
@ -0,0 +1,13 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
|
||||
<defs id="defs3051">
|
||||
<style type="text/css" id="current-color-scheme">
|
||||
.ColorScheme-Text {
|
||||
color:#363636;
|
||||
}
|
||||
</style>
|
||||
</defs>
|
||||
<path style="fill:currentColor;fill-opacity:1;stroke:none"
|
||||
d="M 7 3.0058594 L 7 8 L 2 8 L 2 8.9980469 L 7 8.9980469 L 7 14.007812 L 8 14.007812 L 8 8.9980469 L 13 8.9980469 L 13 8 L 8 8 L 8 3.0058594 L 7 3.0058594 z "
|
||||
class="ColorScheme-Text"
|
||||
/>
|
||||
</svg>
|
After Width: | Height: | Size: 490 B |
|
@ -0,0 +1,8 @@
|
|||
<svg version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<style id="current-color-scheme" type="text/css">.ColorScheme-Text {
|
||||
color:#363636;
|
||||
}</style>
|
||||
</defs>
|
||||
<path class="ColorScheme-Text" d="m3 8v1h10v-1z" fill="currentColor"/>
|
||||
</svg>
|
After Width: | Height: | Size: 281 B |
|
@ -0,0 +1,54 @@
|
|||
<svg width="64" height="64" version="1.1" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<linearGradient id="a">
|
||||
<stop stop-color="#909090" offset="0"/>
|
||||
<stop stop-color="#636363" stop-opacity="0" offset="1"/>
|
||||
</linearGradient>
|
||||
<radialGradient id="b" cx="199.22" cy="60.978" r="62.148" gradientTransform="matrix(1.0119 3e-8 -1.5e-7 5.0958 -134.28 -251.23)" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#e6e6e8" offset="0"/>
|
||||
<stop stop-color="#cbccce" offset="1"/>
|
||||
</radialGradient>
|
||||
<radialGradient id="c" cx="199.22" cy="60.978" r="62.148" gradientTransform="matrix(1.3103 -4e-8 1e-7 3.6151 -193.73 -160.94)" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#ececef" offset="0"/>
|
||||
<stop stop-color="#cbccce" stop-opacity="0" offset="1"/>
|
||||
</radialGradient>
|
||||
<filter id="d" x="-.01448" y="-.016908" width="1.029" height="1.0338" color-interpolation-filters="sRGB">
|
||||
<feGaussianBlur stdDeviation=".74992302"/>
|
||||
</filter>
|
||||
<linearGradient id="e" x1="174.79" x2="174.86" y1="109.47" y2="118.12" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#909090" offset="0"/>
|
||||
<stop stop-color="#727272" stop-opacity="0" offset="1"/>
|
||||
</linearGradient>
|
||||
<radialGradient id="f" cx="178.79" cy="120.7" r="22.055" gradientTransform="matrix(3.8591 -2.3e-7 0 .1388 -511.17 103.95)" gradientUnits="userSpaceOnUse" xlink:href="#a"/>
|
||||
<filter id="g" x="-.040865" y="-.504" width="1.0817" height="2.008" color-interpolation-filters="sRGB">
|
||||
<feGaussianBlur stdDeviation=".32830532"/>
|
||||
</filter>
|
||||
<filter id="h" x="-.080467" y="-.24545" width="1.1609" height="1.4909" color-interpolation-filters="sRGB">
|
||||
<feGaussianBlur stdDeviation="1.4789442"/>
|
||||
</filter>
|
||||
<linearGradient id="i" x1="183.06" x2="183.06" y1="129.42" y2="127.06" gradientUnits="userSpaceOnUse" xlink:href="#a"/>
|
||||
<linearGradient id="j" x1="23.844" x2="23.816" y1="17.574" y2="85.151" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#1bd2fa" offset="0"/>
|
||||
<stop stop-color="#1c7ef2" offset="1"/>
|
||||
</linearGradient>
|
||||
<g transform="matrix(.48966 0 0 .48209 -.95621 -1.3862)">
|
||||
<g stroke-width="2.0582">
|
||||
<rect x="5.1564" y="8.7788" width="124.3" height="103.95" rx="5.6617" fill="#1a1a1a" filter="url(#d)" opacity=".887"/>
|
||||
<rect x="5.1564" y="8.7788" width="124.3" height="103.95" rx="5.6617" fill="url(#b)"/>
|
||||
<rect x="5.1564" y="8.7788" width="124.3" height="103.95" rx="5.6617" fill="url(#c)"/>
|
||||
<path d="m10.818 8.778c-3.1366 0-5.6621 2.5256-5.6621 5.6621v75.664h124.3v-75.664c0-3.1366-2.5256-5.6621-5.6621-5.6621z" fill="#080808"/>
|
||||
<path d="m10.318 12.353h113.49v73.329h-113.49z" fill="url(#j)"/>
|
||||
<path d="m5.1558 106.01v1.0566c0 3.1366 2.5256 5.6621 5.6621 5.6621h112.97c3.1366 0 5.6621-2.5256 5.6621-5.6621v-1.0566c0 3.1366-2.5256 5.6621-5.6621 5.6621h-112.97c-3.1366 0-5.6621-2.5256-5.6621-5.6621z" fill="#afafaf"/>
|
||||
<g transform="translate(-111.48 -1.4739)">
|
||||
<path d="m194.34 114.95c-0.0882 3.6995-0.94643 7.8217 4.9506 11.334 4.7067 2.9258-2.6114 3.1267-4.4295 3.1267h-5.6672-26.478c-1.8181 0-9.1362-0.20092-4.4295-3.1267 5.8971-3.5127 5.0389-7.6349 4.9506-11.334z" filter="url(#h)"/>
|
||||
<path d="m194.34 113.47c-0.0882 3.6995-0.94643 7.8217 4.9506 11.334 4.7067 2.9258-2.6114 3.1267-4.4295 3.1267-10.492 0.46272-21.162 0.7623-32.145 0-1.8181 0-9.1362-0.20092-4.4295-3.1267 5.8971-3.5127 5.0389-7.6349 4.9506-11.334z" fill="#e0e1e6"/>
|
||||
<path d="m194.34 113.47c-0.0882 3.6995-0.94643 7.8217 4.9506 11.334 4.7067 2.9258-2.6114 3.1267-4.4295 3.1267h-5.6672-26.478c-1.8181 0-9.1362-0.20092-4.4295-3.1267 5.8971-3.5127 5.0389-7.6349 4.9506-11.334z" fill="url(#e)"/>
|
||||
<path d="m194.34 113.47c-0.0882 3.6995-0.94643 7.8217 4.9506 11.334 4.7067 2.9258-2.6114 3.1267-4.4295 3.1267h-5.6672-26.478c-1.8181 0-9.1362-0.20092-4.4295-3.1267 5.8971-3.5127 5.0389-7.6349 4.9506-11.334z" fill="url(#f)"/>
|
||||
<ellipse cx="178.29" cy="127.15" rx="15.764" ry=".78168" fill="#fff" filter="url(#g)" opacity=".887"/>
|
||||
<path d="m194.34 113.47c-0.0882 3.6995-0.94643 7.8217 4.9506 11.334 4.7067 2.9258-2.6114 3.1267-4.4295 3.1267h-5.6672-26.478c-1.8181 0-9.1362-0.20092-4.4295-3.1267 5.8971-3.5127 5.0389-7.6349 4.9506-11.334z" fill="url(#i)"/>
|
||||
</g>
|
||||
</g>
|
||||
<path d="m71.574 102.9c-0.16003 0.36969-0.34945 0.70998-0.56891 1.0228-0.29914 0.42652-0.54408 0.72174-0.73285 0.8857-0.29261 0.26911-0.60613 0.4069-0.94186 0.41475-0.24102 0-0.53167-0.0687-0.87001-0.2077-0.33945-0.13848-0.6514-0.20705-0.93664-0.20705-0.29915 0-0.61998 0.0687-0.96315 0.20705-0.3437 0.13913-0.62057 0.21162-0.83226 0.21882-0.32195 0.0137-0.64285-0.12802-0.96316-0.42587-0.20444-0.1783-0.46015-0.48401-0.76648-0.91705-0.32868-0.46244-0.59889-0.99867-0.81058-1.61-0.22671-0.66033-0.34036-1.2998-0.34036-1.9189 0-0.70913 0.15323-1.3207 0.46015-1.8333 0.24121-0.41168 0.56211-0.73643 0.96374-0.97484 0.40163-0.2384 0.83559-0.35988 1.3029-0.36765 0.25572 0 0.59105 0.0791 1.0078 0.23454 0.41554 0.15598 0.68236 0.23507 0.79934 0.23507 0.0875 0 0.38386-0.0925 0.88634-0.27687 0.47518-0.171 0.87622-0.2418 1.2048-0.21391 0.89026 0.0718 1.5591 0.4228 2.0039 1.0551-0.79621 0.48241-1.1901 1.1581-1.1822 2.0249 7e-3 0.6752 0.25212 1.237 0.7335 1.6831 0.21816 0.20707 0.46179 0.36709 0.73285 0.48075-0.0588 0.17044-0.12084 0.33376-0.1868 0.49052zm-2.0418-8.0346c0 0.5292-0.19334 1.0233-0.5787 1.4806-0.46506 0.5437-1.0276 0.85787-1.6376 0.80829-8e-3 -0.0634-0.0123-0.13031-0.0123-0.20052 0-0.50803 0.22116-1.0517 0.61391-1.4963 0.19608-0.22508 0.44546-0.41224 0.74787-0.56153 0.30176-0.14706 0.5872-0.22839 0.85564-0.24232 8e-3 0.07076 0.0112 0.1415 0.0112 0.21169z" fill="#1e1f28" stroke-width=".13443"/>
|
||||
<path d="m10.318 12.352v73.33h113.49v-73.33zm0.55273 0.50781h112.48v72.361h-112.48z" fill-opacity=".21198" stroke-width="2.0582"/>
|
||||
<path d="m10.818 9.0273c-3.1366 0-5.6621 2.5256-5.6621 5.6621v75.414h124.3v-75.414c0-3.1366-2.5255-5.6621-5.6621-5.6621zm-0.5 5.3262h113.49v71.328h-113.49z" fill="#080808" stroke-width="2.0582"/>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 5.8 KiB |
|
@ -0,0 +1,368 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk" version="4.0"/>
|
||||
<object class="GtkAdjustment" id="adjustment1">
|
||||
<property name="upper">9999</property>
|
||||
<property name="value">1024</property>
|
||||
<property name="step-increment">1</property>
|
||||
<property name="page-increment">10</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="adjustment2">
|
||||
<property name="upper">9999</property>
|
||||
<property name="value">576</property>
|
||||
<property name="step-increment">1</property>
|
||||
<property name="page-increment">10</property>
|
||||
</object>
|
||||
<object class="GtkStringList" id="sizes_list">
|
||||
<items>
|
||||
<item translatable="yes">640x360</item>
|
||||
<item translatable="yes">800x450</item>
|
||||
<item translatable="yes">1024x576</item>
|
||||
<item translatable="yes">1280x720</item>
|
||||
<item translatable="yes">1366x768</item>
|
||||
</items>
|
||||
</object>
|
||||
<object class="GtkBox" id="stack_box">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="vexpand">1</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkStackSwitcher">
|
||||
<property name="halign">center</property>
|
||||
<property name="stack">main_stack</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStack" id="main_stack">
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="title" translatable="1">Background Preferences</property>
|
||||
<property name="child">
|
||||
<object class="GtkBox" id="back_page">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="title" translatable="1">Window Size Config</property>
|
||||
<property name="child">
|
||||
<object class="GtkBox" id="winsize_page">
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="hexpand">1</property>
|
||||
<property name="vexpand">1</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="pixel-size">128</property>
|
||||
<property name="icon-name">display_prefs</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGrid">
|
||||
<property name="row-spacing">5</property>
|
||||
<property name="column-spacing">5</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="combo_box">
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">1</property>
|
||||
<property name="column-span">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="radio_default">
|
||||
<property name="label" translatable="1">Use default window size</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="active">1</property>
|
||||
<property name="group">radio_custom</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">0</property>
|
||||
<property name="column-span">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="radio_custom">
|
||||
<property name="label" translatable="1">User defined window size</property>
|
||||
<property name="focusable">1</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">2</property>
|
||||
<property name="column-span">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="spin_width">
|
||||
<property name="sensitive">0</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="adjustment">adjustment1</property>
|
||||
<property name="value">1024</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="spin_height">
|
||||
<property name="sensitive">0</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="adjustment">adjustment2</property>
|
||||
<property name="value">576</property>
|
||||
<layout>
|
||||
<property name="column">3</property>
|
||||
<property name="row">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="1">x</property>
|
||||
<layout>
|
||||
<property name="column">2</property>
|
||||
<property name="row">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</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>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="vexpand">1</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label_size">
|
||||
<property name="label" translatable="1">Current Config: </property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="btnGet">
|
||||
<property name="label" translatable="1">Get Current</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="btnapply">
|
||||
<property name="label" translatable="1">Apply</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
<property name="halign">end</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="title" translatable="1">Dock Preferences</property>
|
||||
<property name="child">
|
||||
<object class="GtkBox" id="dock_page">
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="pixel-size">128</property>
|
||||
<property name="icon-name">display_prefs</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGrid">
|
||||
<property name="row-spacing">5</property>
|
||||
<property name="column-spacing">5</property>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="mode_check">
|
||||
<property name="label" translatable="1">Use panel mode:expand the dock</property>
|
||||
<property name="focusable">1</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">0</property>
|
||||
<property name="column-span">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="1">Position:</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="radio_left">
|
||||
<property name="label" translatable="1">Left</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="active">1</property>
|
||||
<layout>
|
||||
<property name="column">2</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="radio_right">
|
||||
<property name="label" translatable="1">Right</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="group">radio_left</property>
|
||||
<layout>
|
||||
<property name="column">2</property>
|
||||
<property name="row">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="radio_bottom">
|
||||
<property name="label" translatable="1">Bottom</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="group">radio_left</property>
|
||||
<layout>
|
||||
<property name="column">2</property>
|
||||
<property name="row">4</property>
|
||||
</layout>
|
||||
</object>
|
||||
</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>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="vexpand">1</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="1"> </property>
|
||||
<property name="hexpand">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="btnapply1">
|
||||
<property name="label" translatable="1">Apply</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
<property name="halign">end</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
|
@ -0,0 +1,24 @@
|
|||
#include "MyPrefs.h"
|
||||
|
||||
struct _MyPrefs
|
||||
{
|
||||
GtkWindow parent_instance;
|
||||
GtkBuilder *prefs_builder;
|
||||
GtkWidget *background;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(MyPrefs, my_prefs, GTK_TYPE_WINDOW)
|
||||
|
||||
static void my_prefs_init(MyPrefs *self) {}
|
||||
|
||||
static void my_prefs_class_init(MyPrefsClass *klass)
|
||||
{
|
||||
}
|
||||
|
||||
GtkWidget *my_prefs_new(GtkWidget *back, GtkWindow *parent)
|
||||
{
|
||||
GtkWidget *prefs_win = GTK_WIDGET(g_object_new(my_prefs_get_type(),
|
||||
"transient-for", parent, NULL));
|
||||
MY_PREFS(prefs_win)->background = back;
|
||||
return prefs_win;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_DECLARE_FINAL_TYPE(MyPrefs, my_prefs, MY, PREFS, GtkWindow)
|
||||
|
||||
GtkWidget *my_prefs_new(GtkWidget *back, GtkWindow *parent);
|
|
@ -0,0 +1,49 @@
|
|||
#include "MyPrefs.h"
|
||||
|
||||
static void gtkmain(GtkApplication *app, gpointer data)
|
||||
{
|
||||
GtkWidget *window, *overlay, *main_pic, *btn_back;
|
||||
GtkWindow *_window;
|
||||
GtkOverlay *_overlay;
|
||||
GtkWidget *prefs_win;
|
||||
// Create a main window and initalize
|
||||
window = gtk_application_window_new(app);
|
||||
_window = GTK_WINDOW(window);
|
||||
gtk_window_set_icon_name(_window, "org.gtk.daleclack");
|
||||
gtk_window_set_title(_window, "Background Prefs Test");
|
||||
gtk_window_set_default_size(_window, 1024, 576);
|
||||
|
||||
// Overlay to pack the background and button
|
||||
overlay = gtk_overlay_new();
|
||||
gtk_widget_set_hexpand(overlay, TRUE);
|
||||
gtk_widget_set_vexpand(overlay, TRUE);
|
||||
_overlay = GTK_OVERLAY(overlay);
|
||||
|
||||
// Add background widget
|
||||
main_pic = gtk_picture_new();
|
||||
gtk_widget_set_hexpand(main_pic, TRUE);
|
||||
gtk_widget_set_vexpand(main_pic, TRUE);
|
||||
gtk_overlay_set_child(_overlay, main_pic);
|
||||
|
||||
// Add a button
|
||||
btn_back = gtk_button_new_with_label("Prefs");
|
||||
gtk_button_set_has_frame(GTK_BUTTON(btn_back), FALSE);
|
||||
gtk_widget_set_halign(btn_back, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign(btn_back, GTK_ALIGN_CENTER);
|
||||
gtk_overlay_add_overlay(_overlay, btn_back);
|
||||
|
||||
// Creata prefs window
|
||||
prefs_win = my_prefs_new(main_pic, _window);
|
||||
g_signal_connect_swapped(btn_back, "clicked", G_CALLBACK(gtk_window_present), prefs_win);
|
||||
|
||||
gtk_window_set_child(_window, overlay);
|
||||
gtk_window_present(_window);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
// Create a application and run
|
||||
GtkApplication *app = gtk_application_new("org.gtk.daleclack", G_APPLICATION_NON_UNIQUE);
|
||||
g_signal_connect(app, "activate", G_CALLBACK(gtkmain), NULL);
|
||||
return g_application_run(G_APPLICATION(app), argc, argv);
|
||||
}
|
Loading…
Reference in New Issue