2022-04-21 16:53:28 +02:00
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html lang="en">
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="utf-8" />
|
|
|
|
|
<meta name="generator" content="pandoc" />
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
2023-12-10 09:39:32 +01:00
|
|
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">
|
2022-11-21 14:48:20 +01:00
|
|
|
|
<title>GTK 4 tutorial</title>
|
2022-04-21 16:53:28 +02:00
|
|
|
|
<style>
|
|
|
|
|
code{white-space: pre-wrap;}
|
|
|
|
|
span.smallcaps{font-variant: small-caps;}
|
|
|
|
|
span.underline{text-decoration: underline;}
|
|
|
|
|
div.column{display: inline-block; vertical-align: top; width: 50%;}
|
|
|
|
|
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
|
|
|
|
|
ul.task-list{list-style: none;}
|
|
|
|
|
pre{overflow: visible;}
|
|
|
|
|
pre > code.sourceCode { white-space: pre; position: relative; }
|
|
|
|
|
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
|
|
|
|
|
pre > code.sourceCode > span:empty { height: 1.2em; }
|
|
|
|
|
code.sourceCode > span { color: inherit; text-decoration: inherit; }
|
|
|
|
|
div.sourceCode { margin: 1em 0; }
|
|
|
|
|
pre.sourceCode { margin: 0; }
|
|
|
|
|
@media screen {
|
|
|
|
|
div.sourceCode { overflow: auto; }
|
2022-04-17 13:54:42 +02:00
|
|
|
|
}
|
2022-04-21 16:53:28 +02:00
|
|
|
|
@media print {
|
|
|
|
|
pre > code.sourceCode { white-space: pre-wrap; }
|
|
|
|
|
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
|
|
|
|
|
}
|
|
|
|
|
pre.numberSource code
|
|
|
|
|
{ counter-reset: source-line 0; }
|
|
|
|
|
pre.numberSource code > span
|
|
|
|
|
{ position: relative; left: -4em; counter-increment: source-line; }
|
|
|
|
|
pre.numberSource code > span > a:first-child::after
|
|
|
|
|
{ content: counter(source-line);
|
|
|
|
|
position: relative; left: -1em; text-align: right; vertical-align: baseline;
|
|
|
|
|
border: none; display: inline-block;
|
|
|
|
|
-webkit-touch-callout: none; -webkit-user-select: none;
|
|
|
|
|
-khtml-user-select: none; -moz-user-select: none;
|
|
|
|
|
-ms-user-select: none; user-select: none;
|
|
|
|
|
padding: 0 4px; width: 4em;
|
|
|
|
|
color: #aaaaaa;
|
|
|
|
|
}
|
|
|
|
|
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
|
|
|
|
|
div.sourceCode
|
|
|
|
|
{ }
|
|
|
|
|
@media screen {
|
|
|
|
|
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
|
|
|
|
|
}
|
|
|
|
|
code span.al { color: #ff0000; font-weight: bold; } /* Alert */
|
|
|
|
|
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
|
|
|
|
|
code span.at { color: #7d9029; } /* Attribute */
|
|
|
|
|
code span.bn { color: #40a070; } /* BaseN */
|
|
|
|
|
code span.bu { } /* BuiltIn */
|
|
|
|
|
code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
|
|
|
|
|
code span.ch { color: #4070a0; } /* Char */
|
|
|
|
|
code span.cn { color: #880000; } /* Constant */
|
|
|
|
|
code span.co { color: #60a0b0; font-style: italic; } /* Comment */
|
|
|
|
|
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
|
|
|
|
|
code span.do { color: #ba2121; font-style: italic; } /* Documentation */
|
|
|
|
|
code span.dt { color: #902000; } /* DataType */
|
|
|
|
|
code span.dv { color: #40a070; } /* DecVal */
|
|
|
|
|
code span.er { color: #ff0000; font-weight: bold; } /* Error */
|
|
|
|
|
code span.ex { } /* Extension */
|
|
|
|
|
code span.fl { color: #40a070; } /* Float */
|
|
|
|
|
code span.fu { color: #06287e; } /* Function */
|
|
|
|
|
code span.im { } /* Import */
|
|
|
|
|
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
|
|
|
|
|
code span.kw { color: #007020; font-weight: bold; } /* Keyword */
|
|
|
|
|
code span.op { color: #666666; } /* Operator */
|
|
|
|
|
code span.ot { color: #007020; } /* Other */
|
|
|
|
|
code span.pp { color: #bc7a00; } /* Preprocessor */
|
|
|
|
|
code span.sc { color: #4070a0; } /* SpecialChar */
|
|
|
|
|
code span.ss { color: #bb6688; } /* SpecialString */
|
|
|
|
|
code span.st { color: #4070a0; } /* String */
|
|
|
|
|
code span.va { color: #19177c; } /* Variable */
|
|
|
|
|
code span.vs { color: #4070a0; } /* VerbatimString */
|
|
|
|
|
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
|
|
|
|
|
div.sourceCode { margin: 10px; padding: 16px 10px 8px 10px; border: 2px solid silver; background-color: ghostwhite; overflow-x:scroll}
|
|
|
|
|
pre:not(.sourceCode) { margin: 10px; padding: 16px 10px 8px 10px; border: 2px solid silver; background-color: ghostwhite; overflow-x:scroll}
|
|
|
|
|
table {margin-left: auto; margin-right: auto; border-collapse: collapse; border: 1px solid;}
|
|
|
|
|
th {padding: 2px 6px; border: 1px solid; background-color: ghostwhite;}
|
|
|
|
|
td {padding: 2px 6px; border: 1px solid;}
|
|
|
|
|
img {display: block; margin-left: auto; margin-right: auto;}
|
|
|
|
|
figcaption {text-align: center;}
|
|
|
|
|
</style>
|
|
|
|
|
</head>
|
|
|
|
|
<body style="padding-top: 70px;">
|
|
|
|
|
<div class="container">
|
|
|
|
|
<nav class="navbar fixed-top navbar-expand-lg navbar-dark bg-primary">
|
|
|
|
|
<div class="container-fluid">
|
|
|
|
|
<span class="navbar-brand">Gtk4 tutorial</span>
|
|
|
|
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
|
|
|
|
<span class="navbar-toggler-icon"></span>
|
|
|
|
|
</button>
|
|
|
|
|
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
|
|
|
|
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
|
|
|
|
<li class="nav-item">
|
|
|
|
|
<a class="nav-link" href="index.html">Home</a>
|
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="nav-item">
|
|
|
|
|
<a class="nav-link" href="sec2.html">Next: section2</a>
|
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</nav>
|
2023-12-10 09:39:32 +01:00
|
|
|
|
<div class="row justify-content-center">
|
|
|
|
|
<div class="col-xl-10 col-xxl-9">
|
2022-04-17 13:54:42 +02:00
|
|
|
|
<h1 id="prerequisite-and-license">Prerequisite and License</h1>
|
|
|
|
|
<h2 id="prerequisite">Prerequisite</h2>
|
2022-11-21 14:48:20 +01:00
|
|
|
|
<h3 id="gtk-4-on-a-linux-os">GTK 4 on a Linux OS</h3>
|
2023-07-15 10:27:53 +02:00
|
|
|
|
<p>This tutorial describes GTK 4 libraries. It is originally used on
|
2022-11-21 14:48:20 +01:00
|
|
|
|
Linux with C compiler, but now it is used more widely, on Windows and
|
2023-07-15 10:27:53 +02:00
|
|
|
|
MacOS, with Vala, Python, Ruby and so on. However, this tutorial
|
|
|
|
|
describes only <em>C programs on Linux</em>.</p>
|
2022-04-17 13:54:42 +02:00
|
|
|
|
<p>If you want to try the examples in the tutorial, you need:</p>
|
|
|
|
|
<ul>
|
2022-12-21 14:31:33 +01:00
|
|
|
|
<li>PC with Linux distribution like Ubuntu or Debian.</li>
|
|
|
|
|
<li>GCC.</li>
|
2023-07-15 10:27:53 +02:00
|
|
|
|
<li>GTK 4 (version 4.10.1 or later).</li>
|
2022-04-17 13:54:42 +02:00
|
|
|
|
</ul>
|
2023-07-15 10:27:53 +02:00
|
|
|
|
<p>The stable version of GTK is 4.10.1 at present (24/April/2023). The
|
|
|
|
|
version 4.10 adds some new classes and functions and makes some classes
|
|
|
|
|
and functions deprecated. Some example programs in this tutorial don’t
|
|
|
|
|
work on the older version.</p>
|
2022-11-21 14:48:20 +01:00
|
|
|
|
<h3 id="ruby-and-rake-for-making-the-document">Ruby and rake for making
|
|
|
|
|
the document</h3>
|
2022-12-21 14:31:33 +01:00
|
|
|
|
<p>This repository includes Ruby programs. They are used to make GFM
|
|
|
|
|
(GitHub Flavoured Markdown) files, HTML files, Latex files and a PDF
|
|
|
|
|
file.</p>
|
2022-04-17 13:54:42 +02:00
|
|
|
|
<p>You need:</p>
|
|
|
|
|
<ul>
|
2022-12-21 14:31:33 +01:00
|
|
|
|
<li>Linux.</li>
|
2023-12-10 09:39:32 +01:00
|
|
|
|
<li>Ruby programming language. There are two ways to install. One is
|
2022-11-21 14:48:20 +01:00
|
|
|
|
installing the distribution’s package. The other is using rbenv and
|
|
|
|
|
ruby-build. If you want to use the latest version of ruby, use
|
|
|
|
|
rbenv.</li>
|
2023-07-15 10:27:53 +02:00
|
|
|
|
<li>Rake.</li>
|
2022-04-17 13:54:42 +02:00
|
|
|
|
</ul>
|
|
|
|
|
<h2 id="license">License</h2>
|
2023-07-15 10:27:53 +02:00
|
|
|
|
<p>Copyright (C) 2020,2023 ToshioCP (Toshio Sekiya)</p>
|
2022-12-21 14:31:33 +01:00
|
|
|
|
<p>GTK4-tutorial repository contains tutorial documents and programs
|
2022-11-21 14:48:20 +01:00
|
|
|
|
such as converters, generators and controllers. All of them make up the
|
2022-12-21 14:31:33 +01:00
|
|
|
|
‘GTK4-tutorial’ package. This package is simply called ‘GTK4-tutorial’
|
2023-04-15 03:24:30 +02:00
|
|
|
|
in the following description.</p>
|
|
|
|
|
<p>GTK4-tutorial is free; you can redistribute it and/or modify it under
|
2023-12-10 09:39:32 +01:00
|
|
|
|
the terms of the following licenses.</p>
|
2023-04-15 03:24:30 +02:00
|
|
|
|
<ul>
|
|
|
|
|
<li>The license of documents in GTK4-tutorial is the GNU Free
|
|
|
|
|
Documentation License as published by the Free Software Foundation;
|
|
|
|
|
either version 1.3 of the License or, at your opinion, any later
|
|
|
|
|
version. The documents are Markdown, HTML and image files. If you
|
|
|
|
|
generate a PDF file by running <code>rake pdf</code>, it is also
|
2023-04-15 03:28:13 +02:00
|
|
|
|
included by the documents.</li>
|
2023-04-15 03:24:30 +02:00
|
|
|
|
<li>The license of programs in GTK4-tutorial is the GNU General Public
|
|
|
|
|
License as published by the Free Software Foundation; either version 3
|
|
|
|
|
of the License or, at your option, any later version. The programs are
|
|
|
|
|
written in C, Ruby and other languages.</li>
|
|
|
|
|
</ul>
|
2023-04-15 03:28:13 +02:00
|
|
|
|
<p>GTK4-tutorial is distributed in the hope that it will be useful, but
|
|
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
2023-04-15 03:24:30 +02:00
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU License
|
|
|
|
|
web pages for more details.</p>
|
|
|
|
|
<ul>
|
|
|
|
|
<li><a href="https://www.gnu.org/licenses/fdl-1.3.html">GNU Free
|
|
|
|
|
Documentation License</a></li>
|
|
|
|
|
<li><a href="https://www.gnu.org/licenses/gpl-3.0.html">GNU General
|
|
|
|
|
Public License</a></li>
|
|
|
|
|
</ul>
|
|
|
|
|
<p>The licenses above is effective since 15/April/2023. Before that, GPL
|
|
|
|
|
covered all the contents of the GTK4-tutorial. But GFDL1.3 is more
|
|
|
|
|
appropriate for documents so the license was changed. The license above
|
|
|
|
|
is the only effective license since 15/April/2023.</p>
|
2023-12-10 09:39:32 +01:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2022-04-21 16:53:28 +02:00
|
|
|
|
</div>
|
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|