@@ -664,10 +664,34 @@ fn organize_grid_layout(
664664 ctx : & mut ExpressionLoweringCtx ,
665665) -> llr_Expression {
666666 let cells = grid_layout_input_data ( layout, ctx) ;
667- llr_Expression:: ExtraBuiltinFunctionCall {
668- function : "organize_grid_layout" . into ( ) ,
669- arguments : vec ! [ cells] ,
670- return_ty : Type :: Array ( Type :: Int32 . into ( ) ) ,
667+
668+ if let Some ( button_roles) = & layout. dialog_button_roles {
669+ let e = crate :: typeregister:: BUILTIN . with ( |e| e. enums . DialogButtonRole . clone ( ) ) ;
670+ let roles = button_roles
671+ . iter ( )
672+ . map ( |r| {
673+ llr_Expression:: EnumerationValue ( EnumerationValue {
674+ value : e. values . iter ( ) . position ( |x| x == r) . unwrap ( ) as _ ,
675+ enumeration : e. clone ( ) ,
676+ } )
677+ } )
678+ . collect ( ) ;
679+ let roles_expr = llr_Expression:: Array {
680+ element_ty : Type :: Enumeration ( e) ,
681+ values : roles,
682+ as_model : false ,
683+ } ;
684+ llr_Expression:: ExtraBuiltinFunctionCall {
685+ function : "organize_dialog_button_layout" . into ( ) ,
686+ arguments : vec ! [ cells, roles_expr] ,
687+ return_ty : Type :: Array ( Type :: Int32 . into ( ) ) ,
688+ }
689+ } else {
690+ llr_Expression:: ExtraBuiltinFunctionCall {
691+ function : "organize_grid_layout" . into ( ) ,
692+ arguments : vec ! [ cells] ,
693+ return_ty : Type :: Array ( Type :: Int32 . into ( ) ) ,
694+ }
671695 }
672696}
673697
@@ -896,18 +920,6 @@ fn grid_layout_input_data(
896920 }
897921}
898922
899- pub ( super ) fn grid_layout_cell_data_ty ( ) -> Type {
900- Type :: Struct ( Rc :: new ( Struct {
901- fields : IntoIterator :: into_iter ( [
902- ( SmolStr :: new_static ( "col_or_row" ) , Type :: Int32 ) ,
903- ( SmolStr :: new_static ( "span" ) , Type :: Int32 ) ,
904- ( SmolStr :: new_static ( "constraint" ) , crate :: typeregister:: layout_info_type ( ) . into ( ) ) ,
905- ] )
906- . collect ( ) ,
907- name : BuiltinPrivateStruct :: GridLayoutCellData . into ( ) ,
908- } ) )
909- }
910-
911923pub ( super ) fn grid_layout_input_data_ty ( ) -> Type {
912924 Type :: Struct ( Rc :: new ( Struct {
913925 fields : IntoIterator :: into_iter ( [
@@ -919,7 +931,6 @@ pub(super) fn grid_layout_input_data_ty() -> Type {
919931 ] )
920932 . collect ( ) ,
921933 name : BuiltinPrivateStruct :: GridLayoutInputData . into ( ) ,
922- rust_attributes : None ,
923934 } ) )
924935}
925936
0 commit comments