Skip to content
Snippets Groups Projects
window.blp 1.56 KiB
Newer Older
Bruce Cowan's avatar
Bruce Cowan committed
// SPDX-FileCopyrightText: 2022 Bruce Cowan <bruce@bcowan.me.uk>
//
// SPDX-License-Identifier: GPL-3.0-or-later

using Gtk 4.0;
using Adw 1;

template RugbyAppWindow : Adw.ApplicationWindow {
Bruce Cowan's avatar
Bruce Cowan committed
  title: "Rugby";
  default-height: 600;
  default-width: 400;

  Box {
    orientation: vertical;
Bruce Cowan's avatar
Bruce Cowan committed

    Adw.HeaderBar {
      SpinButton scorespin {
        adjustment: Adjustment {
          step-increment: 1;
          upper: 200;
        };
        focusable: true;
        tooltip-text: "Score";
      }
Bruce Cowan's avatar
Bruce Cowan committed

        direction: none;
        menu-model: app_menu;
Bruce Cowan's avatar
Bruce Cowan committed
        tooltip-text: "Main Menu";
Bruce Cowan's avatar
Bruce Cowan committed
    }

Bruce Cowan's avatar
Bruce Cowan committed
    Adw.Clamp {
      maximum-size: 600;
Bruce Cowan's avatar
Bruce Cowan committed

Bruce Cowan's avatar
Bruce Cowan committed
      Stack stack {
        StackPage {
          child: Adw.StatusPage empty_page {
            title: "No possibilities";
          };
        }
Bruce Cowan's avatar
Bruce Cowan committed

Bruce Cowan's avatar
Bruce Cowan committed
        StackPage {
          child: ScrolledWindow list_page {
            vexpand: true;
Bruce Cowan's avatar
Bruce Cowan committed

Bruce Cowan's avatar
Bruce Cowan committed
            ListView listview {
              styles ["rich-list"]

              model: NoSelection {
                model: .RugbyListStore {
                  score: bind scorespin.value;

                  items-changed => list_store_items_changed_cb();
                };
              };
              factory: BuilderListItemFactory {
                resource: "/uk/me/bcowan/Rugby/gtk/score-item.ui";
              };
            }
Bruce Cowan's avatar
Bruce Cowan committed
      }
    }
  }
}

menu app_menu {
  section {
    item ("_Preferences", "app.prefs")
Bruce Cowan's avatar
Bruce Cowan committed
    item ("_Keyboard Shortcuts", "win.show-help-overlay")
Bruce Cowan's avatar
Bruce Cowan committed
    item ("_About Rugby", "app.about")
  }
}