aboutsummaryrefslogtreecommitdiff
path: root/vendor/libghostty-vt/src/apprt/gtk/ui/1.2/search-overlay.blp
blob: 8ab2e3109bf1be2d23b394ddfffb1edb63bea55c (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
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
using Gtk 4.0;
using Gdk 4.0;
using Adw 1;

template $GhosttySearchOverlay: Adw.Bin {
  visible: bind template.active;
  halign-target: end;
  valign-target: start;
  halign: bind template.halign-target;
  valign: bind template.valign-target;

  GestureDrag {
    button: 1;
    propagation-phase: capture;
    drag-end => $on_drag_end();
  }

  Adw.Bin {
    Box container {
      styles [
        "background",
        "search-overlay",
      ]

      orientation: horizontal;
      spacing: 6;

      SearchEntry search_entry {
        placeholder-text: _("Find…");
        width-chars: 20;
        hexpand: true;
        stop-search => $stop_search();
        search-changed => $search_changed();
        next-match => $next_match();
        previous-match => $previous_match();

        EventControllerKey {
          // We need this so we capture before the SearchEntry.
          propagation-phase: capture;
          key-pressed => $search_entry_key_pressed();
        }
      }

      Label {
        styles [
          "dim-label",
        ]

        label: bind $match_label_closure(
          template.has-search-selected,
          template.search-selected,
          template.has-search-total,
          template.search-total
          ) as <string>;
        width-chars: 6;
        xalign: 1.0;
      }

      Box button_box {
        orientation: horizontal;
        spacing: 1;

        styles [
          "linked",
        ]

        Button prev_button {
          icon-name: "go-up-symbolic";
          tooltip-text: _("Previous Match");
          clicked => $next_match();

          cursor: Gdk.Cursor {
            name: "pointer";
          };
        }

        Button next_button {
          icon-name: "go-down-symbolic";
          tooltip-text: _("Next Match");
          clicked => $previous_match();

          cursor: Gdk.Cursor {
            name: "pointer";
          };
        }
      }

      Button close_button {
        icon-name: "window-close-symbolic";
        tooltip-text: _("Close");
        clicked => $stop_search();

        cursor: Gdk.Cursor {
          name: "pointer";
        };
      }
    }
  }
}