summaryrefslogtreecommitdiff
path: root/examples/gtk4-template.ui
blob: 254ed8e7705fa568f05a46fe5736ba55da9f5be2 (plain)
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
<!-- SPDX-License-Identifier: MIT OR LGPL-2.0-or-later -->
<!-- SPDX-FileCopyrightText: 2021 Andy Holmes <andyholmes@gnome.org> -->
<interface>
  <!-- Template

    * class: must be the `GTypeName` given in the class definition, or the
      class name prefixed with `Gjs_` if not given (eg `Gjs_ExampleWinow`)
    * parent: the GType name of the derived class

    -->
  <template class="ExampleWindow" parent="GtkWindow">
    <property name="default-width">480</property>
    <property name="default-height">320</property>
    <child>
      <object class="GtkBox" id="box">
        <property name="visible">True</property>
        <child>
          <object class="GtkButton" id="button">
            <property name="label">Button</property>
            <property name="halign">center</property>
            <property name="hexpand">True</property>
            <property name="valign">center</property>
            <property name="visible">True</property>

            <!-- Signals

              * name: the signal name
              * handler: the name of method on the subclass to call when emitted
              * swapped: must always be "no" in GJS applications
              * object: the object bound to `this` in the callback. This is
                usually the template class (eg. `ExampleClass`) but may also be
                an object ID (eg. `box` or `button`).

              -->
            <signal name="clicked"
                    handler="_onButtonClicked"
                    swapped="no"
                    object="ExampleWindow"/>
          </object>
        </child>
      </object>
    </child>
  </template>
</interface>