Initial commit, part deux
This commit is contained in:
parent
4a7beace84
commit
fd5ee1420c
10 changed files with 1463 additions and 0 deletions
45
src/ui/utility.rs
Normal file
45
src/ui/utility.rs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
use { gtk4 :: { Label , Widget , prelude :: * } , libadwaita :: * } ;
|
||||
|
||||
|
||||
|
||||
pub fn create_label ( label : & str ) -> Label {
|
||||
Label :: builder () . label (label) . build ()
|
||||
}
|
||||
|
||||
macro_rules ! create_horizontal_box { ( $ ( $ child : expr , ) * ) => { {
|
||||
let container = gtk4 :: Box :: builder ()
|
||||
. orientation ( gtk4 :: Orientation :: Horizontal )
|
||||
. build () ;
|
||||
$ ( container . append ( $ child ) ; ) *
|
||||
container
|
||||
} } }
|
||||
|
||||
macro_rules ! create_vertical_box { ( $ ( $ child : expr , ) * ) => { {
|
||||
let container = gtk4 :: Box :: builder ()
|
||||
. orientation ( gtk4 :: Orientation :: Vertical)
|
||||
. build () ;
|
||||
$ ( container . append ( $ child ) ; ) *
|
||||
container
|
||||
} } }
|
||||
|
||||
macro_rules ! create_view_stack { (
|
||||
$ ( $ title : expr , $ icon : expr , $ widget : expr , ) *
|
||||
) => { {
|
||||
let container = ViewStack :: new () ;
|
||||
$ ( container . add_titled_with_icon ( $ widget , None , $ title , $ icon ) ; ) *
|
||||
container
|
||||
} } }
|
||||
|
||||
pub fn create_vertical_filler_container ( child : & impl IsA <Widget> ) -> gtk4 :: Box {
|
||||
create_vertical_box ! (
|
||||
child ,
|
||||
& Bin :: builder ()
|
||||
. css_name ("filler")
|
||||
. vexpand (true)
|
||||
. build () ,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
pub (crate) use { create_horizontal_box , create_vertical_box , create_view_stack } ;
|
||||
Loading…
Add table
Add a link
Reference in a new issue