Add gtk69

This commit is contained in:
daleclack 2021-04-18 16:24:33 +08:00
parent 0873c05047
commit 15e1394105
26 changed files with 1144 additions and 0 deletions

View File

@ -0,0 +1,61 @@
{
"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",
*/
//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",
*/
//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}/**",
"/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/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "gnu17",
"cppStandard": "gnu++14",
"intelliSenseMode": "gcc-x64",
"compilerArgs": [
"`pkg-config --cflags --libs gtk+-3.0`"
],
"configurationProvider": "ms-vscode.cmake-tools"
}
],
"version": 4
}

29
Gtk3/gtk69_Ui3_test/.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,29 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "g++ - Build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/bin/gtk69",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "C/C++: g++ build active file",
"miDebuggerPath": "/usr/bin/gdb"
}
]
}

View File

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

83
Gtk3/gtk69_Ui3_test/.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,83 @@
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++ build active file",
"command": "/usr/bin/g++",
"args": [
"-g",
"src/*.cpp",
"-o",
"${workspaceFolder}/bin/gtk69",
"-pthread",
//For Arm64 linux
/*
"-I/usr/lib/aarch64-linux-gnu/dbus-1.0/include",
"-I/usr/lib/aarch64-linux-gnu/glib-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",
*/
//Ubuntu and kali include paths
//"-I/usr/include/uuid",
//Manjaro linux and Arch linux include args
"-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",
//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",
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}

View File

@ -0,0 +1 @@
glib-compile-resources gtk69.gresource.xml --target=../src/resources.cpp --generate-source

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="gtk69">
<file preprocess="xml-stripblanks">win1.ui</file>
<file preprocess="xml-stripblanks">window.ui</file>
<file preprocess="xml-stripblanks">winsize.ui</file>
</gresource>
<gresource prefix="org/gtk/daleclack">
<file>icons/16x16/actions/window-minimize.png</file>
<file>icons/16x16/actions/window-close.png</file>
<file>icons/48x48/actions/gtk69.png</file>
<file>icons/48x48/actions/win1.png</file>
<file>icons/48x48/actions/win1_running.png</file>
<file>icons/128x128/actions/gtk69.png</file>
</gresource>
</gresources>

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -0,0 +1,63 @@
<?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>
</object>
<object class="GtkImage" id="image2">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<object class="GtkWindow" id="win1">
<property name="can-focus">False</property>
<property name="default-width">440</property>
<property name="default-height">250</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
<child type="titlebar">
<object class="GtkHeaderBar">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="title" translatable="yes">window1</property>
<property name="has-subtitle">False</property>
<child>
<object class="GtkButton" id="btn_close">
<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>
</child>
<child>
<object class="GtkButton" id="btn_mini">
<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="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</interface>

View File

@ -0,0 +1,63 @@
<?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>
</object>
<object class="GtkImage" id="image2">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<object class="GtkWindow" id="win1">
<property name="can-focus">False</property>
<property name="default-width">200</property>
<property name="default-height">200</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
<child type="titlebar">
<object class="GtkHeaderBar">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="title" translatable="yes">window1</property>
<property name="has-subtitle">False</property>
<child>
<object class="GtkButton" id="btn_close">
<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>
</child>
<child>
<object class="GtkButton" id="btn_mini">
<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="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</interface>

View File

@ -0,0 +1,232 @@
<?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="default-width">640</property>
<property name="default-height">360</property>
<child>
<object class="GtkOverlay" id="overlay">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkImage" id="background">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<packing>
<property name="index">-1</property>
</packing>
</child>
</object>
</child>
</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="can-focus">False</property>
<child>
<object class="GtkNotebook">
<property name="width-request">150</property>
<property name="height-request">200</property>
<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="btn_win1">
<property name="label" translatable="yes">Window1</property>
<property name="width-request">150</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">
<property name="label" translatable="yes"> </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">1</property>
</packing>
</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">Apps </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>
<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">Others</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="btnsize">
<property name="label" translatable="yes"> Window size config</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="btnExit">
<property name="label" translatable="yes">Exit</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">1</property>
</packing>
</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">System</property>
</object>
<packing>
<property name="position">2</property>
<property name="tab-fill">False</property>
</packing>
</child>
</object>
</child>
</object>
<object class="GtkBox" id="panelbox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="valign">start</property>
<property name="orientation">vertical</property>
<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="direction">right</property>
<property name="popover">popover1</property>
<child>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="panel_win1">
<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">False</property>
<property name="fill">True</property>
<property name="position">1</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="relief">none</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</interface>

