Introduce view_switcher, header_bar, bin UI macros
This commit is contained in:
parent
a845c0c1fa
commit
eb10495670
2 changed files with 30 additions and 17 deletions
|
|
@ -102,14 +102,33 @@ macro_rules ! flow_box { (
|
|||
widget
|
||||
} } }
|
||||
|
||||
macro_rules ! view_switcher { (
|
||||
$ ( @ policy : $ policy : expr , ) ?
|
||||
$ stack : expr $ (,) ?
|
||||
) => { {
|
||||
let widget = libadwaita :: ViewSwitcher :: new () ;
|
||||
$ ( widget . set_policy ( $ policy ) ; ) ?
|
||||
widget . set_stack ( Some ( & $ stack ) ) ;
|
||||
widget
|
||||
} } }
|
||||
|
||||
macro_rules ! header_bar { ( $ title_widget : expr $ (,) ? ) => { {
|
||||
let widget = libadwaita :: HeaderBar :: new () ;
|
||||
widget . set_title_widget ( Some ( & $ title_widget ) ) ;
|
||||
widget
|
||||
} } }
|
||||
|
||||
macro_rules ! bin { ( $ ( @ vexpand : $ vexpand : expr ) ? $ (,) ? ) => { {
|
||||
let widget = libadwaita :: Bin :: new () ;
|
||||
$ ( widget . set_vexpand ( $ vexpand ) ; ) ?
|
||||
widget
|
||||
} } }
|
||||
|
||||
macro_rules ! vertically_filling { ( $ child : expr ) => {
|
||||
g_box ! (
|
||||
@ orientation : gtk4 :: Orientation :: Vertical ,
|
||||
$ child ,
|
||||
libadwaita :: Bin :: builder ()
|
||||
. css_name ("filler")
|
||||
. vexpand (true)
|
||||
. build () ,
|
||||
bin ! ( @ vexpand : true ) ,
|
||||
)
|
||||
} }
|
||||
|
||||
|
|
@ -125,5 +144,8 @@ pub (crate) use {
|
|||
icon ,
|
||||
scrolled_window ,
|
||||
flow_box ,
|
||||
view_switcher ,
|
||||
header_bar ,
|
||||
bin ,
|
||||
vertically_filling ,
|
||||
} ;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue