File: tour-events.page

package info (click to toggle)
gnome-devel-docs 40.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 79,188 kB
  • sloc: javascript: 2,514; xml: 2,407; ansic: 2,229; python: 1,854; makefile: 805; sh: 499; cpp: 131
file content (69 lines) | stat: -rw-r--r-- 2,665 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" xmlns:its="http://www.w3.org/2005/11/its" type="topic" style="task" id="tour-events" xml:lang="uk">

  <info>
    <link type="next" xref="tour-get_object"/>
    <revision version="0.1" date="2013-06-17" status="stub"/>

    <credit type="author copyright">
      <name>Єкатерина Герасимова (Ekaterina Gerasimova)</name>
      <email its:translate="no">kittykat3756@gmail.com</email>
      <years>2013</years>
    </credit>
    <credit type="author copyright">
      <name>Gordon Hill</name>
      <email its:translate="no">caseyweederman@gmail.com</email>
      <years>2013</years>
    </credit>

    <include xmlns="http://www.w3.org/2001/XInclude" href="cc-by-sa-3-0.xml"/>

    <desc>Прив'язка функцій до подій за допомогою Lang.</desc>
  
    <mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
      <mal:name>Максим Дзюманенко</mal:name>
      <mal:email>dziumanenko@gmail.com</mal:email>
      <mal:years>2010</mal:years>
    </mal:credit>
  
    <mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
      <mal:name>Юрій Чорноіван</mal:name>
      <mal:email>yurchor@ukr.net</mal:email>
      <mal:years>2020</mal:years>
    </mal:credit>
  </info>

  <title>Дії і сигнали</title>

  <links type="prevnext" style="top"/>
  <links type="series" style="floatend">
    <title>Перші кроки у GNOME</title>
  </links>

  <p>У Gtk передбачено набір попередньо визначених подій, яким ви можете скористатися у вашій програмі.</p>
  <example>
    <p>Оголосіть <code>HelloWorld</code> як новий клас.</p>

    <code>
class HelloWorld {
</code>

    <p><code>constructor</code> викликають при створенні нового екземпляра. Створіть <code>GtkApplication</code> і з'єднайте <code>activate</code> із наявною подією Gtk <code>_onActivate</code>, а <code>startup</code> — із <code>_onStartup</code>:</p>

    <code>
    constructor() {
        this.application = new Gtk.Application();
        this.application.connect('activate', this._onActivate.bind(this));
        this.application.connect('startup', this._onStartup.bind(this));
    }
</code>

    <p>Показ вікна при активації програми:</p>
    <code>
    _onActivate() {
        this._window.show_all();
    }
</code>
  </example>
  <links type="prevnext"/>
</page>