View File

@ -0,0 +1,37 @@
<?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="default-width">640</property>
<property name="default-height">360</property>
<child>
<object class="GtkOverlay" id="overlay">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkImage" id="background">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<packing>
<property name="index">-1</property>
</packing>
</child>
</object>
</child>
<child type="titlebar">
<object class="GtkHeaderBar">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="title" translatable="yes">gtk(69)</property>
<property name="show-close-button">True</property>
<property name="decoration-layout">close,minimize,maximize:menu</property>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
</interface>

View File

@ -0,0 +1,174 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.24"/>
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">32767</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
<object class="GtkAdjustment" id="adjustment2">
<property name="upper">32767</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
<object class="GtkDialog" id="dialog">
<property name="can-focus">False</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="button1">
<property name="label">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="button2">
<property name="label">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="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">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="GtkSpinButton" id="btn_width">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="text" translatable="yes">640</property>
<property name="input-purpose">number</property>
<property name="adjustment">adjustment1</property>
<property name="value">640</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</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">2</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="btn_height">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="text" translatable="yes">360</property>
<property name="input-purpose">number</property>
<property name="adjustment">adjustment2</property>
<property name="numeric">True</property>
<property name="value">360</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">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<placeholder/>
</child>
<child>
<object class="GtkButton" id="btn_default">
<property name="label" translatable="yes">Use Default 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">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btnGet">
<property name="label" translatable="yes">Get Current 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="pack-type">end</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="-6">button1</action-widget>
<action-widget response="-5">button2</action-widget>
</action-widgets>
</object>
</interface>

View File

@ -0,0 +1,170 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.24"/>
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">32767</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
<object class="GtkAdjustment" id="adjustment2">
<property name="upper">32767</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
<object class="GtkDialog" id="dialog">
<property name="can-focus">False</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">
<property name="label">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">
<property name="label">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="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">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="GtkSpinButton" id="btn_width">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="text" translatable="yes">640</property>
<property name="input-purpose">number</property>
<property name="adjustment">adjustment1</property>
<property name="value">640</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</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">2</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="btn_height">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="text" translatable="yes">360</property>
<property name="input-purpose">number</property>
<property name="adjustment">adjustment2</property>
<property name="numeric">True</property>
<property name="value">360</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">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<placeholder/>
</child>
<child>
<object class="GtkButton" id="btn_default">
<property name="label" translatable="yes">Use Default 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">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btnGet">
<property name="label" translatable="yes">Get Current 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="pack-type">end</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
</interface>

View File

