Debian Codegraph @

src/scores/dialog.rs

raw symbols SCIP
1 /*
2 * Copyright 2024 Andrey Kutejko <[email protected]>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see <http://www.gnu.org/licenses/>.
16 *
17 * For more details see the file COPYING.
18 */
19
20 use adw::prelude::*;
21
22 pub struct ScoresDialog {
23 pub dlg: adw::Window,
24 pub window_title: adw::WindowTitle,
25 pub headerbar: adw::HeaderBar,
26 pub vbox: gtk::Box,
27 }
28
29 pub fn new_scores_dialog(window: &gtk::Window) -> ScoresDialog {
30 let dlg = adw::Window::builder()
31 .resizable(true)
32 .modal(true)
33 .transient_for(window)
34 .build();
35
36 let window_title = adw::WindowTitle::builder().build();
37
38 let headerbar = adw::HeaderBar::builder()
39 .title_widget(&window_title)
40 .build();
41
42 let content = adw::ToolbarView::builder().build();
43 dlg.set_content(Some(&content));
44
45 content.add_top_bar(&headerbar);
46
47 let vbox = gtk::Box::builder()
48 .orientation(gtk::Orientation::Vertical)
49 .build();
50 content.set_content(Some(&vbox));
51
52 ScoresDialog {
53 dlg,
54 window_title,
55 headerbar,
56 vbox,
57 }
58 }