GTK 4 tutorial for beginners
Find a file
2023-04-10 00:21:41 -06:00
docs Announce that new licenses are under consideration. 2023-03-27 20:27:45 +09:00
gfm Fix source file typo errors. 2023-03-23 17:15:17 +09:00
image Section 30 is added. It is about GtkSignalListItemFactory. 2023-01-31 19:04:06 +09:00
lib Refactor the Rakefile. 2022-08-27 21:43:28 +09:00
src Announce that new licenses are under consideration. 2023-03-27 20:27:45 +09:00
test Update Rakefile. 2022-04-25 10:33:47 +09:00
.gitignore .gitignore is modified. 2023-01-31 21:32:38 +09:00
mktbl.rb Bug fixed. Readme_for_developers.src.md is Updated. 2022-04-17 12:52:12 +09:00
Rakefile Bug fixed. 2022-11-28 10:48:58 +09:00
README.md Fix GitHub Page link 2023-04-10 00:21:41 -06:00
src2md.rb Update Readme_for_developers. 2022-04-25 17:01:44 +09:00

GTK 4 Tutorial for beginners

The GitHub page of this tutorial is also available. Click here.

Contents of this Repository

This tutorial illustrates how to write C programs with the GTK 4 library. It focuses on beginners so the contents are limited to the basics. The table of contents is at the end of this abstract.

  • Section 3 to 21 describes the basics, with the example of a simple editor tfe (Text File Editor).
  • Section 22 to 25 describes GtkDrawingArea.
  • Section 26 to 30 describes the list model and the list view (GtkListView, GtkGridView and GtkColumnView). It also describes GtkExpression.

The latest version of the tutorial is located at GTK4-tutorial GitHub repository. You can read it directly without download.

There's a GitHub Page of this tutorial at https://toshiocp.github.io/Gtk4-tutorial/. It is easier to read than the repository.

GTK 4 Documentation

Please refer to GTK 4 API Reference and GNOME Developer Documentation Website for further information.

These websites were opened in August of 2021. The old documents are located at GTK Reference Manual and GNOME Developer Center.

If you want to know about GObject and the type system, please refer to GObject tutorial. GObject is the base of GTK 4, so it is important for developers to understand GObject as well as GTK 4.

Contribution

This tutorial is still under development and unstable. Even though the codes of the examples have been tested on GTK 4 (version 4.8.1), bugs may still exist. If you find any bugs, errors or mistakes in the tutorial and C examples, please let me know. You can post it to GitHub issues. You can also post updated files to pull request. One thing you need to be careful is to correct the source files, which are under the 'src' directory. Don't modify the files under gfm or html directories. After modifying some source files , run rake to create GFM (GitHub Flavoured Markdown) files and run rake html to create HTML files.

If you have a question, feel free to post it to issue. All questions are helpful and will make this tutorial get better.

How to get Gtk 4 tutorial with HTML or PDF format

If you want to get HTML or PDF format tutorial, make them with rake command, which is a ruby version of make. Type rake html for HTML. Type rake pdf for PDF. There is a document "[How to build GTK 4 Tutorial](gfm/Readme_for_developers.md)" for further information.

License

The license of this repository is GPL and written in Section1.

But new licenses, one of which is GFDL1.3 for documents and the other is GPL3 for programs, are under consideration. The decision will be made on 15/April/2023.

Table of contents

  1. Prerequisite and License
  2. Installing GTK 4 into Linux distributions
  3. GtkApplication and GtkApplicationWindow
  4. Widgets (1)
  5. Widgets (2)
  6. Strings and memory management
  7. Widgets (3)
  8. Defining a final class
  9. GtkBuilder and UI file
  10. Build system
  11. Instance Initialization and destruction
  12. Signals
  13. Functions in TfeTextView
  14. Functions in GtkNotebook
  15. tfeapplication.c
  16. How to build tfe (text file editor)
  17. Menu and action
  18. Stateful action
  19. Ui file for menu and action entries
  20. GtkMenuButton, accelerators, font, pango and gsettings
  21. Template XML and composite widget
  22. GtkDrawingArea and Cairo
  23. Periodic Events
  24. Combine GtkDrawingArea and TfeTextView
  25. Tiny turtle graphics interpreter
  26. GtkListView
  27. GtkGridView and activate signal
  28. GtkExpression
  29. GtkColumnView
  30. GtkSignalListItemFactory