@ -0,0 +1,120 @@
#include <gtk/gtk.h>
#include "winconf.h"
#include "img7.xpm"
static GtkWidget *window1=NULL,*win1_image;
static void win1_destroy(GtkWidget *widget,gpointer data){
gtk_widget_destroy(window1);
window1=NULL;
//GtkWidget *image=(GtkWidget*)gtk_builder_get_object(panel2,"image2");
gtk_image_set_from_icon_name((GtkImage*)win1_image,"win1",GTK_ICON_SIZE_BUTTON);
}
static GtkWidget *win1_init(GtkWindow *parent){
//Initalize window1
GtkWidget *win1,*btn_mini,*btn_close,*img_mini,*img_close;
GtkBuilder *builder=gtk_builder_new_from_resource("/gtk69/win1.ui");
win1=(GtkWidget*)gtk_builder_get_object(builder,"win1");
gtk_window_set_transient_for((GtkWindow*)win1,parent);
img_mini=(GtkWidget*)gtk_builder_get_object(builder,"image1");
gtk_image_set_from_icon_name(GTK_IMAGE(img_mini),"window-minimize",GTK_ICON_SIZE_BUTTON);
btn_mini=(GtkWidget*)gtk_builder_get_object(builder,"btn_mini");
g_signal_connect_swapped(btn_mini,"clicked",G_CALLBACK(gtk_widget_hide),win1);
img_close=(GtkWidget*)gtk_builder_get_object(builder,"image2");
gtk_image_set_from_icon_name(GTK_IMAGE(img_close),"window-close",GTK_ICON_SIZE_BUTTON);
btn_close=(GtkWidget*)gtk_builder_get_object(builder,"btn_close");
g_signal_connect(btn_close,"clicked",G_CALLBACK(win1_destroy),win1);
g_object_unref(builder);
return win1;
}
static void win1_activate(GtkWidget *widget,GtkBuilder *builder){
//The Open button for win1
GtkWindow *win_1=(GtkWindow*)gtk_builder_get_object(builder,"window");
if(window1==NULL){
window1=win1_init(win_1);
gtk_window_set_icon_name((GtkWindow*)window1,"win1");
win1_image=(GtkWidget*)gtk_builder_get_object(builder,"image2");
gtk_image_set_from_icon_name((GtkImage*)win1_image,"win1_running",GTK_ICON_SIZE_BUTTON);
gtk_widget_show_all(window1);
g_signal_connect(window1,"destroy",G_CALLBACK(win1_destroy),NULL);
}
}
static void win1_ctrl(GtkWidget *widget,GtkBuilder *builder){
//The Control button for win on taskbar
GtkWindow *win_2=(GtkWindow*)gtk_builder_get_object(builder,"window");
if(window1==NULL){
win1_image=(GtkWidget*)gtk_builder_get_object(builder,"image2");
window1=win1_init(win_2);
gtk_widget_show_all(window1);
gtk_image_set_from_icon_name((GtkImage*)win1_image,"win1_running",GTK_ICON_SIZE_BUTTON);
g_signal_connect(window1,"destroy",G_CALLBACK(win1_destroy),NULL);
}else{
gboolean is_show=gtk_widget_get_visible(window1);
if(is_show==TRUE) gtk_widget_hide(window1);
else gtk_widget_show_all(window1);
}
}
static void set_background(GtkWidget *back,int width,int height){
//Set a background for window
GdkPixbuf *pixbuf=gdk_pixbuf_new_from_xpm_data(img7);
GdkPixbuf *sized=gdk_pixbuf_scale_simple(pixbuf,width,height,GDK_INTERP_BILINEAR);
gtk_image_set_from_pixbuf((GtkImage*)back,sized);
g_object_unref(pixbuf);
g_object_unref(sized);
}
static void add_panel(GtkWidget *overlay,GtkBuilder *builder){
GtkWindow *win=(GtkWindow*)gtk_builder_get_object(builder,"window");
GtkWidget *panel1,*img_panel,*img_win1,*btn_win1,*panel_win1,*btn_size,*btn_exit;
//Get Panel1 and add the panel to window
panel1=(GtkWidget*)gtk_builder_get_object(builder,"panelbox");
//Main panel button
img_panel=(GtkWidget*)gtk_builder_get_object(builder,"image1");
gtk_image_set_from_icon_name(GTK_IMAGE(img_panel),"gtk69",GTK_ICON_SIZE_BUTTON);
//Window1 button on menu and panel
img_win1=(GtkWidget*)gtk_builder_get_object(builder,"image2");
gtk_image_set_from_icon_name(GTK_IMAGE(img_win1),"win1",GTK_ICON_SIZE_BUTTON);
panel_win1=(GtkWidget*)gtk_builder_get_object(builder,"panel_win1");
btn_win1=(GtkWidget*)gtk_builder_get_object(builder,"btn_win1");
g_signal_connect(panel_win1,"clicked",G_CALLBACK(win1_ctrl),builder);
g_signal_connect(btn_win1,"clicked",G_CALLBACK(win1_activate),builder);
//Window Size config
btn_size=(GtkWidget*)gtk_builder_get_object(builder,"btnsize");
g_signal_connect(btn_size,"clicked",G_CALLBACK(conf_dialog),win);
//Exit
btn_exit=(GtkWidget*)gtk_builder_get_object(builder,"btnExit");
g_signal_connect_swapped(btn_exit,"clicked",G_CALLBACK(gtk_widget_destroy),win);
gtk_widget_set_halign(panel1,GTK_ALIGN_START);
gtk_widget_set_valign(panel1,GTK_ALIGN_START);
gtk_overlay_add_overlay((GtkOverlay*)overlay,panel1);
}
static void gtkmain(GtkApplication *app,gpointer user_data){
GtkBuilder *builder=gtk_builder_new_from_resource("/gtk69/window.ui");
GtkWidget *window,*background,*overlay;
int width=640,height=360;
get_config(&width,&height);
//Get Objects and initalize window
window=(GtkWidget*)gtk_builder_get_object(builder,"window");
gtk_window_set_icon_name(GTK_WINDOW(window),"gtk69");
gtk_window_set_default_size(GTK_WINDOW(window),width,height);
//Background
background=(GtkWidget*)gtk_builder_get_object(builder,"background");
set_background(background,width,height);
//Add panel
overlay=(GtkWidget*)gtk_builder_get_object(builder,"overlay");
add_panel(overlay,builder);
gtk_application_add_window(app,GTK_WINDOW(window));
gtk_widget_show_all(window);
}
int main(int argc,char **argv){
GtkApplication *app;
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);
}

