Introduce flow_box macro
This commit is contained in:
parent
01bfa16481
commit
a845c0c1fa
3 changed files with 55 additions and 37 deletions
|
|
@ -19,6 +19,8 @@ macro_rules ! g_box { (
|
|||
$ ( @ halign : $ halign : expr , ) ?
|
||||
$ ( @ valign : $ valign : expr , ) ?
|
||||
$ ( @ spacing : $ spacing : expr , ) ?
|
||||
$ ( @ margin_top : $ margin_top : expr , ) ?
|
||||
$ ( @ margin_bottom : $ margin_bottom : expr , ) ?
|
||||
$ ( @ widget_name : $ widget_name : expr , ) ?
|
||||
$ ( @ css_classes : $ css_classes : expr , ) ?
|
||||
$ ( $ child : expr ) , + $ (,) ?
|
||||
|
|
@ -28,6 +30,8 @@ macro_rules ! g_box { (
|
|||
$ ( container . set_halign ( $ halign ) ; ) ?
|
||||
$ ( container . set_valign ( $ valign ) ; ) ?
|
||||
$ ( container . set_spacing ( $ spacing ) ; ) ?
|
||||
$ ( container . set_margin_top ( $ margin_top ) ; ) ?
|
||||
$ ( container . set_margin_bottom ( $ margin_bottom ) ; ) ?
|
||||
$ ( container . set_widget_name ( & $ widget_name ) ; ) ?
|
||||
$ ( container . set_css_classes ( & $ css_classes ) ; ) ?
|
||||
$ ( container . append ( & $ child ) ; ) *
|
||||
|
|
@ -86,6 +90,18 @@ macro_rules ! scrolled_window { (
|
|||
widget
|
||||
} } }
|
||||
|
||||
macro_rules ! flow_box { (
|
||||
$ ( @ orientation : $ orientation : expr , ) ?
|
||||
$ ( @ homogeneous : $ homogeneous : expr , ) ?
|
||||
$ ( @ selection_mode : $ selection_mode : expr , ) ?
|
||||
) => { {
|
||||
let widget = gtk4 :: FlowBox :: new () ;
|
||||
$ ( widget . set_orientation ( $ orientation ) ; ) ?
|
||||
$ ( widget . set_homogeneous ( $ homogeneous ) ; ) ?
|
||||
$ ( widget . set_selection_mode ( $ selection_mode ) ; ) ?
|
||||
widget
|
||||
} } }
|
||||
|
||||
macro_rules ! vertically_filling { ( $ child : expr ) => {
|
||||
g_box ! (
|
||||
@ orientation : gtk4 :: Orientation :: Vertical ,
|
||||
|
|
@ -108,5 +124,6 @@ pub (crate) use {
|
|||
popover ,
|
||||
icon ,
|
||||
scrolled_window ,
|
||||
flow_box ,
|
||||
vertically_filling ,
|
||||
} ;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue