using Gtk 4.0;
using Adw 1;

template $SpeechButton : Button {
  tooltip-text: _("Listen");

  styles ["speech-button"]

  child: Overlay {
    [overlay]
    ProgressBar progress_bar {
      visible: false;
      valign: end;

      styles ["osd"]
    }

    child: Stack stack {
      StackPage {
        name: "ready";
        child: Image {
          icon-name: "audio-speakers-symbolic";
        };
      }

      StackPage {
        name: "progress";
        child: Image {
          icon-name: "media-playback-stop-symbolic";
        };
      }

      StackPage {
        name: "error";
        child: Image {
          icon-name: "dialect-speakers-broken-symbolic";
        };
      }

      StackPage {
        name: "loading";
        child: Adw.Spinner {};
      }
    };
  };
}