View File

@ -0,0 +1 @@

Binary file not shown.

View File

@ -0,0 +1,72 @@
#include <cstdio>
#include "winconf.h"
void conf_dialog(GtkWidget *widget,GtkWindow *win){
//Window config dialog
GtkBuilder *conf_size=gtk_builder_new_from_resource("/gtk69/winsize.ui");
GObject *dialog=gtk_builder_get_object(conf_size,"dialog");
gtk_window_set_transient_for(GTK_WINDOW(dialog),win);
g_signal_connect(dialog,"response",G_CALLBACK(conf_response),conf_size);
//Set default config
GtkWidget *btn_width,*btn_height;
btn_width=(GtkWidget*)gtk_builder_get_object(conf_size,"btn_width");
gtk_spin_button_set_value((GtkSpinButton*)btn_width,640.0);
btn_height=(GtkWidget*)gtk_builder_get_object(conf_size,"btn_height");
gtk_spin_button_set_value((GtkSpinButton*)btn_height,360.0);
//Get window size
GObject *btnGet=gtk_builder_get_object(conf_size,"btnGet");
g_signal_connect(btnGet,"clicked",G_CALLBACK(get_winsize),conf_size);
//Reset to default
GObject *btn_default=gtk_builder_get_object(conf_size,"btn_default");
g_signal_connect(btn_default,"clicked",G_CALLBACK(set_default),conf_size);
gtk_widget_show_all(GTK_WIDGET(dialog));
}
void conf_response(GtkWidget *widget,int response,GtkBuilder *builder_conf){
//Get width and height config and put the numbers into winsize.conf file
GtkWidget *btn_width,*btn_height;
btn_width=(GtkWidget*)gtk_builder_get_object(builder_conf,"btn_width");
btn_height=(GtkWidget*)gtk_builder_get_object(builder_conf,"btn_height");
if(response==GTK_RESPONSE_OK){
int width,height;
width=gtk_spin_button_get_value_as_int((GtkSpinButton*)btn_width);
height=gtk_spin_button_get_value_as_int((GtkSpinButton*)btn_height);
freopen("winsize.conf","w",stdout);
g_print("%d %d",width,height);
fclose(stdout);
}
gtk_widget_destroy(widget);
}
void set_default(GtkWidget *widget,GtkBuilder *builder_conf){
//Discard changes and set to default config
GtkWidget *btn_width,*btn_height;
btn_width=(GtkWidget*)gtk_builder_get_object(builder_conf,"btn_width");
gtk_spin_button_set_value((GtkSpinButton*)btn_width,640.0);
btn_height=(GtkWidget*)gtk_builder_get_object(builder_conf,"btn_height");
gtk_spin_button_set_value((GtkSpinButton*)btn_height,360.0);
}
void get_winsize(GtkWidget *widget,GtkBuilder *builder_conf){
//Get current window size
int width=640,height=360;
GtkWindow *window;
//Get dialog window and entry
GObject *dialog=gtk_builder_get_object(builder_conf,"dialog");
GtkWidget *btn_width,*btn_height;
btn_width=(GtkWidget*)gtk_builder_get_object(builder_conf,"btn_width");
btn_height=(GtkWidget*)gtk_builder_get_object(builder_conf,"btn_height");
//Get main window
window=gtk_window_get_transient_for(GTK_WINDOW(dialog));
gtk_window_get_size(GTK_WINDOW(window),&width,&height);
//g_print("%d %d\n",width,height);
gtk_spin_button_set_value((GtkSpinButton*)btn_width,width);
gtk_spin_button_set_value((GtkSpinButton*)btn_height,height);
}
void get_config(int *width,int *height){
freopen("winsize.conf","r",stdin);
scanf("%d",width);
scanf("%d",height);
fclose(stdin);
}

View File

@ -0,0 +1,17 @@
#ifndef __WIN_CONF_H_
#define __WIN_CONF_H_
#include <gtk/gtk.h>
void conf_dialog(GtkWidget *widget,GtkWindow *win);
void conf_response(GtkWidget *widget,int response,GtkBuilder *builder_conf);
void set_default(GtkWidget *widget,GtkBuilder *builder_conf);
void get_winsize(GtkWidget *widget,GtkBuilder *buider_conf);
void get_config(int *width,int *height);
#endif

Binary file not shown.

View File

@ -0,0 +1 @@
878 552

BIN
Gtk3/public_src/img7.7z Normal file

Binary file not shown.