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
/// Creates a GTK box.
///
/// # See Also
/// - [widget Macro](macro.widget.html)
/// - [BoxBuilder in gtk-rs](https://gtk-rs.org/docs/gtk/struct.BoxBuilder.html)
/// - [Box in gtk-rs](https://gtk-rs.org/docs/gtk/struct.Box.html)
///
/// # Examples
///
/// ```rust,no_run
/// # #[macro_use]
/// # extern crate gstore;
/// # use gstore::prelude::*;
/// # use gtk::prelude::*;
/// #
/// # slice! { CountState { count: i64 = 0 } CountAction { Clicked } }
/// # fn reduce_count(action: CountAction, state: CountState) -> CountState { state }
/// # store! { count: Count = crate::{CountState, CountAction, reduce_count} }
/// #
/// # fn main() {
/// #     let store = Store::new(|a,s| s, vec![]);
///
/// gbox! [ horizontal
///     label!(just "Label A")
///     label!(just "Label B")
/// ];
///
/// gbox! [ vertical
///     label!(just "Label A")
///     label!(just "Label B")
/// ];
///
/// gbox! {
///     properties {
///         orientation: gtk::Orientation::Horizontal
///     }
///     children [
///         label!(just "Label A")
///         label!(just "Label A")
///     ]
/// };
/// # }
/// ```
#[macro_export]
macro_rules! gbox {
    (
        vertical $($child:expr)*
    ) => {{
        let gbox = gtk::BoxBuilder::new()
            .visible(true)
            .orientation(gtk::Orientation::Vertical)
            .build();
        widget!(gbox {
            properties {

            }
            children [
                $($child)*
            ]
        });
        gbox
    }};
    (
        horizontal $($child:expr)*
    ) => {{
        let gbox = gtk::BoxBuilder::new()
            .visible(true)
            .orientation(gtk::Orientation::Horizontal)
            .build();
        widget!(gbox {
            properties {

            }
            children [
                $($child)*
            ]
        });
        gbox
    }};
        (
        $($text:tt)*
    ) => {{
        let gbox = gtk::BoxBuilder::new().visible(true).build();
        widget!(gbox { $($text)* });
        gbox
    }}
}